Hay
Date
June 5, 2025, 7:08 a.m.

Environment
qemu-arm64
qemu-x86_64

[   25.910567] ==================================================================
[   25.910855] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   25.911115] Read of size 8 at addr fff00000c7739440 by task kunit_try_catch/200
[   25.911378] 
[   25.911619] CPU: 0 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250605 #1 PREEMPT 
[   25.912106] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.912197] Hardware name: linux,dummy-virt (DT)
[   25.912290] Call trace:
[   25.912377]  show_stack+0x20/0x38 (C)
[   25.912497]  dump_stack_lvl+0x8c/0xd0
[   25.912563]  print_report+0x118/0x608
[   25.912623]  kasan_report+0xdc/0x128
[   25.912680]  __asan_report_load8_noabort+0x20/0x30
[   25.912741]  workqueue_uaf+0x480/0x4a8
[   25.912799]  kunit_try_run_case+0x170/0x3f0
[   25.912862]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.912928]  kthread+0x328/0x630
[   25.912982]  ret_from_fork+0x10/0x20
[   25.913039] 
[   25.913064] Allocated by task 200:
[   25.913097]  kasan_save_stack+0x3c/0x68
[   25.913151]  kasan_save_track+0x20/0x40
[   25.913198]  kasan_save_alloc_info+0x40/0x58
[   25.913249]  __kasan_kmalloc+0xd4/0xd8
[   25.913311]  __kmalloc_cache_noprof+0x16c/0x3c0
[   25.913520]  workqueue_uaf+0x13c/0x4a8
[   25.913729]  kunit_try_run_case+0x170/0x3f0
[   25.913881]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.914090]  kthread+0x328/0x630
[   25.914357]  ret_from_fork+0x10/0x20
[   25.914464] 
[   25.914516] Freed by task 9:
[   25.914585]  kasan_save_stack+0x3c/0x68
[   25.914687]  kasan_save_track+0x20/0x40
[   25.914819]  kasan_save_free_info+0x4c/0x78
[   25.915064]  __kasan_slab_free+0x6c/0x98
[   25.915198]  kfree+0x214/0x3c8
[   25.915288]  workqueue_uaf_work+0x18/0x30
[   25.915407]  process_one_work+0x530/0xf98
[   25.915561]  worker_thread+0x618/0xf38
[   25.916015]  kthread+0x328/0x630
[   25.916198]  ret_from_fork+0x10/0x20
[   25.916374] 
[   25.916469] Last potentially related work creation:
[   25.916647]  kasan_save_stack+0x3c/0x68
[   25.916782]  kasan_record_aux_stack+0xb4/0xc8
[   25.916952]  __queue_work+0x65c/0x1008
[   25.917068]  queue_work_on+0xbc/0xf8
[   25.917164]  workqueue_uaf+0x210/0x4a8
[   25.919374]  kunit_try_run_case+0x170/0x3f0
[   25.919493]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.919616]  kthread+0x328/0x630
[   25.919728]  ret_from_fork+0x10/0x20
[   25.919833] 
[   25.919883] The buggy address belongs to the object at fff00000c7739440
[   25.919883]  which belongs to the cache kmalloc-32 of size 32
[   25.920028] The buggy address is located 0 bytes inside of
[   25.920028]  freed 32-byte region [fff00000c7739440, fff00000c7739460)
[   25.920172] 
[   25.920225] The buggy address belongs to the physical page:
[   25.920301] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107739
[   25.920445] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   25.920565] page_type: f5(slab)
[   25.920657] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   25.920781] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   25.920887] page dumped because: kasan: bad access detected
[   25.920998] 
[   25.921057] Memory state around the buggy address:
[   25.921154]  fff00000c7739300: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   25.921289]  fff00000c7739380: 00 00 07 fc fc fc fc fc 00 00 00 07 fc fc fc fc
[   25.921429] >fff00000c7739400: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   25.921538]                                            ^
[   25.921639]  fff00000c7739480: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.921832]  fff00000c7739500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.921940] ==================================================================


