Commit 99ba2b5
bpf: sockhash, disallow bpf_tcp_close and update in parallel
After latest lock updates there is no longer anything preventing a
close and recvmsg call running in parallel. Additionally, we can
race update with close if we close a socket and simultaneously update
if via the BPF userspace API (note the cgroup ops are already run
with sock_lock held).
To resolve this take sock_lock in close and update paths.
Reported-by: syzbot+b680e42077a0d7c9a0c4@syzkaller.appspotmail.com
Fixes: e9db4ef ("bpf: sockhash fix omitted bucket lock in sock_close")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>1 parent 0c6bc6e commit 99ba2b5
2 files changed
+18
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
318 | 319 | | |
| 320 | + | |
319 | 321 | | |
320 | 322 | | |
321 | 323 | | |
| |||
371 | 373 | | |
372 | 374 | | |
373 | 375 | | |
| 376 | + | |
374 | 377 | | |
375 | 378 | | |
376 | 379 | | |
| |||
2069 | 2072 | | |
2070 | 2073 | | |
2071 | 2074 | | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
2072 | 2078 | | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
2073 | 2082 | | |
2074 | 2083 | | |
2075 | 2084 | | |
| |||
2410 | 2419 | | |
2411 | 2420 | | |
2412 | 2421 | | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
2413 | 2425 | | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
2414 | 2429 | | |
2415 | 2430 | | |
2416 | 2431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
735 | 735 | | |
736 | 736 | | |
737 | 737 | | |
738 | | - | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
739 | 741 | | |
740 | 742 | | |
741 | 743 | | |
| |||
0 commit comments