Re: Regression bisected to f2f84b05e02b (bug: consolidate warn_slowpath_fmt() usage)

From: Kees Cook
Date: Thu May 23 2024 - 19:49:30 EST


On Tue, May 21, 2024 at 08:46:52PM +0200, John Paul Adrian Glaubitz wrote:
> Hi,
>
> Replacing the calls to raw_smp_processor_id() in __warn() with just "0" fixes the problem for me:
>
> diff --git a/kernel/panic.c b/kernel/panic.c
> index 8bff183d6180..12f6cea6b8b0 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -671,11 +671,11 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
>
> if (file)
> pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n",
> - raw_smp_processor_id(), current->pid, file, line,
> + 0, current->pid, file, line,
> caller);
> else
> pr_warn("WARNING: CPU: %d PID: %d at %pS\n",
> - raw_smp_processor_id(), current->pid, caller);
> + 0, current->pid, caller);
>
> #pragma GCC diagnostic push
> #ifndef __clang__
>
> So, I assume the problem is that SMP support is not fully initialized at this
> point yet such that raw_smp_processor_id() causes the zero pointer dereference.

But how does the commit change that? It called __warn() before too.

Is this an inlining bug?

--
Kees Cook