Hay
Date
July 8, 2025, 7:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   19.394882] ==================================================================
[   19.395001] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   19.395139] Read of size 1 at addr fff00000c564f368 by task kunit_try_catch/184
[   19.395202] 
[   19.395533] CPU: 1 UID: 0 PID: 184 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT 
[   19.395867] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.395901] Hardware name: linux,dummy-virt (DT)
[   19.396217] Call trace:
[   19.396349]  show_stack+0x20/0x38 (C)
[   19.396487]  dump_stack_lvl+0x8c/0xd0
[   19.396545]  print_report+0x118/0x608
[   19.396644]  kasan_report+0xdc/0x128
[   19.396784]  __asan_report_load1_noabort+0x20/0x30
[   19.397300]  kmalloc_uaf+0x300/0x338
[   19.397454]  kunit_try_run_case+0x170/0x3f0
[   19.397559]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.397752]  kthread+0x328/0x630
[   19.397905]  ret_from_fork+0x10/0x20
[   19.398204] 
[   19.398288] Allocated by task 184:
[   19.398320]  kasan_save_stack+0x3c/0x68
[   19.398384]  kasan_save_track+0x20/0x40
[   19.398422]  kasan_save_alloc_info+0x40/0x58
[   19.398467]  __kasan_kmalloc+0xd4/0xd8
[   19.398516]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.398553]  kmalloc_uaf+0xb8/0x338
[   19.398586]  kunit_try_run_case+0x170/0x3f0
[   19.398622]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.398665]  kthread+0x328/0x630
[   19.398697]  ret_from_fork+0x10/0x20
[   19.398750] 
[   19.398770] Freed by task 184:
[   19.398804]  kasan_save_stack+0x3c/0x68
[   19.398841]  kasan_save_track+0x20/0x40
[   19.398892]  kasan_save_free_info+0x4c/0x78
[   19.398931]  __kasan_slab_free+0x6c/0x98
[   19.398968]  kfree+0x214/0x3c8
[   19.399020]  kmalloc_uaf+0x11c/0x338
[   19.399064]  kunit_try_run_case+0x170/0x3f0
[   19.399101]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.399169]  kthread+0x328/0x630
[   19.399230]  ret_from_fork+0x10/0x20
[   19.399275] 
[   19.399301] The buggy address belongs to the object at fff00000c564f360
[   19.399301]  which belongs to the cache kmalloc-16 of size 16
[   19.399358] The buggy address is located 8 bytes inside of
[   19.399358]  freed 16-byte region [fff00000c564f360, fff00000c564f370)
[   19.399418] 
[   19.399438] The buggy address belongs to the physical page:
[   19.399469] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10564f
[   19.399695] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.400365] page_type: f5(slab)
[   19.400495] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   19.400626] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   19.400694] page dumped because: kasan: bad access detected
[   19.400848] 
[   19.400899] Memory state around the buggy address:
[   19.401288]  fff00000c564f200: fa fb fc fc fa fb fc fc 00 01 fc fc fa fb fc fc
[   19.401456]  fff00000c564f280: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.401538] >fff00000c564f300: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   19.401697]                                                           ^
[   19.401760]  fff00000c564f380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.401802]  fff00000c564f400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.401998] ==================================================================

