From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Borislav Petkov <bp@alien8.de>, kernel test robot <lkp@intel.com>
Cc: <linux-kernel@vger.kernel.org>, <oe-kbuild-all@lists.linux.dev>,
<x86@kernel.org>, <tglx@linutronix.de>, <mingo@redhat.com>,
<dave.hansen@linux.intel.com>, <peterz@infradead.org>,
<david.kaplan@amd.com>
Subject: Re: [PATCH 1/7] stop_machine: Introduce stop_machine_nmi()
Date: Tue, 27 Jan 2026 11:15:08 -0800 [thread overview]
Message-ID: <960d07f0-d693-4139-ba80-d622b69e6273@intel.com> (raw)
In-Reply-To: <20260127144947.GKaXjQi8R9cE17WYKM@fat_crate.local>
On 1/27/2026 6:49 AM, Borislav Petkov wrote:
>>
>>>> vmlinux.o: error: objtool: stop_machine_nmi_handler+0x23: call to {dynamic}() leaves .noinstr.text section
>
> This one would be hard to fix because that's the
>
> err = msdata->fn(msdata->data);
>
> function pointer which objtool can't see through.
Yes. Under certain config, the 0-day bot tirggers this with
CONFIG_NOINSTR_VALIDATION=y.
Objtool ends up with the following path:
tools/objtool/check.c::validation_call()
-> noinstr_call_dest()
{
/*
* We can't deal with indirect function calls at present;
* assume they're instrumented.
*/
if (!func) {
if (file->pv_ops)
return pv_call_dest(file, insn);
return false;
}
...
}
So every indirect call under noinstr is conservatively treated as
invalid except for pv_ops which seems to be investigated further. In
this series, however, the destination code is to in .noinstr.text.
Given this, I considered something to be adjusted on the tool side, e.g.
by whitelisting the case along the lines of
if (!func) {
...
if (!strncmp(insn_func(insn)->name, "stop_machine_nmi_handler", 24))
return true;
return false;
}
The existing pv_ops handling also looks somewhat misaligned with large
objects like vmlinux.o.
>
> So my suggestion would be to do:
>
> struct nmi_multi_stop_data {
> cpu_stop_safe_fn_t fn;
>
> note the different function pointer type which we will hopefully catch during
> review in the sense that only *safe* functions should be callable by the
> NMI-specific stomp_machine.
>
> Along with:
>
> diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
> index 189b4b108d13..55a350048d4c 100644
> --- a/kernel/stop_machine.c
> +++ b/kernel/stop_machine.c
> @@ -230,7 +230,9 @@ bool noinstr stop_machine_nmi_handler(void)
> raw_cpu_write(stop_machine_nmi_ctrl.nmi_enabled, false);
>
> msdata = raw_cpu_read(stop_machine_nmi_ctrl.msdata);
> + instrumentation_begin();
> err = msdata->fn(msdata->data);
> + instrumentation_end();
> raw_cpu_write(stop_machine_nmi_ctrl.err, err);
> return true;
> }
I also thought this change, but I was a bit hesitant as it could be seen
as lifting up the no-instrumentation.
Now I suppose the net effect will be the same with other workaround,
e.g. tool-side whitelisting. So I think I can go with this as you
suggested (with a clear note on this).
>
> ofc.
>
> Unless someone has a better idea ofc...
Sure.
Thanks,
Chang
next prev parent reply other threads:[~2026-01-27 19:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-25 1:42 [PATCH 0/7] x86/microcode: Refactor NMI-based rendezvous mechanism to stop-machine Chang S. Bae
2026-01-25 1:42 ` [PATCH 1/7] stop_machine: Introduce stop_machine_nmi() Chang S. Bae
2026-01-26 11:51 ` kernel test robot
2026-01-27 14:49 ` Borislav Petkov
2026-01-27 19:15 ` Chang S. Bae [this message]
2026-01-27 15:49 ` Borislav Petkov
2026-01-27 16:00 ` Kaplan, David
2026-01-27 20:49 ` Borislav Petkov
2026-01-28 1:31 ` Kaplan, David
2026-01-28 16:35 ` Borislav Petkov
2026-01-29 12:17 ` Borislav Petkov
2026-01-29 15:47 ` Chang S. Bae
2026-02-02 10:54 ` Borislav Petkov
2026-02-06 2:14 ` Chang S. Bae
2026-03-04 16:33 ` Borislav Petkov
2026-01-28 8:02 ` Thomas Gleixner
2026-01-29 17:07 ` Chang S. Bae
2026-01-30 10:02 ` Thomas Gleixner
2026-01-25 1:42 ` [PATCH 2/7] x86/apic: Implement self-NMI support Chang S. Bae
2026-01-28 8:05 ` Thomas Gleixner
2026-01-29 16:32 ` Chang S. Bae
2026-01-25 1:42 ` [PATCH 3/7] x86/nmi: Support stop_machine_nmi() handler Chang S. Bae
2026-01-25 1:42 ` [PATCH 4/7] x86/microcode: Distinguish NMI control path on stop-machine callback Chang S. Bae
2026-01-28 8:11 ` Thomas Gleixner
2026-01-29 16:32 ` Chang S. Bae
2026-01-25 1:42 ` [PATCH 5/7] x86/microcode: Use stop-machine NMI facility Chang S. Bae
2026-01-25 1:42 ` [PATCH 6/7] x86/nmi: Reference stop-machine static key for offline microcode handler Chang S. Bae
2026-01-25 1:42 ` [PATCH 7/7] x86/microcode: Remove microcode_nmi_handler_enable Chang S. Bae
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=960d07f0-d693-4139-ba80-d622b69e6273@intel.com \
--to=chang.seok.bae@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david.kaplan@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mingo@redhat.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome