kernel_samsung_a53x/include
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
..
acpi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
asm-generic asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation 2024-11-18 12:11:56 +01:00
clocksource Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crypto crypto: af_alg - Disallow multiple in-flight AIO requests 2024-11-18 12:12:26 +01:00
drm drm: Stub out debug prints 2024-11-17 17:45:26 +01:00
dt-bindings Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
keys Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kunit Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kvm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
linux keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry 2024-11-18 12:11:59 +01:00
math-emu Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
media Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
memory Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
misc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE 2024-11-18 12:12:02 +01:00
pcmcia Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ras Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rdma Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scsc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scsi Revert "scsi: core: Add scsi_prot_ref_tag() helper" 2024-11-18 12:12:05 +01:00
sdp Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
soc exynos_pm_qos: Remove exynos_pm_qos_update_request_timeout() 2024-11-17 17:44:09 +01:00
sound ASoC: soc-card: Add storage for PCI SSID 2024-11-18 11:43:13 +01:00
target Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
test Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trace neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section 2024-11-08 11:26:11 +01:00
uapi bpf: Add crosstask check to __bpf_get_stack 2024-11-18 12:12:28 +01:00
variant1/linux Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vdso Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
video Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xen Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00