Hay
Date
June 17, 2025, 3:40 p.m.

Environment
qemu-arm64
qemu-x86_64

[   21.980392] ==================================================================
[   21.980578] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   21.980789] Write of size 33 at addr fff00000c58df180 by task kunit_try_catch/188
[   21.980916] 
[   21.981019] CPU: 0 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.15.3-rc1 #1 PREEMPT 
[   21.981228] Tainted: [B]=BAD_PAGE, [N]=TEST
[   21.981306] Hardware name: linux,dummy-virt (DT)
[   21.981388] Call trace:
[   21.981446]  show_stack+0x20/0x38 (C)
[   21.981574]  dump_stack_lvl+0x8c/0xd0
[   21.981692]  print_report+0x118/0x608
[   21.981820]  kasan_report+0xdc/0x128
[   21.981930]  kasan_check_range+0x100/0x1a8
[   21.982045]  __asan_memset+0x34/0x78
[   21.982161]  kmalloc_uaf_memset+0x170/0x310
[   21.982282]  kunit_try_run_case+0x170/0x3f0
[   21.982403]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.982538]  kthread+0x328/0x630
[   21.982655]  ret_from_fork+0x10/0x20
[   21.983968] 
[   21.984092] Allocated by task 188:
[   21.984180]  kasan_save_stack+0x3c/0x68
[   21.984318]  kasan_save_track+0x20/0x40
[   21.984424]  kasan_save_alloc_info+0x40/0x58
[   21.984594]  __kasan_kmalloc+0xd4/0xd8
[   21.984688]  __kmalloc_cache_noprof+0x16c/0x3c0
[   21.984812]  kmalloc_uaf_memset+0xb8/0x310
[   21.984908]  kunit_try_run_case+0x170/0x3f0
[   21.985008]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.985944]  kthread+0x328/0x630
[   21.986081]  ret_from_fork+0x10/0x20
[   21.986193] 
[   21.986234] Freed by task 188:
[   21.986287]  kasan_save_stack+0x3c/0x68
[   21.986512]  kasan_save_track+0x20/0x40
[   21.986655]  kasan_save_free_info+0x4c/0x78
[   21.987034]  __kasan_slab_free+0x6c/0x98
[   21.987223]  kfree+0x214/0x3c8
[   21.987439]  kmalloc_uaf_memset+0x11c/0x310
[   21.987631]  kunit_try_run_case+0x170/0x3f0
[   21.987723]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.987821]  kthread+0x328/0x630
[   21.987904]  ret_from_fork+0x10/0x20
[   21.988470] 
[   21.988557] The buggy address belongs to the object at fff00000c58df180
[   21.988557]  which belongs to the cache kmalloc-64 of size 64
[   21.988947] The buggy address is located 0 bytes inside of
[   21.988947]  freed 64-byte region [fff00000c58df180, fff00000c58df1c0)
[   21.989193] 
[   21.989240] The buggy address belongs to the physical page:
[   21.989810] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1058df
[   21.990195] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   21.990325] page_type: f5(slab)
[   21.990629] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   21.990771] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   21.990904] page dumped because: kasan: bad access detected
[   21.991098] 
[   21.991144] Memory state around the buggy address:
[   21.991349]  fff00000c58df080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.991561]  fff00000c58df100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.992150] >fff00000c58df180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.992327]                    ^
[   21.992406]  fff00000c58df200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.992582]  fff00000c58df280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.992923] ==================================================================

