From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id 13DD43858CDA for ; Tue, 14 Nov 2023 16:29:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13DD43858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 13DD43858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699979380; cv=none; b=xw9pmhkMvXQtJYk9o0sw1VsoBQVRpEZEwgynq56UX4R2Pvmt3FqAZ6x5n5WnVypXpXCZFW57cxe1TCDlcJVTMsgT4EFWyfrom3LT3iyi4HhIVPgHLWSMU8nytlY3c5BFXAwgOdqTa2oSwGsuiGnzMKKVNFV5aiv60pCx5G4TFd4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699979380; c=relaxed/simple; bh=zm4Wr/ZUQJVauLYCHlUP9ax0o1Z9p/nDBVHeCq9fEu4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=f2iB1ZjFxazZsJa9/IZ9ShncFBxii8f7wxCoRX57Y1WPlDzVEpZ6u1baFiwb7jWUn6z7UxSsgBPNIEWQjiSZVR54Q7C3blPT2lSxh6tfRcDJwd4ARBR6h/GlU5p7q5V6/cwqgN2Sb1an0pIQQpI9lyq1x8QOIb/gMZRDJyEhvZ4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6003a.ext.cloudfilter.net ([10.0.30.151]) by cmsmtp with ESMTPS id 2vMLrrPsZjtZ32wIIrcnXU; Tue, 14 Nov 2023 16:29:42 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 2wIDrO5MMAKSc2wIDrZhmk; Tue, 14 Nov 2023 16:29:37 +0000 X-Authority-Analysis: v=2.4 cv=N6w6qkxB c=1 sm=1 tr=0 ts=6553a071 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=QyXUC8HyAAAA:8 a=SwIvbFOG_DcejjDvu-4A:9 a=zgiPjhLxNE0A:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=A3Fa3mmT2bUqyKKOUeCyEFyJ8L8uIdpncb0s/KHpJTc=; b=XCD6MIK9hFk8KFch1/V00vzMS3 W0zwDZ661dHUv0aehH+2UYmhqKiOiInswJkQkZWU9hg8eF2zc1EwHq3EYpkjwfMf5Bo+zTzOTDf5U uN799VxriFYDSX3i0hAEikI06; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:36292 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1r2wIC-002Utm-2n; Tue, 14 Nov 2023 09:29:36 -0700 From: Tom Tromey To: "Willgerodt, Felix" Cc: Tom Tromey , Keith Seitz , "gdb-patches@sourceware.org" Subject: Re: [PATCH 1/1] gdb: Fix segfault with a negative .dynamic section size References: <20231110091627.2139626-1-felix.willgerodt@intel.com> <87fs19tw07.fsf@tromey.com> X-Attribution: Tom Date: Tue, 14 Nov 2023 09:29:35 -0700 In-Reply-To: (Felix Willgerodt's message of "Tue, 14 Nov 2023 15:41:00 +0000") Message-ID: <87il64pac0.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.77.73 X-Source-L: No X-Exim-ID: 1r2wIC-002Utm-2n X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net (murgatroyd) [97.122.77.73]:36292 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHDfUwX8+c/P8VNVTrP7Qio99VcKgqE+esxvQMymjq4aMLDK6rxTsKPhl6i0cVcwYqI3p29bjMAUYvE11dk44Fde6j3aNtBqQ51+5BTZYIJz0EQBF9ye CUeUsaX6MDy7Gb57A5XmE+jpuC6V0hpjLgBLFRQ+5iIVhYSroyRte+3ElMVCT7Ur1EytxvewyI90BJhSgYTin0mLwd9X0zvsgX8= X-Spam-Status: No, score=-3018.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> Willgerodt, Felix writes: > BFD is checking the section size against the file size two times and once > It checks if the section size is staying in the ELF segments region. > I don't think another warning from GDB would help. Or what GDB at this > part of the code could do differently if it encounters such a thing. Ok, I understand the problem now, I think. bfd_get_section_contents does the size check -- but the buffer for the contents must be allocated before this call. So, this approach is forced on us by BFD's API. Maybe changing that would be good, but meh, (1) changing BFD can be difficult, and (2) it seems like a lot of work for fuzzer input. I do wonder now why gdb generally uses bfd_get_section_contents and not bfd_get_full_section_contents, as the latter supports decompression while former does not. Tom