Message ID | Z5W74JAD90OJGwtk@squeak.grove.modra.org |
---|---|
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 7BD893858427 for <patchwork@sourceware.org>; Sun, 26 Jan 2025 04:39:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BD893858427 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=e5LuwVR8 X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id 7A3963858427 for <binutils@sourceware.org>; Sun, 26 Jan 2025 04:36:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7A3963858427 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 7A3963858427 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::633 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737866213; cv=none; b=r51B7sCveQTFTVRsa6/vZb5wVXxAEiEMYllQ2RJWvAuR2/l2EIDJqCkiZ8z9uZTbIN4rYomloKMwoWPQm1ynpiMbSnkcHNGJnX8tvZs39bgglq3iZe8nvsMVOI08JWyiuXspeCbIYdGsZkWrACH1kxRYAexWY8RjN1GtpIuEBKw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737866213; c=relaxed/simple; bh=QxAfKl3ftqGryS0oXDBlN3xM8B887tLtYxgQFIEIXcw=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=ORGA8hWB3dsk6UWqVJFFJp4FTqg4rnBC7ElEmCIB47pIaYBmIEx0gNbkQPi0qCsToS7ygwM67tsdiUgWssOh+NN6nCHuHfvGJr2B/CQ9nYuqzwdQwaqEhX35idz1CDk7uzaP8UBbLc0tksfNpO0Z7ztEXaR5LYqMoD7EsUVpK00= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A3963858427 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-21675fd60feso76751795ad.2 for <binutils@sourceware.org>; Sat, 25 Jan 2025 20:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737866211; x=1738471011; darn=sourceware.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=uozpbCRz2HXTe2IDY3c182IeCHB1w7D+TIqAe25sc8U=; b=e5LuwVR8vRi7CQ+B42JJl9MBNdDo8tvAkxmioGSCituHg8FT6DmIEk23fHsn9ofJxO vUrPfvJ2foNgBuXGZgFfgJlsssFjfg51w7rrT+0qra5U84Z7z1k3yOf2t2BEDLqibsFP Um95imQxWmihpbNCb2Fgo6DLPTUmVsRi+4Mw3rhNYb06EeVcrO4Yos4vSO759zGvcGpb qooF+YlvDPI00RtmwqNc5bZ5SE0AojPh2URGCVhZOsHicD9u49+vhxv+cHriKL4wB9Ls IC8JtRLGDcemQv93fLK57o4om78TWQ3PslgvEG1n7MpFRqh3cMmdOClnxkyXgD73LYmc 1JdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737866211; x=1738471011; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uozpbCRz2HXTe2IDY3c182IeCHB1w7D+TIqAe25sc8U=; b=bNoMrliPriK5iiF4jVhNHhYNwUnE6779d80G7YeOmDNtDWMYIwBE+dd10py8hFYNxl sW9TnkANhya0Evkv4WYaqcYpgIfn6lfn6MZI5VENgYcvOHPBvVgZsalQNOUiYQxBZTIj ByR+CHRO5tnplT9V0FARXemiwpaJoMeToBfhkgQeCuEGXz64qQv6lzDVEIYRURsqy9YW 68n/fZcA8hvEPgM1DfEXvhsBCheSV5JGk1DdfxWjMyMFXwGbkkPg8hROh63csYM8cSxP OoiqUcfIbi+wc90h1gx3+65RxEBy2BkCUu7iVMVzY67kkzcyev1482UJ0ikmWqjTPvim Dm1g== X-Gm-Message-State: AOJu0YxPZz1LuD/kxSi0MiD8uF+X9tKCbNEcjZaHHCu6UphvdRem13zl pCNnK1/+ugNyaSI2JpWDSWraCRfcmWKU5CvVWKwgYZ6YrLm9m5J4GQ85aQ== X-Gm-Gg: ASbGnctuyIwBLBKYjt3DDl8ZwnAd45Ye0bp7vUU13NpeiaMfR1EDfvLeLoSgHtl5uke JoM6XGXPYv0YqZJT0tgXiw8HoHki9m3zuOWA1vBmoUjYy3LkiVNf6WVe9iAM4JBTVOecm1YgdNK TwtiHNr9yQtIZfMxCP1T9PtkNwSRqfxA8BdWCuZy2c3DP46zH80zNHJHVLYWOoowatufJJAiarx ubXoHdiQAVKFULMW2tbGdv35Q93DNlhpdI8Z4mLPUcFU+5Cbi/GrAY0FGCZ9sZh2twi1+1qaBLB Y1VIIEdwzXCwaZJi X-Google-Smtp-Source: AGHT+IExyclorGf8rWJzInScpWcKKysz7aCXOyJ9xdUZbeY1aLCnPobEfkWA1lbCD733YYTDyBtijw== X-Received: by 2002:a17:903:1205:b0:216:6be9:fd57 with SMTP id d9443c01a7336-21c35551b81mr593340445ad.21.1737866211263; Sat, 25 Jan 2025 20:36:51 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:c507:d85:6052:38b9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da414dfcbsm40271665ad.167.2025.01.25.20.36.50 for <binutils@sourceware.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jan 2025 20:36:50 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 53602114210F; Sun, 26 Jan 2025 15:06:48 +1030 (ACDT) Date: Sun, 26 Jan 2025 15:06:48 +1030 From: Alan Modra <amodra@gmail.com> To: binutils@sourceware.org Subject: loongson buffer overflow Message-ID: <Z5W74JAD90OJGwtk@squeak.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3032.2 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, 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 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 |
loongson buffer overflow
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_binutils_build--master-arm | fail | Patch failed to apply |
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 | fail | Patch failed to apply |
Commit Message
Alan Modra
Jan. 26, 2025, 4:36 a.m. UTC
bfd_elfNN_loongarch_set_data_segment_info can be called from the target after_allocation function with a non-ELF hash table. This is seen in the ld-elf pr21884 testcase. Fix the problem by first checking the hash table type before writing to a loongarch_elf_hash_table field.
Comments
Hi Nick, This patch (commit: 59ba00f21f7) needs to be applied to 2.44 branch. Thanks! 在 2025/1/26 下午12:36, Alan Modra 写道: > bfd_elfNN_loongarch_set_data_segment_info can be called from the target > after_allocation function with a non-ELF hash table. This is seen in > the ld-elf pr21884 testcase. Fix the problem by first checking the > hash table type before writing to a loongarch_elf_hash_table field. > > diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c > index efa57184e44..c24b2600a9a 100644 > --- a/bfd/elfnn-loongarch.c > +++ b/bfd/elfnn-loongarch.c > @@ -5267,8 +5267,9 @@ void > bfd_elfNN_loongarch_set_data_segment_info (struct bfd_link_info *info, > int *data_segment_phase) > { > - struct loongarch_elf_link_hash_table *htab = loongarch_elf_hash_table (info); > - htab->data_segment_phase = data_segment_phase; > + if (is_elf_hash_table (info->hash) > + && elf_hash_table_id (elf_hash_table (info)) == LARCH_ELF_DATA) > + loongarch_elf_hash_table (info)->data_segment_phase = data_segment_phase; > } > > /* Implement R_LARCH_ALIGN by deleting excess alignment NOPs. >
On Sun, Jan 26, 2025 at 08:46:52PM +0800, mengqinggang wrote: > Hi Nick, > > This patch (commit: 59ba00f21f7) needs to be applied to 2.44 branch. Yes, and the fix for pr32599 too, commit fd45211245d0. OK? > 在 2025/1/26 下午12:36, Alan Modra 写道: > > bfd_elfNN_loongarch_set_data_segment_info can be called from the target > > after_allocation function with a non-ELF hash table. This is seen in > > the ld-elf pr21884 testcase. Fix the problem by first checking the > > hash table type before writing to a loongarch_elf_hash_table field. > > > > diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c > > index efa57184e44..c24b2600a9a 100644 > > --- a/bfd/elfnn-loongarch.c > > +++ b/bfd/elfnn-loongarch.c > > @@ -5267,8 +5267,9 @@ void > > bfd_elfNN_loongarch_set_data_segment_info (struct bfd_link_info *info, > > int *data_segment_phase) > > { > > - struct loongarch_elf_link_hash_table *htab = loongarch_elf_hash_table (info); > > - htab->data_segment_phase = data_segment_phase; > > + if (is_elf_hash_table (info->hash) > > + && elf_hash_table_id (elf_hash_table (info)) == LARCH_ELF_DATA) > > + loongarch_elf_hash_table (info)->data_segment_phase = data_segment_phase; > > } > > /* Implement R_LARCH_ALIGN by deleting excess alignment NOPs. > >
Hi Alan, Hi mengqinggang >> This patch (commit: 59ba00f21f7) needs to be applied to 2.44 branch. > > Yes, and the fix for pr32599 too, commit fd45211245d0. Ok to both. Cheers Nick
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index efa57184e44..c24b2600a9a 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -5267,8 +5267,9 @@ void bfd_elfNN_loongarch_set_data_segment_info (struct bfd_link_info *info, int *data_segment_phase) { - struct loongarch_elf_link_hash_table *htab = loongarch_elf_hash_table (info); - htab->data_segment_phase = data_segment_phase; + if (is_elf_hash_table (info->hash) + && elf_hash_table_id (elf_hash_table (info)) == LARCH_ELF_DATA) + loongarch_elf_hash_table (info)->data_segment_phase = data_segment_phase; } /* Implement R_LARCH_ALIGN by deleting excess alignment NOPs.