public inbox for gfs2@lists.linux.dev
 help / color / mirror / Atom feed
* [syzbot] [gfs2?] kernel BUG in gfs2_quota_cleanup (3)
@ 2025-11-27 17:40 syzbot
  2025-11-29 10:11 ` shaurya
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2025-11-27 17:40 UTC (permalink / raw)
  To: agruenba, gfs2, linux-kernel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    d724c6f85e80 Add linux-next specific files for 20251121
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=109dce92580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=68d11c703cf8e4a0
dashboard link: https://syzkaller.appspot.com/bug?extid=af4d53576692f8956fd6
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=178c797c580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11b03612580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/0ccfc806f65a/disk-d724c6f8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c2ec31ffb05e/vmlinux-d724c6f8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c25d9c0c1917/bzImage-d724c6f8.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/a4debf5b02b8/mount_1.gz
  fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=10814612580000)

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+af4d53576692f8956fd6@syzkaller.appspotmail.com

RBP: 00002000000003c0 R08: 00007fff7a4b9a50 R09: 000000000126a4b5
R10: 000000000126a4b5 R11: 0000000000000246 R12: 0000200000000340
R13: 00007fff7a4b9a10 R14: 0000000000000000 R15: 0000200000004140
 </TASK>
gfs2: fsid=syz:syz.0: about to withdraw this file system
------------[ cut here ]------------
kernel BUG at fs/gfs2/quota.c:1520!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 6305 Comm: syz.2.77 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
RIP: 0010:gfs2_quota_cleanup+0x6ee/0x6f0 fs/gfs2/quota.c:1519
Code: ff 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c c2 fd ff ff 4c 89 f7 e8 82 79 21 fe e9 b5 fd ff ff e8 58 d4 54 07 e8 a3 dd ba fd 90 <0f> 0b 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 40 d6
RSP: 0018:ffffc9000493fa40 EFLAGS: 00010293
RAX: ffffffff8406fbcd RBX: 0000000000000002 RCX: ffff88801e703d00
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000000
RBP: ffffc9000493fb50 R08: ffff88807aa440af R09: 1ffff1100f548815
R10: dffffc0000000000 R11: ffffed100f548816 R12: 1ffff92000927f4c
R13: ffff88802fe9d000 R14: dffffc0000000000 R15: 0000000000000000
FS:  000055557fefd500(0000) GS:ffff888125fba000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555573bca808 CR3: 0000000075f56000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 gfs2_make_fs_ro+0x27a/0x300 fs/gfs2/super.c:566
 gfs2_reconfigure+0x6a3/0xb20 fs/gfs2/ops_fstype.c:1594
 reconfigure_super+0x227/0x890 fs/super.c:1077
 do_remount fs/namespace.c:3286 [inline]
 path_mount+0xd29/0xff0 fs/namespace.c:4036
 do_mount fs/namespace.c:4057 [inline]
 __do_sys_mount fs/namespace.c:4246 [inline]
 __se_sys_mount+0x313/0x410 fs/namespace.c:4223
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9ca3d90eea
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff7a4b99c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fff7a4b9a50 RCX: 00007f9ca3d90eea
RDX: 00002000000003c0 RSI: 0000200000000340 RDI: 0000000000000000
RBP: 00002000000003c0 R08: 00007fff7a4b9a50 R09: 000000000126a4b5
R10: 000000000126a4b5 R11: 0000000000000246 R12: 0000200000000340
R13: 00007fff7a4b9a10 R14: 0000000000000000 R15: 0000200000004140
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:gfs2_quota_cleanup+0x6ee/0x6f0 fs/gfs2/quota.c:1519
Code: ff 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c c2 fd ff ff 4c 89 f7 e8 82 79 21 fe e9 b5 fd ff ff e8 58 d4 54 07 e8 a3 dd ba fd 90 <0f> 0b 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 40 d6
RSP: 0018:ffffc9000493fa40 EFLAGS: 00010293
RAX: ffffffff8406fbcd RBX: 0000000000000002 RCX: ffff88801e703d00
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000000
RBP: ffffc9000493fb50 R08: ffff88807aa440af R09: 1ffff1100f548815
R10: dffffc0000000000 R11: ffffed100f548816 R12: 1ffff92000927f4c
R13: ffff88802fe9d000 R14: dffffc0000000000 R15: 0000000000000000
FS:  000055557fefd500(0000) GS:ffff888125eba000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8a64ae2000 CR3: 0000000075f56000 CR4: 00000000003526f0


---
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 syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] [gfs2?] kernel BUG in gfs2_quota_cleanup (3)
  2025-11-27 17:40 [syzbot] [gfs2?] kernel BUG in gfs2_quota_cleanup (3) syzbot
@ 2025-11-29 10:11 ` shaurya
  2025-11-29 12:06   ` syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: shaurya @ 2025-11-29 10:11 UTC (permalink / raw)
  To: syzbot+af4d53576692f8956fd6; +Cc: agruenba, gfs2, linux-kernel, syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]

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

[-- Attachment #2: 0001-gfs2-allow-quota-cleanup-when-filesystem-is-withdraw.patch --]
[-- Type: text/x-patch, Size: 1937 bytes --]

From cb1658e55b1727dcb662f7cb9f287adf46bfe917 Mon Sep 17 00:00:00 2001
From: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
Date: Sat, 29 Nov 2025 15:38:18 +0530
Subject: [PATCH] gfs2: allow quota cleanup when filesystem is withdrawing

gfs2_quota_cleanup() triggers a kernel BUG when called while the
journal is still marked live, SDF_NORECOVERY is not set, and the
filesystem is in the process of withdrawing. This can occur during
filesystem reconfigure operations when a withdraw is triggered
during gfs2_make_fs_ro().

The withdraw process clears SDF_JOURNAL_LIVE in signal_our_withdraw(),
but there's a race window where gfs2_quota_cleanup() can be reached
before this happens during the gfs2_make_fs_ro() -> gfs2_quota_cleanup()
call path.

Add a check for gfs2_withdrawing_or_withdrawn() to the BUG_ON condition
to allow quota cleanup to proceed safely during a withdraw. This is
safe because:
1. The withdraw process handles cleanup gracefully
2. gfs2_quota_cleanup() already skips entries with active references
3. The function waits for references to drain via wait_event_timeout()

Reported-by: syzbot+af4d53576692f8956fd6@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=af4d53576692f8956fd6
Fixes: 71733b492200 ("gfs2: fix kernel BUG in gfs2_quota_cleanup")

Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
---
 fs/gfs2/quota.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 2298e06797ac..4ae07c6cee98 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1517,7 +1517,8 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
 	int count;
 
 	BUG_ON(!test_bit(SDF_NORECOVERY, &sdp->sd_flags) &&
-		test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags));
+	       !gfs2_withdrawing_or_withdrawn(sdp) &&
+	       test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags));
 
 	spin_lock(&qd_lock);
 	list_for_each_entry(qd, &sdp->sd_quota_list, qd_list) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [syzbot] [gfs2?] kernel BUG in gfs2_quota_cleanup (3)
  2025-11-29 10:11 ` shaurya
@ 2025-11-29 12:06   ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2025-11-29 12:06 UTC (permalink / raw)
  To: agruenba, gfs2, linux-kernel, ssranevjti, syzkaller-bugs

Hello,

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

Reported-by: syzbot+af4d53576692f8956fd6@syzkaller.appspotmail.com
Tested-by: syzbot+af4d53576692f8956fd6@syzkaller.appspotmail.com

Tested on:

commit:         19eef1d9 afs: Fix uninit var in afs_alloc_anon_key()
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15f84112580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=682ece70733db9af
dashboard link: https://syzkaller.appspot.com/bug?extid=af4d53576692f8956fd6
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15678112580000

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-29 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-27 17:40 [syzbot] [gfs2?] kernel BUG in gfs2_quota_cleanup (3) syzbot
2025-11-29 10:11 ` shaurya
2025-11-29 12:06   ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox