Hay
Date
July 8, 2025, 11:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   31.248205] ==================================================================
[   31.248302] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x300/0x338
[   31.248547] Read of size 1 at addr fff00000c79816a8 by task kunit_try_catch/215
[   31.248604] 
[   31.248643] CPU: 0 UID: 0 PID: 215 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250708 #1 PREEMPT 
[   31.249088] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.249122] Hardware name: linux,dummy-virt (DT)
[   31.249314] Call trace:
[   31.249437]  show_stack+0x20/0x38 (C)
[   31.249683]  dump_stack_lvl+0x8c/0xd0
[   31.249803]  print_report+0x118/0x5d0
[   31.249851]  kasan_report+0xdc/0x128
[   31.249942]  __asan_report_load1_noabort+0x20/0x30
[   31.250031]  kmalloc_uaf+0x300/0x338
[   31.250076]  kunit_try_run_case+0x170/0x3f0
[   31.250165]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.250231]  kthread+0x328/0x630
[   31.250272]  ret_from_fork+0x10/0x20
[   31.250854] 
[   31.250887] Allocated by task 215:
[   31.250922]  kasan_save_stack+0x3c/0x68
[   31.250971]  kasan_save_track+0x20/0x40
[   31.251010]  kasan_save_alloc_info+0x40/0x58
[   31.251534]  __kasan_kmalloc+0xd4/0xd8
[   31.251637]  __kmalloc_cache_noprof+0x16c/0x3c0
[   31.251698]  kmalloc_uaf+0xb8/0x338
[   31.251734]  kunit_try_run_case+0x170/0x3f0
[   31.251775]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.251826]  kthread+0x328/0x630
[   31.251929]  ret_from_fork+0x10/0x20
[   31.251966] 
[   31.251986] Freed by task 215:
[   31.252013]  kasan_save_stack+0x3c/0x68
[   31.252092]  kasan_save_track+0x20/0x40
[   31.252253]  kasan_save_free_info+0x4c/0x78
[   31.252303]  __kasan_slab_free+0x6c/0x98
[   31.252443]  kfree+0x214/0x3c8
[   31.252483]  kmalloc_uaf+0x11c/0x338
[   31.252866]  kunit_try_run_case+0x170/0x3f0
[   31.252916]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.252968]  kthread+0x328/0x630
[   31.253001]  ret_from_fork+0x10/0x20
[   31.253416] 
[   31.253439] The buggy address belongs to the object at fff00000c79816a0
[   31.253439]  which belongs to the cache kmalloc-16 of size 16
[   31.253711] The buggy address is located 8 bytes inside of
[   31.253711]  freed 16-byte region [fff00000c79816a0, fff00000c79816b0)
[   31.253790] 
[   31.253813] The buggy address belongs to the physical page:
[   31.253846] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107981
[   31.253903] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.253954] page_type: f5(slab)
[   31.253997] raw: 0bfffe0000000000 fff00000c0001640 dead000000000122 0000000000000000
[   31.254047] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   31.254099] page dumped because: kasan: bad access detected
[   31.254131] 
[   31.254149] Memory state around the buggy address:
[   31.254542]  fff00000c7981580: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   31.254790]  fff00000c7981600: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   31.254881] >fff00000c7981680: fa fb fc fc fa fb fc fc fc fc fc fc fc fc fc fc
[   31.254954]                                   ^
[   31.255010]  fff00000c7981700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.255051]  fff00000c7981780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.255111] ==================================================================

