[syzbot] [fs?] WARNING in stashed_dentry_prune

24 views
Skip to first unread message

syzbot

unread,
Mar 13, 2024, 6:23:27ā€ÆAMMar 13
to bra...@kernel.org, ja...@suse.cz, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, vi...@zeniv.linux.org.uk
Hello,

syzbot found the following issue on:

HEAD commit: 0f1a876682f0 Merge tag 'vfs-6.9.uuid' of git://git.kernel...
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1541d101180000
kernel config: https://syzkaller.appspot.com/x/.config?x=f0300fe4d5cae610
dashboard link: https://syzkaller.appspot.com/bug?extid=9b5ec5ccf7234cc6cb86
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1484d70a180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=116b38d1180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9de3cd01214c/disk-0f1a8766.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/af661293680e/vmlinux-0f1a8766.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a439df6ad20e/bzImage-0f1a8766.xz

The issue was bisected to:

commit 2558e3b23112adb82a558bab616890a790a38bc6
Author: Christian Brauner <bra...@kernel.org>
Date: Wed Feb 21 08:59:51 2024 +0000

libfs: add stashed_dentry_prune()

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=108e578e180000
final oops: https://syzkaller.appspot.com/x/report.txt?x=128e578e180000
console output: https://syzkaller.appspot.com/x/log.txt?x=148e578e180000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9b5ec5...@syzkaller.appspotmail.com
Fixes: 2558e3b23112 ("libfs: add stashed_dentry_prune()")

WARNING: CPU: 0 PID: 5112 at fs/libfs.c:2117 stashed_dentry_prune+0x97/0xa0 fs/libfs.c:2117
Modules linked in:
CPU: 0 PID: 5112 Comm: syz-executor244 Not tainted 6.8.0-syzkaller-00295-g0f1a876682f0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
RIP: 0010:stashed_dentry_prune+0x97/0xa0 fs/libfs.c:2117
Code: 00 00 e8 3c cc e2 ff 31 c9 4c 89 f0 f0 49 0f b1 0f eb 05 e8 cb ac 80 ff 5b 41 5c 41 5e 41 5f c3 cc cc cc cc e8 ba ac 80 ff 90 <0f> 0b 90 eb e9 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc90003a97b88 EFLAGS: 00010293

