Message ID | 88c2fb96-185d-ae27-c025-ed025ed54641@suse.com |
---|---|
State | Accepted |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3280886vqx; Fri, 7 Jul 2023 06:47:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlH/NzSmMI2DMMKgBFMEibIsPT+uaIcUC3tCk/0eOFbyq/bab0+z8rgEkcdg63zwysn3ChUP X-Received: by 2002:a50:fc13:0:b0:51e:251d:5cab with SMTP id i19-20020a50fc13000000b0051e251d5cabmr3481910edr.39.1688737669887; Fri, 07 Jul 2023 06:47:49 -0700 (PDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id c21-20020aa7d615000000b0051e2a59d3c6si2239997edr.678.2023.07.07.06.47.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 06:47:49 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=HPProBOP; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C25F4385AF81 for <ouuuleilei@gmail.com>; Fri, 7 Jul 2023 13:47:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C25F4385AF81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688737668; bh=r664fwlTtEkioypSaa3IJ1UvEkpWzWwUIX+VF72ayEc=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=HPProBOPqJBI0/1l8i6RRMxeugJF54zC8TrKxNX/dVF0sOywUHxlofIsbugj3Mpcf lBb0e+dcxkMeXcNE6CDMIG3pJznrPGsoPtK1gkJ9zJn2Kucwpj6A7HNsMLyXSA/TqF hY36nBwHQFR5Wk2azjshs8ju40wJn5wptkeMq/qI= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) by sourceware.org (Postfix) with ESMTPS id 70BF53858C41 for <binutils@sourceware.org>; Fri, 7 Jul 2023 13:47:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 70BF53858C41 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UdRc8GjHQFIzHUktDHbP2iNzxD+hUB7DrXMkahPDGewKmM+OkGDi+HjXHVuJUyJSjXOZ40HiBOhr22zKyi2z1Oi2qJalVMaMhgF1Bqv51RiLgtpy8Dcs22zFgWUJH5YDrwL1SM6yHnWqXBB7JpAQ9J11Upmp4FTOCJivJIW0KwkvdFsk/8kM6JUbqoYRFaoRQzvYTuP7ta2HAg34GJrzdEh2POnrjT7LvkmyV5IUDpzkB+mlUmU57s9pesTUeE3hhtAJ6ZnO0Ze7PbIuvxG9GSaSqSUHtNSAUifNY1Oi96LkHP+tnCovg8uOGR3OFqLPYa93NsmdVZomb5vtkoAa4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r664fwlTtEkioypSaa3IJ1UvEkpWzWwUIX+VF72ayEc=; b=Xw0dVPBKsdG/ksioHF1eFq0dwDNgWo3Kf6pX2L9+4+tHp7THX/Qvmib+fDgaObp2R9hsoYqJkkFzFU9/v4f6xH3ZSa3TTLZ1DU119WIv0zpHoDP8QqUps+3MINyUNbPmeeFgvFtxUxj2oOB6Zqe2kKNca9qM1VrYjfHW+ReomyourUknA/lm++Kr0F+5TRVJ+9zo8Yhg+iOFIiU24j8OVs8zbrHGjKCK8g3hRSCl4sFMmVUN5juCCDBb8ZrSi1+99HdojqgxKYLAD8b7eiw5V3G0mS48x8vAySeO4q5kTmLgsyAU0e6vlqziRH9rC/cminur0lDGVgLCN/hn7Y+XwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from AS8PR04MB8788.eurprd04.prod.outlook.com (2603:10a6:20b:42f::21) by AM8PR04MB7988.eurprd04.prod.outlook.com (2603:10a6:20b:24e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 13:47:38 +0000 Received: from AS8PR04MB8788.eurprd04.prod.outlook.com ([fe80::cbc0:69aa:c9a2:198e]) by AS8PR04MB8788.eurprd04.prod.outlook.com ([fe80::cbc0:69aa:c9a2:198e%7]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 13:47:38 +0000 Message-ID: <88c2fb96-185d-ae27-c025-ed025ed54641@suse.com> Date: Fri, 7 Jul 2023 15:47:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US To: Binutils <binutils@sourceware.org> Cc: Mark Harmstone <mark@harmstone.com>, Nick Clifton <nickc@redhat.com> Subject: [PATCH] ld/PDB: fix off-by-1 in add_globals_ref() Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0012.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::17) To AS8PR04MB8788.eurprd04.prod.outlook.com (2603:10a6:20b:42f::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8788:EE_|AM8PR04MB7988:EE_ X-MS-Office365-Filtering-Correlation-Id: 31a76ffb-1f24-4693-beef-08db7ef0b9e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xw6AhOOEqrLMcvfYb/VDOPamYqaNrtHpo10Q4ZlZM9bnZPnvhC0tIY3yG8P9SIxd7N/k6ANk0cyPfYf5GsWwuzomoG0XMLkPQFXPsAyHchtm+vS2QODstnjLDVECYdsh+kOwhFfrW/S7UxaMw5fGc66bDMl9i8p07pTpQTFmjsZBCrLMMvWWBzTolrptCsHYfQpOlwvqcbxBQ1A1ZluTpq0rDfHzGQu5YKQwq3TfaCCIge0RSxolsOBEZ5rKO1iRYYGgSoxIsqAf5sfbZ0JjmXsJ6UaZfbIAwTxoNKLflq2V1snMF9e9EOGA7+90O5U8e4SU62Vpu1l3nyLCOSi/j3YnfWUcZLBdV0JRtJA5yg2qTE18A2VgL5DT5pGStUc3suR3/wkcAES/h/BSe7SJjSO/c7TuVZWO+f/7y/ISnl21jLo7jBnRORvRBdwGfIcBx9hnfFafBP1LHewHuOJhVKod2pR5ytLSQuzqjPI1W2DzA/NGguTJO44/N2VMV8A/fyJ3G0M7G/eWGMn/Bu65EwUN8/wWUO1d9JMF8cJ/2YrfVnqP/d75KLaYYfD5T6MkjNpkuoeQFuj5IW+r8KZlZ+9IvNsyHGVdsrWgmJLvhnmy5GtTDsIdx+EuCcbFD4uiISF1Levtb5En4warK/nWyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8788.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(376002)(366004)(396003)(39860400002)(346002)(136003)(451199021)(2906002)(38100700002)(6512007)(83380400001)(2616005)(186003)(26005)(6506007)(31696002)(5660300002)(86362001)(8676002)(36756003)(4744005)(54906003)(6486002)(6666004)(478600001)(316002)(41300700001)(8936002)(66556008)(66476007)(66946007)(4326008)(6916009)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?3K3P3F/y/upJcPYzNbOg7uCCmnMs?= =?utf-8?q?t2OnYMJcWkG4OSrYwoz8k7n+U2zPirHN+7GMwcxmtNQIF+zusu2J0iLv2Haz6l2Wr?= =?utf-8?q?XEk2doklW2EZW3yX23G3OucGU4ICGOKZrkHQhTRFBn4MfRfnCv1NZBNKwGOMatCR4?= =?utf-8?q?pjTa0YaB2wXio1RJFmB0eiFt3Px+fyVma2QwhwTEkIGQJN+meuikXhPOCNCVVWQhd?= =?utf-8?q?Vjgm8MDABX3SHNE6XwFD8nPcyHSGlgb69tL2+NW9s32xy+uUg/JgO9o6r78IFBMoU?= =?utf-8?q?TkKBWpEuFWuTKUSkLwuREb72S0uFP/97pPUpxOwegoBZelF1H3T3ODffdtEHI+V/J?= =?utf-8?q?TT2nZk7in6wO0q85/IKDx7UneWrud1n6RGkkdvyoWO90hlxgJjud0pyHz8fy+N7ZZ?= =?utf-8?q?NnK8zESoQfXxF/6kNdftS9NgIZJE/iC1fYof199+9OgG5B1Y4r3PELvkWrlZgxPE+?= =?utf-8?q?45riqatb0u3+A7sWQiGw0l5sQmhKeuE0/DWEhvi98wJ9KrHtGgjsVFBsqW+nUTTa9?= =?utf-8?q?efVou3UgmZFHfFoQKMuZmJKIfL+QNOGk1+Dxv3l0n+9zM1Htutw6AV7XkUG2+6WbY?= =?utf-8?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p12Ikrvm0mhbxAC1sfvMBpD2eYZH5dlKkD1BSICk3AcUuVGnuyg?= =?utf-8?q?NK5ydsTEKu7n?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31a76ffb-1f24-4693-beef-08db7ef0b9e0 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8788.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 13:47:38.0015 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GArXy+xlSDlsgbFR2njOLvMiIUdGRO8NZ2vd20/wGYLgh/vHJxTozt3SiSbvbBv6zmn+x2Njvplh54GAFTONAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7988 X-Spam-Status: No, score=-3026.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 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> From: Jan Beulich via Binutils <binutils@sourceware.org> Reply-To: Jan Beulich <jbeulich@suse.com> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770769791145020190?= X-GMAIL-MSGID: =?utf-8?q?1770769791145020190?= |
Series |
ld/PDB: fix off-by-1 in add_globals_ref()
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | success | Github commit url |
Commit Message
Jan Beulich
July 7, 2023, 1:47 p.m. UTC
Copying one too many bytes can corrupt memory, detected and reported by glibc on a 32-bit distro. --- Nick, again I expect this wants to go on the branch as well. I'm sorry that I didn't get to look into this earlier; I had noticed it a while ago already. In any event I'd like to give Mark a little bit of time to reply (if necessary), before putting it in.
Comments
Thanks Jan - this looks good to me. Mark On 7/7/23 14:47, Jan Beulich wrote: > Copying one too many bytes can corrupt memory, detected and reported by > glibc on a 32-bit distro. > --- > Nick, again I expect this wants to go on the branch as well. I'm sorry > that I didn't get to look into this earlier; I had noticed it a while > ago already. In any event I'd like to give Mark a little bit of time > to reply (if necessary), before putting it in. > > --- a/ld/pdb.c > +++ b/ld/pdb.c > @@ -880,7 +880,7 @@ add_globals_ref (struct globals *glob, b > g->offset = bfd_tell (sym_rec_stream); > g->hash = hash; > g->refcount = 1; > - memcpy (g->data, data, len + 1); > + memcpy (g->data, data, len); > > glob->num_entries++; >
On 11.07.2023 01:30, Mark Harmstone wrote: > Thanks Jan - this looks good to me. I've committed this yesterday, so Nick - what about cherry-picking it onto the branch? Jan > On 7/7/23 14:47, Jan Beulich wrote: >> Copying one too many bytes can corrupt memory, detected and reported by >> glibc on a 32-bit distro. >> --- >> Nick, again I expect this wants to go on the branch as well. I'm sorry >> that I didn't get to look into this earlier; I had noticed it a while >> ago already. In any event I'd like to give Mark a little bit of time >> to reply (if necessary), before putting it in. >> >> --- a/ld/pdb.c >> +++ b/ld/pdb.c >> @@ -880,7 +880,7 @@ add_globals_ref (struct globals *glob, b >> g->offset = bfd_tell (sym_rec_stream); >> g->hash = hash; >> g->refcount = 1; >> - memcpy (g->data, data, len + 1); >> + memcpy (g->data, data, len); >> >> glob->num_entries++; >> > >
Hi Jan, > I've committed this yesterday, so Nick - what about cherry-picking it onto > the branch? Done. Cheers Nick PS. Sorry for the delay - I have been on PTO.
--- a/ld/pdb.c +++ b/ld/pdb.c @@ -880,7 +880,7 @@ add_globals_ref (struct globals *glob, b g->offset = bfd_tell (sym_rec_stream); g->hash = hash; g->refcount = 1; - memcpy (g->data, data, len + 1); + memcpy (g->data, data, len); glob->num_entries++;