-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: add crosstask check to __bpf_get_stack #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bpf-next_base
Are you sure you want to change the base?
Conversation
|
Upstream branch: b4e59c1 |
d955544 to
dc3526c
Compare
|
Upstream branch: b4e59c1 |
2dc0f36 to
66ec86e
Compare
902178a to
bc1b833
Compare
|
Upstream branch: 3815f89 |
66ec86e to
1007cf8
Compare
0fbe9f3 to
b0d20d2
Compare
|
Upstream branch: 6f101db |
1007cf8 to
690904c
Compare
b0d20d2 to
1e02037
Compare
|
Upstream branch: 6f101db |
690904c to
235d062
Compare
1e02037 to
a98cbca
Compare
|
Upstream branch: e80742d |
235d062 to
9757c2d
Compare
a98cbca to
b7b6ef0
Compare
|
Upstream branch: e80742d |
9757c2d to
8debb67
Compare
b7b6ef0 to
293e027
Compare
|
Upstream branch: e80742d |
8debb67 to
fc3a1c6
Compare
293e027 to
260b428
Compare
|
Upstream branch: e80742d |
fc3a1c6 to
b1352af
Compare
260b428 to
08949e6
Compare
|
Upstream branch: 155addf |
b1352af to
4dc0483
Compare
08949e6 to
3a8c9bf
Compare
|
Upstream branch: 689b097 |
4dc0483 to
74aad25
Compare
3a8c9bf to
32f9f95
Compare
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: fa28dcb ("bpf: Introduce helper bpf_get_task_stack()")
Signed-off-by: Jordan Rome <jordalgo@meta.com>
|
Upstream branch: 9241176 |
74aad25 to
9903328
Compare
Pull request for series with
subject: bpf: add crosstask check to __bpf_get_stack
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=799648