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

Environment
qemu-arm64
qemu-x86_64

[   22.845622] ==================================================================
[   22.845811] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   22.846792] Write of size 33 at addr fff00000c76c4680 by task kunit_try_catch/190
[   22.847664] 
[   22.847876] CPU: 1 UID: 0 PID: 190 Comm: kunit_try_catch Tainted: G    B            N  6.15.2-rc1 #1 PREEMPT 
[   22.848168] Tainted: [B]=BAD_PAGE, [N]=TEST
[   22.848238] Hardware name: linux,dummy-virt (DT)
[   22.848326] Call trace:
[   22.848389]  show_stack+0x20/0x38 (C)
[   22.849002]  dump_stack_lvl+0x8c/0xd0
[   22.849154]  print_report+0x118/0x608
[   22.849376]  kasan_report+0xdc/0x128
[   22.849934]  kasan_check_range+0x100/0x1a8
[   22.850154]  __asan_memset+0x34/0x78
[   22.850302]  kmalloc_uaf_memset+0x170/0x310
[   22.850438]  kunit_try_run_case+0x170/0x3f0
[   22.850577]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.850706]  kthread+0x328/0x630
[   22.850798]  ret_from_fork+0x10/0x20
[   22.850914] 
[   22.850953] Allocated by task 190:
[   22.851021]  kasan_save_stack+0x3c/0x68
[   22.851126]  kasan_save_track+0x20/0x40
[   22.851224]  kasan_save_alloc_info+0x40/0x58
[   22.851329]  __kasan_kmalloc+0xd4/0xd8
[   22.852038]  __kmalloc_cache_noprof+0x16c/0x3c0
[   22.852643]  kmalloc_uaf_memset+0xb8/0x310
[   22.852844]  kunit_try_run_case+0x170/0x3f0
[   22.852955]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.853069]  kthread+0x328/0x630
[   22.853157]  ret_from_fork+0x10/0x20
[   22.853241] 
[   22.853289] Freed by task 190:
[   22.853363]  kasan_save_stack+0x3c/0x68
[   22.853848]  kasan_save_track+0x20/0x40
[   22.854311]  kasan_save_free_info+0x4c/0x78
[   22.854834]  __kasan_slab_free+0x6c/0x98
[   22.855125]  kfree+0x214/0x3c8
[   22.855222]  kmalloc_uaf_memset+0x11c/0x310
[   22.855315]  kunit_try_run_case+0x170/0x3f0
[   22.855736]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   22.856091]  kthread+0x328/0x630
[   22.856211]  ret_from_fork+0x10/0x20
[   22.856314] 
[   22.856462] The buggy address belongs to the object at fff00000c76c4680
[   22.856462]  which belongs to the cache kmalloc-64 of size 64
[   22.857017] The buggy address is located 0 bytes inside of
[   22.857017]  freed 64-byte region [fff00000c76c4680, fff00000c76c46c0)
[   22.857247] 
[   22.857306] The buggy address belongs to the physical page:
[   22.857462] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1076c4
[   22.857592] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   22.857986] page_type: f5(slab)
[   22.858332] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   22.858537] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   22.858646] page dumped because: kasan: bad access detected
[   22.858972] 
[   22.859017] Memory state around the buggy address:
[   22.859093]  fff00000c76c4580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.859542]  fff00000c76c4600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.859688] >fff00000c76c4680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   22.859854]                    ^
[   22.860242]  fff00000c76c4700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.860599]  fff00000c76c4780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   22.860802] ==================================================================

