Re: [PATCH] perf machine: Fix NULL deref in machine__is_lock_function()
From: Namhyung Kim
Date: Mon Nov 09 2026 - 21:57:05 EST
On Thu, 05 Nov 2026 14:49:57 +0800, Gu Bin wrote:
> machine__is_lock_function() looks up __sched_text_start and, if found,
> assumes the remaining scheduler/lock text symbols are present too: it
> dereferences sym->start for __sched_text_end, __lock_text_start and
> __lock_text_end without a NULL check, under a "should not fail from
> here" comment.
>
> That assumption has already been broken in practice: on s390,
> __sched_text_end shared its address with __cpuidle_text_start and
> was dropped by symbols__fixup_duplicate(), causing a SIGSEGV in
> "perf lock contention".
> commit d8d85ce86dc8 ("perf lock contention: Fix core dump related to
> not finding the "__sched_text_end" symbol on s/390") worked around
> that particular case by keeping duplicate symbols via
> symbol_conf.allow_aliases. The symbols can also be absent when the
> kernel image has no lock text, or when the symbol table is otherwise
> incomplete.
>
> [...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung