From nobody Fri Apr 17 10:34:52 2026 Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C1722D5436 for ; Sat, 21 Feb 2026 06:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771656122; cv=none; b=qHlq4e36q4zxL5uIZNgYv/CTyp+1yccYenivoRfsm87jz+QNDUPRFitdUjVsbrDrNx2uigOqzilLnHA2SAR0DDVYip1hrQvk5q+os3omnWmP0fM05GDuWYG+7XPbwZ0Df6eDHOghXfTiB3bwIQzTWGQeP4Ag9Eg9kb1XzTLpQXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771656122; c=relaxed/simple; bh=Vbsel4K8y3MXgIkUPFcnh0i9BIGQe6aJpbPT48yaY74=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=q2WwJz9yQx+7W9BkXkvOx8PeFsYWqLIYiIaG0eww4g9GqVQCuKlKMA/frVBKOX8Ghl2tGyCLC/wxR48o02lHi9mEo/pUY5FpKbT8pdUYl001qV17hYgf59nH2WU9nH1UxQaSXO03Nc0oly22Nr+U8dH4texzv8lTKigymH0xdAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f69.google.com with SMTP id 006d021491bc7-67999893008so16944877eaf.2 for ; Fri, 20 Feb 2026 22:42:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771656120; x=1772260920; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QiMYJqB5EZ5BX/3MRIFTD7WJd3Q+qpzhG4HiT7wTzWk=; b=QFEYNFthZejBC2PNxB3qnnFYqjcdRJV6LLS0vKIXLTeRNwPtaDSsMEhBCdOKqQLTuX BQEtUYedI/YBiKvHftlOsCiGDAqjmKsfkcQjN/TYhcQgnS6tY1dILIdbR5hedAootBhi bZ2c/wctTGKVh+7/BWSN5vd7VFjcJEvqY4qjMwrIHTh6fSCNHP2zMWdPtPQfm26JKt2F mKnnxdt7jjXJyKODvMdo193WQWVSINvt3ziTJysNwGbT+k0clCCt8+PtUCl3mVsQbjkS Jj2UQm5Wih69poC0gOxycXw/VcIdh8WEVyX51IQZ6knqtMwObmvg7qaxVUbc5lOEyvNB nzbg== X-Gm-Message-State: AOJu0YyWpQ0WYgpjgBixsceB0Ssc5Ews/duNfYZvEzxbErFrDVi5u4kv yMJEy9sBpZWrKRRe8WP8TRNBC6lRaaLJo4/NnDZKbTvuvogb+DDWVg+MVt7N7cYbrd5LS1Z4ija 857Qg1o57OMevNjPPDN71rsPUTSxkQzrKfyI3xuB6O/9H7LHdtFxfiVKHrbI= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a4a:e909:0:b0:679:92dc:5e11 with SMTP id 006d021491bc7-679c44d031amr1034642eaf.45.1771656120036; Fri, 20 Feb 2026 22:42:00 -0800 (PST) Date: Fri, 20 Feb 2026 22:42:00 -0800 In-Reply-To: <699938a6.a70a0220.2c38d7.0150.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <699953b8.a70a0220.2c38d7.0155.GAE@google.com> Subject: Forwarded: [PATCH] bpf: Fix use-after-free in bpf_raw_tp_link_release From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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_release Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master When a BPF raw tracepoint link is released, bpf_raw_tp_link_release() calls bpf_probe_unregister(), which internally calls tracepoint_probe_unregister(). This function performs an RCU-deferred swap of the tracepoint's funcs array via call_rcu(), so that existing readers can finish observing the old array before it is replaced. However, the subsequent call_rcu() in bpf_link_put_direct() that invokes bpf_raw_tp_link_dealloc() can complete concurrently with the tracepoint's internal grace period. When this happens, kfree(raw_tp) runs while RCU readers can still reach the link via the old funcs array, causing a use-after-free in __bpf_trace_run() when it dereferences link->link.prog. Fix this by calling synchronize_rcu() after bpf_probe_unregister() in bpf_raw_tp_link_release(). This ensures all pre-existing readers that may still be executing __bpf_trace_run() with a pointer to this link have finished before we return. The subsequent call_rcu() for dealloc will then fire only after the link is truly unreachable, making the kfree() safe. Reported-by: syzbot+59701a78e84b0bccfe1b@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D59701a78e84b0bccfe1b Signed-off-by: Deepanshu Kartikey --- kernel/bpf/syscall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index dd89bf809772..e636a2022e54 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); =20 bpf_probe_unregister(raw_tp->btp, raw_tp); + synchronize_rcu(); bpf_put_raw_tracepoint(raw_tp->btp); } =20 --=20 2.43.0