linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* vmlinux.o: warning: objtool: stackleak_erase()+0x35: call to ftrace_likely_update() leaves .noinstr.text section
@ 2022-04-04 12:22 kernel test robot
  2022-04-04 18:27 ` Kees Cook
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2022-04-04 12:22 UTC (permalink / raw)
  To: Kees Cook; +Cc: kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3123109284176b1532874591f7c81f3837bbdc17
commit: dcb85f85fa6f142aae1fe86f399d4503d49f2b60 gcc-plugins/stackleak: Use noinstr in favor of notrace
date:   8 weeks ago
config: x86_64-randconfig-r012-20220404 (https://download.01.org/0day-ci/archive/20220404/202204042008.sCQbEmVS-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dcb85f85fa6f142aae1fe86f399d4503d49f2b60
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout dcb85f85fa6f142aae1fe86f399d4503d49f2b60
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   vmlinux.o: warning: objtool: __wrgsbase_inactive()+0x26: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: __rdgsbase_inactive()+0x23: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: fixup_bad_iret()+0x76: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: noist_exc_debug()+0x3c: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: exc_nmi()+0xaa: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: poke_int3_handler()+0x3e: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: mce_check_crashing_cpu()+0x15: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: mce_start()+0x4e: call to __kcsan_check_access() leaves .noinstr.text section
   vmlinux.o: warning: objtool: mce_gather_info()+0x5f: call to v8086_mode.constprop.0() leaves .noinstr.text section
   vmlinux.o: warning: objtool: mce_read_aux()+0x93: call to mca_msr_reg() leaves .noinstr.text section
   vmlinux.o: warning: objtool: do_machine_check()+0x5f: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: exc_machine_check()+0x8e: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: mce_severity_amd.constprop.0()+0xca: call to mce_severity_amd_smca() leaves .noinstr.text section
   vmlinux.o: warning: objtool: irqentry_nmi_enter()+0x45: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: irqentry_nmi_exit()+0x38: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: enter_from_user_mode()+0x15: call to test_bit() leaves .noinstr.text section
   vmlinux.o: warning: objtool: syscall_enter_from_user_mode()+0x1a: call to test_bit() leaves .noinstr.text section
   vmlinux.o: warning: objtool: syscall_enter_from_user_mode_prepare()+0x15: call to test_bit() leaves .noinstr.text section
   vmlinux.o: warning: objtool: irqentry_enter_from_user_mode()+0x15: call to test_bit() leaves .noinstr.text section
   vmlinux.o: warning: objtool: irqentry_exit()+0x28: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: context_tracking_recursion_enter()+0x103: call to ftrace_likely_update() leaves .noinstr.text section
   vmlinux.o: warning: objtool: __context_tracking_enter()+0x30: call to ftrace_likely_update() leaves .noinstr.text section
>> vmlinux.o: warning: objtool: stackleak_erase()+0x35: call to ftrace_likely_update() leaves .noinstr.text section

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vmlinux.o: warning: objtool: stackleak_erase()+0x35: call to ftrace_likely_update() leaves .noinstr.text section
  2022-04-04 12:22 vmlinux.o: warning: objtool: stackleak_erase()+0x35: call to ftrace_likely_update() leaves .noinstr.text section kernel test robot
@ 2022-04-04 18:27 ` Kees Cook
  2022-04-04 19:25   ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2022-04-04 18:27 UTC (permalink / raw)
  To: Steven Rostedt, Josh Poimboeuf, Peter Zijlstra
  Cc: kbuild-all, linux-kernel, kernel test robot

Hi,

