Hay
Date
June 7, 2025, 10:40 a.m.

Environment
qemu-arm64
qemu-x86_64

[   23.096582] ==================================================================
[   23.097545] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   23.098495] Write of size 33 at addr fff00000c637c080 by task kunit_try_catch/175
[   23.099141] 
[   23.099506] CPU: 0 UID: 0 PID: 175 Comm: kunit_try_catch Tainted: G    B            N 6.14.11-rc1 #1
[   23.099730] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.099811] Hardware name: linux,dummy-virt (DT)
[   23.099915] Call trace:
[   23.099982]  show_stack+0x20/0x38 (C)
[   23.100124]  dump_stack_lvl+0x8c/0xd0
[   23.100266]  print_report+0x118/0x608
[   23.100403]  kasan_report+0xdc/0x128
[   23.100542]  kasan_check_range+0x100/0x1a8
[   23.100677]  __asan_memset+0x34/0x78
[   23.100807]  kmalloc_uaf_memset+0x170/0x310
[   23.100949]  kunit_try_run_case+0x170/0x3f0
[   23.101119]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   23.101275]  kthread+0x318/0x620
[   23.101341]  ret_from_fork+0x10/0x20
[   23.101403] 
[   23.109048] Allocated by task 175:
[   23.109525]  kasan_save_stack+0x3c/0x68
[   23.110058]  kasan_save_track+0x20/0x40
[   23.110544]  kasan_save_alloc_info+0x40/0x58
[   23.111044]  __kasan_kmalloc+0xd4/0xd8
[   23.111613]  __kmalloc_cache_noprof+0x16c/0x3c0
[   23.112090]  kmalloc_uaf_memset+0xb8/0x310
[   23.112631]  kunit_try_run_case+0x170/0x3f0
[   23.114004]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   23.114606]  kthread+0x318/0x620
[   23.115095]  ret_from_fork+0x10/0x20
[   23.115550] 
[   23.115850] Freed by task 175:
[   23.116925]  kasan_save_stack+0x3c/0x68
[   23.117897]  kasan_save_track+0x20/0x40
[   23.118756]  kasan_save_free_info+0x4c/0x78
[   23.119250]  __kasan_slab_free+0x6c/0x98
[   23.119675]  kfree+0x214/0x3c8
[   23.120048]  kmalloc_uaf_memset+0x11c/0x310
[   23.120503]  kunit_try_run_case+0x170/0x3f0
[   23.121042]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   23.122058]  kthread+0x318/0x620
[   23.122501]  ret_from_fork+0x10/0x20
[   23.122918] 
[   23.123155] The buggy address belongs to the object at fff00000c637c080
[   23.123155]  which belongs to the cache kmalloc-64 of size 64
[   23.125132] The buggy address is located 0 bytes inside of
[   23.125132]  freed 64-byte region [fff00000c637c080, fff00000c637c0c0)
[   23.127053] 
[   23.127376] The buggy address belongs to the physical page:
[   23.127807] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10637c
[   23.128533] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   23.129438] page_type: f5(slab)
[   23.131038] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   23.131912] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   23.132825] page dumped because: kasan: bad access detected
[   23.133575] 
[   23.133789] Memory state around the buggy address:
[   23.134207]  fff00000c637bf80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   23.134726]  fff00000c637c000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   23.135286] >fff00000c637c080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   23.135787]                    ^
[   23.136762]  fff00000c637c100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.138533]  fff00000c637c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.139374] ==================================================================

