All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sami Tolvanen <samitolvanen@google.com>
To: kernel test robot <oliver.sang@intel.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Peter Zijlstra <peterz@infradead.org>
Cc: Kees Cook <keescook@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	lkp@lists.01.org, kernel test robot <lkp@intel.com>
Subject: Re: [x86, build] 6dafca9780: WARNING:at_arch/x86/kernel/ftrace.c:#ftrace_verify_code
Date: Mon, 1 Mar 2021 14:14:51 -0800	[thread overview]
Message-ID: <CABCJKuc8H83b_8_Ccp+Cb7O9x5oEu6sPNq63sjGcAJcgiwy0bw@mail.gmail.com> (raw)
In-Reply-To: <20210301074027.GD12822@xsang-OptiPlex-9020>

On Sun, Feb 28, 2021 at 11:25 PM kernel test robot
<oliver.sang@intel.com> wrote:
>
>
> Greeting,
>
> FYI, we noticed the following commit (built with clang-13):
>
> commit: 6dafca97803309c3cb5148d449bfa711e41ddef2 ("x86, build: use objtool mcount")
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

Thanks for the report, I'm able to reproduce the warning.

> [    4.764496] ------------[ ftrace bug ]------------
> [    4.764847] ftrace failed to modify
> [    4.764852] do_sys_open (kbuild/src/consumer/fs/open.c:1186)
> [    4.765483]  actual:   0f:1f:44:00:00
> [    4.765784] Setting ftrace call site to call ftrace function
> [    4.766193] ftrace record flags: 50000001
> [    4.766490]  (1) R
> [    4.766490]  expected tramp: ffffffff81037af0
> [    4.766959] ------------[ cut here ]------------

Basically, the problem is that ftrace_replace_code() expects to find
ideal_nops[NOP_ATOMIC5] here, which in this case is 66:66:66:66:90,
while objtool has replaced the __fentry__ call with 0f:1f:44:00:00.

As ideal_nops changes depending on kernel config and hardware, when
CC_USING_NOP_MCOUNT is defined we could either change
ftrace_nop_replace() to always use P6_NOP5, or skip
ftrace_verify_code() in ftrace_replace_code() for
FTRACE_UPDATE_MAKE_CALL.

Steven, Peter, any thoughts?

Sami

WARNING: multiple messages have this Message-ID (diff)
From: Sami Tolvanen <samitolvanen@google.com>
To: lkp@lists.01.org
Subject: Re: [x86, build] 6dafca9780: WARNING:at_arch/x86/kernel/ftrace.c:#ftrace_verify_code
Date: Mon, 01 Mar 2021 14:14:51 -0800	[thread overview]
Message-ID: <CABCJKuc8H83b_8_Ccp+Cb7O9x5oEu6sPNq63sjGcAJcgiwy0bw@mail.gmail.com> (raw)
In-Reply-To: <20210301074027.GD12822@xsang-OptiPlex-9020>

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

On Sun, Feb 28, 2021 at 11:25 PM kernel test robot
<oliver.sang@intel.com> wrote:
>
>
> Greeting,
>
> FYI, we noticed the following commit (built with clang-13):
>
> commit: 6dafca97803309c3cb5148d449bfa711e41ddef2 ("x86, build: use objtool mcount")
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

Thanks for the report, I'm able to reproduce the warning.

> [    4.764496] ------------[ ftrace bug ]------------
> [    4.764847] ftrace failed to modify
> [    4.764852] do_sys_open (kbuild/src/consumer/fs/open.c:1186)
> [    4.765483]  actual:   0f:1f:44:00:00
> [    4.765784] Setting ftrace call site to call ftrace function
> [    4.766193] ftrace record flags: 50000001
> [    4.766490]  (1) R
> [    4.766490]  expected tramp: ffffffff81037af0
> [    4.766959] ------------[ cut here ]------------

Basically, the problem is that ftrace_replace_code() expects to find
ideal_nops[NOP_ATOMIC5] here, which in this case is 66:66:66:66:90,
while objtool has replaced the __fentry__ call with 0f:1f:44:00:00.

As ideal_nops changes depending on kernel config and hardware, when
CC_USING_NOP_MCOUNT is defined we could either change
ftrace_nop_replace() to always use P6_NOP5, or skip
ftrace_verify_code() in ftrace_replace_code() for
FTRACE_UPDATE_MAKE_CALL.

Steven, Peter, any thoughts?

Sami

  reply	other threads:[~2021-03-02  7:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01  7:40 [x86, build] 6dafca9780: WARNING:at_arch/x86/kernel/ftrace.c:#ftrace_verify_code kernel test robot
2021-03-01  7:40 ` kernel test robot
2021-03-01 22:14 ` Sami Tolvanen [this message]
2021-03-01 22:14   ` Sami Tolvanen
2021-03-01 23:45   ` Steven Rostedt
2021-03-01 23:45     ` Steven Rostedt
2021-03-02  0:03     ` Sami Tolvanen
2021-03-02  0:03       ` Sami Tolvanen
2021-03-02  1:15       ` Steven Rostedt
2021-03-02  1:15         ` Steven Rostedt
2021-03-02  2:40         ` Sami Tolvanen
2021-03-02  2:40           ` Sami Tolvanen
2021-03-02  2:47           ` Steven Rostedt
2021-03-02  2:47             ` Steven Rostedt
2021-03-02  3:23             ` Sami Tolvanen
2021-03-02  3:23               ` Sami Tolvanen
2021-03-02  9:19         ` Peter Zijlstra
2021-03-02  9:19           ` Peter Zijlstra
2021-03-02 15:58           ` Steven Rostedt
2021-03-02 15:58             ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABCJKuc8H83b_8_Ccp+Cb7O9x5oEu6sPNq63sjGcAJcgiwy0bw@mail.gmail.com \
    --to=samitolvanen@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=oliver.sang@intel.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.