Hay
Date
May 29, 2025, 7:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   21.899930] ==================================================================
[   21.900136] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   21.900308] Write of size 33 at addr fff00000c5e38980 by task kunit_try_catch/186
[   21.900495] 
[   21.900634] CPU: 1 UID: 0 PID: 186 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250529 #1 PREEMPT 
[   21.900935] Tainted: [B]=BAD_PAGE, [N]=TEST
[   21.901001] Hardware name: linux,dummy-virt (DT)
[   21.901089] Call trace:
[   21.901174]  show_stack+0x20/0x38 (C)
[   21.901360]  dump_stack_lvl+0x8c/0xd0
[   21.901491]  print_report+0x118/0x608
[   21.901606]  kasan_report+0xdc/0x128
[   21.901821]  kasan_check_range+0x100/0x1a8
[   21.902005]  __asan_memset+0x34/0x78
[   21.902170]  kmalloc_uaf_memset+0x170/0x310
[   21.902288]  kunit_try_run_case+0x170/0x3f0
[   21.902426]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.902583]  kthread+0x328/0x630
[   21.902712]  ret_from_fork+0x10/0x20
[   21.902851] 
[   21.902900] Allocated by task 186:
[   21.902961]  kasan_save_stack+0x3c/0x68
[   21.903139]  kasan_save_track+0x20/0x40
[   21.903227]  kasan_save_alloc_info+0x40/0x58
[   21.903305]  __kasan_kmalloc+0xd4/0xd8
[   21.903385]  __kmalloc_cache_noprof+0x15c/0x3c0
[   21.903485]  kmalloc_uaf_memset+0xb8/0x310
[   21.903573]  kunit_try_run_case+0x170/0x3f0
[   21.903672]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.903782]  kthread+0x328/0x630
[   21.903861]  ret_from_fork+0x10/0x20
[   21.903963] 
[   21.904027] Freed by task 186:
[   21.904124]  kasan_save_stack+0x3c/0x68
[   21.904206]  kasan_save_track+0x20/0x40
[   21.904295]  kasan_save_free_info+0x4c/0x78
[   21.904510]  __kasan_slab_free+0x6c/0x98
[   21.904648]  kfree+0x214/0x3c8
[   21.904730]  kmalloc_uaf_memset+0x11c/0x310
[   21.904838]  kunit_try_run_case+0x170/0x3f0
[   21.904988]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   21.905104]  kthread+0x328/0x630
[   21.905184]  ret_from_fork+0x10/0x20
[   21.905276] 
[   21.905341] The buggy address belongs to the object at fff00000c5e38980
[   21.905341]  which belongs to the cache kmalloc-64 of size 64
[   21.905580] The buggy address is located 0 bytes inside of
[   21.905580]  freed 64-byte region [fff00000c5e38980, fff00000c5e389c0)
[   21.905772] 
[   21.905845] The buggy address belongs to the physical page:
[   21.905926] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105e38
[   21.906152] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   21.906344] page_type: f5(slab)
[   21.906443] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   21.906562] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   21.906671] page dumped because: kasan: bad access detected
[   21.906759] 
[   21.906806] Memory state around the buggy address:
[   21.906951]  fff00000c5e38880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.907065]  fff00000c5e38900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.907167] >fff00000c5e38980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   21.907269]                    ^
[   21.907346]  fff00000c5e38a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.907475]  fff00000c5e38a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   21.907578] ==================================================================