[   23.592463] ==================================================================
[   23.593216] BUG: KASAN: slab-use-after-free in kmalloc_uaf+0x320/0x380
[   23.593458] Read of size 1 at addr ffff8881025fe5e8 by task kunit_try_catch/232
[   23.593676] 
[   23.593773] CPU: 1 UID: 0 PID: 232 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc5-next-20250708 #1 PREEMPT(voluntary) 
[   23.593826] Tainted: [B]=BAD_PAGE, [N]=TEST
[   23.593838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   23.593862] Call Trace:
[   23.593876]  <TASK>
[   23.593896]  dump_stack_lvl+0x73/0xb0
[   23.593927]  print_report+0xd1/0x610
[   23.593950]  ? __virt_addr_valid+0x1db/0x2d0
[   23.593976]  ? kmalloc_uaf+0x320/0x380
[   23.593996]  ? kasan_complete_mode_report_info+0x64/0x200
[   23.594024]  ? kmalloc_uaf+0x320/0x380
[   23.594045]  kasan_report+0x141/0x180
[   23.594067]  ? kmalloc_uaf+0x320/0x380
[   23.594092]  __asan_report_load1_noabort+0x18/0x20
[   23.594119]  kmalloc_uaf+0x320/0x380
[   23.594139]  ? __pfx_kmalloc_uaf+0x10/0x10
[   23.594160]  ? __schedule+0x10cc/0x2b60
[   23.594188]  ? __pfx_read_tsc+0x10/0x10
[   23.594214]  ? ktime_get_ts64+0x86/0x230
[   23.594715]  kunit_try_run_case+0x1a5/0x480
[   23.595049]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.595075]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   23.595099]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   23.595128]  ? __kthread_parkme+0x82/0x180
[   23.595150]  ? preempt_count_sub+0x50/0x80
[   23.595191]  ? __pfx_kunit_try_run_case+0x10/0x10
[   23.595214]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.595252]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   23.595279]  kthread+0x337/0x6f0
[   23.595300]  ? trace_preempt_on+0x20/0xc0
[   23.595326]  ? __pfx_kthread+0x10/0x10
[   23.595348]  ? _raw_spin_unlock_irq+0x47/0x80
[   23.595376]  ? calculate_sigpending+0x7b/0xa0
[   23.595403]  ? __pfx_kthread+0x10/0x10
[   23.595427]  ret_from_fork+0x116/0x1d0
[   23.595446]  ? __pfx_kthread+0x10/0x10
[   23.595468]  ret_from_fork_asm+0x1a/0x30
[   23.595502]  </TASK>
[   23.595514] 
[   23.608926] Allocated by task 232:
[   23.609472]  kasan_save_stack+0x45/0x70
[   23.610079]  kasan_save_track+0x18/0x40
[   23.610609]  kasan_save_alloc_info+0x3b/0x50
[   23.611135]  __kasan_kmalloc+0xb7/0xc0
[   23.611547]  __kmalloc_cache_noprof+0x189/0x420
[   23.612101]  kmalloc_uaf+0xaa/0x380
[   23.612493]  kunit_try_run_case+0x1a5/0x480
[   23.613016]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.613840]  kthread+0x337/0x6f0
[   23.614094]  ret_from_fork+0x116/0x1d0
[   23.614230]  ret_from_fork_asm+0x1a/0x30
[   23.614377] 
[   23.614443] Freed by task 232:
[   23.614550]  kasan_save_stack+0x45/0x70
[   23.614678]  kasan_save_track+0x18/0x40
[   23.615135]  kasan_save_free_info+0x3f/0x60
[   23.615586]  __kasan_slab_free+0x56/0x70
[   23.616160]  kfree+0x222/0x3f0
[   23.616522]  kmalloc_uaf+0x12c/0x380
[   23.617028]  kunit_try_run_case+0x1a5/0x480
[   23.617480]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   23.618090]  kthread+0x337/0x6f0
[   23.618449]  ret_from_fork+0x116/0x1d0
[   23.618837]  ret_from_fork_asm+0x1a/0x30
[   23.619217] 
[   23.619298] The buggy address belongs to the object at ffff8881025fe5e0
[   23.619298]  which belongs to the cache kmalloc-16 of size 16
[   23.619650] The buggy address is located 8 bytes inside of
[   23.619650]  freed 16-byte region [ffff8881025fe5e0, ffff8881025fe5f0)
[   23.620677] 
[   23.620875] The buggy address belongs to the physical page:
[   23.621589] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1025fe
[   23.622658] flags: 0x200000000000000(node=0|zone=2)
[   23.623150] page_type: f5(slab)
[   23.623336] raw: 0200000000000000 ffff888100041640 dead000000000100 dead000000000122
[   23.623562] raw: 0000000000000000 0000000080800080 00000000f5000000 0000000000000000
[   23.623862] page dumped because: kasan: bad access detected
[   23.624114] 
[   23.624205] Memory state around the buggy address:
[   23.624412]  ffff8881025fe480: 00 06 fc fc 00 06 fc fc fa fb fc fc fa fb fc fc
[   23.624699]  ffff8881025fe500: 00 00 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   23.625115] >ffff8881025fe580: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
[   23.625406]                                                           ^
[   23.625676]  ffff8881025fe600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.626038]  ffff8881025fe680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   23.626354] ==================================================================