linux-stable/tools
Ian Rogers b01a706f9e perf bpf-event: Fix use-after-free in synthesis
[ Upstream commit d7b67dd6f9 ]

Calls to perf_env__insert_bpf_prog_info may fail as a sideband thread
may already have inserted the bpf_prog_info. Such failures may yield
info_linear being freed which then causes use-after-free issues with
the internal bpf_prog_info info struct. Make it so that
perf_env__insert_bpf_prog_info trigger early non-error paths and fix
the use-after-free in perf_event__synthesize_one_bpf_prog. Add proper
return error handling to perf_env__add_bpf_info (that calls
perf_env__insert_bpf_prog_info) and propagate the return value in its
callers.

Closes: https://lore.kernel.org/lkml/CAP-5=fWJQcmUOP7MuCA2ihKnDAHUCOBLkQFEkQES-1ZZTrgf8Q@mail.gmail.com/
Fixes: 03edb7020b ("perf bpf: Fix two memory leakages when calling perf_env__insert_bpf_prog_info()")
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250902181713.309797-2-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-09-09 18:50:24 +02:00
..
accounting
arch
bootconfig tools/bootconfig: Fix the wrong format specifier 2025-03-13 12:50:10 +01:00
bpf bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure 2025-08-28 16:24:07 +02:00
build tools/build: Don't pass test log files to linker 2025-06-04 14:37:55 +02:00
cgroup
debugging
edid
firewire
firmware
gpio
hv
iio tools/iio: Add memory allocation failure check for trigger_name 2024-10-17 15:11:52 +02:00
include tools/nolibc: define time_t in terms of __kernel_old_time_t 2025-08-28 16:24:18 +02:00
io_uring
kvm/kvm_stat
laptop
leds
lib libbpf: Fix null pointer dereference in btf_dump__free on allocation failure 2025-07-10 15:57:38 +02:00
memory-model
objtool objtool: Stop UNRET validation on UD2 2025-05-02 07:44:37 +02:00
pci
pcmcia
perf perf bpf-event: Fix use-after-free in synthesis 2025-09-09 18:50:24 +02:00
power pm: cpupower: Fix the snapshot-order of tsc,mperf, clock in mperf_stop() 2025-08-28 16:24:19 +02:00
rcu
scripts tools: Override makefile ARCH variable if defined, but empty 2024-12-14 19:51:30 +01:00
spi
testing selftests: mptcp: pm: check flush doesn't reset limits 2025-08-28 16:24:37 +02:00
thermal/tmon
time
tracing
usb usbip: tools: Fix detach_port() invalid port error path 2024-11-08 16:25:54 +01:00
virtio
vm
wmi
Makefile