Hay
Date
June 16, 2025, 7:07 a.m.

Environment
qemu-arm64
qemu-x86_64

[   19.986527] ==================================================================
[   19.986675] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   19.986857] Read of size 8 at addr fff00000c6406ac0 by task kunit_try_catch/209
[   19.987009] 
[   19.987122] CPU: 0 UID: 0 PID: 209 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250616 #1 PREEMPT 
[   19.987340] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.987406] Hardware name: linux,dummy-virt (DT)
[   19.987482] Call trace:
[   19.987610]  show_stack+0x20/0x38 (C)
[   19.987821]  dump_stack_lvl+0x8c/0xd0
[   19.988013]  print_report+0x118/0x608
[   19.988128]  kasan_report+0xdc/0x128
[   19.988239]  __asan_report_load8_noabort+0x20/0x30
[   19.988710]  workqueue_uaf+0x480/0x4a8
[   19.988864]  kunit_try_run_case+0x170/0x3f0
[   19.988974]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.989117]  kthread+0x328/0x630
[   19.989208]  ret_from_fork+0x10/0x20
[   19.989543] 
[   19.989615] Allocated by task 209:
[   19.989701]  kasan_save_stack+0x3c/0x68
[   19.989787]  kasan_save_track+0x20/0x40
[   19.989920]  kasan_save_alloc_info+0x40/0x58
[   19.990009]  __kasan_kmalloc+0xd4/0xd8
[   19.990126]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.990253]  workqueue_uaf+0x13c/0x4a8
[   19.990344]  kunit_try_run_case+0x170/0x3f0
[   19.990448]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.990580]  kthread+0x328/0x630
[   19.990657]  ret_from_fork+0x10/0x20
[   19.990777] 
[   19.990849] Freed by task 76:
[   19.990939]  kasan_save_stack+0x3c/0x68
[   19.991060]  kasan_save_track+0x20/0x40
[   19.991176]  kasan_save_free_info+0x4c/0x78
[   19.991268]  __kasan_slab_free+0x6c/0x98
[   19.991359]  kfree+0x214/0x3c8
[   19.991435]  workqueue_uaf_work+0x18/0x30
[   19.991521]  process_one_work+0x530/0xf98
[   19.991612]  worker_thread+0x618/0xf38
[   19.991694]  kthread+0x328/0x630
[   19.991773]  ret_from_fork+0x10/0x20
[   19.991866] 
[   19.991910] Last potentially related work creation:
[   19.991963]  kasan_save_stack+0x3c/0x68
[   19.992316]  kasan_record_aux_stack+0xb4/0xc8
[   19.992500]  __queue_work+0x65c/0xfe0
[   19.992587]  queue_work_on+0xbc/0xf8
[   19.992668]  workqueue_uaf+0x210/0x4a8
[   19.992751]  kunit_try_run_case+0x170/0x3f0
[   19.993996]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.994117]  kthread+0x328/0x630
[   19.994202]  ret_from_fork+0x10/0x20
[   19.994382] 
[   19.994444] The buggy address belongs to the object at fff00000c6406ac0
[   19.994444]  which belongs to the cache kmalloc-32 of size 32
[   19.994599] The buggy address is located 0 bytes inside of
[   19.994599]  freed 32-byte region [fff00000c6406ac0, fff00000c6406ae0)
[   19.994789] 
[   19.994860] The buggy address belongs to the physical page:
[   19.994964] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106406
[   19.995103] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.995227] page_type: f5(slab)
[   19.995337] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   19.995473] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   19.995583] page dumped because: kasan: bad access detected
[   19.995667] 
[   19.995712] Memory state around the buggy address:
[   19.996408]  fff00000c6406980: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   19.996989]  fff00000c6406a00: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   19.997200] >fff00000c6406a80: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   19.997456]                                            ^
[   19.997576]  fff00000c6406b00: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.997990]  fff00000c6406b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.998167] ==================================================================