RAX: ffffffff8212ba76 RBX: ffff88807e1bbe58 RCX: ffff8880786a0000
RDX: 0000000000000000 RSI: 0000000000000010 RDI: ffff88807e1bbd60
RBP: 0000000000000001 R08: ffffffff820ce514 R09: 1ffff1100fc377bf
R10: dffffc0000000000 R11: ffffffff8212b9e0 R12: dffffc0000000000
R13: dffffc0000000000 R14: ffff88807e1bbd60 R15: 0000000000000000
FS: 00007fbd2c2fc6c0(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fbd2c2dbd58 CR3: 0000000075822000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__dentry_kill+0xa9/0x630 fs/dcache.c:594
dput+0x19f/0x2b0 fs/dcache.c:845
prepare_anon_dentry fs/libfs.c:2018 [inline]
path_from_stashed+0x695/0xb00 fs/libfs.c:2094
pidfs_alloc_file+0x136/0x210 fs/pidfs.c:248
__pidfd_prepare kernel/fork.c:2027 [inline]
pidfd_prepare+0x7c/0x130 kernel/fork.c:2075
pidfd_create kernel/pid.c:614 [inline]
__do_sys_pidfd_open kernel/pid.c:650 [inline]
__se_sys_pidfd_open+0xe4/0x280 kernel/pid.c:635
do_syscall_64+0xf9/0x240
entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7fbd2c35c7d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fbd2c2fc208 EFLAGS: 00000246 ORIG_RAX: 00000000000001b2
RAX: ffffffffffffffda RBX: 00007fbd2c3e63d8 RCX: 00007fbd2c35c7d9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000000013f0
RBP: 00007fbd2c3e63d0 R08: 00007fbd2c2fbfa7 R09: 0000000000000032
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbd2c3b317c
R13: 00007fbd2c2fc210 R14: 0000000000000001 R15: 00007fbd2c3b301d
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Edward Adam Davis

unread,
Mar 13, 2024, 8:30:43ā€ÆAMMar 13
to syzbot+9b5ec5...@syzkaller.appspotmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
please test w in stashed_dentry_prune

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

diff --git a/fs/libfs.c b/fs/libfs.c
index 0d14ae808fcf..67dc503272eb 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -2013,6 +2013,8 @@ static struct dentry *prepare_anon_dentry(struct dentry **stashed,
if (!dentry)
return ERR_PTR(-ENOMEM);

+ /* Store address of location where dentry's supposed to be stashed. */
+ dentry->d_fsdata = stashed;
inode = new_inode_pseudo(sb);
if (!inode) {
dput(dentry);
@@ -2029,9 +2031,6 @@ static struct dentry *prepare_anon_dentry(struct dentry **stashed,
WARN_ON_ONCE(!S_ISREG(inode->i_mode));
WARN_ON_ONCE(!IS_IMMUTABLE(inode));

- /* Store address of location where dentry's supposed to be stashed. */
- dentry->d_fsdata = stashed;
-
/* @data is now owned by the fs */
d_instantiate(dentry, inode);
return dentry;

Hillf Danton

unread,
Mar 13, 2024, 8:42:23ā€ÆAMMar 13
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Wed, 13 Mar 2024 03:23:25 -0700
> syzbot found the following issue on:
>
> HEAD commit: 0f1a876682f0 Merge tag 'vfs-6.9.uuid' of git://git.kernel...
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=116b38d1180000
--- x/fs/libfs.c
+++ y/fs/libfs.c
@@ -2012,6 +2012,8 @@ static struct dentry *prepare_anon_dentr
dentry = d_alloc_anon(sb);
if (!dentry)
return ERR_PTR(-ENOMEM);
+ /* Store address of location where dentry's supposed to be stashed. */
+ dentry->d_fsdata = stashed;

inode = new_inode_pseudo(sb);
if (!inode) {
@@ -2029,9 +2031,6 @@ static struct dentry *prepare_anon_dentr
WARN_ON_ONCE(!S_ISREG(inode->i_mode));
WARN_ON_ONCE(!IS_IMMUTABLE(inode));

- /* Store address of location where dentry's supposed to be stashed. */
- dentry->d_fsdata = stashed;
-
/* @data is now owned by the fs */
d_instantiate(dentry, inode);
return dentry;
--

syzbot

unread,
Mar 13, 2024, 8:55:08ā€ÆAMMar 13
to ead...@qq.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+9b5ec5...@syzkaller.appspotmail.com

Tested on:

commit: b0546776 Merge tag 'printk-for-6.9' of git://git.kerne..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=1507ceb6180000
kernel config: https://syzkaller.appspot.com/x/.config?x=6fb1be60a193d440
dashboard link: https://syzkaller.appspot.com/bug?extid=9b5ec5ccf7234cc6cb86
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=136276d6180000

Note: testing is done by a robot and is best-effort only.

Edward Adam Davis

unread,
Mar 13, 2024, 9:07:21ā€ÆAMMar 13
to syzbot+9b5ec5...@syzkaller.appspotmail.com, bra...@kernel.org, ja...@suse.cz, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, vi...@zeniv.linux.org.uk
Initialize d_fsdata in advance to avoid warnings when recycling dentry due to
inode allocation failures.

Fixes: 2558e3b23112 ("libfs: add stashed_dentry_prune()")
Reported-and-tested-by: syzbot+9b5ec5...@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <ead...@qq.com>
---
fs/libfs.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/libfs.c b/fs/libfs.c
index 0d14ae808fcf..67dc503272eb 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -2013,6 +2013,8 @@ static struct dentry *prepare_anon_dentry(struct dentry **stashed,
if (!dentry)
return ERR_PTR(-ENOMEM);

+ /* Store address of location where dentry's supposed to be stashed. */
+ dentry->d_fsdata = stashed;
inode = new_inode_pseudo(sb);
if (!inode) {
dput(dentry);
@@ -2029,9 +2031,6 @@ static struct dentry *prepare_anon_dentry(struct dentry **stashed,
WARN_ON_ONCE(!S_ISREG(inode->i_mode));
WARN_ON_ONCE(!IS_IMMUTABLE(inode));

- /* Store address of location where dentry's supposed to be stashed. */
- dentry->d_fsdata = stashed;
-
/* @data is now owned by the fs */
d_instantiate(dentry, inode);
return dentry;
--
2.43.0

syzbot

unread,
Mar 13, 2024, 9:20:06ā€ÆAMMar 13
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+9b5ec5...@syzkaller.appspotmail.com

Tested on:

commit: b0546776 Merge tag 'printk-for-6.9' of git://git.kerne..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=17c7b951180000
kernel config: https://syzkaller.appspot.com/x/.config?x=6fb1be60a193d440
dashboard link: https://syzkaller.appspot.com/bug?extid=9b5ec5ccf7234cc6cb86
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=108c8dae180000

Christian Brauner

unread,
Mar 14, 2024, 6:49:50ā€ÆAMMar 14
to syzbot, ja...@suse.cz, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, vi...@zeniv.linux.org.uk
On Wed, Mar 13, 2024 at 03:23:25AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 0f1a876682f0 Merge tag 'vfs-6.9.uuid' of git://git.kernel...
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1541d101180000
> kernel config: https://syzkaller.appspot.com/x/.config?x=f0300fe4d5cae610
> dashboard link: https://syzkaller.appspot.com/bug?extid=9b5ec5ccf7234cc6cb86
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1484d70a180000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=116b38d1180000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/9de3cd01214c/disk-0f1a8766.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/af661293680e/vmlinux-0f1a8766.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/a439df6ad20e/bzImage-0f1a8766.xz

#syz fix: pidfs: remove config option

syzbot

unread,
Mar 14, 2024, 6:57:31ā€ÆAMMar 14
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: Re: [syzbot] [fs?] WARNING in stashed_dentry_prune
Author: bra...@kernel.org

On Wed, Mar 13, 2024 at 03:23:25AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 0f1a876682f0 Merge tag 'vfs-6.9.uuid' of git://git.kernel...
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1541d101180000
> kernel config: https://syzkaller.appspot.com/x/.config?x=f0300fe4d5cae610
> dashboard link: https://syzkaller.appspot.com/bug?extid=9b5ec5ccf7234cc6cb86
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1484d70a180000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=116b38d1180000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/9de3cd01214c/disk-0f1a8766.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/af661293680e/vmlinux-0f1a8766.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/a439df6ad20e/bzImage-0f1a8766.xz

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 9d9539db8638cfe053fcd1f441746f0e2c8c2d32

Christian Brauner

unread,
Mar 14, 2024, 7:03:02ā€ÆAMMar 14
to Edward Adam Davis, syzbot+9b5ec5...@syzkaller.appspotmail.com, ja...@suse.cz, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, vi...@zeniv.linux.org.uk
Thanks for the patch. However, this is already fixed upstream already.

syzbot

unread,
Mar 14, 2024, 2:48:05ā€ÆPMMar 14
to bra...@kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+9b5ec5...@syzkaller.appspotmail.com

Tested on:

commit: 9d9539db pidfs: remove config option
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=163fc311180000
kernel config: https://syzkaller.appspot.com/x/.config?x=3d8d7e8531ce5633
dashboard link: https://syzkaller.appspot.com/bug?extid=9b5ec5ccf7234cc6cb86
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Note: no patches were applied.
Reply all
Reply to author
Forward
0 new messages