From nobody Mon Jun 8 09:48:08 2026 Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.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 ED5871F4634 for ; Sat, 30 May 2026 00:40:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780101658; cv=none; b=qNWW4lTH2J1TPCwkRFFoKE1QCgnsecq+9hXg9r7SbzCCpXj0fSw3Ov5TZwSDIx2HsQu4oUmhUxwzetH5rpkNz+hNE/Tc8FkJasWsnGXCLTDSE0pDy65Qrhwo5FskRYvvUJn5TeJvB2NUKJwtifmRG5sujn11sm8shsmpx6YyM+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780101658; c=relaxed/simple; bh=5BN0tGV79cCi6an9T26eypf8c70FY27jyeDlpJLk3+w=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=bloF76buTFWbEg5riE7RVvDWuuCrM3kus7UPtKRunnwDxOFrDOgsI/u/Ja4b9muAd0xWiEv2YyUP+vNqdyip4tT+SF3fG4bYYHQuXKCwngqZwuSsIfHzaTfvl9Pq5IoMx6gR2fx2qB2bYNaBD0lrDmGDkL1VETO0HlIUkx0Y3V0= 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.210.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-ot1-f69.google.com with SMTP id 46e09a7af769-7e606551a79so8432872a34.3 for ; Fri, 29 May 2026 17:40:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780101656; x=1780706456; 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=YvZfTb7YV1teUF3mzd6U7r53dAST5WH8+KlbmZYEUy0=; b=QeGodu0zrH6Scf5Zp22kKiu/aOte2yXohDQk4hEinxqPtGVUOEmp/cQB0LDNCU3HmM 9LW/s8mW4xf4/HQv59uHMNyVFA46id34ssZ3sX2w4LYimER0cUkqk6x+me8fCJbf6r/O 1qjoqFt/o+FgV40N1WManzGhq76fmMNm7BPwEb5js3XllGtx6t0DaUPt3zZPj5q4xUYP vvPRTaL+OIWgvL2CqA667sYj2RbbYDhDdU/V/x4Ly1AbKhmSUNh+LuxP6NjUpk/B+Q4e NxBQcTJdIejCgcyH42Vb5yL8ATntBf8cOefG0puDhOODqC2Bb1aWNDU/od9DOpQSQ5Rz hujw== X-Gm-Message-State: AOJu0YxKlzwqPdjG0MFviPcQWP9tQXL3mPtFlupeNnO7RjXqwcnxgEk8 Fj3gVvCCdo0lk5Klq9LrLiiFxfrkMDWHI5cieFTY/wlNcW8KPOmS3GX1DtszpxGxpquIdH1o9EL v2Kv4ATAMTyEt/tuBXwa/yH4Buq6i9sd2AsJXiHF7YOtGSfHPp4ux4tMQqfY= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:4c08:b0:69e:5d9:7e4a with SMTP id 006d021491bc7-69e103cb04cmr828744eaf.49.1780101655936; Fri, 29 May 2026 17:40:55 -0700 (PDT) Date: Fri, 29 May 2026 17:40:55 -0700 In-Reply-To: <6a19f098.abb04025.19af7b.0004.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a1a3217.abb04025.19af7b.0005.GAE@google.com> Subject: Forwarded: [PATCH] bpf: defer bpffs symlink inode freeing until RCU grace period 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: defer bpffs symlink inode freeing until RCU grace per= iod Author: hongao@uniontech.com #syz test bpffs currently frees inodes directly from ->destroy_inode(). This can race with RCU path walk following a bpffs symlink: a lookup reader may still hold an unstable inode pointer while unlink frees the inode memory, leading to a KASAN use-after-free in security_inode_follow_link(). Keep BPF object reference dropping in ->destroy_inode(), where sleeping cleanup is allowed, but move symlink target and inode memory freeing to ->free_inode() so VFS releases them after an RCU grace period. Fixes: 4f375ade6aa9 ("bpf: Avoid RCU context warning when unpinning htab wi= th internal structs") Reported-by: syzbot+0962e3a1af6d5e26a52c@syzkaller.appspotmail.com Signed-off-by: hongao --- kernel/bpf/inode.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c index 25c06a011825..a1e9660f9237 100644 --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c @@ -766,10 +766,14 @@ static void bpf_destroy_inode(struct inode *inode) { enum bpf_type type; =20 - if (S_ISLNK(inode->i_mode)) - kfree(inode->i_link); if (!bpf_inode_type(inode, &type)) bpf_any_put(inode->i_private, type); +} + +static void bpf_free_inode(struct inode *inode) +{ + if (S_ISLNK(inode->i_mode)) + kfree(inode->i_link); free_inode_nonrcu(inode); } =20 @@ -778,6 +782,7 @@ const struct super_operations bpf_super_ops =3D { .drop_inode =3D inode_just_drop, .show_options =3D bpf_show_options, .destroy_inode =3D bpf_destroy_inode, + .free_inode =3D bpf_free_inode, }; =20 enum { --=20 2.51.0