From: syzbot <syzbot+59701a78e84b0bccfe1b@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] bpf: Fix use-after-free in bpf_raw_tp_link on tracepoint unregistration
Date: Sat, 21 Feb 2026 04:07:08 -0800 [thread overview]
Message-ID: <69999fec.050a0220.340abe.0d26.GAE@google.com> (raw)
In-Reply-To: <699938a6.a70a0220.2c38d7.0150.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] bpf: Fix use-after-free in bpf_raw_tp_link on tracepoint unregistration
Author: kartikey406@gmail.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
A slab-use-after-free is reported by KASAN in __bpf_trace_run /
bpf_trace_run2 when a BPF raw tracepoint link is being torn down
while the tracepoint is concurrently firing on another CPU.
The tracepoint invocation path protects its read side with SRCU
(srcu_read_lock_fast_notrace(&tracepoint_srcu)), but when a BPF raw
tracepoint link is released, bpf_link_free() defers the kfree of the
bpf_raw_tp_link via call_rcu(), which only waits for a regular RCU
grace period. Since regular RCU and SRCU are independent
synchronization domains, call_rcu() does not wait for in-flight SRCU
readers. This means the bpf_raw_tp_link can be freed while a
tracepoint callback is still accessing it, leading to a
use-after-free.
Fix this by calling tracepoint_synchronize_unregister() after
bpf_probe_unregister() in bpf_raw_tp_link_release(). This function
calls synchronize_srcu(&tracepoint_srcu), ensuring all in-flight
tracepoint callbacks have completed before the link enters the
RCU-deferred free path in bpf_link_free().
Reported-by: syzbot+59701a78e84b0bccfe1b@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=59701a78e84b0bccfe1b
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
kernel/bpf/syscall.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index dd89bf809772..af6d435dd500 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -3782,6 +3782,7 @@ static void bpf_raw_tp_link_release(struct bpf_link *link)
container_of(link, struct bpf_raw_tp_link, link);
bpf_probe_unregister(raw_tp->btp, raw_tp);
+ tracepoint_synchronize_unregister();
bpf_put_raw_tracepoint(raw_tp->btp);
}
--
2.43.0
next prev parent reply other threads:[~2026-02-21 12:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-21 4:46 [syzbot] [trace?] [bpf?] KASAN: slab-use-after-free Read in bpf_trace_run2 (3) syzbot
2026-02-21 5:19 ` Forwarded: [PATCH] bpf: Fix use-after-free in bpf_raw_tp_link_dealloc syzbot
2026-02-21 5:41 ` syzbot
2026-02-21 6:42 ` Forwarded: [PATCH] bpf: Fix use-after-free in bpf_raw_tp_link_release syzbot
2026-02-21 10:45 ` syzbot
2026-02-21 12:07 ` syzbot [this message]
2026-02-21 23:34 ` Forwarded: [PATCH] bpf: Fix use-after-free in bpf_raw_tp_link on tracepoint unregistration syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69999fec.050a0220.340abe.0d26.GAE@google.com \
--to=syzbot+59701a78e84b0bccfe1b@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox