kernel_samsung_a53x/tools/include/uapi/linux
Jordan Rome 23a49e6f7e bpf: Add crosstask check to __bpf_get_stack
[ Upstream commit b8e3a87a627b575896e448021e5c2f8a3bc19931 ]

Currently get_perf_callchain only supports user stack walking for
the current task. Passing the correct *crosstask* param will return
0 frames if the task passed to __bpf_get_stack isn't the current
one instead of a single incorrect frame/address. This change
passes the correct *crosstask* param but also does a preemptive
check in __bpf_get_stack if the task is current and returns
-EOPNOTSUPP if it is not.

This issue was found using bpf_get_task_stack inside a BPF
iterator ("iter/task"), which iterates over all tasks.
bpf_get_task_stack works fine for fetching kernel stacks
but because get_perf_callchain relies on the caller to know
if the requested *task* is the current one (via *crosstask*)
it was failing in a confusing way.

It might be possible to get user stacks for all tasks utilizing
something like access_process_vm but that requires the bpf
program calling bpf_get_task_stack to be sleepable and would
therefore be a breaking change.

Fixes: fa28dcb82a38 ("bpf: Introduce helper bpf_get_task_stack()")
Signed-off-by: Jordan Rome <jordalgo@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20231108112334.3433136-1-jordalgo@meta.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 12:12:28 +01:00
..
tc_act Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bpf.h bpf: Add crosstask check to __bpf_get_stack 2024-11-18 12:12:28 +01:00
bpf_common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bpf_perf_event.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btf.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
const.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
erspan.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ethtool.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fadvise.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fcntl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
filter.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fscrypt.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hw_breakpoint.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
if_link.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
if_tun.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
if_xdp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
in.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kcmp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kvm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lirc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mman.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mount.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netlink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
openat2.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
perf_event.h tools headers UAPI: Sync linux/perf_event.h with the kernel sources 2024-11-18 12:11:47 +01:00
pkt_cls.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pkt_sched.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
prctl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sched.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
seg6.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
seg6_local.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stat.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tls.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
types.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usbdevice_fs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vhost.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00