[   13.167412] ==================================================================
[   13.168115] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   13.168767] Read of size 1 at addr ffff88810256a328 by task kunit_try_catch/201
[   13.169283] 
[   13.169467] CPU: 1 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5 #1 PREEMPT(voluntary) 
[   13.169513] Tainted: [B]=BAD_PAGE, [N]=TEST
[   13.169524] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   13.169544] Call Trace:
[   13.169566]  <TASK>
[   13.169581]  dump_stack_lvl+0x73/0xb0
[   13.169610]  print_report+0xd1/0x650
[   13.169631]  ? __virt_addr_valid+0x1db/0x2d0
[   13.169703]  ? kmalloc_uaf+0x320/0x380
[   13.169724]  ? kasan_complete_mode_report_info+0x64/0x200
[   13.169760]  ? kmalloc_uaf+0x320/0x380
[   13.169780]  kasan_report+0x141/0x180
[   13.169800]  ? kmalloc_uaf+0x320/0x380
[   13.169825]  __asan_report_load1_noabort+0x18/0x20
[   13.169848]  kmalloc_uaf+0x320/0x380
[   13.169866]  ? __pfx_kmalloc_uaf+0x10/0x10
[   13.169886]  ? __schedule+0x10cc/0x2b60
[   13.169908]  ? __pfx_read_tsc+0x10/0x10
[   13.169928]  ? ktime_get_ts64+0x86/0x230
[   13.169951]  kunit_try_run_case+0x1a5/0x480
[   13.169973]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.169994]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   13.170016]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   13.170038]  ? __kthread_parkme+0x82/0x180
[   13.170068]  ? preempt_count_sub+0x50/0x80
[   13.170091]  ? __pfx_kunit_try_run_case+0x10/0x10
[   13.170114]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.170136]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   13.170158]  kthread+0x337/0x6f0
[   13.170176]  ? trace_preempt_on+0x20/0xc0
[   13.170197]  ? __pfx_kthread+0x10/0x10
[   13.170217]  ? _raw_spin_unlock_irq+0x47/0x80
[   13.170237]  ? calculate_sigpending+0x7b/0xa0
[   13.170260]  ? __pfx_kthread+0x10/0x10
[   13.170281]  ret_from_fork+0x116/0x1d0
[   13.170298]  ? __pfx_kthread+0x10/0x10
[   13.170317]  ret_from_fork_asm+0x1a/0x30
[   13.170347]  </TASK>
[   13.170358] 
[   13.179684] Allocated by task 201:
[   13.179891]  kasan_save_stack+0x45/0x70
[   13.180057]  kasan_save_track+0x18/0x40
[   13.180201]  kasan_save_alloc_info+0x3b/0x50
[   13.180749]  __kasan_kmalloc+0xb7/0xc0
[   13.180975]  __kmalloc_cache_noprof+0x189/0x420
[   13.181198]  kmalloc_uaf+0xaa/0x380
[   13.181522]  kunit_try_run_case+0x1a5/0x480
[   13.181831]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.182206]  kthread+0x337/0x6f0
[   13.182498]  ret_from_fork+0x116/0x1d0
[   13.182660]  ret_from_fork_asm+0x1a/0x30
[   13.183018] 
[   13.183252] Freed by task 201:
[   13.183396]  kasan_save_stack+0x45/0x70
[   13.183626]  kasan_save_track+0x18/0x40
[   13.183916]  kasan_save_free_info+0x3f/0x60
[   13.184322]  __kasan_slab_free+0x56/0x70
[   13.184609]  kfree+0x222/0x3f0
[   13.184850]  kmalloc_uaf+0x12c/0x380
[   13.185002]  kunit_try_run_case+0x1a5/0x480
[   13.185313]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   13.185820]  kthread+0x337/0x6f0
[   13.185996]  ret_from_fork+0x116/0x1d0
[   13.186246]  ret_from_fork_asm+0x1a/0x30
[   13.186535] 
[   13.186727] The buggy address belongs to the object at ffff88810256a320
[   13.186727]  which belongs to the cache kmalloc-16 of size 16
[   13.187236] The buggy address is located 8 bytes inside of
[   13.187236]  freed 16-byte region [ffff88810256a320, ffff88810256a330)
[   13.187943] 
[   13.188057] The buggy address belongs to the physical page:
[   13.188522] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10256a
[   13.188946] flags: 0x200000000000000(node=0|zone=2)
[   13.189335] page_type: f5(slab)
[   13.189556] raw: 0200000000000000 ffff888100041640 dead000000000122 0000000000000000
[   13.189940] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   13.190404] page dumped because: kasan: bad access detected
[   13.190853] 
[   13.190934] Memory state around the buggy address:
[   13.191215]  ffff88810256a200: 00 02 fc fc 00 02 fc fc 00 02 fc fc fa fb fc fc
[   13.191761]  ffff88810256a280: fa fb fc fc fa fb fc fc 00 05 fc fc fa fb fc fc
[   13.192228] >ffff88810256a300: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   13.192754]                                   ^
[   13.192975]  ffff88810256a380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.193561]  ffff88810256a400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   13.193969] ==================================================================