syzbot


KASAN: use-after-free Write in gfs2_qd_shrink_scan

Status: auto-obsoleted due to no activity on 2024/09/04 11:09
Reported-by: syzbot+93b5db0d83591b8aff90@syzkaller.appspotmail.com
First crash: 216d, last: 148d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Write in gfs2_qd_shrink_scan origin:lts-only syz 97 12h10m 199d 0/3 upstream: reported syz repro on 2024/05/05 21:02

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
BUG: KASAN: use-after-free in atomic_dec include/linux/atomic/atomic-instrumented.h:257 [inline]
BUG: KASAN: use-after-free in gfs2_qd_dispose fs/gfs2/quota.c:137 [inline]
BUG: KASAN: use-after-free in gfs2_qd_shrink_scan+0x63d/0x860 fs/gfs2/quota.c:175
Write of size 4 at addr ffff88807762ca70 by task syz-executor.2/5879

CPU: 0 PID: 5879 Comm: syz-executor.2 Not tainted 6.1.92-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
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:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
 instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
 atomic_dec include/linux/atomic/atomic-instrumented.h:257 [inline]
 gfs2_qd_dispose fs/gfs2/quota.c:137 [inline]
 gfs2_qd_shrink_scan+0x63d/0x860 fs/gfs2/quota.c:175
 do_shrink_slab+0x597/0xed0 mm/vmscan.c:846
 shrink_slab+0x237/0x8b0 mm/vmscan.c:1006
 drop_slab_node mm/vmscan.c:1041 [inline]
 drop_slab+0x163/0x290 mm/vmscan.c:1051
 drop_caches_sysctl_handler+0xb3/0x160 fs/drop_caches.c:66
 proc_sys_call_handler+0x541/0x8a0 fs/proc/proc_sysctl.c:604
 do_iter_write+0x6e6/0xc50 fs/read_write.c:861
 iter_file_splice_write+0x830/0xfc0 fs/splice.c:685
 do_splice_from fs/splice.c:763 [inline]
 direct_splice_actor+0xe3/0x1c0 fs/splice.c:950
 splice_direct_to_actor+0x4c7/0xc30 fs/splice.c:896
 do_splice_direct+0x2a5/0x3e0 fs/splice.c:1002
 do_sendfile+0x61c/0xff0 fs/read_write.c:1255
 __do_sys_sendfile64 fs/read_write.c:1317 [inline]
 __se_sys_sendfile64+0xfc/0x1e0 fs/read_write.c:1309
 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
RIP: 0033:0x7f0fa647cea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f0fa72de0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f0fa65b3f80 RCX: 00007f0fa647cea9
RDX: 0000000020002080 RSI: 0000000000000003 RDI: 0000000000000004
RBP: 00007f0fa64ebff4 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000023b R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f0fa65b3f80 R15: 00007ffd9af410e8
 </TASK>

Allocated by task 5791:
 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:556 [inline]
 kzalloc include/linux/slab.h:692 [inline]
 init_sbd fs/gfs2/ops_fstype.c:77 [inline]
 gfs2_fill_super+0x15a/0x26e0 fs/gfs2/ops_fstype.c:1149
 get_tree_bdev+0x3fe/0x620 fs/super.c:1355
 gfs2_get_tree+0x50/0x210 fs/gfs2/ops_fstype.c:1330
 vfs_get_tree+0x88/0x270 fs/super.c:1562
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3051
 do_mount fs/namespace.c:3394 [inline]
 __do_sys_mount fs/namespace.c:3602 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3579
 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 5131:
 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
 generic_shutdown_super+0x130/0x340 fs/super.c:501
 kill_block_super+0x7a/0xe0 fs/super.c:1459
 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:179
 get_signal+0x15fc/0x17d0 kernel/signal.c:2639
 arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871
 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:174
 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 ffff88807762c000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 2672 bytes inside of
 8192-byte region [ffff88807762c000, ffff88807762e000)

