2023-10-10 18:19:13

by syzbot

[permalink] [raw]
Subject: [syzbot] [gfs2?] WARNING: suspicious RCU usage in gfs2_permission

Hello,

syzbot found the following issue on:

HEAD commit: 7d730f1bf6f3 Add linux-next specific files for 20231005
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11dd3679680000
kernel config: https://syzkaller.appspot.com/x/.config?x=f532286be4fff4b5
dashboard link: https://syzkaller.appspot.com/bug?extid=3e5130844b0c0e2b4948
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1d7f28a4398f/disk-7d730f1b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d454d124268e/vmlinux-7d730f1b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/dbca966175cb/bzImage-7d730f1b.xz

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

gfs2: fsid=syz:syz: Now mounting FS (format 1801)...
gfs2: fsid=syz:syz.0: journal 0 mapped with 14 extents in 0ms
gfs2: fsid=syz:syz.0: first mount done, others may mount
=============================
WARNING: suspicious RCU usage
6.6.0-rc4-next-20231005-syzkaller #0 Not tainted
-----------------------------
fs/gfs2/inode.c:1876 suspicious rcu_dereference_check() usage!

other info that might help us debug this:


rcu_scheduler_active = 2, debug_locks = 1
no locks held by syz-executor.5/5216.

stack backtrace:
CPU: 1 PID: 5216 Comm: syz-executor.5 Not tainted 6.6.0-rc4-next-20231005-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x125/0x1b0 lib/dump_stack.c:106
lockdep_rcu_suspicious+0x20c/0x3b0 kernel/locking/lockdep.c:6711
gfs2_permission+0x3f9/0x4c0 fs/gfs2/inode.c:1876
do_inode_permission fs/namei.c:461 [inline]
inode_permission fs/namei.c:528 [inline]
inode_permission+0x384/0x5e0 fs/namei.c:503
may_open+0x11c/0x400 fs/namei.c:3248
do_open fs/namei.c:3618 [inline]
path_openat+0x17aa/0x2ce0 fs/namei.c:3777
do_filp_open+0x1de/0x430 fs/namei.c:3807
do_sys_openat2+0x176/0x1e0 fs/open.c:1422
do_sys_open fs/open.c:1437 [inline]
__do_sys_openat fs/open.c:1453 [inline]
__se_sys_openat fs/open.c:1448 [inline]
__x64_sys_openat+0x175/0x210 fs/open.c:1448
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f916187b6e0
Code: 48 89 44 24 20 75 93 44 89 54 24 0c e8 09 82 02 00 44 8b 54 24 0c 89 da 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 38 44 89 c7 89 44 24 0c e8 5c 82 02 00 8b 44
RSP: 002b:00007f916262ce70 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000010000 RCX: 00007f916187b6e0
RDX: 0000000000010000 RSI: 0000000020000140 RDI: 00000000ffffff9c
RBP: 0000000020000140 R08: 0000000000000000 R09: 0000000000000c19
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000020000140
R13: 00007f916262cf40 R14: 00000000000126ad R15: 00000000200129c0
</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.

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

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

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

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


2023-10-18 14:28:21

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [gfs2?] WARNING: suspicious RCU usage in gfs2_permission

syzbot has found a reproducer for the following issue on:

HEAD commit: 2dac75696c6d Add linux-next specific files for 20231018
git tree: linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=13af5fe5680000
kernel config: https://syzkaller.appspot.com/x/.config?x=6f8545e1ef7a2b66
dashboard link: https://syzkaller.appspot.com/bug?extid=3e5130844b0c0e2b4948
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=101c8d09680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11a07475680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2375f16ed327/disk-2dac7569.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c80aee6e2e6c/vmlinux-2dac7569.xz
kernel image: https://storage.googleapis.com/syzbot-assets/664dc23b738d/bzImage-2dac7569.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/5ce278ef6f36/mount_0.gz

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

