WSL2-Linux-Kernel/include/uapi
Jordan Rome 131afd9a57 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: fa28dcb82a ("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-01-25 14:52:36 -08:00
..
asm-generic signal: Deliver SIGTRAP on perf event asynchronously if blocked 2022-06-09 10:22:48 +02:00
drm drm/fourcc: Add packed 10bit YUV 4:2:0 format 2022-12-31 13:14:10 +01:00
linux bpf: Add crosstask check to __bpf_get_stack 2024-01-25 14:52:36 -08:00
misc habanalabs: fix resetting args in wait for CS IOCTL 2021-09-29 12:18:48 +03:00
mtd
rdma RDMA/mlx5: Don't compare mkey tags in DEVX indirect mkey 2022-10-26 12:35:03 +02:00
scsi scsi: fc: Add EDC ELS definition 2021-08-24 22:56:33 -04:00
sound ASoC: Intel: Skylake: Fix declaration of enum skl_ch_cfg 2023-05-30 13:55:33 +01:00
video
xen
Kbuild