[v6.1] KASAN: use-after-free Read in gfs2_quotad

6 views
Skip to first unread message

syzbot

unread,
Apr 13, 2025, 2:37:24 PM4/13/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 420102835862 Linux 6.1.134
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=143740cc580000
kernel config: https://syzkaller.appspot.com/x/.config?x=febe6f728099e2de
dashboard link: https://syzkaller.appspot.com/bug?extid=cc1fa5bf93b04933f5db
compiler: Debian clang version 15.0.6, 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/e3e9df5cb900/disk-42010283.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/256b543066fd/vmlinux-42010283.xz
kernel image: https://storage.googleapis.com/syzbot-assets/030db118e6aa/bzImage-42010283.xz

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

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x77/0x1f80 kernel/locking/lockdep.c:4919
Read of size 8 at addr ffff88807782cbb0 by task gfs2_quotad/6202

CPU: 0 PID: 6202 Comm: gfs2_quotad Not tainted 6.1.134-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:427
kasan_report+0x136/0x160 mm/kasan/report.c:531
__lock_acquire+0x77/0x1f80 kernel/locking/lockdep.c:4919
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
finish_wait+0xc4/0x1e0 kernel/sched/wait.c:410
gfs2_quotad+0x4e8/0x670 fs/gfs2/quota.c:1579
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>

Allocated by task 6391:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:563 [inline]
kzalloc include/linux/slab.h:699 [inline]
fat_fill_super+0x112/0x4d60 fs/fat/inode.c:1625
mount_bdev+0x2c9/0x3f0 fs/super.c:1443
legacy_get_tree+0xeb/0x180 fs/fs_context.c:632
vfs_get_tree+0x88/0x270 fs/super.c:1573
do_new_mount+0x2ba/0xb40 fs/namespace.c:3056
do_mount fs/namespace.c:3399 [inline]
__do_sys_mount fs/namespace.c:3607 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3584
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 4251:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
rcu_do_batch kernel/rcu/tree.c:2297 [inline]
rcu_core+0xade/0x1820 kernel/rcu/tree.c:2557
handle_softirqs+0x2ee/0xa40 kernel/softirq.c:578
__do_softirq kernel/softirq.c:612 [inline]
invoke_softirq kernel/softirq.c:452 [inline]
__irq_exit_rcu+0x157/0x240 kernel/softirq.c:661
irq_exit_rcu+0x5/0x20 kernel/softirq.c:673
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1118 [inline]
sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1118
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:691

Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
call_rcu+0x163/0xa10 kernel/rcu/tree.c:2845
generic_shutdown_super+0x130/0x340 fs/super.c:501
kill_block_super+0x7a/0xe0 fs/super.c:1470
deactivate_locked_super+0xa0/0x110 fs/super.c:332
cleanup_mnt+0x490/0x520 fs/namespace.c:1186
task_work_run+0x246/0x300 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:177
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88807782c000
which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 2992 bytes inside of
8192-byte region [ffff88807782c000, ffff88807782e000)

The buggy address belongs to the physical page:
page:ffffea0001de0a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x77828
head:ffffea0001de0a00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000799e00 dead000000000002 ffff888017c42280
raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3917, tgid 3917 (dhcpcd), ts 184358388551, free_ts 179588921578
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2532
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4328
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5606
alloc_slab_page+0x6a/0x150 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x84/0x2d0 mm/slub.c:1992
___slab_alloc+0xc20/0x1270 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:935 [inline]
__kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:956
kmalloc_reserve net/core/skbuff.c:446 [inline]
__alloc_skb+0x12a/0x2c0 net/core/skbuff.c:515
alloc_skb include/linux/skbuff.h:1271 [inline]
netlink_dump+0x1f5/0xc80 net/netlink/af_netlink.c:2185
__netlink_dump_start+0x529/0x6d0 net/netlink/af_netlink.c:2320
netlink_dump_start include/linux/netlink.h:269 [inline]
rtnetlink_rcv_msg+0xd56/0x1000 net/core/rtnetlink.c:6109
netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2493
netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
netlink_unicast+0x7e2/0x970 net/netlink/af_netlink.c:1337
netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1859
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
__sys_sendto+0x480/0x600 net/socket.c:2153
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1459 [inline]
free_pcp_prepare mm/page_alloc.c:1509 [inline]
free_unref_page_prepare+0x12a6/0x15b0 mm/page_alloc.c:3384
free_unref_page+0x33/0x3e0 mm/page_alloc.c:3479
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
slab_alloc mm/slub.c:3406 [inline]
__kmem_cache_alloc_lru mm/slub.c:3413 [inline]
kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422
getname_flags+0xb8/0x4f0 fs/namei.c:139
vfs_fstatat fs/stat.c:266 [inline]
__do_sys_newfstatat fs/stat.c:437 [inline]
__se_sys_newfstatat fs/stat.c:431 [inline]
__x64_sys_newfstatat+0x130/0x1e0 fs/stat.c:431
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
ffff88807782ca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807782cb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807782cb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807782cc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807782cc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


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

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

