linux-yocto/tools/perf
Ian Rogers 203719d829 perf bpf-utils: Harden get_bpf_prog_info_linear
[ Upstream commit 01be43f2a0eaeed83e94dee054742f37625c86d9 ]

In get_bpf_prog_info_linear two calls to bpf_obj_get_info_by_fd are
made, the first to compute memory requirements for a struct perf_bpil
and the second to fill it in. Previously the code would warn when the
second call didn't match the first. Such races can be common place in
things like perf test, whose perf trace tests will frequently load BPF
programs. Rather than a debug message, return actual errors for this
case. Out of paranoia also validate the read bpf_prog_info array
value. Change the type of ptr to avoid mismatched pointer type
compiler warnings. Add some additional debug print outs and sanity
asserts.

Closes: https://lore.kernel.org/lkml/CAP-5=fWJQcmUOP7MuCA2ihKnDAHUCOBLkQFEkQES-1ZZTrgf8Q@mail.gmail.com/
Fixes: 6ac22d036f ("perf bpf: Pull in bpf_program__get_prog_info_linear()")
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250902181713.309797-4-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-09-09 18:58:25 +02:00
..
arch perf tools: Fix up some comments and code to properly use the event_source bus 2025-04-07 10:08:36 +02:00
bench perf bench: Fix perf bench syscall loop count 2025-04-10 14:39:23 +02:00
check-header_ignore_hunks/lib perf tools: Cope with differences for lib/list_sort.c copy from the kernel 2024-10-02 15:07:32 -03:00
dlfilters
Documentation perf tools: Fix up some comments and code to properly use the event_source bus 2025-04-07 10:08:36 +02:00
include/perf
jvmti
pmu-events perf vendor events arm64 AmpereOneX: Fix frontend_bound calculation 2025-04-10 14:39:26 +02:00
python
scripts perf scripts python: exported-sql-viewer.py: Fix pattern matching with Python 3 2025-06-19 15:32:06 +02:00
tests perf tests bp_account: Fix leaked file descriptor 2025-08-15 12:13:54 +02:00
trace perf beauty: Update copy of linux/socket.h with the kernel sources 2024-09-30 17:23:38 -03:00
ui perf ui browser hists: Set actions->thread before calling do_zoom_thread() 2025-06-19 15:32:04 +02:00
util perf bpf-utils: Harden get_bpf_prog_info_linear 2025-09-09 18:58:25 +02:00
.gitignore perf tools: Remove libtraceevent in .gitignore 2025-08-15 12:13:57 +02:00
Build perf check: Introduce 'check' subcommand 2024-09-04 09:56:05 -03:00
builtin-annotate.c perf annotate: Display the branch counter histogram 2024-08-14 10:20:40 -03:00
builtin-bench.c perf bench uprobe: Add uretprobe variant of uprobe benchmarks 2024-04-12 17:54:02 -03:00
builtin-buildid-cache.c perf dso: Add reference count checking and accessor functions 2024-05-06 15:28:49 -03:00
builtin-buildid-list.c perf buildid-list: Use perf_tool__init 2024-08-12 18:07:10 -03:00
builtin-c2c.c perf mem: Fix missed p-core mem events on ADL and RPL 2024-09-06 11:45:17 -03:00
builtin-check.c perf check: Fix inconsistencies in feature names 2024-09-04 16:19:53 -03:00
builtin-config.c
builtin-daemon.c perf daemon: Fix the build on more 32-bit architectures 2024-08-19 21:44:30 -03:00
builtin-data.c
builtin-diff.c perf report: Display the branch counter histogram 2024-08-14 10:20:40 -03:00
builtin-evlist.c perf evlist: Print hint for group 2024-09-11 13:08:45 -03:00
builtin-ftrace.c perf ftrace: Fix undefined behavior in cmp_profile_data() 2024-12-19 18:12:59 +01:00
builtin-help.c perf help: Fix a typo ("bellow") 2024-09-11 11:24:12 -03:00
builtin-inject.c perf inject: Fix use without initialization of local variables 2025-02-08 09:57:33 +01:00
builtin-kallsyms.c perf dso: Add reference count checking and accessor functions 2024-05-06 15:28:49 -03:00
builtin-kmem.c libsubcmd: Don't free the usage string 2024-09-04 09:54:24 -03:00
builtin-kvm.c libsubcmd: Don't free the usage string 2024-09-04 09:54:24 -03:00
builtin-kwork.c libsubcmd: Don't free the usage string 2024-09-04 09:54:24 -03:00
builtin-list.c perf list: Fix topic and pmu_name argument order 2024-12-05 14:02:24 +01:00
builtin-lock.c perf lock: Fix parse_lock_type which only retrieve one lock flag 2025-02-08 09:57:35 +01:00
builtin-mem.c perf mem: Fix the wrong reference in parse_record_events() 2024-09-06 11:45:28 -03:00
builtin-probe.c perf probe: Use zfree() to avoid possibly accessing dangling pointers 2024-05-07 12:44:02 -03:00
builtin-record.c perf record: Fix incorrect --user-regs comments 2025-06-19 15:32:08 +02:00
builtin-report.c perf report: Switch data file correctly in TUI 2025-04-10 14:39:22 +02:00
builtin-sched.c perf sched: Fix memory leaks in 'perf sched latency' 2025-08-15 12:13:52 +02:00
builtin-script.c perf env: Find correct branch counter info on hybrid 2024-09-11 13:08:46 -03:00
builtin-stat.c perf tools: Fix up some comments and code to properly use the event_source bus 2025-04-07 10:08:36 +02:00
builtin-timechart.c perf timechart: Use perf_tool__init() 2024-08-12 18:12:06 -03:00
builtin-top.c perf top: Don't complain about lack of vmlinux when not resolving some kernel samples 2025-02-08 09:57:31 +01:00
builtin-trace.c perf trace: Set errpid to false for rseq and set_robust_list 2025-06-19 15:32:08 +02:00
builtin-version.c perf version: Update --build-options to use 'supported_features' array 2024-09-04 16:19:29 -03:00
builtin.h perf check: Introduce 'check' subcommand 2024-09-04 09:56:05 -03:00
check-headers.sh tools headers: Update the linux/unaligned.h copy with the kernel sources 2024-10-28 12:34:28 -03:00
command-list.txt
CREDITS
design.txt
Makefile perf tools: Fix wrong message when running "make JOBS=1" 2024-08-01 12:11:33 -03:00
Makefile.config perf build: Warn when libdebuginfod devel files are not available 2025-06-19 15:32:04 +02:00
Makefile.perf perf tests: Fix 'perf report' tests installation 2025-06-19 15:32:06 +02:00
MANIFEST perf MANIFEST: Add arch/*/include/uapi/asm/bpf_perf_event.h to the perf tarball 2025-02-08 09:57:32 +01:00
perf-archive.sh perf build: Add shellcheck to tools/perf scripts 2024-04-12 17:54:02 -03:00
perf-completion.sh perf build: Add shellcheck to tools/perf scripts 2024-04-12 17:54:02 -03:00
perf-iostat.sh
perf-read-vdso.c
perf-sys.h
perf.c perf check: Introduce 'check' subcommand 2024-09-04 09:56:05 -03:00
perf.h