================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline] BUG: KASAN: slab-use-after-free in atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1383 [inline] BUG: KASAN: slab-use-after-free in gfs2_qd_dealloc+0x81/0xe0 fs/gfs2/quota.c:112 Write of size 4 at addr ffff8880425d0a80 by task udevd/4740 CPU: 0 UID: 0 PID: 4740 Comm: udevd Not tainted 6.16.0-rc7-syzkaller-00105-g2942242dde89 #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 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1383 [inline] gfs2_qd_dealloc+0x81/0xe0 fs/gfs2/quota.c:112 rcu_do_batch kernel/rcu/tree.c:2576 [inline] rcu_core+0xca8/0x1710 kernel/rcu/tree.c:2832 handle_softirqs+0x286/0x870 kernel/softirq.c:579 __do_softirq kernel/softirq.c:613 [inline] invoke_softirq kernel/softirq.c:453 [inline] __irq_exit_rcu+0xca/0x1f0 kernel/softirq.c:680 irq_exit_rcu+0x9/0x30 kernel/softirq.c:696 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1050 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1050 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:lock_release+0x2b5/0x3e0 kernel/locking/lockdep.c:5896 Code: 51 48 c7 44 24 20 00 00 00 00 9c 8f 44 24 20 f7 44 24 20 00 02 00 00 75 56 f7 c3 00 02 00 00 74 01 fb 65 48 8b 05 eb 31 02 11 <48> 3b 44 24 28 0f 85 8b 00 00 00 48 83 c4 30 5b 41 5c 41 5d 41 5e RSP: 0018:ffffc900021cf8a0 EFLAGS: 00000206 RAX: a5fc9bd0b4250d00 RBX: 0000000000000202 RCX: a5fc9bd0b4250d00 RDX: 0000000000000000 RSI: ffffffff8db873be RDI: ffffffff8be29f40 RBP: ffff888000f8d370 R08: ffff888052cdd83b R09: 1ffff1100a59bb07 R10: dffffc0000000000 R11: ffffed100a59bb08 R12: 0000000000000000 R13: 0000000000000000 R14: ffffffff8e13f0e0 R15: ffff888000f8c880 rcu_lock_release include/linux/rcupdate.h:341 [inline] rcu_read_unlock include/linux/rcupdate.h:871 [inline] dput+0x179/0x2b0 fs/dcache.c:906 path_put fs/namei.c:626 [inline] terminate_walk+0x1b5/0x4b0 fs/namei.c:752 path_openat+0x2e01/0x3830 fs/namei.c:4056 do_filp_open+0x1fa/0x410 fs/namei.c:4082 do_sys_openat2+0x121/0x1c0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1463 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:0x7f739eb15c3a Code: 41 89 f2 48 89 54 24 e0 41 83 e2 40 75 2a 89 f0 f7 d0 a9 00 00 41 00 74 1f 89 f2 b8 01 01 00 00 48 89 fe bf 9c ff ff ff 0f 05 <48> 3d 00 f0 ff ff 77 2e c3 0f 1f 44 00 00 48 8d 44 24 08 c7 44 24 RSP: 002b:00007ffd09719a38 EFLAGS: 00000206 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 000055a0a4bf1fd0 RCX: 00007f739eb15c3a RDX: 0000000000090800 RSI: 000055a0a4bccf50 RDI: 00000000ffffff9c RBP: 000055a0a4bccf50 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000206 R12: 000055a0a4bd1470 R13: 00000000000000fe R14: 000055a06f977be0 R15: 00007ffd09719d00 Allocated by task 5344: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x230/0x3d0 mm/slub.c:4359 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] init_sbd fs/gfs2/ops_fstype.c:78 [inline] gfs2_fill_super+0x11c/0x20e0 fs/gfs2/ops_fstype.c:1128 get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1681 gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1335 vfs_get_tree+0x92/0x2b0 fs/super.c:1804 do_new_mount+0x24a/0xa40 fs/namespace.c:3902 do_mount fs/namespace.c:4239 [inline] __do_sys_mount fs/namespace.c:4450 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4427 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 Freed by task 5344: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2381 [inline] slab_free mm/slub.c:4643 [inline] kfree+0x18e/0x440 mm/slub.c:4842 free_sbd fs/gfs2/ops_fstype.c:71 [inline] gfs2_fill_super+0x153d/0x20e0 fs/gfs2/ops_fstype.c:1319 get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1681 gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1335 vfs_get_tree+0x92/0x2b0 fs/super.c:1804 do_new_mount+0x24a/0xa40 fs/namespace.c:3902 do_mount fs/namespace.c:4239 [inline] __do_sys_mount fs/namespace.c:4450 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4427 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 The buggy address belongs to the object at ffff8880425d0000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2688 bytes inside of freed 8192-byte region [ffff8880425d0000, ffff8880425d2000) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x425d0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801a442280 ffffea0000e88400 0000000000000006 raw: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff88801a442280 ffffea0000e88400 0000000000000006 head: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000 head: 04fff00000000003 ffffea0001097401 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 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 5319, tgid 5319 (sh), ts 79958985684, free_ts 68718577972 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704 prep_new_page mm/page_alloc.c:1712 [inline] get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3669 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419 alloc_slab_page mm/slub.c:2451 [inline] allocate_slab+0x8a/0x3b0 mm/slub.c:2619 new_slab mm/slub.c:2673 [inline] ___slab_alloc+0xbfc/0x1480 mm/slub.c:3859 __slab_alloc mm/slub.c:3949 [inline] __slab_alloc_node mm/slub.c:4024 [inline] slab_alloc_node mm/slub.c:4185 [inline] __kmalloc_cache_noprof+0x296/0x3d0 mm/slub.c:4354 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] tomoyo_print_bprm security/tomoyo/audit.c:26 [inline] tomoyo_init_log+0x111f/0x1f70 security/tomoyo/audit.c:264 tomoyo_supervisor+0x340/0x1480 security/tomoyo/common.c:2198 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline] tomoyo_env_perm+0x149/0x1e0 security/tomoyo/environ.c:63 tomoyo_environ security/tomoyo/domain.c:672 [inline] tomoyo_find_next_domain+0x15cf/0x1aa0 security/tomoyo/domain.c:888 tomoyo_bprm_check_security+0x11c/0x180 security/tomoyo/tomoyo.c:102 security_bprm_check+0x89/0x270 security/security.c:1302 search_binary_handler fs/exec.c:1660 [inline] exec_binprm fs/exec.c:1702 [inline] bprm_execve+0x8ee/0x1450 fs/exec.c:1754 do_execveat_common+0x510/0x6a0 fs/exec.c:1860 do_execve fs/exec.c:1934 [inline] __do_sys_execve fs/exec.c:2010 [inline] __se_sys_execve fs/exec.c:2005 [inline] __x64_sys_execve+0x94/0xb0 fs/exec.c:2005 page last free pid 5288 tgid 5288 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1248 [inline] __free_frozen_pages+0xc71/0xe70 mm/page_alloc.c:2706 skb_release_data+0x62d/0x7c0 net/core/skbuff.c:1087 skb_release_all net/core/skbuff.c:1152 [inline] kfree_skb_add_bulk net/core/skbuff.c:1225 [inline] kfree_skb_list_reason+0x25d/0x460 net/core/skbuff.c:1247 skb_release_data+0x61e/0x7c0 net/core/skbuff.c:1085 skb_release_all net/core/skbuff.c:1152 [inline] __napi_kfree_skb net/core/skbuff.c:1442 [inline] kfree_skb_napi_cache net/core/skbuff.c:7168 [inline] skb_attempt_defer_free+0x422/0x5c0 net/core/skbuff.c:7190 tcp_eat_recv_skb net/ipv4/tcp.c:1565 [inline] tcp_recvmsg_locked+0x249d/0x3660 net/ipv4/tcp.c:2862 tcp_recvmsg+0x216/0x810 net/ipv4/tcp.c:2908 inet_recvmsg+0x147/0x250 net/ipv4/af_inet.c:883 sock_recvmsg_nosec net/socket.c:1017 [inline] sock_recvmsg+0x1a8/0x270 net/socket.c:1039 sock_read_iter+0x231/0x2f0 net/socket.c:1109 new_sync_read fs/read_write.c:491 [inline] vfs_read+0x4d0/0x980 fs/read_write.c:572 ksys_read+0x145/0x250 fs/read_write.c:715 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 Memory state around the buggy address: ffff8880425d0980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880425d0a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880425d0a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880425d0b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880425d0b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 51 push %rcx 1: 48 c7 44 24 20 00 00 movq $0x0,0x20(%rsp) 8: 00 00 a: 9c pushf b: 8f 44 24 20 pop 0x20(%rsp) f: f7 44 24 20 00 02 00 testl $0x200,0x20(%rsp) 16: 00 17: 75 56 jne 0x6f 19: f7 c3 00 02 00 00 test $0x200,%ebx 1f: 74 01 je 0x22 21: fb sti 22: 65 48 8b 05 eb 31 02 mov %gs:0x110231eb(%rip),%rax # 0x11023215 29: 11 * 2a: 48 3b 44 24 28 cmp 0x28(%rsp),%rax <-- trapping instruction 2f: 0f 85 8b 00 00 00 jne 0xc0 35: 48 83 c4 30 add $0x30,%rsp 39: 5b pop %rbx 3a: 41 5c pop %r12 3c: 41 5d pop %r13 3e: 41 5e pop %r14