Re: [PATCH 5/5] perf dso: Replace assert with runtime check in dso__read_symbol()

[email protected]
Newsgroups org.kernel.vger.linux-perf-users
Message-ID <[email protected]>
> From: Arnaldo Carvalho de Melo <[email protected]>
> 
> dso__read_symbol() asserts that len <= jited_prog_len, where len comes
> from sym->end - sym->start (parsed from PERF_RECORD_KSYMBOL in
> perf.data).  Both values originate from untrusted file input.
> 
> With NDEBUG (production builds), the assert is compiled out, allowing
> an out-of-bounds heap read when the BPF program buffer is accessed.
> Without NDEBUG, a crafted perf.data crashes perf with an assertion
> failure.
> 
> Replace the assert with a runtime bounds check that returns NULL with
> an appropriate error code, matching the existing error handling
> pattern in this function.
> 
> Fixes: aa04707f507e ("perf dso: Support BPF programs in dso__read_symbol()")
> Reported-by: sashiko-bot <[email protected]>
> Cc: Ian Rogers <[email protected]>
> Cc: Song Liu <[email protected]>
> Assisted-by: Claude:claude-opus-4.6
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.