Hay
Date
July 5, 2025, 11:09 a.m.

Environment
qemu-arm64
qemu-x86_64

[   19.617381] ==================================================================
[   19.617580] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   19.617737] Read of size 8 at addr fff00000c78abf40 by task kunit_try_catch/201
[   19.617862] 
[   19.617941] CPU: 0 UID: 0 PID: 201 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT 
[   19.618146] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.618206] Hardware name: linux,dummy-virt (DT)
[   19.618278] Call trace:
[   19.618334]  show_stack+0x20/0x38 (C)
[   19.618518]  dump_stack_lvl+0x8c/0xd0
[   19.618622]  print_report+0x118/0x608
[   19.618733]  kasan_report+0xdc/0x128
[   19.618838]  __asan_report_load8_noabort+0x20/0x30
[   19.618909]  workqueue_uaf+0x480/0x4a8
[   19.619040]  kunit_try_run_case+0x170/0x3f0
[   19.619203]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.619313]  kthread+0x328/0x630
[   19.619411]  ret_from_fork+0x10/0x20
[   19.619823] 
[   19.619878] Allocated by task 201:
[   19.619936]  kasan_save_stack+0x3c/0x68
[   19.620136]  kasan_save_track+0x20/0x40
[   19.620378]  kasan_save_alloc_info+0x40/0x58
[   19.620637]  __kasan_kmalloc+0xd4/0xd8
[   19.620726]  __kmalloc_cache_noprof+0x16c/0x3c0
[   19.620823]  workqueue_uaf+0x13c/0x4a8
[   19.621162]  kunit_try_run_case+0x170/0x3f0
[   19.621326]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.621437]  kthread+0x328/0x630
[   19.621705]  ret_from_fork+0x10/0x20
[   19.621885] 
[   19.621938] Freed by task 9:
[   19.622003]  kasan_save_stack+0x3c/0x68
[   19.622076]  kasan_save_track+0x20/0x40
[   19.622155]  kasan_save_free_info+0x4c/0x78
[   19.622241]  __kasan_slab_free+0x6c/0x98
[   19.622333]  kfree+0x214/0x3c8
[   19.622430]  workqueue_uaf_work+0x18/0x30
[   19.622775]  process_one_work+0x530/0xf98
[   19.622880]  worker_thread+0x618/0xf38
[   19.623051]  kthread+0x328/0x630
[   19.623242]  ret_from_fork+0x10/0x20
[   19.623542] 
[   19.623590] Last potentially related work creation:
[   19.623697]  kasan_save_stack+0x3c/0x68
[   19.623785]  kasan_record_aux_stack+0xb4/0xc8
[   19.623929]  __queue_work+0x65c/0x1008
[   19.624053]  queue_work_on+0xbc/0xf8
[   19.624234]  workqueue_uaf+0x210/0x4a8
[   19.624320]  kunit_try_run_case+0x170/0x3f0
[   19.624428]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.624525]  kthread+0x328/0x630
[   19.624606]  ret_from_fork+0x10/0x20
[   19.625122] 
[   19.625178] The buggy address belongs to the object at fff00000c78abf40
[   19.625178]  which belongs to the cache kmalloc-32 of size 32
[   19.625318] The buggy address is located 0 bytes inside of
[   19.625318]  freed 32-byte region [fff00000c78abf40, fff00000c78abf60)
[   19.625486] 
[   19.625537] The buggy address belongs to the physical page:
[   19.625605] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1078ab
[   19.626161] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.626340] page_type: f5(slab)
[   19.626562] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   19.626809] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   19.626932] page dumped because: kasan: bad access detected
[   19.626991] 
[   19.627027] Memory state around the buggy address:
[   19.627314]  fff00000c78abe00: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   19.627586]  fff00000c78abe80: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   19.627699] >fff00000c78abf00: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   19.627786]                                            ^
[   19.628404]  fff00000c78abf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.628547]  fff00000c78ac000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   19.628643] ==================================================================

