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 39E613858C2C for ; Fri, 26 Jan 2024 19:45:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 39E613858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 39E613858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706298361; cv=none; b=e47Z49ydScfDurwJv5fldUnXqIUFJHm2BPfP2QZtkfjWgNk54wk6ORdBxcD+SdCRZfANYIfO/eEB64u/OCAiW1wsCdyom09ptv7hq2jEl766WD7VYMbV0lBhP2q1IgewaiVbAzh0eFbJbYauGnyAvFkJq/8naYaIGsSyuIfWPRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706298361; c=relaxed/simple; bh=8LCtl4mRg4yiuMAxPt3T/l+lgJK6kA9PC/cw1KSoVsg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Mk5hRbpAkWFYm0//UNu7pYRPgwHu3wQ6/hQ1UX+wfnn+TIH95ZPmmeY0M+LMfdHqsEQoh5/cSB+qYDtGTvAW6Cl6EFyB4KKhHZ/XKXrplGRn5Tm+pjYn9Yyu8NGR3jAFu6bwithfXUoiXu5BCAU/XDrIWUrEjA30gIkBvcjIR/4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706298358; 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=yK7fo0kE6FpgO5ZSOEfhykeuF7j/EIF7zzAZjWgFDds=; b=iEK4dggvX4qV+jg/udGDAUti1Ll0c0Q7JDYwk7SzTyGNGDEmFvFplfCp98kjzjEAHEEW8l fe3WSVHBcePCG8VQnl/7GN/oMrmDiDSPn4BbzGX9zhRzQIg2QD80FNqrJ3XoGpgKYXyIB7 LFnPyhGscJNa2uY/sKkQ+xm5ABhJEXk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-690-5CtKKZE9NKWPXBEqUGDO4A-1; Fri, 26 Jan 2024 14:45:55 -0500 X-MC-Unique: 5CtKKZE9NKWPXBEqUGDO4A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A7C8185A780; Fri, 26 Jan 2024 19:45:55 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B520492BFA; Fri, 26 Jan 2024 19:45:54 +0000 (UTC) From: Florian Weimer To: Alejandro Colomar Cc: Arsen =?utf-8?Q?Arsenovi=C4=87?= , libc-alpha@sourceware.org Subject: Re: free(3) const void * References: <87fryk5fyy.fsf@gentoo.org> Date: Fri, 26 Jan 2024 20:45:50 +0100 In-Reply-To: (Alejandro Colomar's message of "Fri, 26 Jan 2024 16:35:04 +0100") Message-ID: <871qa3280h.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.3 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: * Alejandro Colomar: > That would reqire dereferencing the pointer, to actually get the > lvalue, which free(3) never does. Just to clarify, our implementation in fact dereferences the pointer, both to obtain heap metadata (outside the previously allocated object), and to read from the object itself. For the latter, see this commit and subsequent ones: commit bcdaad21d4635931d1bd3b54a7894276925d081d Author: DJ Delorie Date: Tue Nov 20 13:24:09 2018 -0500 malloc: tcache double free check Thanks, Florian