Message ID | e7e1de1d01194df3ff4053cb0815fc2ddba33213.1687360711.git.christophe.leroy@csgroup.eu |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4471258vqr; Wed, 21 Jun 2023 09:03:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4p4e2/U75DuI+ji9h0mU+/1IpsVVsQ8v8F7EgaTn4SVUBBXfIz5eZwaW63ZpzDRPrgdS7W X-Received: by 2002:a05:6a00:14c1:b0:668:8493:2552 with SMTP id w1-20020a056a0014c100b0066884932552mr9552633pfu.18.1687363389915; Wed, 21 Jun 2023 09:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687363389; cv=none; d=google.com; s=arc-20160816; b=Rh8raBmy4hGbUuFsOiYBaedVIyI6mtuH8loAwQf1yiglKDiNba5A692GvnF2kk3lKX xwkj/MzKEcMmA4wjOPOFQH0XFseliBKLFYT2pIhSugOWu/h3rif+u0PxzH3LvBknR5xt BzTJxQs4GTyruJSYdEM6Z2MYixZXejIJkF/BWluUio/GQvjnYmEyf8WhoZwugP6ue781 c2SPDUU4xxxKtMK7OGfWZuI9bzDPx7H7LB5FUoKzgUvnZhfKlxswFLYfTpmupK4Lvo1f 2Z3J3L4SuMtKuCOtZSw5dLz0/QD7Cn68bOfPDeE/56y8MNXlKjRQY59hTBPpGGJHLRQc oW5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4f+mcooyDvaZTWnXHhSUB7Xqh2JCpivVsAirCOtHWSU=; b=u2+MMnP6ll/x6WNXeG/m1k0Txx8SayIXKsHJkG0j+wxYL7JwUSeECXm7RAZNo1DEy3 A2u2mMXj0gMncnnYO/8Do3f4p/c2nwJ7yGBjZoWmQsNjoa/uKUMPSCgUbqOAB0wlSxc1 +V73kMu83g0IxsDsegrI86f9MN5LnS0G+9q8svybRzKn36rWKTScSSGPA8Zo4abUCxDi LRaWJfWeF0DMP/357BmNBb4J8OH5o8fIvlqeJuyKib+YRdU/L3/DZ7B6yabkGlFVbxCM 2W0Tu1CJZ4DmIO1q5Q72OzH9cymMd85V8++KWSx6Nku1/ftKd3dMYlghibKyXcSYvg1C 2FVA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=csgroup.eu Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b190-20020a621bc7000000b0065fe77bf291si1677791pfb.276.2023.06.21.09.02.56; Wed, 21 Jun 2023 09:03:09 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=csgroup.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231751AbjFUPW5 (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Wed, 21 Jun 2023 11:22:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbjFUPWe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 21 Jun 2023 11:22:34 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 439EE2D7F for <linux-kernel@vger.kernel.org>; Wed, 21 Jun 2023 08:20:45 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4QmRz004c7z9sJj; Wed, 21 Jun 2023 17:20:44 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pCGSmOT-fKYY; Wed, 21 Jun 2023 17:20:43 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4QmRyx2PMJz9sJs; Wed, 21 Jun 2023 17:20:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4EE338B779; Wed, 21 Jun 2023 17:20:41 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id dIDcK9DBKVGZ; Wed, 21 Jun 2023 17:20:41 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 24B988B763; Wed, 21 Jun 2023 17:20:41 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 35LFKbuK2124260 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 21 Jun 2023 17:20:37 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 35LFKbQZ2124256; Wed, 21 Jun 2023 17:20:37 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy <christophe.leroy@csgroup.eu> To: Josh Poimboeuf <jpoimboe@kernel.org>, Peter Zijlstra <peterz@infradead.org> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] objtool: Make 'sec-address' always on Date: Wed, 21 Jun 2023 17:20:31 +0200 Message-Id: <e7e1de1d01194df3ff4053cb0815fc2ddba33213.1687360711.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687360830; l=2749; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=cug9KrnhkD0tWNRN91NqNAgvx0YYURd13fBg+W5IvHQ=; b=MSMupOM8tiZHXuHmbGUr+49tsvsHOoMqLJJr6dQ9WAhib0c9wQaeZlV1OoHElkm//dypb0DWq 8Ers3uhG87CCZKBc1aSQNebBr5BBhwJHfoFpOCSe2UDbQpXq9wSto2C X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, T_SCC_BODY_TEXT_LINE,T_SPF_HELO_TEMPERROR,T_SPF_TEMPERROR autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769328753895163048?= X-GMAIL-MSGID: =?utf-8?q?1769328753895163048?= |
Series |
objtool: Make 'sec-address' always on
|
|
Commit Message
Christophe Leroy
June 21, 2023, 3:20 p.m. UTC
Most of the time objtool warnings are useless without the
absolute address within the section.
Today there is --sec-address option to get it printed, but
that option is nowhere used and requires a change in Makefile
to use it.
Having the address inside the section at all time in addition
to the address within the object doesn't hurt and will help.
Remove the --sec-address option and print it at all time.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
tools/objtool/builtin-check.c | 1 -
tools/objtool/include/objtool/builtin.h | 1 -
tools/objtool/include/objtool/warn.h | 6 ++----
3 files changed, 2 insertions(+), 6 deletions(-)
Comments
On Wed, Jun 21, 2023 at 05:20:31PM +0200, Christophe Leroy wrote: > Most of the time objtool warnings are useless without the > absolute address within the section. > > Today there is --sec-address option to get it printed, but > that option is nowhere used and requires a change in Makefile > to use it. > > Having the address inside the section at all time in addition > to the address within the object doesn't hurt and will help. > > Remove the --sec-address option and print it at all time. This option actually feels like clutter to me. The func+offset format works fine, combined with scripts like objdump-func and faddr2line. And we also have a new OBJTOOL_VERBOSE=1 option which auto-disassembles the affected function. On x86 we've been using func+offset for console stack traces for many years, due to KASLR. So maybe we're just more used to it. But the scripts make it fine. Also it helps with identifying the same warning across different configs/compilers.
Hi Christophe,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.4-rc7 next-20230623]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Christophe-Leroy/objtool-Make-sec-address-always-on/20230621-232305
base: linus/master
patch link: https://lore.kernel.org/r/e7e1de1d01194df3ff4053cb0815fc2ddba33213.1687360711.git.christophe.leroy%40csgroup.eu
patch subject: [PATCH] objtool: Make 'sec-address' always on
config: x86_64-randconfig-c002-20230622 (https://download.01.org/0day-ci/archive/20230624/202306241520.4jIgEhK4-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230624/202306241520.4jIgEhK4-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306241520.4jIgEhK4-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> vmlinux.o: warning: objtool: ibt_selftest+0x14 (.text+0x92b54): sibling call from callable instruction with modified stack frame
vmlinux.o: warning: objtool: .altinstr_replacement+0x19a4: redundant UACCESS disable
vmlinux.o: warning: objtool: iovec_from_user.part.0+0xb1 (.text+0x1c47761): call to copy_iovec_from_user.part.0() with UACCESS enabled
vmlinux.o: warning: objtool: ibt_selftest+0x1e (.text+0x92b5e): return with modified stack frame
objdump-func vmlinux.o ibt_selftest:
0000 0000000000092b40 <ibt_selftest>:
0000 92b40: f3 0f 1e fa endbr64
0004 92b44: e8 00 00 00 00 call 92b49 <ibt_selftest+0x9> 92b45: R_X86_64_PLT32 __fentry__-0x4
0009 92b49: 55 push %rbp
000a 92b4a: 48 89 e5 mov %rsp,%rbp
000d 92b4d: 48 8d 05 02 00 00 00 lea 0x2(%rip),%rax # 92b56 <ibt_selftest_ip>
0014 92b54: ff e0 jmp *%rax
0000 0000000000092b56 <ibt_selftest_ip>:
0000 92b56: 90 nop
0001 92b57: 48 85 c0 test %rax,%rax
0004 92b5a: 5d pop %rbp
0005 92b5b: 0f 94 c0 sete %al
0008 92b5e: e9 00 00 00 00 jmp 92b63 <ibt_selftest_ip+0xd> 92b5f: R_X86_64_PLT32 __x86_return_thunk-0x4
000d 92b63: 66 2e 0f 1f 84 00 00 00 00 00 cs nopw 0x0(%rax,%rax,1)
0017 92b6d: 0f 1f 00 nopl (%rax)
Le 24/06/2023 à 09:33, kernel test robot a écrit : > Hi Christophe, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on linus/master] > [also build test WARNING on v6.4-rc7 next-20230623] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Christophe-Leroy/objtool-Make-sec-address-always-on/20230621-232305 > base: linus/master > patch link: https://lore.kernel.org/r/e7e1de1d01194df3ff4053cb0815fc2ddba33213.1687360711.git.christophe.leroy%40csgroup.eu > patch subject: [PATCH] objtool: Make 'sec-address' always on > config: x86_64-randconfig-c002-20230622 (https://download.01.org/0day-ci/archive/20230624/202306241520.4jIgEhK4-lkp@intel.com/config) > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 > reproduce: (https://download.01.org/0day-ci/archive/20230624/202306241520.4jIgEhK4-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202306241520.4jIgEhK4-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > >>> vmlinux.o: warning: objtool: ibt_selftest+0x14 (.text+0x92b54): sibling call from callable instruction with modified stack frame > vmlinux.o: warning: objtool: .altinstr_replacement+0x19a4: redundant UACCESS disable > vmlinux.o: warning: objtool: iovec_from_user.part.0+0xb1 (.text+0x1c47761): call to copy_iovec_from_user.part.0() with UACCESS enabled > vmlinux.o: warning: objtool: ibt_selftest+0x1e (.text+0x92b5e): return with modified stack frame > I can't really see any link between that warning and the changes in the patch. Whatever, this patch will be discarded as pointed out by Josh. Christophe > > objdump-func vmlinux.o ibt_selftest: > 0000 0000000000092b40 <ibt_selftest>: > 0000 92b40: f3 0f 1e fa endbr64 > 0004 92b44: e8 00 00 00 00 call 92b49 <ibt_selftest+0x9> 92b45: R_X86_64_PLT32 __fentry__-0x4 > 0009 92b49: 55 push %rbp > 000a 92b4a: 48 89 e5 mov %rsp,%rbp > 000d 92b4d: 48 8d 05 02 00 00 00 lea 0x2(%rip),%rax # 92b56 <ibt_selftest_ip> > 0014 92b54: ff e0 jmp *%rax > 0000 0000000000092b56 <ibt_selftest_ip>: > 0000 92b56: 90 nop > 0001 92b57: 48 85 c0 test %rax,%rax > 0004 92b5a: 5d pop %rbp > 0005 92b5b: 0f 94 c0 sete %al > 0008 92b5e: e9 00 00 00 00 jmp 92b63 <ibt_selftest_ip+0xd> 92b5f: R_X86_64_PLT32 __x86_return_thunk-0x4 > 000d 92b63: 66 2e 0f 1f 84 00 00 00 00 00 cs nopw 0x0(%rax,%rax,1) > 0017 92b6d: 0f 1f 00 nopl (%rax) >
Le 22/06/2023 à 08:31, Josh Poimboeuf a écrit : > On Wed, Jun 21, 2023 at 05:20:31PM +0200, Christophe Leroy wrote: >> Most of the time objtool warnings are useless without the >> absolute address within the section. >> >> Today there is --sec-address option to get it printed, but >> that option is nowhere used and requires a change in Makefile >> to use it. >> >> Having the address inside the section at all time in addition >> to the address within the object doesn't hurt and will help. >> >> Remove the --sec-address option and print it at all time. > > This option actually feels like clutter to me. The func+offset format > works fine, combined with scripts like objdump-func and faddr2line. And > we also have a new OBJTOOL_VERBOSE=1 option which auto-disassembles the > affected function. > > On x86 we've been using func+offset for console stack traces for many > years, due to KASLR. So maybe we're just more used to it. But the > scripts make it fine. Ah right, I didn't know that script, I was struggling with objtool -dr Therefore the patch is not needed, and neither is the --sec-address option, maybe we can remove it completely. > > Also it helps with identifying the same warning across different > configs/compilers. > Good point. Christophe
On Sat, Jun 24, 2023 at 08:30:48AM +0000, Christophe Leroy wrote: > >>> vmlinux.o: warning: objtool: ibt_selftest+0x14 (.text+0x92b54): sibling call from callable instruction with modified stack frame > > vmlinux.o: warning: objtool: .altinstr_replacement+0x19a4: redundant UACCESS disable > > vmlinux.o: warning: objtool: iovec_from_user.part.0+0xb1 (.text+0x1c47761): call to copy_iovec_from_user.part.0() with UACCESS enabled > > vmlinux.o: warning: objtool: ibt_selftest+0x1e (.text+0x92b5e): return with modified stack frame > > > > I can't really see any link between that warning and the changes in the > patch. I suspect it's a pre-existing warning, but because the patch made a change to the default formatting (adding .text+off), it looks like a new warning to the bots.
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 7c175198d09f..d5024a95467a 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -91,7 +91,6 @@ static const struct option check_options[] = { OPT_BOOLEAN(0, "module", &opts.module, "object is part of a kernel module"), OPT_BOOLEAN(0, "mnop", &opts.mnop, "nop out mcount call sites"), OPT_BOOLEAN(0, "no-unreachable", &opts.no_unreachable, "skip 'unreachable instruction' warnings"), - OPT_BOOLEAN(0, "sec-address", &opts.sec_address, "print section addresses in warnings"), OPT_BOOLEAN(0, "stats", &opts.stats, "print statistics"), OPT_END(), diff --git a/tools/objtool/include/objtool/builtin.h b/tools/objtool/include/objtool/builtin.h index 2a108e648b7a..af79618cf6ab 100644 --- a/tools/objtool/include/objtool/builtin.h +++ b/tools/objtool/include/objtool/builtin.h @@ -35,7 +35,6 @@ struct opts { bool mnop; bool module; bool no_unreachable; - bool sec_address; bool stats; }; diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h index b1c920dc9516..2db9717d0558 100644 --- a/tools/objtool/include/objtool/warn.h +++ b/tools/objtool/include/objtool/warn.h @@ -21,7 +21,6 @@ static inline char *offstr(struct section *sec, unsigned long offset) bool is_text = (sec->sh.sh_flags & SHF_EXECINSTR); struct symbol *sym = NULL; char *str; - int len; if (is_text) sym = find_func_containing(sec, offset); @@ -30,9 +29,8 @@ static inline char *offstr(struct section *sec, unsigned long offset) if (sym) { str = malloc(strlen(sym->name) + strlen(sec->name) + 40); - len = sprintf(str, "%s+0x%lx", sym->name, offset - sym->offset); - if (opts.sec_address) - sprintf(str+len, " (%s+0x%lx)", sec->name, offset); + sprintf(str, "%s+0x%lx (%s+0x%lx)", sym->name, + offset - sym->offset, sec->name, offset); } else { str = malloc(strlen(sec->name) + 20); sprintf(str, "%s+0x%lx", sec->name, offset);