[   12.089095] ==================================================================
[   12.089499] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   12.090106] Read of size 8 at addr ffff888102a266c0 by task kunit_try_catch/225
[   12.090469] 
[   12.090588] CPU: 0 UID: 0 PID: 225 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc2-next-20250616 #1 PREEMPT(voluntary) 
[   12.090636] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.090648] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.090667] Call Trace:
[   12.090680]  <TASK>
[   12.090696]  dump_stack_lvl+0x73/0xb0
[   12.090726]  print_report+0xd1/0x650
[   12.090748]  ? __virt_addr_valid+0x1db/0x2d0
[   12.090769]  ? workqueue_uaf+0x4d6/0x560
[   12.090790]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.090811]  ? workqueue_uaf+0x4d6/0x560
[   12.090831]  kasan_report+0x141/0x180
[   12.090851]  ? workqueue_uaf+0x4d6/0x560
[   12.090876]  __asan_report_load8_noabort+0x18/0x20
[   12.090899]  workqueue_uaf+0x4d6/0x560
[   12.090920]  ? __pfx_workqueue_uaf+0x10/0x10
[   12.090953]  ? __schedule+0x10cc/0x2b60
[   12.090974]  ? __pfx_read_tsc+0x10/0x10
[   12.090995]  ? ktime_get_ts64+0x86/0x230
[   12.091020]  kunit_try_run_case+0x1a5/0x480
[   12.091043]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.091064]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.091085]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.091106]  ? __kthread_parkme+0x82/0x180
[   12.091126]  ? preempt_count_sub+0x50/0x80
[   12.091149]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.091172]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.091193]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.091215]  kthread+0x337/0x6f0
[   12.091234]  ? trace_preempt_on+0x20/0xc0
[   12.091257]  ? __pfx_kthread+0x10/0x10
[   12.091277]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.091296]  ? calculate_sigpending+0x7b/0xa0
[   12.091320]  ? __pfx_kthread+0x10/0x10
[   12.091341]  ret_from_fork+0x116/0x1d0
[   12.091358]  ? __pfx_kthread+0x10/0x10
[   12.091377]  ret_from_fork_asm+0x1a/0x30
[   12.091596]  </TASK>
[   12.091611] 
[   12.099195] Allocated by task 225:
[   12.099349]  kasan_save_stack+0x45/0x70
[   12.099495]  kasan_save_track+0x18/0x40
[   12.099723]  kasan_save_alloc_info+0x3b/0x50
[   12.099957]  __kasan_kmalloc+0xb7/0xc0
[   12.100142]  __kmalloc_cache_noprof+0x189/0x420
[   12.100340]  workqueue_uaf+0x152/0x560
[   12.100879]  kunit_try_run_case+0x1a5/0x480
[   12.101047]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.101225]  kthread+0x337/0x6f0
[   12.101961]  ret_from_fork+0x116/0x1d0
[   12.102444]  ret_from_fork_asm+0x1a/0x30
[   12.103058] 
[   12.103224] Freed by task 9:
[   12.103332]  kasan_save_stack+0x45/0x70
[   12.103474]  kasan_save_track+0x18/0x40
[   12.103603]  kasan_save_free_info+0x3f/0x60
[   12.103742]  __kasan_slab_free+0x56/0x70
[   12.103869]  kfree+0x222/0x3f0
[   12.104564]  workqueue_uaf_work+0x12/0x20
[   12.105423]  process_one_work+0x5ee/0xf60
[   12.106002]  worker_thread+0x758/0x1220
[   12.106509]  kthread+0x337/0x6f0
[   12.106703]  ret_from_fork+0x116/0x1d0
[   12.107844]  ret_from_fork_asm+0x1a/0x30
[   12.108267] 
[   12.108509] Last potentially related work creation:
[   12.108690]  kasan_save_stack+0x45/0x70
[   12.108927]  kasan_record_aux_stack+0xb2/0xc0
[   12.109140]  __queue_work+0x61a/0xe70
[   12.109370]  queue_work_on+0xb6/0xc0
[   12.109760]  workqueue_uaf+0x26d/0x560
[   12.109948]  kunit_try_run_case+0x1a5/0x480
[   12.110119]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.110368]  kthread+0x337/0x6f0
[   12.110593]  ret_from_fork+0x116/0x1d0
[   12.110726]  ret_from_fork_asm+0x1a/0x30
[   12.110915] 
[   12.111077] The buggy address belongs to the object at ffff888102a266c0
[   12.111077]  which belongs to the cache kmalloc-32 of size 32
[   12.112091] The buggy address is located 0 bytes inside of
[   12.112091]  freed 32-byte region [ffff888102a266c0, ffff888102a266e0)
[   12.112685] 
[   12.112869] The buggy address belongs to the physical page:
[   12.113254] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a26
[   12.113768] flags: 0x200000000000000(node=0|zone=2)
[   12.114051] page_type: f5(slab)
[   12.114213] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   12.114609] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   12.114941] page dumped because: kasan: bad access detected
[   12.115125] 
[   12.115213] Memory state around the buggy address:
[   12.115493]  ffff888102a26580: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   12.115801]  ffff888102a26600: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   12.116132] >ffff888102a26680: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   12.116414]                                            ^
[   12.116646]  ffff888102a26700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.117051]  ffff888102a26780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.117340] ==================================================================