From patchwork Fri Jun 9 07:47:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 105339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp781041vqr; Fri, 9 Jun 2023 00:58:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7NIkf/xnb05X11T24LqI/ONkxlm4xFKxJQyfG+JH4QlTYDyOTFuIO/D2bfCQQyzFIrS/8i X-Received: by 2002:a05:620a:2994:b0:75d:478b:bd5a with SMTP id r20-20020a05620a299400b0075d478bbd5amr610672qkp.18.1686297502850; Fri, 09 Jun 2023 00:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686297502; cv=none; d=google.com; s=arc-20160816; b=Gc1eG1pcLNjwYAz3XoxVILKv5iMrQWIldmdVCHGlxJcPC6ZN5hPEsguwZigxrZ3ar8 eAQOw6X9JfPa4yD2GwqeBAmo5pENy8NKfj23SMwPlSr7Uwq7Fcm+EcpA3chdlVPfh3uX RUuWTwwufLdhb+68fjSIcA/jSFGJeggoYSE0kRzKY+hZYMWx9b4gahzv7Mv4U12H9uKR wZMoEtnC0mNUl4lrXqH1GjT88bYOT4kXAPnRYqbDILtsicZi8E4MGx7Az7xnlSyGPZm5 J8/O8rVjmBW7k/zg1JvtvZM4ygsmm3tKdYm+YZsKuCwWTKxKqdv4dWHOYlUBVMxiGjOW 5Atg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=ZD/7cDb+c9jg0rA3MfW9PxAaWkqFMYDyabqKilSRHTA=; b=HeE3323fEE3CDdZqUlII1liA66OeqA97PaAYxqCujOOHXf2xs+u7qavjby11WsFgs7 EA3WQzlqyLsHHE1rgM6ye/5DUVbjtwjfZAE9mirFZb7XZDt/uh+711C6KrlJMjg5Gh82 rC7YSnSvhxBHR7fiz6XEhHsuckn8bx2PmS+U7IJ9TkKy7EFSzOnY+xxNQnLHqewBwSk3 fcaH3LQehzMfBJwTnqSBWUHBPDQFWvhBgrU1XZ3cYd+Aa8wRx712tgwNetyOU0xRnvFy gZwZ5mUCedqL90tv4T/HkN6XnOKUJOK/dvZwn/Hn313reGJidb7+xx5LOwJ9tQ5vViq7 zzjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bvp2v0qI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=RHTWk6M4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id np17-20020a17090b4c5100b002475bc0a186si4042670pjb.69.2023.06.09.00.58.10; Fri, 09 Jun 2023 00:58:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bvp2v0qI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=RHTWk6M4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239328AbjFIHsk (ORCPT + 99 others); Fri, 9 Jun 2023 03:48:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239093AbjFIHro (ORCPT ); Fri, 9 Jun 2023 03:47:44 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 119491BE2; Fri, 9 Jun 2023 00:47:41 -0700 (PDT) Date: Fri, 09 Jun 2023 07:47:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686296854; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZD/7cDb+c9jg0rA3MfW9PxAaWkqFMYDyabqKilSRHTA=; b=bvp2v0qIXVJvvKUDMTHyrRhWYmEefkF9kThsnfvBBg3TuPsS2kU8WMKY+y9y8zBUwB4hIK eN2zdcjio1MVbkxNQyygp8YXA6Xp2IVyZYJXdx0l0CX+JKzzEPkQXzeL2QHvrUB7WDelkw q9YcmzxfwXvUFQ4nGUfLKQq6JwfXw+AkxbQbk78cSFhuFtBfe0n3udT16oJIGFkKOX1ul6 2r3wuvIMyWgaNcoPyvgreD+0/jpSNsMMLoary05WUuNGmQsb3+IiJQFd+zZNOYCmhkz/Dr aFFUr3HXSlgtyoKflhswFkjqT9BZtYE78YZCSvFFNMSENhjFiabDRCzKmS1tSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686296854; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZD/7cDb+c9jg0rA3MfW9PxAaWkqFMYDyabqKilSRHTA=; b=RHTWk6M4Q/iZn00JVJPKziWG00SeunYhSOLUlwTymAKFFFQ5feNpiDM+kcJGVNKwfV8+VM AiurDe6yRVkl46DA== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool: Don't free memory in elf_close() Cc: Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <74bdb3058b8f029db8d5b3b5175f2a200804196d.1685464332.git.jpoimboe@kernel.org> References: <74bdb3058b8f029db8d5b3b5175f2a200804196d.1685464332.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <168629685414.404.166550567183252024.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767341181493578006?= X-GMAIL-MSGID: =?utf-8?q?1768211090363963157?= The following commit has been merged into the objtool/core branch of tip: Commit-ID: 5201a9bcb7d3f98ab99c17325b0aa925c2888ca3 Gitweb: https://git.kernel.org/tip/5201a9bcb7d3f98ab99c17325b0aa925c2888ca3 Author: Josh Poimboeuf AuthorDate: Tue, 30 May 2023 10:21:01 -07:00 Committer: Josh Poimboeuf CommitterDate: Wed, 07 Jun 2023 10:03:19 -07:00 objtool: Don't free memory in elf_close() It's not necessary, objtool's about to exit anyway. Link: https://lore.kernel.org/r/74bdb3058b8f029db8d5b3b5175f2a200804196d.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 8d491b2..8d53f18 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -1350,30 +1350,14 @@ int elf_write(struct elf *elf) void elf_close(struct elf *elf) { - struct section *sec, *tmpsec; - struct symbol *sym, *tmpsym; - struct reloc *reloc, *tmpreloc; - if (elf->elf) elf_end(elf->elf); if (elf->fd > 0) close(elf->fd); - list_for_each_entry_safe(sec, tmpsec, &elf->sections, list) { - list_for_each_entry_safe(sym, tmpsym, &sec->symbol_list, list) { - list_del(&sym->list); - hash_del(&sym->hash); - } - list_for_each_entry_safe(reloc, tmpreloc, &sec->reloc_list, list) { - list_del(&reloc->list); - hash_del(&reloc->hash); - } - list_del(&sec->list); - free(sec->reloc_data); - } - - free(elf->symbol_data); - free(elf->section_data); - free(elf); + /* + * NOTE: All remaining allocations are leaked on purpose. Objtool is + * about to exit anyway. + */ }