The buggy address belongs to the physical page:
page:ffffea0001dd8a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x77628
head:ffffea0001dd8a00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001695c00 dead000000000004 ffff888012442280
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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3845, tgid 3845 (syz-executor.4), ts 69639709326, free_ts 69570359806
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
 prep_new_page mm/page_alloc.c:2520 [inline]
 get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5547
 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:954 [inline]
 __kmalloc_node+0xa2/0x230 mm/slab_common.c:962
 kmalloc_node include/linux/slab.h:582 [inline]
 kvmalloc_node+0x6e/0x180 mm/util.c:581
 kvmalloc include/linux/slab.h:709 [inline]
 kvmalloc_array include/linux/slab.h:727 [inline]
 __ptr_ring_init_queue_alloc include/linux/ptr_ring.h:471 [inline]
 ptr_ring_init include/linux/ptr_ring.h:489 [inline]
 wg_packet_queue_init+0x8e/0x2f0 drivers/net/wireguard/queueing.c:32
 wg_newlink+0x40d/0x740 drivers/net/wireguard/device.c:357
 rtnl_newlink_create net/core/rtnetlink.c:3390 [inline]
 __rtnl_newlink net/core/rtnetlink.c:3610 [inline]
 rtnl_newlink+0x14e3/0x2050 net/core/rtnetlink.c:3623
 rtnetlink_rcv_msg+0x818/0xff0 net/core/rtnetlink.c:6121
 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1440 [inline]
 free_pcp_prepare mm/page_alloc.c:1490 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3453
 free_slab mm/slub.c:2031 [inline]
 discard_slab mm/slub.c:2037 [inline]
 __unfreeze_partials+0x1b7/0x210 mm/slub.c:2586
 put_cpu_partial+0x17b/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+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]
 __kmem_cache_alloc_node+0x137/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:975
 kmalloc_reserve net/core/skbuff.c:446 [inline]
 __alloc_skb+0x135/0x670 net/core/skbuff.c:515
 alloc_skb include/linux/skbuff.h:1271 [inline]
 alloc_skb_with_frags+0xa4/0x740 net/core/skbuff.c:6168
 sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2747
 unix_dgram_sendmsg+0x5b1/0x2050 net/unix/af_unix.c:1939
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 sock_write_iter+0x394/0x4e0 net/socket.c:1143
 do_iter_write+0x6e6/0xc50 fs/read_write.c:861

Memory state around the buggy address:
 ffff88807762c900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807762c980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807762ca00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff88807762ca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807762cb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (24):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/12 04:00 linux-6.1.y 88690811da69 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/10 21:21 linux-6.1.y 88690811da69 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/10 21:14 linux-6.1.y 88690811da69 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/10 21:14 linux-6.1.y 88690811da69 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/07 07:42 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/06 23:30 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/06 23:14 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/06 19:43 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/06 19:40 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/06 05:09 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/05 22:14 linux-6.1.y 88690811da69 5aa1a7c9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/03 20:02 linux-6.1.y 88690811da69 0aba2352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/05/10 23:11 linux-6.1.y 909ba1f1b414 f7c35481 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/26 11:08 linux-6.1.y eb44d83053d6 c6d33a01 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/20 19:38 linux-6.1.y eb44d83053d6 dac2aa43 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/20 19:38 linux-6.1.y eb44d83053d6 dac2aa43 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/18 03:29 linux-6.1.y eb44d83053d6 ce6011bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/07 05:33 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/07 04:46 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/07 03:39 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/02 14:49 linux-6.1.y 88690811da69 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/06/02 14:49 linux-6.1.y 88690811da69 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/05/31 21:15 linux-6.1.y 88690811da69 0c378259 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
2024/04/18 23:09 linux-6.1.y 6741e066ec76 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in gfs2_qd_shrink_scan
* Struck through repros no longer work on HEAD.