2022-06-06 17:32:20

by syzbot

[permalink] [raw]
Subject: [syzbot] WARNING in register_shrinker_prepared

Hello,

syzbot found the following issue on:

HEAD commit: 1cfd968b58a1 Add linux-next specific files for 20220603
git tree: linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=12f7b6b3f00000
kernel config: https://syzkaller.appspot.com/x/.config?x=7da8386e3742814f
dashboard link: https://syzkaller.appspot.com/bug?extid=300d27c79fe6d4cbcc39
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=103e5177f00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13545057f00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

loop0: detected capacity change from 0 to 20
------------[ cut here ]------------
WARNING: CPU: 0 PID: 3694 at mm/vmscan.c:681 register_shrinker_prepared+0x119/0x150 mm/vmscan.c:681
Modules linked in:
CPU: 0 PID: 3694 Comm: syz-executor250 Not tainted 5.18.0-next-20220603-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:register_shrinker_prepared+0x119/0x150 mm/vmscan.c:681
Code: ff 89 c5 89 c6 e8 87 18 d1 ff 85 ed 75 17 e8 2e 1c d1 ff 5b 48 c7 c7 60 dd e7 8b 5d 41 5c 41 5d e9 6c d2 b3 ff e8 17 1c d1 ff <0f> 0b eb e0 e8 5e f7 1d 00 eb be 4c 89 e7 e8 e4 f7 1d 00 eb 81 e8
RSP: 0018:ffffc900030c7c80 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
RDX: ffff8880238eba80 RSI: ffffffff81a965c9 RDI: 0000000000000005
RBP: 00000000fffffff4 R08: 0000000000000005 R09: 0000000000000000
R10: 00000000fffffff4 R11: 0000000000000001 R12: ffff88807ebca7a0
R13: ffff8880770347a0 R14: ffffffff8c50df80 R15: ffff888011c82c00
FS: 000055555733f300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007effd0fd11d0 CR3: 00000000203c8000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
sget+0x472/0x580 fs/super.c:631
mount_bdev+0xf8/0x450 fs/super.c:1342
legacy_get_tree+0x105/0x220 fs/fs_context.c:610
vfs_get_tree+0x89/0x2f0 fs/super.c:1501
do_new_mount fs/namespace.c:3040 [inline]
path_mount+0x1320/0x1fa0 fs/namespace.c:3370
do_mount fs/namespace.c:3383 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount fs/namespace.c:3568 [inline]
__x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7effd0ff93fa
Code: 48 c7 c2 c0 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 a8 00 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffce9034038 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffce9034090 RCX: 00007effd0ff93fa
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffce9034050
RBP: 00007ffce9034050 R08: 00007ffce9034090 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000020000218
R13: 0000000000000004 R14: 0000000000000005 R15: 0000000000000001
</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 [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches


2022-06-07 00:56:31

by Roman Gushchin

[permalink] [raw]
Subject: Re: [syzbot] WARNING in register_shrinker_prepared

On Mon, Jun 06, 2022 at 02:34:36PM -0700, Eric Biggers wrote:
> On Mon, Jun 06, 2022 at 12:23:02PM -0700, Andrew Morton wrote:
> > (cc Roman)
> >
> > On Mon, 06 Jun 2022 10:17:34 -0700 syzbot <[email protected]> wrote:
> >
> > > Hello,
> > >
> > > syzbot found the following issue on:
> > >
> > > HEAD commit: 1cfd968b58a1 Add linux-next specific files for 20220603
> > > git tree: linux-next
> > > console+strace: https://syzkaller.appspot.com/x/log.txt?x=12f7b6b3f00000
> > > kernel config: https://syzkaller.appspot.com/x/.config?x=7da8386e3742814f
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=300d27c79fe6d4cbcc39
> > > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=103e5177f00000
> > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13545057f00000
> > >
> > > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > > Reported-by: [email protected]
> > >
> > > loop0: detected capacity change from 0 to 20
> > > ------------[ cut here ]------------
> > > WARNING: CPU: 0 PID: 3694 at mm/vmscan.c:681 register_shrinker_prepared+0x119/0x150 mm/vmscan.c:681
> >
> > That's
> >
> > WARN_ON_ONCE(shrinker_debugfs_add(shrinker));
> >
> > I assume that debugfs_create_dir() failed. Please see the NOTE: in
> > that function's kerneldoc.
> >
>
> The call to ida_alloc() can fail too.
>
> register_shrinker_prepared() is not allowed to fail; anything that can fail must
> happen in prealloc_shrinker(). So either this new debugfs registration code
> needs to be moved to prealloc_shrinker(), or errors from it need to be ignored
> (which might be appropriate since it is just debugfs).

I don't think we want to panic or fail to mount filesystems because of it,
so I agree, ignoring is the best option.

2022-06-07 02:31:02

by Eric Biggers

[permalink] [raw]
Subject: Re: [syzbot] WARNING in register_shrinker_prepared

On Mon, Jun 06, 2022 at 12:23:02PM -0700, Andrew Morton wrote:
> (cc Roman)
>
> On Mon, 06 Jun 2022 10:17:34 -0700 syzbot <[email protected]> wrote:
>
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: 1cfd968b58a1 Add linux-next specific files for 20220603
> > git tree: linux-next
> > console+strace: https://syzkaller.appspot.com/x/log.txt?x=12f7b6b3f00000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=7da8386e3742814f
> > dashboard link: https://syzkaller.appspot.com/bug?extid=300d27c79fe6d4cbcc39
> > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=103e5177f00000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13545057f00000
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: [email protected]
> >
> > loop0: detected capacity change from 0 to 20
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 3694 at mm/vmscan.c:681 register_shrinker_prepared+0x119/0x150 mm/vmscan.c:681
>
> That's
>
> WARN_ON_ONCE(shrinker_debugfs_add(shrinker));
>
> I assume that debugfs_create_dir() failed. Please see the NOTE: in
> that function's kerneldoc.
>

The call to ida_alloc() can fail too.

register_shrinker_prepared() is not allowed to fail; anything that can fail must
happen in prealloc_shrinker(). So either this new debugfs registration code
needs to be moved to prealloc_shrinker(), or errors from it need to be ignored
(which might be appropriate since it is just debugfs).

- Eric

2022-06-07 02:55:09

by Andrew Morton

[permalink] [raw]
Subject: Re: [syzbot] WARNING in register_shrinker_prepared

(cc Roman)

On Mon, 06 Jun 2022 10:17:34 -0700 syzbot <[email protected]> wrote:

> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 1cfd968b58a1 Add linux-next specific files for 20220603
> git tree: linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=12f7b6b3f00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=7da8386e3742814f
> dashboard link: https://syzkaller.appspot.com/bug?extid=300d27c79fe6d4cbcc39
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=103e5177f00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13545057f00000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: [email protected]
>
> loop0: detected capacity change from 0 to 20
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 3694 at mm/vmscan.c:681 register_shrinker_prepared+0x119/0x150 mm/vmscan.c:681

That's

WARN_ON_ONCE(shrinker_debugfs_add(shrinker));

I assume that debugfs_create_dir() failed. Please see the NOTE: in
that function's kerneldoc.


2022-06-07 17:37:43

by Roman Gushchin

[permalink] [raw]
Subject: Re: [syzbot] WARNING in register_shrinker_prepared

On Mon, Jun 06, 2022 at 12:23:02PM -0700, Andrew Morton wrote:
> (cc Roman)
>
> On Mon, 06 Jun 2022 10:17:34 -0700 syzbot <[email protected]> wrote:
>
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: 1cfd968b58a1 Add linux-next specific files for 20220603
> > git tree: linux-next
> > console+strace: https://syzkaller.appspot.com/x/log.txt?x=12f7b6b3f00000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=7da8386e3742814f
> > dashboard link: https://syzkaller.appspot.com/bug?extid=300d27c79fe6d4cbcc39
> > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=103e5177f00000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13545057f00000
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: [email protected]
> >
> > loop0: detected capacity change from 0 to 20
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 3694 at mm/vmscan.c:681 register_shrinker_prepared+0x119/0x150 mm/vmscan.c:681
>
> That's
>
> WARN_ON_ONCE(shrinker_debugfs_add(shrinker));
>
> I assume that debugfs_create_dir() failed. Please see the NOTE: in
> that function's kerneldoc.


I agree and we really need to just ignore it.

If it happens because shrinker_debugfs is not initialized yet, there will be
a second chance. Otherwise we can't do much anyway.

Thank you!

--

diff --git a/mm/vmscan.c b/mm/vmscan.c
index fd8a472b6501..ab885561d3e5 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -682,7 +682,7 @@ void register_shrinker_prepared(struct shrinker *shrinker)
down_write(&shrinker_rwsem);
list_add_tail(&shrinker->list, &shrinker_list);
shrinker->flags |= SHRINKER_REGISTERED;
- WARN_ON_ONCE(shrinker_debugfs_add(shrinker));
+ shrinker_debugfs_add(shrinker);
up_write(&shrinker_rwsem);
}