gfs2: fsid=syz:syz.0: first mount done, others may mount
=============================
WARNING: suspicious RCU usage
6.6.0-rc6-next-20231018-syzkaller #0 Not tainted
-----------------------------
fs/gfs2/inode.c:1877 suspicious rcu_dereference_check() usage!

other info that might help us debug this:


rcu_scheduler_active = 2, debug_locks = 1
no locks held by syz-executor120/5052.

stack backtrace:
CPU: 1 PID: 5052 Comm: syz-executor120 Not tainted 6.6.0-rc6-next-20231018-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x125/0x1b0 lib/dump_stack.c:106
lockdep_rcu_suspicious+0x20c/0x3b0 kernel/locking/lockdep.c:6711
gfs2_permission+0x3f9/0x4c0 fs/gfs2/inode.c:1877
do_inode_permission fs/namei.c:462 [inline]
inode_permission fs/namei.c:529 [inline]
inode_permission+0x384/0x5e0 fs/namei.c:504
may_open+0x11c/0x400 fs/namei.c:3249
do_open fs/namei.c:3619 [inline]
path_openat+0x17aa/0x2ce0 fs/namei.c:3778
do_filp_open+0x1de/0x430 fs/namei.c:3808
do_sys_openat2+0x176/0x1e0 fs/open.c:1440
do_sys_open fs/open.c:1455 [inline]
__do_sys_openat fs/open.c:1471 [inline]
__se_sys_openat fs/open.c:1466 [inline]
__x64_sys_openat+0x175/0x210 fs/open.c:1466
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f5b23a31a11
Code: 75 57 89 f0 25 00 00 41 00 3d 00 00 41 00 74 49 80 3d 7a 06 0b 00 00 74 6d 89 da 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 93 00 00 00 48 8b 54 24 28 64 48 2b 14 25
RSP: 002b:00007ffe9ecd33a0 EFLAGS: 00000202 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000010000 RCX: 00007f5b23a31a11
RDX: 0000000000010000 RSI: 0000000020037f80 RDI: 00000000ffffff9c
RBP: 0000000020037f80 R08: 00007ffe9ecd3470 R09: 0000000000037f13
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
R13: 00007ffe9ecd3470 R14: 0000000000000003 R15: 0000000001000000
</TASK>


---
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.

2023-10-20 07:11:19

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [gfs2?] WARNING: suspicious RCU usage in gfs2_permission

syzbot has bisected this issue to:

commit 0abd1557e21c617bd13fc18f7725fc6363c05913
Author: Al Viro <[email protected]>
Date: Mon Oct 2 02:33:44 2023 +0000

gfs2: fix an oops in gfs2_permission

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=10b21c33680000
start commit: 2dac75696c6d Add linux-next specific files for 20231018
git tree: linux-next
final oops: https://syzkaller.appspot.com/x/report.txt?x=12b21c33680000
console output: https://syzkaller.appspot.com/x/log.txt?x=14b21c33680000
kernel config: https://syzkaller.appspot.com/x/.config?x=6f8545e1ef7a2b66
dashboard link: https://syzkaller.appspot.com/bug?extid=3e5130844b0c0e2b4948
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=101c8d09680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11a07475680000

Reported-by: [email protected]
Fixes: 0abd1557e21c ("gfs2: fix an oops in gfs2_permission")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

2023-10-25 03:22:18

by Al Viro

[permalink] [raw]
Subject: Re: [syzbot] [gfs2?] WARNING: suspicious RCU usage in gfs2_permission