[   19.673446] ==================================================================
[   19.674197] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   19.674892] Write of size 33 at addr ffff888102eda680 by task kunit_try_catch/206
[   19.676633] 
[   19.677556] CPU: 1 UID: 0 PID: 206 Comm: kunit_try_catch Tainted: G    B            N  6.15.3-rc1 #1 PREEMPT(voluntary) 
[   19.677633] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.677653] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   19.677685] Call Trace:
[   19.677708]  <TASK>
[   19.677732]  dump_stack_lvl+0x73/0xb0
[   19.677779]  print_report+0xd1/0x650
[   19.677816]  ? __virt_addr_valid+0x1db/0x2d0
[   19.677850]  ? kmalloc_uaf_memset+0x1a3/0x360
[   19.677883]  ? kasan_complete_mode_report_info+0x64/0x200
[   19.677916]  ? kmalloc_uaf_memset+0x1a3/0x360
[   19.677968]  kasan_report+0x141/0x180
[   19.678051]  ? kmalloc_uaf_memset+0x1a3/0x360
[   19.678124]  kasan_check_range+0x10c/0x1c0
[   19.678156]  __asan_memset+0x27/0x50
[   19.678186]  kmalloc_uaf_memset+0x1a3/0x360
[   19.678218]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   19.678251]  ? __schedule+0x10cc/0x2b60
[   19.678310]  ? __pfx_read_tsc+0x10/0x10
[   19.678350]  ? ktime_get_ts64+0x86/0x230
[   19.678390]  kunit_try_run_case+0x1a5/0x480
[   19.678431]  ? __pfx_kunit_try_run_case+0x10/0x10
[   19.678463]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   19.678499]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   19.678532]  ? __kthread_parkme+0x82/0x180
[   19.678565]  ? preempt_count_sub+0x50/0x80
[   19.678602]  ? __pfx_kunit_try_run_case+0x10/0x10
[   19.678636]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.678668]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   19.678701]  kthread+0x337/0x6f0
[   19.678724]  ? trace_preempt_on+0x20/0xc0
[   19.678760]  ? __pfx_kthread+0x10/0x10
[   19.678785]  ? _raw_spin_unlock_irq+0x47/0x80
[   19.678815]  ? calculate_sigpending+0x7b/0xa0
[   19.678847]  ? __pfx_kthread+0x10/0x10
[   19.678872]  ret_from_fork+0x41/0x80
[   19.678902]  ? __pfx_kthread+0x10/0x10
[   19.678927]  ret_from_fork_asm+0x1a/0x30
[   19.679018]  </TASK>
[   19.679059] 
[   19.700351] Allocated by task 206:
[   19.701697]  kasan_save_stack+0x45/0x70
[   19.702075]  kasan_save_track+0x18/0x40
[   19.702511]  kasan_save_alloc_info+0x3b/0x50
[   19.702883]  __kasan_kmalloc+0xb7/0xc0
[   19.703665]  __kmalloc_cache_noprof+0x189/0x420
[   19.704043]  kmalloc_uaf_memset+0xa9/0x360
[   19.704923]  kunit_try_run_case+0x1a5/0x480
[   19.705410]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.706695]  kthread+0x337/0x6f0
[   19.707531]  ret_from_fork+0x41/0x80
[   19.707952]  ret_from_fork_asm+0x1a/0x30
[   19.708376] 
[   19.708720] Freed by task 206:
[   19.709633]  kasan_save_stack+0x45/0x70
[   19.710231]  kasan_save_track+0x18/0x40
[   19.710619]  kasan_save_free_info+0x3f/0x60
[   19.711141]  __kasan_slab_free+0x56/0x70
[   19.711652]  kfree+0x222/0x3f0
[   19.712120]  kmalloc_uaf_memset+0x12b/0x360
[   19.712876]  kunit_try_run_case+0x1a5/0x480
[   19.713333]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   19.714502]  kthread+0x337/0x6f0
[   19.714871]  ret_from_fork+0x41/0x80
[   19.715379]  ret_from_fork_asm+0x1a/0x30
[   19.715925] 
[   19.716362] The buggy address belongs to the object at ffff888102eda680
[   19.716362]  which belongs to the cache kmalloc-64 of size 64
[   19.717545] The buggy address is located 0 bytes inside of
[   19.717545]  freed 64-byte region [ffff888102eda680, ffff888102eda6c0)
[   19.719339] 
[   19.719626] The buggy address belongs to the physical page:
[   19.720177] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102eda
[   19.720753] flags: 0x200000000000000(node=0|zone=2)
[   19.721389] page_type: f5(slab)
[   19.721799] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   19.723104] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   19.723702] page dumped because: kasan: bad access detected
[   19.724206] 
[   19.724432] Memory state around the buggy address:
[   19.724849]  ffff888102eda580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.725760]  ffff888102eda600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.726394] >ffff888102eda680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   19.727048]                    ^
[   19.728475]  ffff888102eda700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.729338]  ffff888102eda780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.729940] ==================================================================