Re: [PATCH] perf symbols: Don't let a module's last symbol overlap the next module
From: Arnaldo Carvalho de Melo
Date: Tue Sep 29 2026 - 16:47:10 EST
On Tue, Sep 29, 2026 at 10:55:40AM -0700, Namhyung Kim wrote:
> On Mon, Sep 28, 2026 at 04:32:27PM -0700, Alireza Haghdoost via B4 Relay wrote:
> > From: Alireza Haghdoost <haghdoost@xxxxxxxx>
> >
> > symbols__fixup_end() extends a zero-size symbol that is the last one in
> > the kernel or in a module to the end of the next page. On x86 the next
> > module can start in that page, so the stretched symbol overlaps it, and
> > a lookup can return the wrong symbol. For example:
> >
> > ffffffffc0c4aa50 t dca_sysfs_exit [dca]
> > ffffffffc0c4b000 t __nft_trace_packet [nf_tables]
> > ffffffffc0c4b0b0 t nft_do_chain [nf_tables]
> >
> > dca_sysfs_exit gets end 0xffffffffc0c4c000, and samples in nft_do_chain
> > are reported as dca_sysfs_exit.
> >
> > This patch clamps the end to the next symbol's start. The ARM case this
> > code was added for, where the next module is far away, is unchanged.
> >
> > Add a "Kallsyms symbol ends" test case to the Symbols suite that covers
> > the kernel/module boundary, adjacent modules and a distant module.
> >
> > Fixes: 8799ebce84d6 ("perf symbol: Update symbols__fixup_end()")
> > Fixes: bacefe0c7b77 ("perf tools: Fixup module symbol end address properly")
> > Signed-off-by: Alireza Haghdoost <haghdoost@xxxxxxxx>
>
> Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
Thanks, applied to perf-tools-next, for v7.4.
- Arnaldo