Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1748418rda; Tue, 24 Oct 2023 01:53:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9LMEqXtY8wh4cDkBPsu8DEsUAhVeQm3Xi1zPJUHIAYV87jngGAHJziNo9tBdETjVQXYb4 X-Received: by 2002:a05:6a00:1798:b0:6ad:535e:6ed9 with SMTP id s24-20020a056a00179800b006ad535e6ed9mr11568011pfg.16.1698137606687; Tue, 24 Oct 2023 01:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698137606; cv=none; d=google.com; s=arc-20160816; b=g0Nui78s9MR0fAzu320XpnqOxjXNsK0PPi+ILu2lTf0+mZUA0odsuqLnQQNSiZwLbW 6y8a7v9ljlWnCKGf48C+murc2ka5Fj2JHcNypEGYAoJDLag/xDJehVs0kBtLPHMHC8Kj /8TZvep88Tw0mip0yeJBJMTZyAmfPQg7qalN3op1Nfjfn3l3jMIcZxBxxR17zjKF1G/R ws5wI8n2Nwa3jkiVBM03eLWcWH2MGF4/N06mno2HkRt2qdfmU21GXpMnCmGfpoSkqgfm Nkay+klrmRZFs4CCIPGr/EOPbMxToen0xkxkyP95y+RVB/2Lwaqh3vogWjW+92pwel8/ NpMQ== 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=9keY+q4ayzhYfj1Sywl/i+fSmvZAiGDKGIdRrjeEPao=; fh=U6xOoS4yrKwokS92UnWWBZ6Bz5Mf5FIxoc6GYbAL22U=; b=bWLoHDB5i108GcR74NG0M1Z8R+8CCg5cLki1gpO+0CJuhCHSt03s+8f48PAqjHx7dc MCcbvH7ZYO3xGQs2zKI2yzBMNDp9yzOgMZuNR3O0rLj0Klf66NFML/WK9VHHR11Oljwg RprlBDzUzJ6uEG6arE1K3HTKka8stuwxZcvJvazbtjzeFmZ7cM9zLgljgHZS9CgLpHir o6VP03VApR9LSO0dLTfHnnJEJ7LIjs1kKCFXHos4uxx9BYbJ76XHNUkwkUR50V5ZASwQ fObzSH6vNZPS/tQwt7ArYZnhP8QIuKIdGy2JJrJyeC8WxkcyYYtRzld5YSlmp9TEKvvY 6dFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Vzmc0dVO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ka34-20020a056a0093a200b006a15afe16c2si8384238pfb.296.2023.10.24.01.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 01:53:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Vzmc0dVO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 33C918047508; Tue, 24 Oct 2023 01:53:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234081AbjJXIxL (ORCPT + 99 others); Tue, 24 Oct 2023 04:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233928AbjJXIxB (ORCPT ); Tue, 24 Oct 2023 04:53:01 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 854FC1712; Tue, 24 Oct 2023 01:52:45 -0700 (PDT) Date: Tue, 24 Oct 2023 08:52:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1698137563; 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=9keY+q4ayzhYfj1Sywl/i+fSmvZAiGDKGIdRrjeEPao=; b=Vzmc0dVOKxkFjyP23HLc9Vsg5ONrlxIVzkD6KBjnmq6umrqmIbWZsLNQzH2UhqhublWUl+ JDI79T1ZeB78YndUO6V723oU71nMLIUF+tUACpS8BwjFVrQaj2GVXZIhcLdoTuMC3rNQYB o98E+HXlr2o0L53NmDTOqqZA2R5iN/ERBtw4mIfdLU5e18ubNEP7Eg0GF0ltTmpPbZNbCh 7DHhKOyGPILn7K1GuGlRLc06MTBoN9GZ2cm4FUXOWG3q+Wc7qwZkoDZBVpNJ6pAg7AvbWv qGGs3O+1clAwI+CnXsWZovzlr5f2dM+1alFfQq8iHd5+AFlSFLvt77i3//ahZw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1698137563; 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=9keY+q4ayzhYfj1Sywl/i+fSmvZAiGDKGIdRrjeEPao=; b=Uv+/y9J7Kixz9OlL6VLhiBIKuu2qHbyaimq0lgu2+GEItQrzNIJn5g5N4KymyqbDKS2/Iu MKQD6jffr2swE6Aw== From: "tip-bot2 for Will Deacon" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] scripts/faddr2line: Skip over mapping symbols in output from readelf Cc: Masahiro Yamada , Will Deacon , Nick Desaulniers , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231002165750.1661-4-will@kernel.org> References: <20231002165750.1661-4-will@kernel.org> MIME-Version: 1.0 Message-ID: <169813756305.3135.18196140276976513319.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 24 Oct 2023 01:53:23 -0700 (PDT) The following commit has been merged into the objtool/core branch of tip: Commit-ID: 60fd39af33d3f63c4c94bd06784ebdf0d883f5c9 Gitweb: https://git.kernel.org/tip/60fd39af33d3f63c4c94bd06784ebdf0d883f5c9 Author: Will Deacon AuthorDate: Mon, 02 Oct 2023 17:57:49 +01:00 Committer: Josh Poimboeuf CommitterDate: Mon, 23 Oct 2023 08:36:46 -07:00 scripts/faddr2line: Skip over mapping symbols in output from readelf Mapping symbols emitted in the readelf output can confuse the 'faddr2line' symbol size calculation, resulting in the erroneous rejection of valid offsets. This is especially prevalent when building an arm64 kernel with CONFIG_CFI_CLANG=y, where most functions are prefixed with a 32-bit data value in a '$d.n' section. For example: 447538: ffff800080014b80 548 FUNC GLOBAL DEFAULT 2 do_one_initcall 104: ffff800080014c74 0 NOTYPE LOCAL DEFAULT 2 $x.73 106: ffff800080014d30 0 NOTYPE LOCAL DEFAULT 2 $x.75 111: ffff800080014da4 0 NOTYPE LOCAL DEFAULT 2 $d.78 112: ffff800080014da8 0 NOTYPE LOCAL DEFAULT 2 $x.79 36: ffff800080014de0 200 FUNC LOCAL DEFAULT 2 run_init_process Adding a warning to do_one_initcall() results in: | WARNING: CPU: 0 PID: 1 at init/main.c:1236 do_one_initcall+0xf4/0x260 Which 'faddr2line' refuses to accept: $ ./scripts/faddr2line vmlinux do_one_initcall+0xf4/0x260 skipping do_one_initcall address at 0xffff800080014c74 due to size mismatch (0x260 != 0x224) no match for do_one_initcall+0xf4/0x260 Filter out these entries from readelf using a shell reimplementation of is_mapping_symbol(), so that the size of a symbol is calculated as a delta to the next symbol present in ksymtab. Suggested-by: Masahiro Yamada Signed-off-by: Will Deacon Reviewed-by: Nick Desaulniers Link: https://lore.kernel.org/r/20231002165750.1661-4-will@kernel.org Signed-off-by: Josh Poimboeuf --- scripts/faddr2line | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/faddr2line b/scripts/faddr2line index 6b82068..587415a 100755 --- a/scripts/faddr2line +++ b/scripts/faddr2line @@ -179,6 +179,11 @@ __faddr2line() { local cur_sym_elf_size=${fields[2]} local cur_sym_name=${fields[7]:-} + # is_mapping_symbol(cur_sym_name) + if [[ ${cur_sym_name} =~ ^(\.L|L0|\$) ]]; then + continue + fi + if [[ $cur_sym_addr = $sym_addr ]] && [[ $cur_sym_elf_size = $sym_elf_size ]] && [[ $cur_sym_name = $sym_name ]]; then