| Message ID | 20250918235914.947103-1-hjl.tools@gmail.com |
|---|---|
| State | New |
| Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D66553858C66 for <patchwork@sourceware.org>; Fri, 19 Sep 2025 00:01:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D66553858C66 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=JVmW1ewl X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id F0D873858D37 for <binutils@sourceware.org>; Thu, 18 Sep 2025 23:59:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F0D873858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F0D873858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758239962; cv=none; b=HslqdNn/Drc7mOiWz8+VDpFD+B4ESrX4gJju4jJagoAOZ6OVxYfVe90he6s6DXOnPi3ILtu+mqi6r6MplQJCEL5s86KER0H+cCwFZEkdZ2y2cULbJfR+/FV/IfunMQvC47DVnyAmkSVWsXyVWkIZjGdRwIF25ML/r/wXUcIa6is= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758239962; c=relaxed/simple; bh=ZMBt/FLAvr3bXYI4cc0ptF9tv/fL1eBmvv8yhBQFdo0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xJiU7Cxobltx+mShr6uaQYqyUuO75GSASk0iXffkfO2WmZDeR+k9ciQf5mV/ps7Dr2/OcgAWNm9fDfzhwxIhSmnNcwKUuwIpk/2M2blWlBXgyfnUBRnLSkntABtmrVcTwCg7VpP0W3mJLai+fLK+Zpy6K8H7RXbOGS2Y6gcpTKo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F0D873858D37 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7761b392d50so2069744b3a.0 for <binutils@sourceware.org>; Thu, 18 Sep 2025 16:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758239961; x=1758844761; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2YYlef2UvG2WZ9+wrfgieup80uFKWWK6CdXO4nK2yMM=; b=JVmW1ewl/Pf2J9iLayt3VNfB7VzllWNTwQa+GgrMqhaIKF9XnoqPUZjYIlWmzliDGg tgBYHhJZqL8EaXCAhfoW8RBBO0uaS2gXQF6vLg1KfXsa7urawr97cnv6B+4n6MWeaChT yWAznkrwa8EMthlCCV9hJG9VBhSkwPaBqAcU8q9O3hIIkBNoQ5HuBspU1rYnPBjtOcC4 VJQc9KUBXcnbCO/CascuN0YAH7rETP0VJwBQQhiGfRwVz7z/wlrwfw3cvBkaovUFA3Kz zKvxsga8IS4CjsB08LL2mJ7KxyiSvQ/IrKA0GGvZf+xTMqB+bbzadZjs+JaF7fT+GJOH RZJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758239961; x=1758844761; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2YYlef2UvG2WZ9+wrfgieup80uFKWWK6CdXO4nK2yMM=; b=wpkxxosRY79Hj8awTJeydklugCXeevlvP0DcOektAmXK62DkTpihQbqun7aYDlWgq8 v2n+CgaJSAuUjdZKLWhPzsbXMtKmh36aHh+A5E1e+qnT/WJBHH1jubP39aCklMMifq0G SxPB06Y7Mnr67T6SPheLuYJ2LeaWcW8pQJ6P4vWwbd8C1rUPhFpVATFs5BFQ8RZD9PMV NUzqWjbawd9qIOTPwFSCph4SrHzG5baKqFeScqYDUTYKchgcKW1tv/HVCFkHvEIvaj7V X08K9S2XQ0cFqBXu6zcsLDB3Ftgy+eXU73n5suH6ToLl94n5kppyZuhMuXuXms4q7RmH MSFg== X-Gm-Message-State: AOJu0YzHxOQUEgZS0fEm7zjkMJewt4BpJPw58tB/w+DaMEw5xHWLyPXa n4WEBv5CIVaDcZi02ahwVlUuU5nVtmLFPH9JcDNtlLZXBupoNhdgigw9+C6yPA== X-Gm-Gg: ASbGnct2qEyt7NTKCgBavaqLNIMGSKpVNxlLOcam5bBKTHYySaEFJkEw8D5PvdWo/ad r0itAG561DnzF5O89993kZXsmPAqErBXEi3Q1wzaLjSG7+sLF/TU414pJWpRpOsrtkPTGI0n/Sn CqzhRzyi5Ax9bxrHdJntYnQ6smQlMdppRXSx1SmRpgic48n1C7EzDr40h8twV60CbLaowKrepxx Mw085+nNKFGv5LaBb75ybC7cToerA1fjEPjylVCawdNEniTO2EJHFMsQ6pro2DxVcG5nF0U65Wr 9EcEk6IUzzfyONB5yqGqdf8Ch+bQbeefl6Rnn0GLdLdAIcPaPef+pSCC6hIM0FQv3MbLCsF9hG2 tBJlrVf/Fp9ZwqFgr4nzvm3L4AFf9PlcC3mwvYWHN+wT9+iwNw8YwSto2HkeWK5JiaDRF X-Google-Smtp-Source: AGHT+IHlFQC3LF7b96ul7o7N/pc4WAU7kVKrjAAIa6U7c9LaJKcY9PDzO1lr8cj3eX/3opupzYfPwA== X-Received: by 2002:a05:6a00:3e23:b0:772:5a3f:7cb3 with SMTP id d2e1a72fcca58-77e4ce337f2mr1621514b3a.1.1758239960845; Thu, 18 Sep 2025 16:59:20 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.59.163.31]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-77cff226f28sm3485191b3a.92.2025.09.18.16.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Sep 2025 16:59:20 -0700 (PDT) Received: from gnu-cfl-3.localdomain (localhost [127.0.0.1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 6906274005C; Thu, 18 Sep 2025 16:59:19 -0700 (PDT) From: "H.J. Lu" <hjl.tools@gmail.com> To: binutils@sourceware.org Cc: amodra@gmail.com, nickc@redhat.com, jbeulich@suse.com Subject: [PATCH] coff: Ignore corrupt relocation table Date: Thu, 18 Sep 2025 16:59:14 -0700 Message-ID: <20250918235914.947103-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3015.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
coff: Ignore corrupt relocation table
|
|
Commit Message
H.J. Lu
Sept. 18, 2025, 11:59 p.m. UTC
Ignore slurp corrupt relocation table to avoid linker crash later.
PR ld/33455
* coffcode.h (coff_slurp_reloc_table): Return false for illegal
symbol index.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
bfd/coffcode.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Fri, Sep 19, 2025 at 7:59 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > Ignore slurp corrupt relocation table to avoid linker crash later. > > PR ld/33455 > * coffcode.h (coff_slurp_reloc_table): Return false for illegal > symbol index. > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com> > --- > bfd/coffcode.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/bfd/coffcode.h b/bfd/coffcode.h > index 4a1f4be3773..3dfb31f6b79 100644 > --- a/bfd/coffcode.h > +++ b/bfd/coffcode.h > @@ -5306,8 +5306,8 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols) > /* xgettext:c-format */ > (_("%pB: warning: illegal symbol index %ld in relocs"), > abfd, dst.r_symndx); > - cache_ptr->sym_ptr_ptr = &bfd_abs_section_ptr->symbol; > - ptr = NULL; > + /* Ignore corrupt relocation table: PR ld/33455. */ > + return false; > } > else > { > -- > 2.51.0 > Any comments or objections?
On Sun, Sep 21, 2025 at 03:47:11PM +0800, H.J. Lu wrote: > On Fri, Sep 19, 2025 at 7:59 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > Ignore slurp corrupt relocation table to avoid linker crash later. > > > > PR ld/33455 > > * coffcode.h (coff_slurp_reloc_table): Return false for illegal > > symbol index. > > > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com> > > --- > > bfd/coffcode.h | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/bfd/coffcode.h b/bfd/coffcode.h > > index 4a1f4be3773..3dfb31f6b79 100644 > > --- a/bfd/coffcode.h > > +++ b/bfd/coffcode.h > > @@ -5306,8 +5306,8 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols) > > /* xgettext:c-format */ > > (_("%pB: warning: illegal symbol index %ld in relocs"), > > abfd, dst.r_symndx); > > - cache_ptr->sym_ptr_ptr = &bfd_abs_section_ptr->symbol; > > - ptr = NULL; > > + /* Ignore corrupt relocation table: PR ld/33455. */ > > + return false; > > } > > else > > { > > -- > > 2.51.0 > > > > Any comments or objections? All three of your patches for these fuzzed object file linker bugs reduce the capability of the binutils to display corrupted object files. I'd rather completely ignore fuzzers than do that.
On Sun, Sep 21, 2025 at 6:12 PM Alan Modra <amodra@gmail.com> wrote: > > On Sun, Sep 21, 2025 at 03:47:11PM +0800, H.J. Lu wrote: > > On Fri, Sep 19, 2025 at 7:59 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > > > > > Ignore slurp corrupt relocation table to avoid linker crash later. > > > > > > PR ld/33455 > > > * coffcode.h (coff_slurp_reloc_table): Return false for illegal > > > symbol index. > > > > > > Signed-off-by: H.J. Lu <hjl.tools@gmail.com> > > > --- > > > bfd/coffcode.h | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/bfd/coffcode.h b/bfd/coffcode.h > > > index 4a1f4be3773..3dfb31f6b79 100644 > > > --- a/bfd/coffcode.h > > > +++ b/bfd/coffcode.h > > > @@ -5306,8 +5306,8 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols) > > > /* xgettext:c-format */ > > > (_("%pB: warning: illegal symbol index %ld in relocs"), > > > abfd, dst.r_symndx); > > > - cache_ptr->sym_ptr_ptr = &bfd_abs_section_ptr->symbol; > > > - ptr = NULL; > > > + /* Ignore corrupt relocation table: PR ld/33455. */ > > > + return false; > > > } > > > else > > > { > > > -- > > > 2.51.0 > > > > > > > Any comments or objections? > > All three of your patches for these fuzzed object file linker bugs > reduce the capability of the binutils to display corrupted object Such information displayed by binutils is unreliable and corrupted objects may lead to corrupted executable. I think benefits of such corrupted information are very limited if any. > files. I'd rather completely ignore fuzzers than do that. > > -- > Alan Modra
On 21.09.2025 13:45, H.J. Lu wrote: > On Sun, Sep 21, 2025 at 6:12 PM Alan Modra <amodra@gmail.com> wrote: >> On Sun, Sep 21, 2025 at 03:47:11PM +0800, H.J. Lu wrote: >>> Any comments or objections? >> >> All three of your patches for these fuzzed object file linker bugs >> reduce the capability of the binutils to display corrupted object > > Such information displayed by binutils is unreliable and corrupted > objects may lead to corrupted executable. I think benefits of > such corrupted information are very limited if any. I agree with Alan. Corruption or anomalies may be diagnosed (by warnings, in particular when linking), but we still should aim at displaying to users whatever we can sensibly display. Jan
On Sun, Sep 21, 2025 at 07:52:01PM +0200, Jan Beulich wrote: > On 21.09.2025 13:45, H.J. Lu wrote: > > On Sun, Sep 21, 2025 at 6:12 PM Alan Modra <amodra@gmail.com> wrote: > >> On Sun, Sep 21, 2025 at 03:47:11PM +0800, H.J. Lu wrote: > >>> Any comments or objections? > >> > >> All three of your patches for these fuzzed object file linker bugs > >> reduce the capability of the binutils to display corrupted object > > > > Such information displayed by binutils is unreliable and corrupted > > objects may lead to corrupted executable. I think benefits of > > such corrupted information are very limited if any. > > I agree with Alan. Corruption or anomalies may be diagnosed (by > warnings, in particular when linking), but we still should aim at > displaying to users whatever we can sensibly display. Yes, it would be quite OK to refuse to link objects that are corrupted, but we shouldn't refuse to objdump them.
On Mon, Sep 22, 2025 at 6:14 AM Alan Modra <amodra@gmail.com> wrote: > > On Sun, Sep 21, 2025 at 07:52:01PM +0200, Jan Beulich wrote: > > On 21.09.2025 13:45, H.J. Lu wrote: > > > On Sun, Sep 21, 2025 at 6:12 PM Alan Modra <amodra@gmail.com> wrote: > > >> On Sun, Sep 21, 2025 at 03:47:11PM +0800, H.J. Lu wrote: > > >>> Any comments or objections? > > >> > > >> All three of your patches for these fuzzed object file linker bugs > > >> reduce the capability of the binutils to display corrupted object > > > > > > Such information displayed by binutils is unreliable and corrupted > > > objects may lead to corrupted executable. I think benefits of > > > such corrupted information are very limited if any. > > > > I agree with Alan. Corruption or anomalies may be diagnosed (by > > warnings, in particular when linking), but we still should aim at > > displaying to users whatever we can sensibly display. > > Yes, it would be quite OK to refuse to link objects that are > corrupted, but we shouldn't refuse to objdump them. > I will see what I can do.
diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 4a1f4be3773..3dfb31f6b79 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -5306,8 +5306,8 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols) /* xgettext:c-format */ (_("%pB: warning: illegal symbol index %ld in relocs"), abfd, dst.r_symndx); - cache_ptr->sym_ptr_ptr = &bfd_abs_section_ptr->symbol; - ptr = NULL; + /* Ignore corrupt relocation table: PR ld/33455. */ + return false; } else {