Hay
Date
May 15, 2025, 10:38 a.m.

Environment
qemu-arm64
qemu-x86_64

[   18.529804] ==================================================================
[   18.530202] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   18.530530] Read of size 8 at addr fff00000c1764bc0 by task kunit_try_catch/200
[   18.531179] 
[   18.531377] CPU: 1 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250515 #1 PREEMPT 
[   18.531890] Tainted: [B]=BAD_PAGE, [N]=TEST
[   18.532083] Hardware name: linux,dummy-virt (DT)
[   18.532254] Call trace:
[   18.532373]  show_stack+0x20/0x38 (C)
[   18.532630]  dump_stack_lvl+0x8c/0xd0
[   18.533054]  print_report+0x118/0x608
[   18.533231]  kasan_report+0xdc/0x128
[   18.533619]  __asan_report_load8_noabort+0x20/0x30
[   18.533674]  workqueue_uaf+0x480/0x4a8
[   18.534243]  kunit_try_run_case+0x170/0x3f0
[   18.534377]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.534714]  kthread+0x328/0x630
[   18.535094]  ret_from_fork+0x10/0x20
[   18.535154] 
[   18.535434] Allocated by task 200:
[   18.535643]  kasan_save_stack+0x3c/0x68
[   18.535944]  kasan_save_track+0x20/0x40
[   18.536151]  kasan_save_alloc_info+0x40/0x58
[   18.536342]  __kasan_kmalloc+0xd4/0xd8
[   18.536400]  __kmalloc_cache_noprof+0x15c/0x3c0
[   18.536441]  workqueue_uaf+0x13c/0x4a8
[   18.536841]  kunit_try_run_case+0x170/0x3f0
[   18.536937]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.537275]  kthread+0x328/0x630
[   18.537631]  ret_from_fork+0x10/0x20
[   18.537797] 
[   18.537820] Freed by task 47:
[   18.538106]  kasan_save_stack+0x3c/0x68
[   18.538170]  kasan_save_track+0x20/0x40
[   18.538232]  kasan_save_free_info+0x4c/0x78
[   18.538347]  __kasan_slab_free+0x6c/0x98
[   18.538431]  kfree+0x214/0x3c8
[   18.538763]  workqueue_uaf_work+0x18/0x30
[   18.539065]  process_one_work+0x530/0xf98
[   18.539443]  worker_thread+0x8ac/0xf28
[   18.539725]  kthread+0x328/0x630
[   18.539837]  ret_from_fork+0x10/0x20
[   18.540442] 
[   18.540485] Last potentially related work creation:
[   18.540515]  kasan_save_stack+0x3c/0x68
[   18.540559]  kasan_record_aux_stack+0xb4/0xc8
[   18.540601]  __queue_work+0x65c/0x1010
[   18.540637]  queue_work_on+0xbc/0xf8
[   18.540672]  workqueue_uaf+0x210/0x4a8
[   18.541470]  kunit_try_run_case+0x170/0x3f0
[   18.541542]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   18.541604]  kthread+0x328/0x630
[   18.541809]  ret_from_fork+0x10/0x20
[   18.541848] 
[   18.542051] The buggy address belongs to the object at fff00000c1764bc0
[   18.542051]  which belongs to the cache kmalloc-32 of size 32
[   18.542126] The buggy address is located 0 bytes inside of
[   18.542126]  freed 32-byte region [fff00000c1764bc0, fff00000c1764be0)
[   18.542709] 
[   18.542744] The buggy address belongs to the physical page:
[   18.542785] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101764
[   18.543144] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   18.543722] page_type: f5(slab)
[   18.543778] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   18.544015] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   18.544143] page dumped because: kasan: bad access detected
[   18.544553] 
[   18.544577] Memory state around the buggy address:
[   18.544825]  fff00000c1764a80: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   18.545180]  fff00000c1764b00: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   18.545238] >fff00000c1764b80: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   18.545496]                                            ^
[   18.545693]  fff00000c1764c00: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.545865]  fff00000c1764c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   18.545980] ==================================================================