[   12.022429] ==================================================================
[   12.022904] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   12.023199] Read of size 8 at addr ffff888102782600 by task kunit_try_catch/217
[   12.023537] 
[   12.023652] CPU: 1 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-next-20250605 #1 PREEMPT(voluntary) 
[   12.023696] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.023707] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.023728] Call Trace:
[   12.023739]  <TASK>
[   12.023770]  dump_stack_lvl+0x73/0xb0
[   12.023798]  print_report+0xd1/0x650
[   12.023819]  ? __virt_addr_valid+0x1db/0x2d0
[   12.023843]  ? workqueue_uaf+0x4d6/0x560
[   12.023863]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.023885]  ? workqueue_uaf+0x4d6/0x560
[   12.023917]  kasan_report+0x141/0x180
[   12.023938]  ? workqueue_uaf+0x4d6/0x560
[   12.024008]  __asan_report_load8_noabort+0x18/0x20
[   12.024029]  workqueue_uaf+0x4d6/0x560
[   12.024050]  ? __pfx_workqueue_uaf+0x10/0x10
[   12.024072]  ? __schedule+0x10cc/0x2b60
[   12.024095]  ? __pfx_read_tsc+0x10/0x10
[   12.024116]  ? ktime_get_ts64+0x86/0x230
[   12.024140]  kunit_try_run_case+0x1a5/0x480
[   12.024161]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.024180]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.024205]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.024228]  ? __kthread_parkme+0x82/0x180
[   12.024248]  ? preempt_count_sub+0x50/0x80
[   12.024271]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.024291]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.024315]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.024338]  kthread+0x337/0x6f0
[   12.024357]  ? trace_preempt_on+0x20/0xc0
[   12.024380]  ? __pfx_kthread+0x10/0x10
[   12.024399]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.024421]  ? calculate_sigpending+0x7b/0xa0
[   12.024445]  ? __pfx_kthread+0x10/0x10
[   12.024465]  ret_from_fork+0x116/0x1d0
[   12.024482]  ? __pfx_kthread+0x10/0x10
[   12.024502]  ret_from_fork_asm+0x1a/0x30
[   12.024532]  </TASK>
[   12.024543] 
[   12.032030] Allocated by task 217:
[   12.032186]  kasan_save_stack+0x45/0x70
[   12.032351]  kasan_save_track+0x18/0x40
[   12.032546]  kasan_save_alloc_info+0x3b/0x50
[   12.032733]  __kasan_kmalloc+0xb7/0xc0
[   12.032928]  __kmalloc_cache_noprof+0x189/0x420
[   12.033143]  workqueue_uaf+0x152/0x560
[   12.033312]  kunit_try_run_case+0x1a5/0x480
[   12.033502]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.033716]  kthread+0x337/0x6f0
[   12.034077]  ret_from_fork+0x116/0x1d0
[   12.034219]  ret_from_fork_asm+0x1a/0x30
[   12.034359] 
[   12.034456] Freed by task 44:
[   12.034606]  kasan_save_stack+0x45/0x70
[   12.034797]  kasan_save_track+0x18/0x40
[   12.034999]  kasan_save_free_info+0x3f/0x60
[   12.035316]  __kasan_slab_free+0x56/0x70
[   12.035469]  kfree+0x222/0x3f0
[   12.035586]  workqueue_uaf_work+0x12/0x20
[   12.035749]  process_one_work+0x5ee/0xf60
[   12.035995]  worker_thread+0x758/0x1220
[   12.036366]  kthread+0x337/0x6f0
[   12.036521]  ret_from_fork+0x116/0x1d0
[   12.036653]  ret_from_fork_asm+0x1a/0x30
[   12.036791] 
[   12.036862] Last potentially related work creation:
[   12.037025]  kasan_save_stack+0x45/0x70
[   12.037165]  kasan_record_aux_stack+0xb2/0xc0
[   12.037418]  __queue_work+0x626/0xeb0
[   12.037606]  queue_work_on+0xb6/0xc0
[   12.037792]  workqueue_uaf+0x26d/0x560
[   12.037996]  kunit_try_run_case+0x1a5/0x480
[   12.038387]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.038560]  kthread+0x337/0x6f0
[   12.038678]  ret_from_fork+0x116/0x1d0
[   12.038807]  ret_from_fork_asm+0x1a/0x30
[   12.039107] 
[   12.039206] The buggy address belongs to the object at ffff888102782600
[   12.039206]  which belongs to the cache kmalloc-32 of size 32
[   12.039905] The buggy address is located 0 bytes inside of
[   12.039905]  freed 32-byte region [ffff888102782600, ffff888102782620)
[   12.040435] 
[   12.040531] The buggy address belongs to the physical page:
[   12.040800] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102782
[   12.041141] flags: 0x200000000000000(node=0|zone=2)
[   12.041328] page_type: f5(slab)
[   12.041449] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   12.041976] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   12.042330] page dumped because: kasan: bad access detected
[   12.042587] 
[   12.042772] Memory state around the buggy address:
[   12.043026]  ffff888102782500: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   12.043310]  ffff888102782580: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   12.043608] >ffff888102782600: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   12.043919]                    ^
[   12.044099]  ffff888102782680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.044396]  ffff888102782700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.044711] ==================================================================