From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B1CE63948A71 for ; Mon, 5 Dec 2022 20:35:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B1CE63948A71 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670272507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DYRnv5XqbL2d9izkSYCkBNZm8UL2mx6tKPvDkTKmN5Q=; b=JwGir9ys2nM8Li2iV8bmF3/cHLLqo5Xl/uYrvUPllPWjfpAaysi3sYDTphkibZ7TzcaMH9 P+82ntC9LyciJtWts7Xwd4N0kl00U6p6TgN+HwMtzwA0/qBNS/hX0nOCfc/KdYi5eFQRNT bjdllg5LCmwUndy+0BYqkII3QJV9yZo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-12-PeG8-dhiPw6ySFv-LjnEeQ-1; Mon, 05 Dec 2022 15:35:05 -0500 X-MC-Unique: PeG8-dhiPw6ySFv-LjnEeQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A804A380453C; Mon, 5 Dec 2022 20:35:05 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.84]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E78949BB60; Mon, 5 Dec 2022 20:35:04 +0000 (UTC) From: Florian Weimer To: Zack Weinberg via Libc-alpha Cc: Zack Weinberg Subject: Re: [RFC] Supporting malloc_usable_size References: <20221124213258.305192-1-siddhesh@gotplt.org> <87sfhyrp19.fsf@igel.home> <87o7smrnlh.fsf@igel.home> <87pmd2rnce.fsf@oldenburg.str.redhat.com> <5758633c-9989-e463-0eb6-33f483439289@owlfolio.org> Date: Mon, 05 Dec 2022 21:35:01 +0100 In-Reply-To: <5758633c-9989-e463-0eb6-33f483439289@owlfolio.org> (Zack Weinberg via Libc-alpha's message of "Mon, 5 Dec 2022 13:46:08 -0500") Message-ID: <87359tpp1m.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Zack Weinberg via Libc-alpha: > On 2022-12-02 7:39 AM, Florian Weimer via Libc-alpha wrote: >> * Andreas Schwab: >> >>> On Dez 02 2022, Siddhesh Poyarekar wrote: >>> >>>> However the man page starts with "Although the excess bytes can be >>>> overwritten by the application without ill effects" and maybe that >>>> reassurance needs to be dropped. >>> >>> Or perhaps amended: "until the next call to malloc/realloc/free in any >>> thread". >> The list will never be complete because glibc can call into the >> malloc >> subsystem internally > > How about this then? "The excess bytes, if any, are only guaranteed > to exist until the next call to malloc/realloc/free in any thread. > Note that almost all C library functions are allowed to use malloc > internally for scratch space, and the list of functions that do so may > change without notice. Only the functions documented as > async-signal-safe are guaranteed not to use malloc internally." I think it's a backwards-incompatible change. The existing manual page documents the function as MT-Safe. With this new policy, I don't think malloc_usable_size is useful for anything at all, and we can just deprecate it (with a deprecation warning message) and eventually remove it from linking (after considering the impact on replacement malloc implementations, but I don't think it will be problematic). >> or even spontaneously from an internal service thread > > We don't have any of those now, do we? I'm inclined to say that we > _shouldn't_ have any of those. mq_notify and timer_create do this, I think. Thanks, Florian