[   14.745144] ==================================================================
[   14.746104] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   14.746708] Read of size 8 at addr ffff88810230d400 by task kunit_try_catch/218
[   14.747121] 
[   14.747353] CPU: 1 UID: 0 PID: 218 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250515 #1 PREEMPT(voluntary) 
[   14.747454] Tainted: [B]=BAD_PAGE, [N]=TEST
[   14.747479] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   14.747518] Call Trace:
[   14.747545]  <TASK>
[   14.747583]  dump_stack_lvl+0x73/0xb0
[   14.747683]  print_report+0xd1/0x650
[   14.747745]  ? __virt_addr_valid+0x1db/0x2d0
[   14.747790]  ? workqueue_uaf+0x4d6/0x560
[   14.747834]  ? kasan_complete_mode_report_info+0x64/0x200
[   14.747879]  ? workqueue_uaf+0x4d6/0x560
[   14.747924]  kasan_report+0x141/0x180
[   14.747964]  ? workqueue_uaf+0x4d6/0x560
[   14.748009]  __asan_report_load8_noabort+0x18/0x20
[   14.748050]  workqueue_uaf+0x4d6/0x560
[   14.748094]  ? __pfx_workqueue_uaf+0x10/0x10
[   14.748136]  ? irqentry_exit+0x2a/0x60
[   14.748177]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   14.748234]  ? __pfx_read_tsc+0x10/0x10
[   14.748268]  ? ktime_get_ts64+0x86/0x230
[   14.748308]  kunit_try_run_case+0x1a5/0x480
[   14.748348]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.748385]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   14.748417]  ? __kthread_parkme+0x82/0x180
[   14.748488]  ? _raw_spin_unlock_irqrestore+0x49/0x90
[   14.748629]  ? __pfx_kunit_try_run_case+0x10/0x10
[   14.748665]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.748700]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   14.748732]  kthread+0x337/0x6f0
[   14.748761]  ? trace_preempt_on+0x20/0xc0
[   14.748797]  ? __pfx_kthread+0x10/0x10
[   14.748829]  ? _raw_spin_unlock_irq+0x47/0x80
[   14.748852]  ? calculate_sigpending+0x7b/0xa0
[   14.748874]  ? __pfx_kthread+0x10/0x10
[   14.748894]  ret_from_fork+0x116/0x1d0
[   14.748912]  ? __pfx_kthread+0x10/0x10
[   14.748931]  ret_from_fork_asm+0x1a/0x30
[   14.748961]  </TASK>
[   14.748974] 
[   14.760359] Allocated by task 218:
[   14.760705]  kasan_save_stack+0x45/0x70
[   14.761024]  kasan_save_track+0x18/0x40
[   14.761907]  kasan_save_alloc_info+0x3b/0x50
[   14.762164]  __kasan_kmalloc+0xb7/0xc0
[   14.762478]  __kmalloc_cache_noprof+0x189/0x420
[   14.762944]  workqueue_uaf+0x152/0x560
[   14.763301]  kunit_try_run_case+0x1a5/0x480
[   14.763746]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.764194]  kthread+0x337/0x6f0
[   14.764461]  ret_from_fork+0x116/0x1d0
[   14.764764]  ret_from_fork_asm+0x1a/0x30
[   14.765058] 
[   14.765219] Freed by task 24:
[   14.765457]  kasan_save_stack+0x45/0x70
[   14.765666]  kasan_save_track+0x18/0x40
[   14.765838]  kasan_save_free_info+0x3f/0x60
[   14.766014]  __kasan_slab_free+0x56/0x70
[   14.766170]  kfree+0x222/0x3f0
[   14.766687]  workqueue_uaf_work+0x12/0x20
[   14.767082]  process_one_work+0x5ee/0xf60
[   14.767984]  worker_thread+0x725/0x1320
[   14.768591]  kthread+0x337/0x6f0
[   14.769117]  ret_from_fork+0x116/0x1d0
[   14.769442]  ret_from_fork_asm+0x1a/0x30
[   14.769790] 
[   14.769942] Last potentially related work creation:
[   14.770154]  kasan_save_stack+0x45/0x70
[   14.770450]  kasan_record_aux_stack+0xb2/0xc0
[   14.770814]  __queue_work+0x626/0xeb0
[   14.771042]  queue_work_on+0xb6/0xc0
[   14.771338]  workqueue_uaf+0x26d/0x560
[   14.771566]  kunit_try_run_case+0x1a5/0x480
[   14.771880]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   14.772128]  kthread+0x337/0x6f0
[   14.772296]  ret_from_fork+0x116/0x1d0
[   14.772453]  ret_from_fork_asm+0x1a/0x30
[   14.772626] 
[   14.772780] The buggy address belongs to the object at ffff88810230d400
[   14.772780]  which belongs to the cache kmalloc-32 of size 32
[   14.774472] The buggy address is located 0 bytes inside of
[   14.774472]  freed 32-byte region [ffff88810230d400, ffff88810230d420)
[   14.775463] 
[   14.775651] The buggy address belongs to the physical page:
[   14.775934] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10230d
[   14.776271] flags: 0x200000000000000(node=0|zone=2)
[   14.776479] page_type: f5(slab)
[   14.776748] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   14.777572] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   14.777910] page dumped because: kasan: bad access detected
[   14.778620] 
[   14.778808] Memory state around the buggy address:
[   14.779116]  ffff88810230d300: 00 00 05 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   14.779797]  ffff88810230d380: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   14.780125] >ffff88810230d400: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   14.780893]                    ^
[   14.781197]  ffff88810230d480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.781634]  ffff88810230d500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   14.782032] ==================================================================