syzbot


KASAN: use-after-free Read in ocfs2_lock_global_qf

Status: upstream: reported C repro on 2025/01/13 01:15
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+e51b9e99a48ccc64bdb3@syzkaller.appspotmail.com
First crash: 2d07h, last: 2d01h
Bug presence (2)
Date Name Commit Repro Result
2025/01/13 linux-5.15.y (ToT) 4735586da88e C [report] KASAN: use-after-free Read in ocfs2_lock_global_qf
2025/01/13 upstream (ToT) 5bc55a333a2f C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in ocfs2_lock_global_qf origin:lts-only C 3 1d17h 2d07h 0/3 upstream: reported C repro on 2025/01/13 01:08
upstream KASAN: slab-use-after-free Read in ocfs2_lock_global_qf ocfs2 C inconclusive 11 13d 64d 24/28 upstream: reported C repro on 2024/11/11 09:46

Sample crash report:
(syz-executor123,4164,1):ocfs2_block_check_validate:402 ERROR: CRC32 failed: stored: 0xcfdff595, computed 0xefed4a20. Applying ECC.
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
==================================================================
BUG: KASAN: use-after-free in ocfs2_lock_global_qf+0xb4/0x2a0 fs/ocfs2/quota_global.c:303
Read of size 8 at addr ffff888074857028 by task syz-executor123/4164

CPU: 0 PID: 4164 Comm: syz-executor123 Not tainted 5.15.176-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 ocfs2_lock_global_qf+0xb4/0x2a0 fs/ocfs2/quota_global.c:303
 ocfs2_get_next_id+0x21c/0x710 fs/ocfs2/quota_global.c:888
 dquot_get_next_dqblk+0x6e/0x3a0 fs/quota/dquot.c:2710
 quota_getnextquota+0x2bc/0x6b0 fs/quota/quota.c:249
 __do_sys_quotactl fs/quota/quota.c:959 [inline]
 __se_sys_quotactl+0x2b1/0x770 fs/quota/quota.c:915
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f8071deeb99
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff762c53a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000b3
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8071deeb99
RDX: 000000000000ee01 RSI: 00000000200080c0 RDI: ffffffff80000901
RBP: 00007f8071e665f0 R08: 0000000020000c40 R09: 0000555585b794c0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff762c53d0
R13: 00007fff762c55f8 R14: 431bde82d7b634db R15: 00007f8071e3703b
 </TASK>

Allocated by task 4164:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 ocfs2_local_read_info+0x1ea/0x19e0 fs/ocfs2/quota_local.c:696
 dquot_load_quota_sb+0x754/0xb90 fs/quota/dquot.c:2463
 dquot_load_quota_inode+0x318/0x600 fs/quota/dquot.c:2500
 ocfs2_enable_quotas+0x221/0x440 fs/ocfs2/super.c:927
 ocfs2_fill_super+0x4423/0x5890 fs/ocfs2/super.c:1140
 mount_bdev+0x2c9/0x3f0 fs/super.c:1400
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1530
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3012
 do_mount fs/namespace.c:3355 [inline]
 __do_sys_mount fs/namespace.c:3563 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3540
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 4164:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xf1/0x270 mm/slub.c:4559
 ocfs2_local_free_info+0x813/0x990 fs/ocfs2/quota_local.c:869
 dquot_disable+0x1111/0x1c60 fs/quota/dquot.c:2309
 dquot_suspend include/linux/quotaops.h:84 [inline]
 ocfs2_susp_quotas+0x247/0x340 fs/ocfs2/super.c:893
 ocfs2_remount+0x56e/0xc30 fs/ocfs2/super.c:648
 reconfigure_super+0x43a/0x870 fs/super.c:938
 do_remount fs/namespace.c:2668 [inline]
 path_mount+0xceb/0x10a0 fs/namespace.c:3334
 do_mount fs/namespace.c:3355 [inline]
 __do_sys_mount fs/namespace.c:3563 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3540
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888074857000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 40 bytes inside of
 1024-byte region [ffff888074857000, ffff888074857400)
The buggy address belongs to the page:
page:ffffea0001d21400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x74850
head:ffffea0001d21400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888017441dc0
raw: 0000000000000000 0000000000100010 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4158, ts 55385421807, free_ts 55322446254
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5465
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 __kmalloc_node_track_caller+0x1f6/0x390 mm/slub.c:4958
 kmalloc_reserve net/core/skbuff.c:356 [inline]
 __alloc_skb+0x12c/0x590 net/core/skbuff.c:427
 alloc_skb_fclone include/linux/skbuff.h:1212 [inline]
 sk_stream_alloc_skb+0x1fc/0xac0 net/ipv4/tcp.c:889
 tcp_sendmsg_locked+0xd34/0x3a90 net/ipv4/tcp.c:1314
 tcp_sendmsg+0x2c/0x40 net/ipv4/tcp.c:1457
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 sock_write_iter+0x39b/0x530 net/socket.c:1079
 call_write_iter include/linux/fs.h:2174 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0xacd/0xe50 fs/read_write.c:594
 ksys_write+0x1a2/0x2c0 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 put_page include/linux/mm.h:1247 [inline]
 __skb_frag_unref include/linux/skbuff.h:3231 [inline]
 skb_release_data+0x411/0x8a0 net/core/skbuff.c:672
 skb_release_all net/core/skbuff.c:742 [inline]
 __kfree_skb+0x4c/0x60 net/core/skbuff.c:756
 sk_eat_skb include/net/sock.h:2732 [inline]
 tcp_recvmsg_locked+0x1629/0x29b0 net/ipv4/tcp.c:2517
 tcp_recvmsg+0x24e/0x7f0 net/ipv4/tcp.c:2563
 inet_recvmsg+0x157/0x280 net/ipv4/af_inet.c:868
 sock_recvmsg_nosec net/socket.c:966 [inline]
 sock_recvmsg net/socket.c:984 [inline]
 sock_read_iter+0x353/0x480 net/socket.c:1057
 call_read_iter include/linux/fs.h:2168 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0xa93/0xe10 fs/read_write.c:485
 ksys_read+0x1a2/0x2c0 fs/read_write.c:623
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff888074856f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888074856f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888074857000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff888074857080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888074857100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/13 01:56 linux-5.15.y 4735586da88e 6dbc6a9b .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Read in ocfs2_lock_global_qf
2025/01/13 01:35 linux-5.15.y 4735586da88e 6dbc6a9b .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Read in ocfs2_lock_global_qf
2025/01/13 01:19 linux-5.15.y 4735586da88e 6dbc6a9b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ocfs2_lock_global_qf
2025/01/13 01:14 linux-5.15.y 4735586da88e 6dbc6a9b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ocfs2_lock_global_qf
* Struck through repros no longer work on HEAD.