================================================================== BUG: KASAN: use-after-free in process_notifier+0x343/0x7b0 drivers/misc/uid_sys_stats.c:707 Write of size 8 at addr ffff88810b94d658 by task syz-executor.4/958 CPU: 0 PID: 958 Comm: syz-executor.4 Not tainted 6.1.25-syzkaller-00063-g4b3ab91671d8 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:427 kasan_report+0x13c/0x170 mm/kasan/report.c:531 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report_generic.c:356 process_notifier+0x343/0x7b0 drivers/misc/uid_sys_stats.c:707 notifier_call_chain kernel/notifier.c:87 [inline] blocking_notifier_call_chain+0xbb/0x140 kernel/notifier.c:382 profile_task_exit+0x1e/0x30 kernel/profile.c:146 do_exit+0x2c1/0x2b80 kernel/exit.c:819 do_group_exit+0x21a/0x2d0 kernel/exit.c:1025 get_signal+0x169d/0x1820 kernel/signal.c:2866 arch_do_signal_or_restart+0xb0/0x16f0 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop+0x6b/0xa0 kernel/entry/common.c:168 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:204 irqentry_exit_to_user_mode+0x9/0x20 kernel/entry/common.c:310 irqentry_exit+0x12/0x40 kernel/entry/common.c:413 exc_page_fault+0x4d0/0x6e0 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0033:0x7f723e627790 Code: 5b 5d c3 48 8d 3d 7f fa 09 00 e8 db fa ff ff 48 8d 3d 81 fa 09 00 e8 cf fa ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 <53> 89 fb 48 83 ec 10 64 8b 04 25 ac ff ff ff 85 c0 74 2a 89 fe 31 RSP: 002b:00007f7235638b38 EFLAGS: 00000202 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007f723e6d2048 RDX: 00007f7235638b40 RSI: 00007f7235638c70 RDI: 000000000000000b RBP: 00007f723e6c847a R08: 00007ffcedb4e080 R09: 00007ffcedb4e0b0 R10: 0000000000005942 R11: 000000000000007e R12: 0000000000000000 R13: 000000000000006e R14: 00007f723e79cae0 R15: 00007ffcedb29248 Allocated by task 958: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505 ____kasan_kmalloc mm/kasan/common.c:379 [inline] __kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388 kasan_kmalloc include/linux/kasan.h:212 [inline] kmalloc_trace+0x44/0xa0 mm/slab_common.c:1052 kmalloc include/linux/slab.h:553 [inline] process_notifier+0x2c1/0x7b0 drivers/misc/uid_sys_stats.c:695 notifier_call_chain kernel/notifier.c:87 [inline] blocking_notifier_call_chain+0xbb/0x140 kernel/notifier.c:382 profile_task_exit+0x1e/0x30 kernel/profile.c:146 do_exit+0x2c1/0x2b80 kernel/exit.c:819 do_group_exit+0x21a/0x2d0 kernel/exit.c:1025 get_signal+0x169d/0x1820 kernel/signal.c:2866 arch_do_signal_or_restart+0xb0/0x16f0 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop+0x6b/0xa0 kernel/entry/common.c:168 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:204 irqentry_exit_to_user_mode+0x9/0x20 kernel/entry/common.c:310 irqentry_exit+0x12/0x40 kernel/entry/common.c:413 exc_page_fault+0x4d0/0x6e0 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:570 Freed by task 400: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249 kasan_slab_free include/linux/kasan.h:178 [inline] slab_free_hook mm/slub.c:1744 [inline] slab_free_freelist_hook mm/slub.c:1770 [inline] slab_free mm/slub.c:3681 [inline] __kmem_cache_free+0x218/0x3b0 mm/slub.c:3694 kfree+0x7a/0xf0 mm/slab_common.c:1009 update_stats_workfn+0x36b/0x3e0 drivers/misc/uid_sys_stats.c:674 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2296 worker_thread+0xa60/0x1260 kernel/workqueue.c:2443 kthread+0x26d/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the object at ffff88810b94d600 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 88 bytes inside of 96-byte region [ffff88810b94d600, ffff88810b94d660) The buggy address belongs to the physical page: page:ffffea00042e5340 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10b94d flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 ffffea00042c6400 dead000000000006 ffff888100042900 raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 1 (swapper/0), ts 1859351102, free_ts 1859056427 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2582 prep_new_page+0x1b/0x110 mm/page_alloc.c:2589 get_page_from_freelist+0x2762/0x27f0 mm/page_alloc.c:4387 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5664 allocate_slab mm/slub.c:1959 [inline] new_slab+0xce/0x4c0 mm/slub.c:2012 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3200 __slab_alloc+0x5d/0xa0 mm/slub.c:3299 slab_alloc_node mm/slub.c:3384 [inline] __kmem_cache_alloc_node+0x1af/0x250 mm/slub.c:3457 kmalloc_trace+0x2a/0xa0 mm/slab_common.c:1047 kmalloc include/linux/slab.h:553 [inline] kzalloc include/linux/slab.h:689 [inline] kobject_create lib/kobject.c:760 [inline] kobject_create_and_add+0x59/0x260 lib/kobject.c:786 device_add_disk+0x4bf/0xec0 block/genhd.c:494 add_disk include/linux/blkdev.h:777 [inline] brd_alloc+0x4cf/0x740 drivers/block/brd.c:422 brd_init+0x105/0x1d0 drivers/block/brd.c:484 do_one_initcall+0x18d/0x630 init/main.c:1301 do_initcall_level+0x186/0x306 init/main.c:1374 do_initcalls+0x4e/0x8e init/main.c:1390 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1494 [inline] free_pcp_prepare mm/page_alloc.c:1568 [inline] free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3486 free_unref_page+0x8d/0x480 mm/page_alloc.c:3582 free_the_page mm/page_alloc.c:794 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5753 __vunmap+0x9f3/0xb60 mm/vmalloc.c:2728 __vfree mm/vmalloc.c:2776 [inline] vfree+0x5c/0x80 mm/vmalloc.c:2807 free_partitions block/partitions/core.c:118 [inline] check_partition block/partitions/core.c:177 [inline] blk_add_partitions block/partitions/core.c:602 [inline] bdev_disk_changed+0x7be/0x12c0 block/partitions/core.c:688 blkdev_get_whole+0x2fc/0x380 block/bdev.c:690 blkdev_get_by_dev+0x2db/0x980 block/bdev.c:827 disk_scan_partitions+0x1bd/0x2c0 block/genhd.c:384 device_add_disk+0xba6/0xec0 block/genhd.c:531 add_disk include/linux/blkdev.h:777 [inline] brd_alloc+0x4cf/0x740 drivers/block/brd.c:422 brd_init+0x105/0x1d0 drivers/block/brd.c:484 do_one_initcall+0x18d/0x630 init/main.c:1301 do_initcall_level+0x186/0x306 init/main.c:1374 do_initcalls+0x4e/0x8e init/main.c:1390 do_basic_setup+0x81/0x8a init/main.c:1409 Memory state around the buggy address: ffff88810b94d500: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc ffff88810b94d580: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc >ffff88810b94d600: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88810b94d680: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc ffff88810b94d700: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc ==================================================================