| Message ID | 20260930193657.733-4-oleg.tolmatcev@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 vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 20DDD4BA799D for <patchwork@sourceware.org>; Wed, 30 Sep 2026 19:38:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 20DDD4BA799D Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=WD6FfG3F X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm2-x11.google.com (mail-wm2-x11.google.com [IPv6:2a00:1450:4864:31::11]) by sourceware.org (Postfix) with ESMTPS id BEFDB4BB24C9 for <binutils@sourceware.org>; Wed, 30 Sep 2026 19:37:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BEFDB4BB24C9 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 BEFDB4BB24C9 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:31::11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790797048; cv=none; b=he1ZyaSO0JoCplyB4Xy0bOI/cMyB46uqZ3JS6K5tZvhvHE07cc1eOVENJkK95djTOQmpB515M2O9cOqfkySi8be9lDhOKZvqJuPybRksCpVYrOJPdEh/LoC7A4k2tIuDU9yXBuHMEVpKfNx65RueXpmkT1O6AMcMivnjSFlRnuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790797048; c=relaxed/simple; bh=7vngOOllBDnV91PqnFWpgT9NihzR+C6oL/t0tfJKt6c=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Urm0smIKKpv02AWNz7BP2x9kV4dpOsxhR0Jp1BDUPl+TfRxmkWh2+ULcKFiEhOVh6XAukUAjqjNaOuj/8htvNKiSsTRSt0lHLyB4Z7SNdLx/kojVu5MPPNIzT/8sXYL71jradBwED5sCLt5xpC/8flmVUYUM+2RKIIyk7XnXRNg= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=WD6FfG3F DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEFDB4BB24C9 Received: by mail-wm2-x11.google.com with SMTP id 5b1f17b1804b1-49ffa15f67fso28542865e9.2 for <binutils@sourceware.org>; Wed, 30 Sep 2026 12:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790797048; x=1791401848; 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:content-type; bh=Dq7iu+E1G6ukylpzNNUywxGamf5PV0deU7pcNUIfhYE=; b=WD6FfG3FO9856rV+wpZrgawh5czdJ3GcY/Xqw6sw3HGXbjlMrzYhJ3B2f6ssTiqlw7 NvP01OxvSZlGTH9Zttl25cZPl2BLGBrgMj/Dz426jQDk2B5lbwqVoeigvAnt1DAn3IeZ xOeoT0P9wtgL9i//F1BF4RDwTlnAE7EAd1nf1fjNc9xBCIluA/fYjEQerp5k3zdAXxzd qIP0NlI8ZagPIQrJAlPIph+Xe+7v1iS6p0kBPXhY9F+r9wdMBKX75l37e6a8jRFOaLpi TgTbkYzgvI6JDXlnSFos0h5fhzna+pwKHqY5NxH1DFRdnNLc0biMl8VFpXN4X5a5nXjW 8AaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790797048; x=1791401848; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Dq7iu+E1G6ukylpzNNUywxGamf5PV0deU7pcNUIfhYE=; b=SC8j9V/teKqSNQjIu9gPB56CQPypBX82wmCTOFE0u7LR4rI5bBdgiS5wyXQeH75K9O +ocQiZ0wWsX8WThZ8pYnfuOcVoCJmIASjdW3G8fofpLa7bjmKY2sXTsyA+wckzbEJjkL D1UE1MN1I5jTBWUsiC2/qrC91fFGczWwvDZ638dVsBA9R7LNmI7qKCtXHCW9lGnh4nrL 1KQXc3BlXoEjm2Yj3IkdxYI2tB/PIbO2FIu1StzBjyULChc9QrxAxdZuLhotm2zz6PIc uIpRjq3pELdBQDXRD6L5+1gOp6/CytioKFY3xTyjPmYZt9cvZjtZgGwnf9d7RlwjlmG9 QivQ== X-Gm-Message-State: AFuF++mBjgN29BeK6Z18pjX8ROYB9M35BnRE/JhzXa5HB/TsUXjKmNiB eec/XN1W2v25N/t+zbgc8r2YiMLOCeP9DZRvirFmAr8O3Qd6OoMDBGZxFl1OGg== X-Gm-Gg: AYBFou3C7e6VEugrsbK9hn/uQex+NnEFnDOJ4+4OUHUe+Q1ESvmOQC7h0Ky3lrXNtzM BmOcdzyZWEx9OvHtki+kPXvzOrbJMZQmiErcsUZMK2+uN4e7Pw6IsQyA+00IGISiOUh+2kpg6TZ 8EfgnUA50qAkW1pT0ed54FQn1fFZgnIP+TNTPc3hecSNk8swoN3UjW+/qi0Oj02ifnK6gbe8b6D cKYvBfoW1M5ddAYzJ0vtKO0Msqqcee8anlVxuT0/nIb4EkbDK61vDUtjnp5cN3pYnUIZFQMalc0 4xMf5lZsxxI0xKtwIkhfvPa4OjfZCuCFKtpkDQhPDdtwOvUYy1y/ZnGZ4jmAWUrTgH20rpBO1tf /G5Tiy/4zFNPoXwYGLyA6v0Pz7OzOh6RRv21Kjn6sp0GkiJupkUx+t+gnQKCASA3ukWGvSznYeE mRRbejBLFsP2H8X73z3Q0aNhrNeKiytZMwV/hBFu2faH/I1oZjBwYweeZlt55mLtk8Vx1xIK7mv PXmActSukgdiPIBkj6VwT6GuGoQzuF+NOMHV+aA8CLzaxzvkvavOmxcYFYztpz2nqkbqyOUFhUo fL8= X-Received: by 2002:a05:600c:4592:b0:49f:ffc7:2099 with SMTP id 5b1f17b1804b1-4a01b122fc3mr41652985e9.26.1790797047481; Wed, 30 Sep 2026 12:37:27 -0700 (PDT) Received: from Mein-PC (p200300ed8f0406002186408458360e23.dip0.t-ipconnect.de. [2003:ed:8f04:600:2186:4084:5836:e23]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a01f979c05sm8518815e9.3.2026.09.30.12.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2026 12:37:27 -0700 (PDT) From: Oleg Tolmatcev <oleg.tolmatcev@gmail.com> To: binutils@sourceware.org Cc: Oleg Tolmatcev <oleg.tolmatcev@gmail.com> Subject: [PATCH] ld/pdb: Avoid double-free on malformed symbol data Date: Wed, 30 Sep 2026 21:36:53 +0200 Message-ID: <20260930193657.733-4-oleg.tolmatcev@gmail.com> X-Mailer: git-send-email 2.56.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 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, RCVD_IN_PBL, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 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 |
ld/pdb: Avoid double-free on malformed symbol data
|
|
Checks
| Context | Check | Description |
|---|---|---|
| linaro-tcwg-bot/tcwg_binutils_build--master-arm | success | Build passed |
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 | success | Build passed |
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 | success | Test passed |
| linaro-tcwg-bot/tcwg_binutils_check--master-arm | success | Test passed |
Commit Message
Oleg Tolmatcev
Sept. 30, 2026, 7:36 p.m. UTC
When handle_debugs_section fails, create_module_info_substream frees the file arrays for all modules, including the current one. Do not free the current array in populate_module_stream as well. ld/ * pdb.c (populate_module_stream): Leave mod_source->files cleanup to the caller. --- ld/pdb.c | 1 - 1 file changed, 1 deletion(-)
Comments
On 30.09.2026 21:36, Oleg Tolmatcev wrote: > When handle_debugs_section fails, create_module_info_substream frees > the file arrays for all modules, including the current one. Do not free > the current array in populate_module_stream as well. Isn't the same true then ... > --- a/ld/pdb.c > +++ b/ld/pdb.c > @@ -3955,7 +3955,6 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size, > { > free (c13_info); > free (syms); > - free (mod_source->files); > free (map); > return false; > } ... a few lines up from here, when handle_debugt_section() fails? The freeing there is actually yet more odd, as mod_source isn't passed to the function (so cannot have changed, at least apparently). Jan
пт, 2 окт. 2026 г. в 11:58, Jan Beulich <jbeulich@suse.com>: > > On 30.09.2026 21:36, Oleg Tolmatcev wrote: > > When handle_debugs_section fails, create_module_info_substream frees > > the file arrays for all modules, including the current one. Do not free > > the current array in populate_module_stream as well. > > Isn't the same true then ... > > > --- a/ld/pdb.c > > +++ b/ld/pdb.c > > @@ -3955,7 +3955,6 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size, > > { > > free (c13_info); > > free (syms); > > - free (mod_source->files); > > free (map); > > return false; > > } > > ... a few lines up from here, when handle_debugt_section() fails? The > freeing there is actually yet more odd, as mod_source isn't passed to > the function (so cannot have changed, at least apparently). > > Jan Yes, good catch, I will send a v2 which removes the other free() too. Oleg
diff --git a/ld/pdb.c b/ld/pdb.c index 434bdb197ca..9988fd94f51 100644 --- a/ld/pdb.c +++ b/ld/pdb.c @@ -3955,7 +3955,6 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size, { free (c13_info); free (syms); - free (mod_source->files); free (map); return false; }