[   11.131076] ==================================================================
[   11.131549] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   11.132065] Write of size 33 at addr ffff888102f99080 by task kunit_try_catch/203
[   11.132362] 
[   11.132566] CPU: 0 UID: 0 PID: 203 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250529 #1 PREEMPT(voluntary) 
[   11.132649] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.132663] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.132685] Call Trace:
[   11.132698]  <TASK>
[   11.132715]  dump_stack_lvl+0x73/0xb0
[   11.132745]  print_report+0xd1/0x650
[   11.132889]  ? __virt_addr_valid+0x1db/0x2d0
[   11.132915]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.132936]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.132959]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.132981]  kasan_report+0x141/0x180
[   11.133003]  ? kmalloc_uaf_memset+0x1a3/0x360
[   11.133030]  kasan_check_range+0x10c/0x1c0
[   11.133070]  __asan_memset+0x27/0x50
[   11.133091]  kmalloc_uaf_memset+0x1a3/0x360
[   11.133112]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   11.133135]  ? __schedule+0x10cc/0x2b60
[   11.133159]  ? __pfx_read_tsc+0x10/0x10
[   11.133180]  ? ktime_get_ts64+0x86/0x230
[   11.133205]  kunit_try_run_case+0x1a5/0x480
[   11.133227]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.133260]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.133285]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.133309]  ? __kthread_parkme+0x82/0x180
[   11.133329]  ? preempt_count_sub+0x50/0x80
[   11.133353]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.133374]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.133398]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.133422]  kthread+0x337/0x6f0
[   11.133441]  ? trace_preempt_on+0x20/0xc0
[   11.133465]  ? __pfx_kthread+0x10/0x10
[   11.133485]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.133507]  ? calculate_sigpending+0x7b/0xa0
[   11.133531]  ? __pfx_kthread+0x10/0x10
[   11.133552]  ret_from_fork+0x116/0x1d0
[   11.133570]  ? __pfx_kthread+0x10/0x10
[   11.133590]  ret_from_fork_asm+0x1a/0x30
[   11.133634]  </TASK>
[   11.133645] 
[   11.143456] Allocated by task 203:
[   11.143604]  kasan_save_stack+0x45/0x70
[   11.144017]  kasan_save_track+0x18/0x40
[   11.144248]  kasan_save_alloc_info+0x3b/0x50
[   11.144501]  __kasan_kmalloc+0xb7/0xc0
[   11.144738]  __kmalloc_cache_noprof+0x189/0x420
[   11.144992]  kmalloc_uaf_memset+0xa9/0x360
[   11.145354]  kunit_try_run_case+0x1a5/0x480
[   11.146084]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.146303]  kthread+0x337/0x6f0
[   11.146477]  ret_from_fork+0x116/0x1d0
[   11.146707]  ret_from_fork_asm+0x1a/0x30
[   11.147253] 
[   11.147384] Freed by task 203:
[   11.147555]  kasan_save_stack+0x45/0x70
[   11.148026]  kasan_save_track+0x18/0x40
[   11.148241]  kasan_save_free_info+0x3f/0x60
[   11.148575]  __kasan_slab_free+0x56/0x70
[   11.148798]  kfree+0x222/0x3f0
[   11.149089]  kmalloc_uaf_memset+0x12b/0x360
[   11.149445]  kunit_try_run_case+0x1a5/0x480
[   11.149672]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.150250]  kthread+0x337/0x6f0
[   11.150540]  ret_from_fork+0x116/0x1d0
[   11.150939]  ret_from_fork_asm+0x1a/0x30
[   11.151261] 
[   11.151380] The buggy address belongs to the object at ffff888102f99080
[   11.151380]  which belongs to the cache kmalloc-64 of size 64
[   11.152208] The buggy address is located 0 bytes inside of
[   11.152208]  freed 64-byte region [ffff888102f99080, ffff888102f990c0)
[   11.152985] 
[   11.153090] The buggy address belongs to the physical page:
[   11.153477] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102f99
[   11.154069] flags: 0x200000000000000(node=0|zone=2)
[   11.154301] page_type: f5(slab)
[   11.154473] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   11.154957] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   11.155261] page dumped because: kasan: bad access detected
[   11.155524] 
[   11.155623] Memory state around the buggy address:
[   11.155804]  ffff888102f98f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.156212]  ffff888102f99000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.156506] >ffff888102f99080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   11.156794]                    ^
[   11.157050]  ffff888102f99100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.157327]  ffff888102f99180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.157598] ==================================================================