================================================================== 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:1375 [inline] BUG: KASAN: slab-use-after-free in gfs2_qd_dealloc+0x7a/0xf0 fs/gfs2/quota.c:115 Write of size 4 at addr ffff88801b0e0a78 by task ksoftirqd/2/21 CPU: 2 PID: 21 Comm: ksoftirqd/2 Not tainted 6.6.0-rc7-syzkaller-00195-g2af9b20dbb39 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 check_region_inline mm/kasan/generic.c:181 [inline] kasan_check_range+0xef/0x190 mm/kasan/generic.c:187 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1375 [inline] gfs2_qd_dealloc+0x7a/0xf0 fs/gfs2/quota.c:115 rcu_do_batch kernel/rcu/tree.c:2139 [inline] rcu_core+0x805/0x1bb0 kernel/rcu/tree.c:2403 __do_softirq+0x218/0x965 kernel/softirq.c:553 run_ksoftirqd kernel/softirq.c:921 [inline] run_ksoftirqd+0x31/0x60 kernel/softirq.c:913 smpboot_thread_fn+0x660/0xa00 kernel/smpboot.c:164 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Allocated by task 9067: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] init_sbd fs/gfs2/ops_fstype.c:77 [inline] gfs2_fill_super+0x149/0x2e50 fs/gfs2/ops_fstype.c:1164 get_tree_bdev+0x3b5/0x650 fs/super.c:1577 gfs2_get_tree+0x4e/0x280 fs/gfs2/ops_fstype.c:1348 vfs_get_tree+0x8c/0x370 fs/super.c:1750 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5178: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x138/0x190 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] __cache_free mm/slab.c:3370 [inline] __do_kmem_cache_free mm/slab.c:3557 [inline] __kmem_cache_free+0xcc/0x2d0 mm/slab.c:3564 generic_shutdown_super+0x161/0x3c0 fs/super.c:693 kill_block_super+0x3b/0x70 fs/super.c:1646 gfs2_kill_sb+0x361/0x410 fs/gfs2/ops_fstype.c:1811 deactivate_locked_super+0x9a/0x170 fs/super.c:481 deactivate_super+0xde/0x100 fs/super.c:514 cleanup_mnt+0x222/0x3d0 fs/namespace.c:1254 task_work_run+0x14d/0x240 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x215/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492 insert_work+0x38/0x230 kernel/workqueue.c:1647 __queue_work+0x5d0/0x1050 kernel/workqueue.c:1799 queue_work_on+0xed/0x110 kernel/workqueue.c:1834 queue_work include/linux/workqueue.h:554 [inline] schedule_work include/linux/workqueue.h:615 [inline] f2fs_handle_critical_error+0x841/0xa00 fs/f2fs/super.c:4130 f2fs_write_end_io+0xddf/0x11a0 fs/f2fs/data.c:366 bio_endio+0x593/0x6a0 block/bio.c:1603 submit_bio_noacct+0x3f2/0x1b10 block/blk-core.c:808 __submit_merged_bio+0x301/0x6a0 fs/f2fs/data.c:589 __f2fs_submit_merged_write fs/f2fs/data.c:682 [inline] __submit_merged_write_cond+0x319/0x3f0 fs/f2fs/data.c:704 f2fs_submit_merged_write_cond fs/f2fs/data.c:721 [inline] f2fs_write_cache_pages+0x1b46/0x2030 fs/f2fs/data.c:3280 __f2fs_write_data_pages fs/f2fs/data.c:3360 [inline] f2fs_write_data_pages+0x4d3/0xe20 fs/f2fs/data.c:3387 do_writepages+0x1b4/0x690 mm/page-writeback.c:2553 filemap_fdatawrite_wbc mm/filemap.c:390 [inline] filemap_fdatawrite_wbc+0x144/0x1b0 mm/filemap.c:380 __filemap_fdatawrite_range+0xba/0x100 mm/filemap.c:423 f2fs_sync_dirty_inodes+0x47d/0x940 fs/f2fs/checkpoint.c:1107 block_operations+0x297/0xf20 fs/f2fs/checkpoint.c:1240 f2fs_write_checkpoint+0x4e3/0x4b60 fs/f2fs/checkpoint.c:1648 __write_checkpoint_sync fs/f2fs/checkpoint.c:1765 [inline] f2fs_issue_checkpoint+0x193/0x4a0 fs/f2fs/checkpoint.c:1862 f2fs_sync_fs+0x317/0x3c0 fs/f2fs/super.c:1713 f2fs_create+0x4b8/0x650 fs/f2fs/namei.c:387 lookup_open.isra.0+0x1049/0x1360 fs/namei.c:3496 open_last_lookups fs/namei.c:3564 [inline] path_openat+0x931/0x29c0 fs/namei.c:3794 do_filp_open+0x1de/0x430 fs/namei.c:3824 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_creat fs/open.c:1513 [inline] __se_sys_creat fs/open.c:1507 [inline] __x64_sys_creat+0xcd/0x120 fs/open.c:1507 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492 insert_work+0x38/0x230 kernel/workqueue.c:1647 __queue_work+0x5d0/0x1050 kernel/workqueue.c:1799 queue_work_on+0xed/0x110 kernel/workqueue.c:1834 queue_work include/linux/workqueue.h:554 [inline] schedule_work include/linux/workqueue.h:615 [inline] f2fs_handle_critical_error+0x841/0xa00 fs/f2fs/super.c:4130 f2fs_write_end_io+0xddf/0x11a0 fs/f2fs/data.c:366 bio_endio+0x593/0x6a0 block/bio.c:1603 submit_bio_noacct+0x3f2/0x1b10 block/blk-core.c:808 __submit_merged_bio+0x301/0x6a0 fs/f2fs/data.c:589 __f2fs_submit_merged_write fs/f2fs/data.c:682 [inline] __submit_merged_write_cond+0x319/0x3f0 fs/f2fs/data.c:704 f2fs_submit_merged_write_cond fs/f2fs/data.c:721 [inline] f2fs_write_cache_pages+0x1b46/0x2030 fs/f2fs/data.c:3280 __f2fs_write_data_pages fs/f2fs/data.c:3360 [inline] f2fs_write_data_pages+0x4d3/0xe20 fs/f2fs/data.c:3387 do_writepages+0x1b4/0x690 mm/page-writeback.c:2553 filemap_fdatawrite_wbc mm/filemap.c:390 [inline] filemap_fdatawrite_wbc+0x144/0x1b0 mm/filemap.c:380 __filemap_fdatawrite_range+0xba/0x100 mm/filemap.c:423 f2fs_sync_dirty_inodes+0x47d/0x940 fs/f2fs/checkpoint.c:1107 block_operations+0x297/0xf20 fs/f2fs/checkpoint.c:1240 f2fs_write_checkpoint+0x4e3/0x4b60 fs/f2fs/checkpoint.c:1648 __write_checkpoint_sync fs/f2fs/checkpoint.c:1765 [inline] f2fs_issue_checkpoint+0x193/0x4a0 fs/f2fs/checkpoint.c:1862 f2fs_sync_fs+0x317/0x3c0 fs/f2fs/super.c:1713 f2fs_create+0x4b8/0x650 fs/f2fs/namei.c:387 lookup_open.isra.0+0x1049/0x1360 fs/namei.c:3496 open_last_lookups fs/namei.c:3564 [inline] path_openat+0x931/0x29c0 fs/namei.c:3794 do_filp_open+0x1de/0x430 fs/namei.c:3824 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_creat fs/open.c:1513 [inline] __se_sys_creat fs/open.c:1507 [inline] __x64_sys_creat+0xcd/0x120 fs/open.c:1507 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88801b0e0000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2680 bytes inside of freed 8192-byte region [ffff88801b0e0000, ffff88801b0e2000) The buggy address belongs to the physical page: page:ffffea00006c3800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1b0e0 head:ffffea00006c3800 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x1() raw: 00fff00000000840 ffff888012c40a00 ffffea00006a0610 ffffea0000b66210 raw: 0000000000000000 ffff88801b0e0000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x242040(__GFP_IO|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 5174, tgid 5174 (syz-fuzzer), ts 194792368809, free_ts 170492241470 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x99/0x3a0 mm/slab.c:2550 cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] __kmem_cache_alloc_node+0x3c5/0x470 mm/slab.c:3521 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1117 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] tomoyo_print_bprm security/tomoyo/audit.c:26 [inline] tomoyo_init_log+0xcdf/0x2110 security/tomoyo/audit.c:264 tomoyo_supervisor+0x30c/0xea0 security/tomoyo/common.c:2089 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline] tomoyo_env_perm+0x18f/0x200 security/tomoyo/environ.c:63 tomoyo_environ security/tomoyo/domain.c:672 [inline] tomoyo_find_next_domain+0xef6/0x2020 security/tomoyo/domain.c:878 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:101 [inline] tomoyo_bprm_check_security+0x12b/0x1d0 security/tomoyo/tomoyo.c:91 security_bprm_check+0x6a/0xe0 security/security.c:1103 search_binary_handler fs/exec.c:1727 [inline] exec_binprm fs/exec.c:1781 [inline] bprm_execve fs/exec.c:1856 [inline] bprm_execve+0x73f/0x1a40 fs/exec.c:1812 do_execveat_common.isra.0+0x5d3/0x740 fs/exec.c:1964 do_execve fs/exec.c:2038 [inline] __do_sys_execve fs/exec.c:2114 [inline] __se_sys_execve fs/exec.c:2109 [inline] __x64_sys_execve+0x8c/0xb0 fs/exec.c:2109 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405 slab_destroy mm/slab.c:1608 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1628 cache_flusharray mm/slab.c:3341 [inline] ___cache_free+0x2b7/0x420 mm/slab.c:3404 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x4c/0x1b0 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slab.c:3237 [inline] kmem_cache_alloc_node+0x173/0x540 mm/slab.c:3509 __alloc_skb+0x287/0x330 net/core/skbuff.c:640 alloc_skb_fclone include/linux/skbuff.h:1336 [inline] tcp_stream_alloc_skb+0x34/0x560 net/ipv4/tcp.c:871 tcp_sendmsg_locked+0xeb6/0x3450 net/ipv4/tcp.c:1153 tcp_sendmsg+0x2e/0x40 net/ipv4/tcp.c:1340 inet_sendmsg+0x9d/0xe0 net/ipv4/af_inet.c:846 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0xd5/0x180 net/socket.c:745 sock_write_iter+0x29b/0x3d0 net/socket.c:1158 call_write_iter include/linux/fs.h:1956 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x650/0xe40 fs/read_write.c:584 Memory state around the buggy address: ffff88801b0e0900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801b0e0980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801b0e0a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801b0e0a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801b0e0b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================