perf/bpf: Fix data race in __perf_event_overflow - #8705
Open
kernel-patches-daemon-bpf-rc[bot] wants to merge 1 commit into
Open
perf/bpf: Fix data race in __perf_event_overflow#8705kernel-patches-daemon-bpf-rc[bot] wants to merge 1 commit into
kernel-patches-daemon-bpf-rc[bot] wants to merge 1 commit into
Conversation
Author
|
Upstream branch: 07cb86a |
Author
|
Upstream branch: 07cb86a |
kernel-patches-daemon-bpf-rc
Bot
force-pushed
the
series/1144381=>bpf-next
branch
from
August 12, 2026 00:21
3fcb3d2 to
fa8d223
Compare
perf_event_detach_bpf_prog() writes event->prog = NULL under bpf_event_mutex, while __perf_event_overflow() reads event->prog concurrently without any lock protection. This causes a data race detected by KCSAN. __perf_event_overflow() can be called from interrupt/NMI context, so it cannot acquire bpf_event_mutex. Fix the race by using WRITE_ONCE() in perf_event_detach_bpf_prog() and READ_ONCE() in __perf_event_overflow(). Also store the result of READ_ONCE() in a local variable to avoid reading event->prog twice which could result in a NULL pointer dereference if the pointer becomes NULL between the two reads. Reported-by: syzbot+651d2774bd1d8395595f@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=651d2774bd1d8395595f Fixes: f11f10b ("perf/bpf: Call BPF handler directly, not through overflow machinery") Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com> Reported-by: syzbot+651d2774bd1d8395595f@syzkaller.appspotmail.com Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com> Signed-off-by: appear twice. Also, the second Reported-by: is placed
Author
|
Upstream branch: 07cb86a |
kernel-patches-daemon-bpf-rc
Bot
force-pushed
the
series/1144381=>bpf-next
branch
from
August 12, 2026 01:13
fa8d223 to
4efdba4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: perf/bpf: Fix data race in __perf_event_overflow
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1144381