[   14.038978] ==================================================================
[   14.039421] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   14.040189] Write of size 33 at addr ffff888102da2000 by task kunit_try_catch/206
[   14.040427] 
[   14.040537] CPU: 1 UID: 0 PID: 206 Comm: kunit_try_catch Tainted: G    B            N  6.15.2-rc1 #1 PREEMPT(voluntary) 
[   14.040621] Tainted: [B]=BAD_PAGE, [N]=TEST
[   14.040641] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   14.040674] Call Trace:
[   14.040698]  <TASK>
[   14.040728]  dump_stack_lvl+0x73/0xb0
[   14.040772]  print_report+0xd1/0x650
[   14.040796]  ? __virt_addr_valid+0x1db/0x2d0
[   14.040817]  ? kmalloc_uaf_memset+0x1a3/0x360
[   14.040838]  ? kasan_complete_mode_report_info+0x64/0x200
[   14.040858]  ? kmalloc_uaf_memset+0x1a3/0x360
[   14.040878]  kasan_report+0x141/0x180
[   14.040899]  ? kmalloc_uaf_memset+0x1a3/0x360
[   14.040923]  kasan_check_range+0x10c/0x1c0
[   14.040941]  __asan_memset+0x27/0x50
[   14.040961]  kmalloc_uaf_memset+0x1a3/0x360
[   14.040980]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   14.041001]  ? __schedule+0x10cc/0x2b30
[   14.041021]  ? __pfx_read_tsc+0x10/0x10
[   14.041040]  ? ktime_get_ts64+0x86/0x230
[   14.041065]  kunit_try_run_case+0x1a5/0x480
[   14.041088]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.041108]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   14.041130]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   14.041151]  ? __kthread_parkme+0x82/0x180
[   14.041172]  ? preempt_count_sub+0x50/0x80
[   14.041195]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.041217]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.041238]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   14.041258]  kthread+0x337/0x6f0
[   14.041275]  ? trace_preempt_on+0x20/0xc0
[   14.041297]  ? __pfx_kthread+0x10/0x10
[   14.041314]  ? _raw_spin_unlock_irq+0x47/0x80
[   14.041333]  ? calculate_sigpending+0x7b/0xa0
[   14.041353]  ? __pfx_kthread+0x10/0x10
[   14.041371]  ret_from_fork+0x41/0x80
[   14.041390]  ? __pfx_kthread+0x10/0x10
[   14.041407]  ret_from_fork_asm+0x1a/0x30
[   14.041436]  </TASK>
[   14.041448] 
[   14.053021] Allocated by task 206:
[   14.053326]  kasan_save_stack+0x45/0x70
[   14.053714]  kasan_save_track+0x18/0x40
[   14.054141]  kasan_save_alloc_info+0x3b/0x50
[   14.054444]  __kasan_kmalloc+0xb7/0xc0
[   14.054893]  __kmalloc_cache_noprof+0x189/0x420
[   14.055266]  kmalloc_uaf_memset+0xa9/0x360
[   14.055490]  kunit_try_run_case+0x1a5/0x480
[   14.055753]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.056136]  kthread+0x337/0x6f0
[   14.056293]  ret_from_fork+0x41/0x80
[   14.057094]  ret_from_fork_asm+0x1a/0x30
[   14.057485] 
[   14.057846] Freed by task 206:
[   14.058021]  kasan_save_stack+0x45/0x70
[   14.058353]  kasan_save_track+0x18/0x40
[   14.058783]  kasan_save_free_info+0x3f/0x60
[   14.059056]  __kasan_slab_free+0x56/0x70
[   14.059414]  kfree+0x222/0x3f0
[   14.059873]  kmalloc_uaf_memset+0x12b/0x360
[   14.060105]  kunit_try_run_case+0x1a5/0x480
[   14.060441]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.060979]  kthread+0x337/0x6f0
[   14.061214]  ret_from_fork+0x41/0x80
[   14.061534]  ret_from_fork_asm+0x1a/0x30
[   14.062319] 
[   14.062486] The buggy address belongs to the object at ffff888102da2000
[   14.062486]  which belongs to the cache kmalloc-64 of size 64
[   14.063309] The buggy address is located 0 bytes inside of
[   14.063309]  freed 64-byte region [ffff888102da2000, ffff888102da2040)
[   14.064176] 
[   14.064378] The buggy address belongs to the physical page:
[   14.064891] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102da2
[   14.065177] flags: 0x200000000000000(node=0|zone=2)
[   14.065590] page_type: f5(slab)
[   14.066034] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   14.066359] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   14.067154] page dumped because: kasan: bad access detected
[   14.067473] 
[   14.067596] Memory state around the buggy address:
[   14.068584]  ffff888102da1f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.069186]  ffff888102da1f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.069791] >ffff888102da2000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   14.070322]                    ^
[   14.070611]  ffff888102da2080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.071123]  ffff888102da2100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.071609] ==================================================================