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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id C412C398A4AC for ; Tue, 20 Jul 2021 08:05:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C412C398A4AC Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-75-PiYZpwlLMaeJ7JxT0OWWZA-1; Tue, 20 Jul 2021 04:05:52 -0400 X-MC-Unique: PiYZpwlLMaeJ7JxT0OWWZA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D66791030C21; Tue, 20 Jul 2021 08:05:50 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-73.phx2.redhat.com [10.3.112.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B83821001281; Tue, 20 Jul 2021 08:05:45 +0000 (UTC) From: Florian Weimer To: Siddhesh Poyarekar Cc: libc-alpha@sourceware.org, carlos@redhat.com Subject: Re: [PATCH] manual: reallocarray and str*dup interposition is not supported References: <20210720014329.1251125-1-siddhesh@sourceware.org> Date: Tue, 20 Jul 2021 10:05:43 +0200 In-Reply-To: <20210720014329.1251125-1-siddhesh@sourceware.org> (Siddhesh Poyarekar's message of "Tue, 20 Jul 2021 07:13:29 +0530") Message-ID: <8735s9v294.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 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2021 08:05:55 -0000 * Siddhesh Poyarekar: > These functions call the core allocator functions (realloc and malloc > respectively) and are hence guaranteed to allocate memory using the > correct functions when multiple allocators are interposed. Having > these functions interposed in one allocator and not another may result > in confusion, hence discourage interposing them altogether. > --- > manual/memory.texi | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/manual/memory.texi b/manual/memory.texi > index 31ee36be8c..4560781f64 100644 > --- a/manual/memory.texi > +++ b/manual/memory.texi > @@ -2033,6 +2033,11 @@ when a replacement @code{malloc} is in use. However, failure to replace > these functions typically does not result in crashes or other incorrect > application behavior, but may result in static linking failures. > > +Replacing the @code{reallocarray} function and the @code{strdup} family of > +functions is not supported and may produce incorrect results. @theglibc{} > +implementations of these functions call the replacement @code{malloc} and > +@code{realloc} functions whenever available. There are other examples: realpath, getcwd, asprintf, and more. So please rephrase this in such a way that reallocarray and strdup are just examples of memory-allocating library functions that call the replacement malloc implementation. Thanks, Florian