bpf: Fix mmap_lock leak in irq_work path - #13040
bpf: Fix mmap_lock leak in irq_work path#13040kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Conversation
|
Upstream branch: fdec474 |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
|
Forwarding comment 5127711825 via email |
cb64c09 to
64657ea
Compare
|
Upstream branch: 2659f94 |
1be4c68 to
10a093f
Compare
64657ea to
e5a6c05
Compare
|
Upstream branch: 863f3dd |
10a093f to
d21f5e4
Compare
e5a6c05 to
7d50b4c
Compare
|
Upstream branch: f0e80de |
d21f5e4 to
e543362
Compare
8722dea to
76c9e44
Compare
|
Upstream branch: f0e80de |
e543362 to
3687ba8
Compare
68fd498 to
a5a131e
Compare
|
Upstream branch: f0e80de |
3687ba8 to
8de6e34
Compare
0ea3224 to
d60d0b1
Compare
|
Upstream branch: f0e80de |
8de6e34 to
d714503
Compare
d60d0b1 to
60b5e07
Compare
|
Upstream branch: 682b1c1 |
d714503 to
b166e15
Compare
60b5e07 to
656ccb8
Compare
|
Upstream branch: 28e911d |
stack_map_get_build_id_offset() introduced a per-CPU irq_work to defer mmap_read_unlock() from NMI context, and bpf_find_vma() later reused the same mmap_unlock_work. Both callers only check whether the work is busy before taking mmap_lock, so a nested caller can reuse the slot before the first caller queues it. Two read locks may then be acquired while only one deferred unlock runs, leaking a read lock and blocking exit_mmap(). Reserve the per-CPU slot before mmap_read_trylock(). Use the same wrapper in stackmap and bpf_find_vma() so both callers release the reservation on trylock failure. Release it after the irq_work callback unlocks the mm. Fixes: bae77c5 ("bpf: enable stackmap with build_id in nmi context") Reported-by: syzbot+cdd6c0925e12b0af60cc@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=cdd6c0925e12b0af60cc Reported-by: sashiko-bot@kernel.org Closes: https://lore.kernel.org/r/20260630033745.B80201F000E9@smtp.kernel.org Tested-by: Sun Jian <sun.jian.kdev@gmail.com> Reviewed-by: Puranjay Mohan <puranjay@kernel.org> Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev> Signed-off-by: Sanghyun Park <sanghyun.park.cnu@gmail.com>
b166e15 to
86a95da
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1137112 expired. Closing PR. |
Pull request for series with
subject: bpf: Fix mmap_lock leak in irq_work path
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1137112