Re: [PATCH] perf machine: Fix NULL deref in thread__resolve_callchain_sample()
From: Arnaldo Carvalho de Melo
Date: Tue Oct 27 2026 - 16:44:10 EST
On Tue, Oct 27, 2026 at 08:21:16AM -0700, Ian Rogers wrote:
> On Tue, Oct 27, 2026 at 4:54 AM <lv.yating@xxxxxxxxxx> wrote:
> > When recording with -j stack, resolve_lbr_callchain_sample() can
> > dereference a NULL 'chain' pointer while resolving the branch
> > stack.
> > $ perf record -j stack -e branches:u uname
> > perf: Segmentation fault
> > Fix it by checking 'chain' for NULL before dereferencing it.
> > Fixes: 29be60c93d2d ("perf build-id: Mark DSO in sample callchains")
> > Signed-off-by: lvyating <lv.yating@xxxxxxxxxx>
> > Cc: stable@xxxxxxxxxxxxxxx
> Tested-by: Ian Rogers <irogers@xxxxxxxxxx>
> Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>
Thanks, applied for v7.4.
> I wonder - this failure points to a lack of test coverage. For LBR the
> main coverage comes from:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/shell/record_lbr.sh?h=perf-tools-next
> Could you help expand the tests to avoid regressions?
That would be great indeed,
- Arnaldo