Hay
Date
July 1, 2025, 12:10 a.m.

Environment
qemu-arm64
qemu-x86_64

[   17.977830] ==================================================================
[   17.978573] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   17.978651] Read of size 8 at addr fff00000c781c8c0 by task kunit_try_catch/200
[   17.978703] 
[   17.978739] CPU: 1 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   17.978826] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.978853] Hardware name: linux,dummy-virt (DT)
[   17.979462] Call trace:
[   17.979505]  show_stack+0x20/0x38 (C)
[   17.979561]  dump_stack_lvl+0x8c/0xd0
[   17.979989]  print_report+0x118/0x608
[   17.980256]  kasan_report+0xdc/0x128
[   17.980482]  __asan_report_load8_noabort+0x20/0x30
[   17.980698]  workqueue_uaf+0x480/0x4a8
[   17.981145]  kunit_try_run_case+0x170/0x3f0
[   17.981394]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.981733]  kthread+0x328/0x630
[   17.982017]  ret_from_fork+0x10/0x20
[   17.982304] 
[   17.982332] Allocated by task 200:
[   17.982584]  kasan_save_stack+0x3c/0x68
[   17.982744]  kasan_save_track+0x20/0x40
[   17.982918]  kasan_save_alloc_info+0x40/0x58
[   17.983142]  __kasan_kmalloc+0xd4/0xd8
[   17.983357]  __kmalloc_cache_noprof+0x16c/0x3c0
[   17.983558]  workqueue_uaf+0x13c/0x4a8
[   17.983793]  kunit_try_run_case+0x170/0x3f0
[   17.983936]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.984159]  kthread+0x328/0x630
[   17.984397]  ret_from_fork+0x10/0x20
[   17.984472] 
[   17.984762] Freed by task 47:
[   17.984928]  kasan_save_stack+0x3c/0x68
[   17.985039]  kasan_save_track+0x20/0x40
[   17.985080]  kasan_save_free_info+0x4c/0x78
[   17.985383]  __kasan_slab_free+0x6c/0x98
[   17.985596]  kfree+0x214/0x3c8
[   17.985889]  workqueue_uaf_work+0x18/0x30
[   17.986151]  process_one_work+0x530/0xf98
[   17.986675]  worker_thread+0x618/0xf38
[   17.986765]  kthread+0x328/0x630
[   17.987004]  ret_from_fork+0x10/0x20
[   17.987255] 
[   17.987284] Last potentially related work creation:
[   17.987320]  kasan_save_stack+0x3c/0x68
[   17.987715]  kasan_record_aux_stack+0xb4/0xc8
[   17.988021]  __queue_work+0x65c/0x1008
[   17.988392]  queue_work_on+0xbc/0xf8
[   17.988477]  workqueue_uaf+0x210/0x4a8
[   17.988651]  kunit_try_run_case+0x170/0x3f0
[   17.988998]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.989386]  kthread+0x328/0x630
[   17.989499]  ret_from_fork+0x10/0x20
[   17.989542] 
[   17.989562] The buggy address belongs to the object at fff00000c781c8c0
[   17.989562]  which belongs to the cache kmalloc-32 of size 32
[   17.990038] The buggy address is located 0 bytes inside of
[   17.990038]  freed 32-byte region [fff00000c781c8c0, fff00000c781c8e0)
[   17.990265] 
[   17.990321] The buggy address belongs to the physical page:
[   17.990838] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10781c
[   17.991078] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.991515] page_type: f5(slab)
[   17.991578] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   17.991974] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   17.992125] page dumped because: kasan: bad access detected
[   17.992439] 
[   17.992499] Memory state around the buggy address:
[   17.992667]  fff00000c781c780: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   17.992992]  fff00000c781c800: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   17.993378] >fff00000c781c880: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   17.993423]                                            ^
[   17.993865]  fff00000c781c900: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.994175]  fff00000c781c980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.994486] ==================================================================

