From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6CmUCQk2U2edKQYAWB0awg (envelope-from ) for ; Fri, 06 Dec 2024 12:36:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1733506569; bh=HYD1aHmRRAtZLj0lg2jq8/isTF/ESxQ2vaB5bT5TStI=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=stMvrN2233ZAfd8uuMSeNNrRn8OgV/TSBm21AgPEb+6lGl8SUf1jG7/HeEsHXEgNS e6fY1oFt6tocqG9IIQjAT9Q6P8Yi955u9/JTaIagXmr1n/KZmZmkMGbu4SVmScOibN FETxpT+hYxNE/Jr+JW92R4PckrrAEQyygKNClqIw= Received: by simark.ca (Postfix, from userid 112) id 241641E197; Fri, 6 Dec 2024 12:36:09 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=4.0.0 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=IIdE87o5; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=XZk1WaMh; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id ACE3F1E092 for ; Fri, 6 Dec 2024 12:36:08 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 58D42385841D for ; Fri, 6 Dec 2024 17:36:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58D42385841D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=IIdE87o5; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=XZk1WaMh Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 007163858408 for ; Fri, 6 Dec 2024 17:35:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 007163858408 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 007163858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733506505; cv=none; b=bcqlAE0JsFMFrobW8eWJTKMF3t3pdZ0j7s5k+1E5hKFzWFvDWj4gjxsWeugtrAL3vJ7oMzCKbBO9CD8wvkEB+OQEI2W7WvkpyChx+U9mmEdXQjq8mkP0rZVG29jnx6qDJQAJ+2nVabW+GY+LNWgJ4WRHylVQYfRekD3WDVfVWNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733506505; c=relaxed/simple; bh=HYD1aHmRRAtZLj0lg2jq8/isTF/ESxQ2vaB5bT5TStI=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=DUaLI8sp+Mxeu3BiUvG9QKrmwCPZiUdDBJno4OM9ag6rYKcT/F/o91IS5FR88Xe3/k4dJAYgHyO8p0tvspwClnnrfm/36Zk578ZLS3/kZIGC0/15vN3hxqTmzAGXUUm3yotW1rJOG+juY8Kf0ioJEliZhV0XXGwjfhgbXo622qU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 007163858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1733506504; bh=HYD1aHmRRAtZLj0lg2jq8/isTF/ESxQ2vaB5bT5TStI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=IIdE87o5DNNCjDPLQyAHPzQaSJqzrLbal3jZAktUf3+y0+4xWv/13ed4+Sk6QxVTF Z6wV6HvUe+E9IokKnp+gBodQa0m69YtsXjKq4wCaaFQ5DeBmB5b+tQ/QNekgQg0B1u 7rmjJMx3RFCNIQgZpYzsHqOBpmmvy0fpnb/73uJk= Received: by simark.ca (Postfix, from userid 112) id 53AB51E1A4; Fri, 6 Dec 2024 12:35:04 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1733506503; bh=HYD1aHmRRAtZLj0lg2jq8/isTF/ESxQ2vaB5bT5TStI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=XZk1WaMh/VOzWTuhfuRObRufwNJmClFxi59pGXpinMqytfxhqbKgCogX5TcGIgWDZ qtZAjGDTrKW7AmRgAl9rPiwXCNnUg45hXZ0TVWMpDh8dCP2URWE9DaKEKcHgaJ6X7i okWzCrXFqhPl2rPHyf90sqQh7DvhrjQIo5mJKKGk= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A5BC41E092; Fri, 6 Dec 2024 12:35:03 -0500 (EST) Message-ID: Date: Fri, 6 Dec 2024 12:35:03 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb: Fix use-after-free when an objfile has no symbols to load To: Guinevere Larsen , gdb-patches@sourceware.org References: <20241205131959.3400690-1-guinevere@redhat.com> Content-Language: en-US From: Simon Marchi In-Reply-To: <20241205131959.3400690-1-guinevere@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2024-12-05 08:19, Guinevere Larsen wrote: > The recent commit moved an initialization of an objfile_holder in > syms_from_objfile_1 much earlier in the function, to better deal with > when GDB is unable to read the objfile format. > > However, there is an early exit from syms_from_objfile_1 when the > objfile can be understood, but has no symbols. That was not releasing > the objfile_holder, so the objfile was being unlinked from the program > space, but the process of reading the objfile was being continued, > leading to use-after-frees flagged by the Address Sanitizer. > > This commit fixes that UAF by making the objfile_holder release the > objfile right before the early exit. > > This commit also changes the test gdb.base/dump.exp since that was the > original test that flagged the UAF, but at the end of the test the > generated files were being deleted, meaning we couldn't redo the test > manually after teh fact. That final deletion was removed teh -> the Approved-By: Simon Marchi Thanks, Simon