On Mon, Apr 04, 2022 at 08:22:33PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   3123109284176b1532874591f7c81f3837bbdc17
> commit: dcb85f85fa6f142aae1fe86f399d4503d49f2b60 gcc-plugins/stackleak: Use noinstr in favor of notrace
> date:   8 weeks ago
> config: x86_64-randconfig-r012-20220404 (https://download.01.org/0day-ci/archive/20220404/202204042008.sCQbEmVS-lkp@intel.com/config)
> compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
> reproduce (this is a W=1 build):
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dcb85f85fa6f142aae1fe86f399d4503d49f2b60
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout dcb85f85fa6f142aae1fe86f399d4503d49f2b60
>         # save the config file to linux build tree
>         mkdir build_dir
>         make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    vmlinux.o: warning: objtool: __wrgsbase_inactive()+0x26: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: __rdgsbase_inactive()+0x23: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: fixup_bad_iret()+0x76: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: noist_exc_debug()+0x3c: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: exc_nmi()+0xaa: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: poke_int3_handler()+0x3e: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: mce_check_crashing_cpu()+0x15: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: mce_start()+0x4e: call to __kcsan_check_access() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: mce_gather_info()+0x5f: call to v8086_mode.constprop.0() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: mce_read_aux()+0x93: call to mca_msr_reg() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: do_machine_check()+0x5f: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: exc_machine_check()+0x8e: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: mce_severity_amd.constprop.0()+0xca: call to mce_severity_amd_smca() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: irqentry_nmi_enter()+0x45: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: irqentry_nmi_exit()+0x38: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: enter_from_user_mode()+0x15: call to test_bit() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: syscall_enter_from_user_mode()+0x1a: call to test_bit() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: syscall_enter_from_user_mode_prepare()+0x15: call to test_bit() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: irqentry_enter_from_user_mode()+0x15: call to test_bit() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: irqentry_exit()+0x28: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: context_tracking_recursion_enter()+0x103: call to ftrace_likely_update() leaves .noinstr.text section
>    vmlinux.o: warning: objtool: __context_tracking_enter()+0x30: call to ftrace_likely_update() leaves .noinstr.text section
> >> vmlinux.o: warning: objtool: stackleak_erase()+0x35: call to ftrace_likely_update() leaves .noinstr.text section

I got CCed on this because of stackleak_erase() triggering, this, but it
appears to be an existing issue for other callers too. It looks like
__branch_check__() shouldn't be emitting ftrace_likely_update() calls
for noinstr functions...

I have no idea how a macro is meant to check for function attributes,
though... :(

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vmlinux.o: warning: objtool: stackleak_erase()+0x35: call to ftrace_likely_update() leaves .noinstr.text section
  2022-04-04 18:27 ` Kees Cook
@ 2022-04-04 19:25   ` Steven Rostedt
  2022-04-05  8:03     ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2022-04-04 19:25 UTC (permalink / raw)
  To: Kees Cook
  Cc: Josh Poimboeuf, Peter Zijlstra, kbuild-all, linux-kernel,
	kernel test robot

On Mon, 4 Apr 2022 11:27:47 -0700
Kees Cook <keescook@chromium.org> wrote:

> I got CCed on this because of stackleak_erase() triggering, this, but it
> appears to be an existing issue for other callers too. It looks like
> __branch_check__() shouldn't be emitting ftrace_likely_update() calls
> for noinstr functions...
> 
> I have no idea how a macro is meant to check for function attributes,
> though... :(

Ignore it. It's the branch tracer enabled (that is, every "if ()" is being
traced).

Although I still use the branch profiler, I do not believe anyone uses the
branch tracer. The branch profiler updates an array of counters that tells
when the branch was true or false, the branch tracer actually traces
(records an event) for every branch in the system!

I think I'll just send a patch to nuke the tracer. I'm sure Peter Zijlstra
will be happy when I do that. But I still want the profiler, as I find that
useful.

-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vmlinux.o: warning: objtool: stackleak_erase()+0x35: call to ftrace_likely_update() leaves .noinstr.text section
  2022-04-04 19:25   ` Steven Rostedt
@ 2022-04-05  8:03     ` Peter Zijlstra
  2022-04-05 13:38       ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2022-04-05  8:03 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Kees Cook, Josh Poimboeuf, kbuild-all, linux-kernel, kernel test robot

On Mon, Apr 04, 2022 at 03:25:02PM -0400, Steven Rostedt wrote:
> On Mon, 4 Apr 2022 11:27:47 -0700
> Kees Cook <keescook@chromium.org> wrote:
> 
> > I got CCed on this because of stackleak_erase() triggering, this, but it
> > appears to be an existing issue for other callers too. It looks like
> > __branch_check__() shouldn't be emitting ftrace_likely_update() calls
> > for noinstr functions...
> > 
> > I have no idea how a macro is meant to check for function attributes,
> > though... :(
> 
> Ignore it. It's the branch tracer enabled (that is, every "if ()" is being
> traced).
> 
> Although I still use the branch profiler, I do not believe anyone uses the
> branch tracer. The branch profiler updates an array of counters that tells
> when the branch was true or false, the branch tracer actually traces
> (records an event) for every branch in the system!

\o/

> I think I'll just send a patch to nuke the tracer. I'm sure Peter Zijlstra
> will be happy when I do that. But I still want the profiler, as I find that
> useful.

It'll explode the moment Lai's entry rework goes through. That'll make
us run C code before we switch to the kernel address space, so your
counters will not exist/be-mapped and *BOOM*.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vmlinux.o: warning: objtool: stackleak_erase()+0x35: call to ftrace_likely_update() leaves .noinstr.text section
  2022-04-05  8:03     ` Peter Zijlstra
@ 2022-04-05 13:38       ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2022-04-05 13:38 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Kees Cook, Josh Poimboeuf, kbuild-all, linux-kernel, kernel test robot

On Tue, 5 Apr 2022 10:03:35 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> > I think I'll just send a patch to nuke the tracer. I'm sure Peter Zijlstra
> > will be happy when I do that. But I still want the profiler, as I find that
> > useful.  
> 
> It'll explode the moment Lai's entry rework goes through. That'll make
> us run C code before we switch to the kernel address space, so your
> counters will not exist/be-mapped and *BOOM*.

We could black list those areas. Just add:

#define DISABLE_BRANCH_PROFILING at the top of any file and it will not
do the profiling.

-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-06  0:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 12:22 vmlinux.o: warning: objtool: stackleak_erase()+0x35: call to ftrace_likely_update() leaves .noinstr.text section kernel test robot
2022-04-04 18:27 ` Kees Cook
2022-04-04 19:25   ` Steven Rostedt
2022-04-05  8:03     ` Peter Zijlstra
2022-04-05 13:38       ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).