unread,
May 13, 2025, 3:13:26 AM5/13/25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 02b72ccb5f9d Linux 6.1.138
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14cf0f68580000
kernel config: https://syzkaller.appspot.com/x/.config?x=40498c8aeab367b8
dashboard link: https://syzkaller.appspot.com/bug?extid=cc1fa5bf93b04933f5db
compiler: Debian clang version 20.1.2 (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97), Debian LLD 20.1.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13ef7670580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14f38af4580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/741917d96f57/disk-02b72ccb.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b5e0c69249ae/vmlinux-02b72ccb.xz
kernel image: https://storage.googleapis.com/syzbot-assets/06bfb546fb37/bzImage-02b72ccb.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/fd82ee317020/mount_2.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=15ef7670580000)

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

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0xf7/0x7c50 kernel/locking/lockdep.c:4919
Read of size 8 at addr ffff8880267c0bb0 by task gfs2_quotad/4518

CPU: 0 PID: 4518 Comm: gfs2_quotad Not tainted 6.1.138-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0xa8/0x220 mm/kasan/report.c:427
kasan_report+0x10b/0x140 mm/kasan/report.c:531
__lock_acquire+0xf7/0x7c50 kernel/locking/lockdep.c:4919
lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xa4/0xf0 kernel/locking/spinlock.c:162
finish_wait+0xb8/0x1d0 kernel/sched/wait.c:410
gfs2_quotad+0x4e6/0x670 fs/gfs2/quota.c:1579
kthread+0x29d/0x330 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>

Allocated by task 4507:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x8e/0xa0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:563 [inline]
kzalloc include/linux/slab.h:699 [inline]
init_sbd fs/gfs2/ops_fstype.c:77 [inline]
gfs2_fill_super+0x117/0x1f80 fs/gfs2/ops_fstype.c:1148
get_tree_bdev+0x3f1/0x610 fs/super.c:1366
gfs2_get_tree+0x4d/0x1e0 fs/gfs2/ops_fstype.c:1327
vfs_get_tree+0x88/0x270 fs/super.c:1573
do_new_mount+0x24a/0xa40 fs/namespace.c:3057
do_mount fs/namespace.c:3400 [inline]
__do_sys_mount fs/namespace.c:3608 [inline]
__se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3585
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 4252:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x2d/0x50 mm/kasan/generic.c:516
____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook+0x131/0x1a0 mm/slub.c:1750
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0xb6/0x1f0 mm/slub.c:3674
generic_shutdown_super+0x130/0x340 fs/super.c:501
kill_block_super+0x7c/0xe0 fs/super.c:1470
deactivate_locked_super+0x93/0xf0 fs/super.c:332
cleanup_mnt+0x463/0x4f0 fs/namespace.c:1186
task_work_run+0x1ca/0x250 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff8880267c0000
which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 2992 bytes inside of
8192-byte region [ffff8880267c0000, ffff8880267c2000)

The buggy address belongs to the physical page:
page:ffffea000099f000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x267c0
head:ffffea000099f000 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001eb6800 dead000000000005 ffff888017442280
raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3994, tgid 3994 (S50crond), ts 38353682617, free_ts 38343913764
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328
__alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5606
alloc_slab_page+0x5d/0x160 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x87/0x2c0 mm/slub.c:1992
___slab_alloc+0xbc6/0x1220 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x1a0/0x260 mm/slub.c:3437
kmalloc_trace+0x26/0xe0 mm/slab_common.c:1026
kmalloc include/linux/slab.h:563 [inline]
kzalloc include/linux/slab.h:699 [inline]
tomoyo_print_bprm security/tomoyo/audit.c:26 [inline]
tomoyo_init_log+0x1081/0x1f50 security/tomoyo/audit.c:264
tomoyo_supervisor+0x326/0x10b0 security/tomoyo/common.c:2088
tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline]
tomoyo_env_perm+0x146/0x1e0 security/tomoyo/environ.c:63
tomoyo_environ security/tomoyo/domain.c:672 [inline]
tomoyo_find_next_domain+0x157a/0x1a40 security/tomoyo/domain.c:882
tomoyo_bprm_check_security+0x100/0x150 security/tomoyo/tomoyo.c:101
security_bprm_check+0x5e/0x90 security/security.c:869
search_binary_handler fs/exec.c:1752 [inline]
exec_binprm fs/exec.c:1805 [inline]
bprm_execve+0xa77/0x18a0 fs/exec.c:1874
do_execveat_common+0x51b/0x6c0 fs/exec.c:1979
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1459 [inline]
free_pcp_prepare mm/page_alloc.c:1509 [inline]
free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384
free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3479
free_slab mm/slub.c:2031 [inline]
discard_slab mm/slub.c:2037 [inline]
__unfreeze_partials+0x1a5/0x200 mm/slub.c:2586
put_cpu_partial+0x17c/0x250 mm/slub.c:2662
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
__kmem_cache_alloc_node+0x140/0x260 mm/slub.c:3437
kmalloc_trace+0x26/0xe0 mm/slab_common.c:1026
kmalloc include/linux/slab.h:563 [inline]
tomoyo_print_header security/tomoyo/audit.c:156 [inline]
tomoyo_init_log+0x171/0x1f50 security/tomoyo/audit.c:255
tomoyo_supervisor+0x326/0x10b0 security/tomoyo/common.c:2088
tomoyo_audit_path_log security/tomoyo/file.c:168 [inline]
tomoyo_path_permission+0x25a/0x380 security/tomoyo/file.c:587
tomoyo_check_open_permission+0x236/0x380 security/tomoyo/file.c:777
security_file_open+0x5e/0xa0 security/security.c:1681
do_dentry_open+0x305/0x10d0 fs/open.c:869

Memory state around the buggy address:
ffff8880267c0a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880267c0b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880267c0b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880267c0c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880267c0c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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.
Reply all
Reply to author
Forward
0 new messages