[   17.980964] ==================================================================
[   17.981577] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a4/0x360
[   17.982266] Write of size 33 at addr ffff888102ca9380 by task kunit_try_catch/194
[   17.982826] 
[   17.983060] CPU: 0 UID: 0 PID: 194 Comm: kunit_try_catch Tainted: G    B            N 6.14.11-rc1 #1
[   17.983193] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.983223] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   17.983268] Call Trace:
[   17.983301]  <TASK>
[   17.983338]  dump_stack_lvl+0x73/0xb0
[   17.983438]  print_report+0xd1/0x650
[   17.983494]  ? __virt_addr_valid+0x1db/0x2d0
[   17.983549]  ? kmalloc_uaf_memset+0x1a4/0x360
[   17.983597]  ? kasan_complete_mode_report_info+0x64/0x200
[   17.983657]  ? kmalloc_uaf_memset+0x1a4/0x360
[   17.983723]  kasan_report+0x140/0x180
[   17.983779]  ? kmalloc_uaf_memset+0x1a4/0x360
[   17.983842]  kasan_check_range+0x10c/0x1c0
[   17.983911]  __asan_memset+0x27/0x50
[   17.983966]  kmalloc_uaf_memset+0x1a4/0x360
[   17.984044]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   17.984103]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   17.984161]  kunit_try_run_case+0x1a6/0x480
[   17.984222]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.984303]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   17.984362]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   17.984421]  ? __kthread_parkme+0x82/0x160
[   17.984482]  ? preempt_count_sub+0x50/0x80
[   17.984539]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.984589]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.984627]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   17.984660]  kthread+0x324/0x6e0
[   17.984688]  ? trace_preempt_on+0x20/0xc0
[   17.984718]  ? __pfx_kthread+0x10/0x10
[   17.984745]  ? _raw_spin_unlock_irq+0x47/0x80
[   17.984773]  ? calculate_sigpending+0x7b/0xa0
[   17.984801]  ? __pfx_kthread+0x10/0x10
[   17.984829]  ret_from_fork+0x41/0x80
[   17.984853]  ? __pfx_kthread+0x10/0x10
[   17.984905]  ret_from_fork_asm+0x1a/0x30
[   17.984945]  </TASK>
[   17.984959] 
[   17.999731] Allocated by task 194:
[   18.000157]  kasan_save_stack+0x45/0x70
[   18.000889]  kasan_save_track+0x18/0x40
[   18.001323]  kasan_save_alloc_info+0x3b/0x50
[   18.001807]  __kasan_kmalloc+0xb7/0xc0
[   18.002265]  __kmalloc_cache_noprof+0x18a/0x420
[   18.002800]  kmalloc_uaf_memset+0xaa/0x360
[   18.003235]  kunit_try_run_case+0x1a6/0x480
[   18.003534]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.004250]  kthread+0x324/0x6e0
[   18.004653]  ret_from_fork+0x41/0x80
[   18.005201]  ret_from_fork_asm+0x1a/0x30
[   18.005677] 
[   18.005816] Freed by task 194:
[   18.006763]  kasan_save_stack+0x45/0x70
[   18.007079]  kasan_save_track+0x18/0x40
[   18.007317]  kasan_save_free_info+0x3f/0x60
[   18.007894]  __kasan_slab_free+0x56/0x70
[   18.008295]  kfree+0x224/0x3f0
[   18.009134]  kmalloc_uaf_memset+0x12c/0x360
[   18.009446]  kunit_try_run_case+0x1a6/0x480
[   18.010035]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   18.010420]  kthread+0x324/0x6e0
[   18.010958]  ret_from_fork+0x41/0x80
[   18.011332]  ret_from_fork_asm+0x1a/0x30
[   18.011473] 
[   18.011545] The buggy address belongs to the object at ffff888102ca9380
[   18.011545]  which belongs to the cache kmalloc-64 of size 64
[   18.011818] The buggy address is located 0 bytes inside of
[   18.011818]  freed 64-byte region [ffff888102ca9380, ffff888102ca93c0)
[   18.012267] 
[   18.012954] The buggy address belongs to the physical page:
[   18.013594] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102ca9
[   18.014255] flags: 0x200000000000000(node=0|zone=2)
[   18.014900] page_type: f5(slab)
[   18.015298] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   18.016009] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   18.016796] page dumped because: kasan: bad access detected
[   18.017208] 
[   18.017378] Memory state around the buggy address:
[   18.018105]  ffff888102ca9280: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
[   18.018702]  ffff888102ca9300: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.019368] >ffff888102ca9380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   18.019975]                    ^
[   18.020314]  ffff888102ca9400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.020875]  ffff888102ca9480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.021783] ==================================================================