[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YD2loOkd/AYqKPB6@google.com>
Date: Mon, 1 Mar 2021 18:40:32 -0800
From: Sami Tolvanen <samitolvanen@...gle.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: kernel test robot <oliver.sang@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Kees Cook <keescook@...omium.org>,
LKML <linux-kernel@...r.kernel.org>, lkp@...ts.01.org,
kernel test robot <lkp@...el.com>
Subject: Re: [x86, build] 6dafca9780:
WARNING:at_arch/x86/kernel/ftrace.c:#ftrace_verify_code
On Mon, Mar 01, 2021 at 08:15:26PM -0500, Steven Rostedt wrote:
> On Mon, 1 Mar 2021 16:03:51 -0800
> Sami Tolvanen <samitolvanen@...gle.com> wrote:
> >
> > > ret = ftrace_verify_code(rec->ip, old);
> > > +
> > > + if (__is_defined(CC_USING_NOP_MCOUNT) && ret && old_nop) {
> > > + /* Compiler could have put in P6_NOP5 */
> > > + old = P6_NOP5;
> > > + ret = ftrace_verify_code(rec->ip, old);
> > > + }
> > > +
> >
> > Wouldn't that still hit WARN(1) in the initial ftrace_verify_code()
> > call if ideal_nops doesn't match?
>
> That was too quickly written ;-)
>
> Take 2:
>
> [ with fixes for setting p6_nop ]
Thanks, I tested this with the config from the build bot, and I can
confirm that it fixes the issue for me.
I also tested a quick patch to disable the __fentry__ conversion in
objtool, and it seems to work too, but it's probably a good idea to
fix the issue with CC_USING_NOP_MCOUNT in any case.
diff --git a/Makefile b/Makefile
index f9b54da2fca0..536fea073d5b 100644
--- a/Makefile
+++ b/Makefile
@@ -863,9 +863,6 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_CC
endif
endif
endif
-ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
- CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
-endif
ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
ifdef CONFIG_HAVE_C_RECORDMCOUNT
BUILD_C_RECORDMCOUNT := y
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 068cdb41f76f..497e00c1cb69 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1047,21 +1047,9 @@ static int add_call_destinations(struct objtool_file *file)
insn->type = INSN_NOP;
}
- if (mcount && !strcmp(insn->call_dest->name, "__fentry__")) {
- if (reloc) {
- reloc->type = R_NONE;
- elf_write_reloc(file->elf, reloc);
- }
-
- elf_write_insn(file->elf, insn->sec,
- insn->offset, insn->len,
- arch_nop_insn(insn->len));
-
- insn->type = INSN_NOP;
-
+ if (mcount && !strcmp(insn->call_dest->name, "__fentry__"))
list_add_tail(&insn->mcount_loc_node,
&file->mcount_loc_list);
- }
/*
* Whatever stack impact regular CALLs have, should be undone
Sami
Powered by blists - more mailing lists