On Fri, Oct 20, 2023 at 12:10:38AM -0700, syzbot wrote:
> syzbot has bisected this issue to:
>
> commit 0abd1557e21c617bd13fc18f7725fc6363c05913
> Author: Al Viro <[email protected]>
> Date: Mon Oct 2 02:33:44 2023 +0000
>
> gfs2: fix an oops in gfs2_permission
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=10b21c33680000
> start commit: 2dac75696c6d Add linux-next specific files for 20231018
> git tree: linux-next
> final oops: https://syzkaller.appspot.com/x/report.txt?x=12b21c33680000
> console output: https://syzkaller.appspot.com/x/log.txt?x=14b21c33680000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6f8545e1ef7a2b66
> dashboard link: https://syzkaller.appspot.com/bug?extid=3e5130844b0c0e2b4948
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=101c8d09680000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11a07475680000
>
> Reported-by: [email protected]
> Fixes: 0abd1557e21c ("gfs2: fix an oops in gfs2_permission")
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Complaints about rcu_dereference() outside of rcu_read_lock().

We could replace that line with
if (mask & MAY_NOT_BLOCK)
gl = rcu_dereference(ip->i_gl);
else
gl = ip->i_gl;
or by any equivalent way to tell lockdep it ought to STFU.
BTW, the amount of rcu_dereference_protected(..., true) is somewhat depressing...

Probably need to turn
ip->i_gl = NULL;
in the end of gfs2_evict_inode() into rcu_assign_pointer(ip->i_gl, NULL);
and transpose it with the previous line -
gfs2_glock_put_eventually(ip->i_gl);

I don't think it really matters in this case, though - destruction of the object
it used to point to is delayed in all cases. Matter of taste (and lockdep
false positives)...

2023-10-30 21:06:11

by Andreas Gruenbacher

[permalink] [raw]
Subject: Re: [syzbot] [gfs2?] WARNING: suspicious RCU usage in gfs2_permission

Al,

On Wed, Oct 25, 2023 at 5:29 AM Al Viro <[email protected]> wrote:
> On Fri, Oct 20, 2023 at 12:10:38AM -0700, syzbot wrote:
> > syzbot has bisected this issue to:
> >
> > commit 0abd1557e21c617bd13fc18f7725fc6363c05913
> > Author: Al Viro <[email protected]>
> > Date: Mon Oct 2 02:33:44 2023 +0000
> >
> > gfs2: fix an oops in gfs2_permission
> >
> > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=10b21c33680000
> > start commit: 2dac75696c6d Add linux-next specific files for 20231018
> > git tree: linux-next
> > final oops: https://syzkaller.appspot.com/x/report.txt?x=12b21c33680000
> > console output: https://syzkaller.appspot.com/x/log.txt?x=14b21c33680000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=6f8545e1ef7a2b66
> > dashboard link: https://syzkaller.appspot.com/bug?extid=3e5130844b0c0e2b4948
> > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=101c8d09680000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11a07475680000
> >
> > Reported-by: [email protected]
> > Fixes: 0abd1557e21c ("gfs2: fix an oops in gfs2_permission")
> >
> > For information about bisection process see: https://goo.gl/tpsmEJ#bisection
>
> Complaints about rcu_dereference() outside of rcu_read_lock().
>
> We could replace that line with
> if (mask & MAY_NOT_BLOCK)
> gl = rcu_dereference(ip->i_gl);
> else
> gl = ip->i_gl;
> or by any equivalent way to tell lockdep it ought to STFU.

the following should do then, right?

gl = rcu_dereference_check(ip->i_gl, !(mask & MAY_NOT_BLOCK));

> BTW, the amount of rcu_dereference_protected(..., true) is somewhat depressing...
>
> Probably need to turn
> ip->i_gl = NULL;
> in the end of gfs2_evict_inode() into rcu_assign_pointer(ip->i_gl, NULL);

That's what commit 0abd1557e21c6 does already so there's nothing to fix, right?

> and transpose it with the previous line -
> gfs2_glock_put_eventually(ip->i_gl);
>
> I don't think it really matters in this case, though - destruction of the object
> it used to point to is delayed in all cases. Matter of taste (and lockdep
> false positives)...

I don't understand. What would lockdep complain about here?

Thanks,
Andreas