-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: avoid sleeping in invalid context during sock_map_delete_elem path #6127
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: avoid sleeping in invalid context during sock_map_delete_elem path #6127
Conversation
|
Upstream branch: 39e9d5f |
06bf66d to
4b3a35b
Compare
|
Upstream branch: 39e9d5f |
b9ec0b8 to
4b2d0db
Compare
4b3a35b to
ec7437a
Compare
|
Upstream branch: 48a97ff |
4b2d0db to
9a3d3fb
Compare
ec7437a to
fa9b89f
Compare
|
Upstream branch: 27aab47 |
9a3d3fb to
c650e59
Compare
fa9b89f to
631bcf6
Compare
|
Upstream branch: 48a97ff |
c650e59 to
963fba3
Compare
631bcf6 to
db45b16
Compare
|
Upstream branch: 48a97ff |
963fba3 to
c5a1685
Compare
db45b16 to
cf0c057
Compare
|
Upstream branch: 48a97ff |
The syzkaller report exposed a BUG: “sleeping function called from
invalid context” in sock_map_delete_elem, which happens when
`bpf_test_timer_enter()` disables preemption but the delete path later
invokes a sleeping function while still in that context. Specifically:
- The crash trace shows `bpf_test_timer_enter()` acquiring a
preempt_disable path (via t->mode == NO_PREEMPT), but the symmetric
release path always calls migrate_enable(), mismatching the earlier
disable.
- As a result, preemption remains disabled across the
sock_map_delete_elem path, leading to a sleeping call under an invalid
context. :contentReference[oaicite:0]{index=0}
To fix this, normalize the disable/enable pairing: always use
migrate_disable()/migrate_enable() regardless of t->mode. This ensures
that we never remain with preemption disabled unintentionally when
entering the delete path, and avoids invalid-context sleeping.
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=1f1fbecb9413cdbfbef8
Suggested-by: Yonghong Song <[email protected]>
Suggested-by: Menglong Dong <[email protected]>
Co-authored-by: Sahil Chandna <[email protected]>
Signed-off-by: Brahmajit Das <[email protected]>
c5a1685 to
d046209
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1010865 expired. Closing PR. |
Pull request for series with
subject: bpf: avoid sleeping in invalid context during sock_map_delete_elem path
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1010865