[   14.311275] ==================================================================
[   14.311955] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   14.312391] Read of size 8 at addr ffff8881038d8880 by task kunit_try_catch/217
[   14.312799] 
[   14.312946] CPU: 0 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.16.0-rc4 #1 PREEMPT(voluntary) 
[   14.313009] Tainted: [B]=BAD_PAGE, [N]=TEST
[   14.313024] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   14.313054] Call Trace:
[   14.313070]  <TASK>
[   14.313093]  dump_stack_lvl+0x73/0xb0
[   14.313129]  print_report+0xd1/0x650
[   14.313156]  ? __virt_addr_valid+0x1db/0x2d0
[   14.313184]  ? workqueue_uaf+0x4d6/0x560
[   14.313210]  ? kasan_complete_mode_report_info+0x64/0x200
[   14.313265]  ? workqueue_uaf+0x4d6/0x560
[   14.313308]  kasan_report+0x141/0x180
[   14.313335]  ? workqueue_uaf+0x4d6/0x560
[   14.313367]  __asan_report_load8_noabort+0x18/0x20
[   14.313413]  workqueue_uaf+0x4d6/0x560
[   14.313455]  ? __pfx_workqueue_uaf+0x10/0x10
[   14.313483]  ? __schedule+0x10cc/0x2b60
[   14.313510]  ? __pfx_read_tsc+0x10/0x10
[   14.313536]  ? ktime_get_ts64+0x86/0x230
[   14.313566]  kunit_try_run_case+0x1a5/0x480
[   14.313597]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.313623]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   14.313666]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   14.313694]  ? __kthread_parkme+0x82/0x180
[   14.313719]  ? preempt_count_sub+0x50/0x80
[   14.313748]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.313794]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.313822]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   14.313851]  kthread+0x337/0x6f0
[   14.313874]  ? trace_preempt_on+0x20/0xc0
[   14.313904]  ? __pfx_kthread+0x10/0x10
[   14.313928]  ? _raw_spin_unlock_irq+0x47/0x80
[   14.313954]  ? calculate_sigpending+0x7b/0xa0
[   14.313984]  ? __pfx_kthread+0x10/0x10
[   14.314010]  ret_from_fork+0x116/0x1d0
[   14.314033]  ? __pfx_kthread+0x10/0x10
[   14.314058]  ret_from_fork_asm+0x1a/0x30
[   14.314097]  </TASK>
[   14.314111] 
[   14.326025] Allocated by task 217:
[   14.326262]  kasan_save_stack+0x45/0x70
[   14.326453]  kasan_save_track+0x18/0x40
[   14.326683]  kasan_save_alloc_info+0x3b/0x50
[   14.326930]  __kasan_kmalloc+0xb7/0xc0
[   14.327254]  __kmalloc_cache_noprof+0x189/0x420
[   14.327733]  workqueue_uaf+0x152/0x560
[   14.327936]  kunit_try_run_case+0x1a5/0x480
[   14.328110]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.328645]  kthread+0x337/0x6f0
[   14.329074]  ret_from_fork+0x116/0x1d0
[   14.329247]  ret_from_fork_asm+0x1a/0x30
[   14.329756] 
[   14.329945] Freed by task 9:
[   14.330140]  kasan_save_stack+0x45/0x70
[   14.330354]  kasan_save_track+0x18/0x40
[   14.330633]  kasan_save_free_info+0x3f/0x60
[   14.330923]  __kasan_slab_free+0x56/0x70
[   14.331145]  kfree+0x222/0x3f0
[   14.331379]  workqueue_uaf_work+0x12/0x20
[   14.331707]  process_one_work+0x5ee/0xf60
[   14.332046]  worker_thread+0x758/0x1220
[   14.332321]  kthread+0x337/0x6f0
[   14.332530]  ret_from_fork+0x116/0x1d0
[   14.332743]  ret_from_fork_asm+0x1a/0x30
[   14.332907] 
[   14.333020] Last potentially related work creation:
[   14.333506]  kasan_save_stack+0x45/0x70
[   14.333731]  kasan_record_aux_stack+0xb2/0xc0
[   14.334035]  __queue_work+0x626/0xeb0
[   14.334286]  queue_work_on+0xb6/0xc0
[   14.334548]  workqueue_uaf+0x26d/0x560
[   14.334763]  kunit_try_run_case+0x1a5/0x480
[   14.335120]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.335338]  kthread+0x337/0x6f0
[   14.335492]  ret_from_fork+0x116/0x1d0
[   14.335772]  ret_from_fork_asm+0x1a/0x30
[   14.336263] 
[   14.336593] The buggy address belongs to the object at ffff8881038d8880
[   14.336593]  which belongs to the cache kmalloc-32 of size 32
[   14.337374] The buggy address is located 0 bytes inside of
[   14.337374]  freed 32-byte region [ffff8881038d8880, ffff8881038d88a0)
[   14.338011] 
[   14.338256] The buggy address belongs to the physical page:
[   14.338510] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1038d8
[   14.338918] flags: 0x200000000000000(node=0|zone=2)
[   14.339541] page_type: f5(slab)
[   14.339762] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   14.340206] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   14.340476] page dumped because: kasan: bad access detected
[   14.340795] 
[   14.340933] Memory state around the buggy address:
[   14.341359]  ffff8881038d8780: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   14.341722]  ffff8881038d8800: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   14.342051] >ffff8881038d8880: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   14.342475]                    ^
[   14.342790]  ffff8881038d8900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.343237]  ffff8881038d8980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.343604] ==================================================================