Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp365122imu; Tue, 20 Nov 2018 00:07:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/UP1Z9oIxVbxgcQ/p2Oje8affCECdyGZyJgE067vLP06Vgviyb492d0byJMiV5mOwzQIaCV X-Received: by 2002:a17:902:9004:: with SMTP id a4-v6mr1177991plp.334.1542701243364; Tue, 20 Nov 2018 00:07:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542701243; cv=none; d=google.com; s=arc-20160816; b=Jnzgv2Fz7To3zMMhbJQSrqFXeQD7DltMBgZ1V4/nh9zIYS+7+W4LujsnaXjoKWDleV bDv+LUNMKdMsJYMLtcO8toJFT5eJydN2d3jYz4QE0vqkLIhF/8AK1RB9G33FZBGUaYX/ F8ddbFTIpftiddac36lER2BtSTTF56NhRUYniXMFYYYEmzEWM5ow7oVQxt9R1bkvLDDT jAU433id8LOt4py0jKynx6uPgS/vCiXU60AL6Xd91hhbnEnED4k8M5l3W4EBBoS5Sou4 asm1mpZD/X/tA3hhP8kfJaLEEdpQH7HVzvQXYRDRVYtRmAo6T1j9uigDQlEmcT2aXQkc RpiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=78pOmaJL2TMG6sgbu665m2QrT/xNoHSP8WaCb+g7BO0=; b=huSJxXo/KaKXbMRrIqIBiecHE7v+6Jo2Cuah9IL20mgJeG8I5/SCdf6PHDeEQJaXGO USuWdZ5ZGukHkVzJ5hjalsARC1nxf3+gLyNmWVbnpRzSknX8RBGE6fwIBFEh4+OqlaXN xSGWSk8INylZ2oEOxLlnr2xIwlBzZSbTWZMCXTE3L5bNq3jzab+TX+XlcYqNScnFecFm shj9OxUqh0u+5WyKtu1TJeDaKz0njUq0NXIGlxwLm2dau6oGGeeLcdUjTBfGnBdhxd5I 6eNc3zKKXrLO0wZdKuQfqiM6Z5jL2Fcn1kdfVVkxiNdCWLP3Yu6X8RVfJbAUHOzeWzx9 hYiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h70si39170807pge.221.2018.11.20.00.07.08; Tue, 20 Nov 2018 00:07:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726153AbeKTSdy (ORCPT + 99 others); Tue, 20 Nov 2018 13:33:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbeKTSdx (ORCPT ); Tue, 20 Nov 2018 13:33:53 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F4A8811A9; Tue, 20 Nov 2018 08:06:05 +0000 (UTC) Received: from shodan.usersys.redhat.com (unknown [10.43.17.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F46C2619B; Tue, 20 Nov 2018 08:06:05 +0000 (UTC) Received: by shodan.usersys.redhat.com (Postfix, from userid 1000) id 80D3D2C0FA1; Tue, 20 Nov 2018 09:06:04 +0100 (CET) From: Artem Savkov To: Josh Poimboeuf Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Artem Savkov Subject: [PATCH v4 1/2] objtool: fix failed cold symbol doublefree Date: Tue, 20 Nov 2018 09:05:47 +0100 Message-Id: <20181120080548.26082-2-asavkov@redhat.com> In-Reply-To: <20181120080548.26082-1-asavkov@redhat.com> References: <20181112125519.26855-1-asavkov@redhat.com> <20181120080548.26082-1-asavkov@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 20 Nov 2018 08:06:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If read_symbols() fails during second list traversal (the one dealing with ".cold" subfunctions) it frees the symbol, but never deletes it from the list/hash_table resulting in symbol being freed again in elf_close(). Fix by just returning an error leaving cleanup to elf_close(). Fixes: 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions") Signed-off-by: Artem Savkov --- tools/objtool/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 6dbb9fae0f9d..e7a7ac40e045 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -312,7 +312,7 @@ static int read_symbols(struct elf *elf) if (!pfunc) { WARN("%s(): can't find parent function", sym->name); - goto err; + return -1; } sym->pfunc = pfunc; -- 2.19.1