Skip to content
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

bpf: trace: send signals asynchronously if !preemptible #8362

Open
wants to merge 1 commit into
base: bpf_base
Choose a base branch
from

Conversation

puranjaymohan
Copy link
Contributor

BPF programs can execute in all kinds of contexts and when a program running in a non-preemptible context uses the bpf_send_signal() kfunc, it will cause issues because this kfunc can sleep.

So change irqs_disabled() to !preemptible() that covers all edge cases: preempt_count() == 0 and irqs_disabled()

Reported-by: syzbot+97da3d7e0112d59971de@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/67486b09.050a0220.253251.0084.GAE@google.com/
Fixes: 1bc7896 ("bpf: Fix deadlock with rq_lock in bpf_send_signal()")

BPF programs can execute in all kinds of contexts and when a program
running in a non-preemptible context uses the bpf_send_signal() kfunc,
it will cause issues because this kfunc can sleep.

So change `irqs_disabled()` to `!preemptible()` that covers all edge
cases: preempt_count() == 0 and irqs_disabled()

Reported-by: syzbot+97da3d7e0112d59971de@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/67486b09.050a0220.253251.0084.GAE@google.com/
Fixes: 1bc7896 ("bpf: Fix deadlock with rq_lock in bpf_send_signal()")
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the bpf_base branch 3 times, most recently from 150763b to 22a0c89 Compare January 17, 2025 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant