Hay
Date
July 23, 2025, 2:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   15.540913] ==================================================================
[   15.541016] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   15.541284] Write of size 33 at addr fff00000c3f90300 by task kunit_try_catch/186
[   15.541559] 
[   15.541600] CPU: 1 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc7 #1 PREEMPT 
[   15.541872] Tainted: [B]=BAD_PAGE, [N]=TEST
[   15.541908] Hardware name: linux,dummy-virt (DT)
[   15.541964] Call trace:
[   15.541989]  show_stack+0x20/0x38 (C)
[   15.542296]  dump_stack_lvl+0x8c/0xd0
[   15.542481]  print_report+0x118/0x5d0
[   15.542543]  kasan_report+0xdc/0x128
[   15.542986]  kasan_check_range+0x100/0x1a8
[   15.543085]  __asan_memset+0x34/0x78
[   15.543254]  kmalloc_uaf_memset+0x170/0x310
[   15.543444]  kunit_try_run_case+0x170/0x3f0
[   15.543500]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.543555]  kthread+0x328/0x630
[   15.543603]  ret_from_fork+0x10/0x20
[   15.544025] 
[   15.544069] Allocated by task 186:
[   15.544236]  kasan_save_stack+0x3c/0x68
[   15.544333]  kasan_save_track+0x20/0x40
[   15.544487]  kasan_save_alloc_info+0x40/0x58
[   15.544532]  __kasan_kmalloc+0xd4/0xd8
[   15.544755]  __kmalloc_cache_noprof+0x16c/0x3c0
[   15.544989]  kmalloc_uaf_memset+0xb8/0x310
[   15.545112]  kunit_try_run_case+0x170/0x3f0
[   15.545211]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.545307]  kthread+0x328/0x630
[   15.545424]  ret_from_fork+0x10/0x20
[   15.545576] 
[   15.545732] Freed by task 186:
[   15.545923]  kasan_save_stack+0x3c/0x68
[   15.546022]  kasan_save_track+0x20/0x40
[   15.546105]  kasan_save_free_info+0x4c/0x78
[   15.546300]  __kasan_slab_free+0x6c/0x98
[   15.546519]  kfree+0x214/0x3c8
[   15.546641]  kmalloc_uaf_memset+0x11c/0x310
[   15.546688]  kunit_try_run_case+0x170/0x3f0
[   15.546749]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   15.546794]  kthread+0x328/0x630
[   15.546827]  ret_from_fork+0x10/0x20
[   15.546875] 
[   15.546895] The buggy address belongs to the object at fff00000c3f90300
[   15.546895]  which belongs to the cache kmalloc-64 of size 64
[   15.546960] The buggy address is located 0 bytes inside of
[   15.546960]  freed 64-byte region [fff00000c3f90300, fff00000c3f90340)
[   15.547036] 
[   15.547063] The buggy address belongs to the physical page:
[   15.547110] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x103f90
[   15.547168] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   15.547227] page_type: f5(slab)
[   15.547276] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   15.547329] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   15.547370] page dumped because: kasan: bad access detected
[   15.547402] 
[   15.547420] Memory state around the buggy address:
[   15.547471]  fff00000c3f90200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.547525]  fff00000c3f90280: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.547578] >fff00000c3f90300: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   15.547626]                    ^
[   15.547667]  fff00000c3f90380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.547720]  fff00000c3f90400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   15.547769] ==================================================================

[   12.859349] ==================================================================
[   12.860378] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   12.861099] Write of size 33 at addr ffff888102b02d80 by task kunit_try_catch/203
[   12.862191] 
[   12.862373] CPU: 0 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc7 #1 PREEMPT(voluntary) 
[   12.862417] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.862443] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.862464] Call Trace:
[   12.862475]  <TASK>
[   12.862490]  dump_stack_lvl+0x73/0xb0
[   12.862527]  print_report+0xd1/0x610
[   12.862549]  ? __virt_addr_valid+0x1db/0x2d0
[   12.862570]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.862591]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.862612]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.862633]  kasan_report+0x141/0x180
[   12.862654]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.862679]  kasan_check_range+0x10c/0x1c0
[   12.862702]  __asan_memset+0x27/0x50
[   12.862721]  kmalloc_uaf_memset+0x1a3/0x360
[   12.862741]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.862762]  ? __schedule+0x10c6/0x2b60
[   12.862785]  ? __pfx_read_tsc+0x10/0x10
[   12.862805]  ? ktime_get_ts64+0x86/0x230
[   12.862838]  kunit_try_run_case+0x1a5/0x480
[   12.862862]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.862884]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.862907]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.862929]  ? __kthread_parkme+0x82/0x180
[   12.862949]  ? preempt_count_sub+0x50/0x80
[   12.862971]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.862994]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.863017]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.863039]  kthread+0x337/0x6f0
[   12.863058]  ? trace_preempt_on+0x20/0xc0
[   12.863080]  ? __pfx_kthread+0x10/0x10
[   12.863100]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.863121]  ? calculate_sigpending+0x7b/0xa0
[   12.863144]  ? __pfx_kthread+0x10/0x10
[   12.863164]  ret_from_fork+0x116/0x1d0
[   12.863182]  ? __pfx_kthread+0x10/0x10
[   12.863202]  ret_from_fork_asm+0x1a/0x30
[   12.863233]  </TASK>
[   12.863243] 
[   12.878058] Allocated by task 203:
[   12.878430]  kasan_save_stack+0x45/0x70
[   12.878928]  kasan_save_track+0x18/0x40
[   12.879468]  kasan_save_alloc_info+0x3b/0x50
[   12.879900]  __kasan_kmalloc+0xb7/0xc0
[   12.880340]  __kmalloc_cache_noprof+0x189/0x420
[   12.880776]  kmalloc_uaf_memset+0xa9/0x360
[   12.881095]  kunit_try_run_case+0x1a5/0x480
[   12.881415]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.881608]  kthread+0x337/0x6f0
[   12.881731]  ret_from_fork+0x116/0x1d0
[   12.881881]  ret_from_fork_asm+0x1a/0x30
[   12.882024] 
[   12.882107] Freed by task 203:
[   12.882405]  kasan_save_stack+0x45/0x70
[   12.882852]  kasan_save_track+0x18/0x40
[   12.883285]  kasan_save_free_info+0x3f/0x60
[   12.883694]  __kasan_slab_free+0x56/0x70
[   12.884078]  kfree+0x222/0x3f0
[   12.884494]  kmalloc_uaf_memset+0x12b/0x360
[   12.884904]  kunit_try_run_case+0x1a5/0x480
[   12.885365]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.885863]  kthread+0x337/0x6f0
[   12.886197]  ret_from_fork+0x116/0x1d0
[   12.886630]  ret_from_fork_asm+0x1a/0x30
[   12.887030] 
[   12.887224] The buggy address belongs to the object at ffff888102b02d80
[   12.887224]  which belongs to the cache kmalloc-64 of size 64
[   12.887825] The buggy address is located 0 bytes inside of
[   12.887825]  freed 64-byte region [ffff888102b02d80, ffff888102b02dc0)
[   12.888439] 
[   12.888704] The buggy address belongs to the physical page:
[   12.889340] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102b02
[   12.890050] flags: 0x200000000000000(node=0|zone=2)
[   12.890709] page_type: f5(slab)
[   12.891033] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.891708] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.891978] page dumped because: kasan: bad access detected
[   12.892265] 
[   12.892470] Memory state around the buggy address:
[   12.892730]  ffff888102b02c80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.893042]  ffff888102b02d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.893332] >ffff888102b02d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.893708]                    ^
[   12.893880]  ffff888102b02e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.894247]  ffff888102b02e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.894560] ==================================================================