kernel BUG in do_qc
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: e0797d3b91de Merge tag 'fs_for_v6.16-rc1' of git://git.ker.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=15906482580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d8dc7eba91909b25 dashboard link: https://syzkaller.appspot.com/bug?extid=bad65435361712796381 compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9c217b1391c8/disk-e0797d3b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/610d0945fbb8/vmlinux-e0797d3b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/873bcc0b4e15/bzImage-e0797d3b.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
gfs2: fsid=syz:syz.0: fatal assertion failed
------------[ cut here ]------------ kernel BUG at fs/gfs2/quota.c:320! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 1 UID: 0 PID: 15470 Comm: syz.7.1727 Not tainted 6.15.0-syzkaller-08297-ge0797d3b91de #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 RIP: 0010:__qd_hold fs/gfs2/quota.c:320 [inline] RIP: 0010:do_qc+0x5c1/0x5e0 fs/gfs2/quota.c:705 Code: 00 00 00 00 00 fc ff df 48 8b 0c 24 80 3c 01 00 74 0a 48 8b 7c 24 10 e8 ed ac 2d fe 48 8b 44 24 10 48 8b 38 e8 00 9a 34 fd 90 <0f> 0b e8 38 8f ca fd 48 8b 7c 24 10 e8 ee 99 34 fd 90 0f 0b 66 66 RSP: 0018:ffffc90004897870 EFLAGS: 00010246 RAX: 000000000000002c RBX: 1ffff1100fcd880e RCX: 6b8263604adfeb00 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffffffffffffffff R08: ffffc90004897547 R09: 1ffff92000912ea8 R10: dffffc0000000000 R11: fffff52000912ea9 R12: ffff88807e6c4000 R13: ffff88807e6c4070 R14: ffff88807e6c4090 R15: 0000000000000000 FS: 00005555633cd500(0000) GS:ffff888125d64000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f1ec997ed38 CR3: 000000005be83000 CR4: 0000000000350ef0 Call Trace: <TASK> gfs2_quota_change+0x394/0x800 fs/gfs2/quota.c:1304 gfs2_free_di+0x2db/0x3f0 fs/gfs2/rgrp.c:2592 gfs2_dinode_dealloc+0x30d/0x3e0 fs/gfs2/inode.c:497 evict_unlinked_inode fs/gfs2/super.c:1332 [inline] gfs2_evict_inode+0xe0b/0x1000 fs/gfs2/super.c:1429 evict+0x504/0x9c0 fs/inode.c:810 __dentry_kill+0x209/0x660 fs/dcache.c:669 dput+0x19f/0x2b0 fs/dcache.c:911 __fput+0x68e/0xa70 fs/file_table.c:473 task_work_run+0x1d4/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xec/0x110 kernel/entry/common.c:114 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline] do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff80c58e969 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffdc7ba0008 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 000000000015531b RCX: 00007ff80c58e969 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007ff80c7b7ba0 R08: 0000000000000001 R09: 0000000dc7ba02ff R10: 00007ff80c400000 R11: 0000000000000246 R12: 00007ff80c7b5fac R13: 00007ff80c7b5fa0 R14: ffffffffffffffff R15: 00007ffdc7ba0120 </TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:__qd_hold fs/gfs2/quota.c:320 [inline] RIP: 0010:do_qc+0x5c1/0x5e0 fs/gfs2/quota.c:705 Code: 00 00 00 00 00 fc ff df 48 8b 0c 24 80 3c 01 00 74 0a 48 8b 7c 24 10 e8 ed ac 2d fe 48 8b 44 24 10 48 8b 38 e8 00 9a 34 fd 90 <0f> 0b e8 38 8f ca fd 48 8b 7c 24 10 e8 ee 99 34 fd 90 0f 0b 66 66 RSP: 0018:ffffc90004897870 EFLAGS: 00010246 RAX: 000000000000002c RBX: 1ffff1100fcd880e RCX: 6b8263604adfeb00 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffffffffffffffff R08: ffffc90004897547 R09: 1ffff92000912ea8 R10: dffffc0000000000 R11: fffff52000912ea9 R12: ffff88807e6c4000 R13: ffff88807e6c4070 R14: ffff88807e6c4090 R15: 0000000000000000 FS: 00005555633cd500(0000) GS:ffff888125d64000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f1ec997ed38 CR3: 000000005be83000 CR4: 0000000000350ef0
---
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 report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
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
syzbot
syzbotsyzbot has found a reproducer for the following issue on:
syzbot has found a reproducer for the following issue on:
HEAD commit: eacf91b0c78a Merge tag 'fbdev-for-6.17-rc1' of git://git.k.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=162a3834580000 kernel config: https://syzkaller.appspot.com/x/.config?x=bbdefbf39cb79f7e dashboard link: https://syzkaller.appspot.com/bug?extid=bad65435361712796381 compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10c03cf0580000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=112a3834580000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-eacf91b0.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/51416a3bb992/vmlinux-eacf91b0.xz
kernel image: https://storage.googleapis.com/syzbot-assets/aa2684a00ab0/bzImage-eacf91b0.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/d4ede27f2613/mount_1.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=151c7f82580000)
IMPORTANT: if you fix the issue, please add the following tag to the commit:
gfs2: fsid=syz:syz.0: first mount done, others may mount
gfs2: fsid=syz:syz.0: found 1 quota changes
gfs2: fsid=syz:syz.0: fatal assertion failed
------------[ cut here ]------------ kernel BUG at fs/gfs2/quota.c:320! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 0 UID: 0 PID: 5780 Comm: syz.0.38 Not tainted 6.16.0-syzkaller-11129-geacf91b0c78a #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:__qd_hold fs/gfs2/quota.c:320 [inline] RIP: 0010:do_qc+0x5c1/0x5e0 fs/gfs2/quota.c:705 Code: 00 00 00 00 00 fc ff df 48 8b 0c 24 80 3c 01 00 74 0a 48 8b 7c 24 10 e8 bd fd 28 fe 48 8b 44 24 10 48 8b 38 e8 70 e2 2e fd 90 <0f> 0b e8 f8 2b c4 fd 48 8b 7c 24 10 e8 5e e2 2e fd 90 0f 0b 66 66 RSP: 0018:ffffc9000d68f348 EFLAGS: 00010246 RAX: 000000000000002c RBX: 1ffff1100860680e RCX: 05e99f5eed550400 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: 0000000000000001 R08: ffffc9000d68f067 R09: 1ffff92001ad1e0c R10: dffffc0000000000 R11: fffff52001ad1e0d R12: ffff888043034000 R13: ffff888043034070 R14: ffff888043034090 R15: 0000000000000000 FS: 00007faa59d406c0(0000) GS:ffff88808d21f000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fb33a2f7000 CR3: 000000003f713000 CR4: 0000000000352ef0 Call Trace: <TASK> gfs2_quota_change+0x394/0x800 fs/gfs2/quota.c:1304 gfs2_alloc_blocks+0x18bc/0x2080 fs/gfs2/rgrp.c:2494 alloc_dinode+0x258/0x550 fs/gfs2/inode.c:422 gfs2_create_inode+0xbbc/0x1560 fs/gfs2/inode.c:807 gfs2_atomic_open+0xd2/0x220 fs/gfs2/inode.c:1395 atomic_open fs/namei.c:3568 [inline] lookup_open fs/namei.c:3679 [inline] open_last_lookups fs/namei.c:3807 [inline] path_openat+0xf63/0x3830 fs/namei.c:4043 do_filp_open+0x1fa/0x410 fs/namei.c:4073 do_sys_openat2+0x121/0x1c0 fs/open.c:1435 do_sys_open fs/open.c:1450 [inline] __do_sys_openat fs/open.c:1466 [inline] __se_sys_openat fs/open.c:1461 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1461 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7faa58f8eb69 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007faa59d40038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007faa591b5fa0 RCX: 00007faa58f8eb69 RDX: 0000000000105042 RSI: 0000200000000080 RDI: ffffffffffffff9c RBP: 00007faa59011df1 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007faa591b5fa0 R15: 00007ffdf5ca1658 </TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:__qd_hold fs/gfs2/quota.c:320 [inline] RIP: 0010:do_qc+0x5c1/0x5e0 fs/gfs2/quota.c:705 Code: 00 00 00 00 00 fc ff df 48 8b 0c 24 80 3c 01 00 74 0a 48 8b 7c 24 10 e8 bd fd 28 fe 48 8b 44 24 10 48 8b 38 e8 70 e2 2e fd 90 <0f> 0b e8 f8 2b c4 fd 48 8b 7c 24 10 e8 5e e2 2e fd 90 0f 0b 66 66 RSP: 0018:ffffc9000d68f348 EFLAGS: 00010246 RAX: 000000000000002c RBX: 1ffff1100860680e RCX: 05e99f5eed550400 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: 0000000000000001 R08: ffffc9000d68f067 R09: 1ffff92001ad1e0c R10: dffffc0000000000 R11: fffff52001ad1e0d R12: ffff888043034000 R13: ffff888043034070 R14: ffff888043034090 R15: 0000000000000000 FS: 00007faa59d406c0(0000) GS:ffff88808d21f000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fb33a2f7000 CR3: 000000003f713000 CR4: 0000000000352ef0
---
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.
PATCH 1/1 gfs2: Fix refcount of quota data restored at mount
In reply to syzbotgfs2_quota_init() resets the lockref count to 0 despite setting QDF_CHANGE, which owns a reference released by do_qc(). Quota syncing can therefore consume a concurrent user's reference, leaving the count at 0 and triggering the assertion in __qd_hold().
Keep the initial reference from qd_alloc(). During cleanup, clear the in-memory change and slot state and drop the QDF_CHANGE reference for objects with no other references. Leave the on-disk quota change records untouched for recovery on the next mount.
---
If QDF_CHANGE remains set at teardown, a concurrent sysfs quota_refresh can make cleanup skip a restored object during remount-ro or unmount. The last external put then leaves the QDF_CHANGE reference behind, whereas before this patch it could dispose of the object with the journal shut down. Feedback on handling this reference safely would be appreciated.
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
fs/gfs2/quota.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/gfs2/quota.c +6 -1
@@ -1470,7 +1470,6 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)if (qd ==NULL ) goto fail_brelse; - qd->qd_lockref.count =0 ;set_bit (QDF_CHANGE , &qd->qd_flags); qd->qd_change = qc_change; qd->qd_slot = slot;
@@ -1542,6 +1541,12 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)spin_lock (&qd_lock);list_for_each_entry (qd, &sdp->sd_quota_list, qd_list) {spin_lock (&qd->qd_lockref.lock); +if (qd->qd_lockref.count ==1 && +test_and_clear_bit (QDF_CHANGE , &qd->qd_flags)) { + qd->qd_change =0 ; + qd->qd_slot_ref =0 ; + qd->qd_lockref.count =0 ; + }if (qd->qd_lockref.count !=0 ) {spin_unlock (&qd->qd_lockref.lock);continue ;
Signature · 1 line
2.43.7
syzbot
syzbotsyzbot has tested the proposed patch but the reproducer is still triggering an issue: lost connection to test machine
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
lost connection to test machine
Tested on:
commit: 05441d69 Merge tag 'cocci-7.4-rc1' of git://git.kernel.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=1554a055580000 kernel config: https://syzkaller.appspot.com/x/.config?x=e29ebf56758bec63 dashboard link: https://syzkaller.appspot.com/bug?extid=bad65435361712796381 compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8 patch: https://syzkaller.appspot.com/x/patch.diff?x=17f4b2dd580000