[   12.049319] ==================================================================
[   12.049729] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   12.050040] Read of size 8 at addr ffff88810390b2c0 by task kunit_try_catch/217
[   12.050483] 
[   12.050584] CPU: 1 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   12.050626] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.050638] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.050657] Call Trace:
[   12.050668]  <TASK>
[   12.050683]  dump_stack_lvl+0x73/0xb0
[   12.050711]  print_report+0xd1/0x650
[   12.050732]  ? __virt_addr_valid+0x1db/0x2d0
[   12.050753]  ? workqueue_uaf+0x4d6/0x560
[   12.050773]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.050794]  ? workqueue_uaf+0x4d6/0x560
[   12.050815]  kasan_report+0x141/0x180
[   12.050835]  ? workqueue_uaf+0x4d6/0x560
[   12.050860]  __asan_report_load8_noabort+0x18/0x20
[   12.050883]  workqueue_uaf+0x4d6/0x560
[   12.050903]  ? __pfx_workqueue_uaf+0x10/0x10
[   12.050924]  ? __schedule+0x10cc/0x2b60
[   12.050944]  ? __pfx_read_tsc+0x10/0x10
[   12.050964]  ? ktime_get_ts64+0x86/0x230
[   12.050987]  kunit_try_run_case+0x1a5/0x480
[   12.051009]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.051048]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.051072]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   12.051095]  ? __kthread_parkme+0x82/0x180
[   12.051114]  ? preempt_count_sub+0x50/0x80
[   12.051138]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.051161]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.051183]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.051204]  kthread+0x337/0x6f0
[   12.051222]  ? trace_preempt_on+0x20/0xc0
[   12.051244]  ? __pfx_kthread+0x10/0x10
[   12.051263]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.051283]  ? calculate_sigpending+0x7b/0xa0
[   12.051305]  ? __pfx_kthread+0x10/0x10
[   12.051325]  ret_from_fork+0x116/0x1d0
[   12.051342]  ? __pfx_kthread+0x10/0x10
[   12.051362]  ret_from_fork_asm+0x1a/0x30
[   12.051392]  </TASK>
[   12.051402] 
[   12.061352] Allocated by task 217:
[   12.061532]  kasan_save_stack+0x45/0x70
[   12.061824]  kasan_save_track+0x18/0x40
[   12.062049]  kasan_save_alloc_info+0x3b/0x50
[   12.062425]  __kasan_kmalloc+0xb7/0xc0
[   12.062719]  __kmalloc_cache_noprof+0x189/0x420
[   12.062933]  workqueue_uaf+0x152/0x560
[   12.063386]  kunit_try_run_case+0x1a5/0x480
[   12.063596]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.063896]  kthread+0x337/0x6f0
[   12.064039]  ret_from_fork+0x116/0x1d0
[   12.064501]  ret_from_fork_asm+0x1a/0x30
[   12.064776] 
[   12.064879] Freed by task 41:
[   12.065292]  kasan_save_stack+0x45/0x70
[   12.065597]  kasan_save_track+0x18/0x40
[   12.065807]  kasan_save_free_info+0x3f/0x60
[   12.066014]  __kasan_slab_free+0x56/0x70
[   12.066436]  kfree+0x222/0x3f0
[   12.066592]  workqueue_uaf_work+0x12/0x20
[   12.066957]  process_one_work+0x5ee/0xf60
[   12.067180]  worker_thread+0x758/0x1220
[   12.067364]  kthread+0x337/0x6f0
[   12.067515]  ret_from_fork+0x116/0x1d0
[   12.067696]  ret_from_fork_asm+0x1a/0x30
[   12.067861] 
[   12.067955] Last potentially related work creation:
[   12.068582]  kasan_save_stack+0x45/0x70
[   12.068730]  kasan_record_aux_stack+0xb2/0xc0
[   12.069116]  __queue_work+0x626/0xeb0
[   12.069534]  queue_work_on+0xb6/0xc0
[   12.069870]  workqueue_uaf+0x26d/0x560
[   12.070071]  kunit_try_run_case+0x1a5/0x480
[   12.070437]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.070802]  kthread+0x337/0x6f0
[   12.070931]  ret_from_fork+0x116/0x1d0
[   12.071438]  ret_from_fork_asm+0x1a/0x30
[   12.071727] 
[   12.071828] The buggy address belongs to the object at ffff88810390b2c0
[   12.071828]  which belongs to the cache kmalloc-32 of size 32
[   12.072745] The buggy address is located 0 bytes inside of
[   12.072745]  freed 32-byte region [ffff88810390b2c0, ffff88810390b2e0)
[   12.073411] 
[   12.073539] The buggy address belongs to the physical page:
[   12.073775] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10390b
[   12.074369] flags: 0x200000000000000(node=0|zone=2)
[   12.074564] page_type: f5(slab)
[   12.074795] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   12.075293] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   12.075621] page dumped because: kasan: bad access detected
[   12.075851] 
[   12.075934] Memory state around the buggy address:
[   12.076152]  ffff88810390b180: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   12.076749]  ffff88810390b200: fa fb fb fb fc fc fc fc 00 00 07 fc fc fc fc fc
[   12.077021] >ffff88810390b280: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   12.077506]                                            ^
[   12.077812]  ffff88810390b300: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.078094]  ffff88810390b380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.078539] ==================================================================