Hay
Date
May 12, 2025, 11:48 a.m.

Environment
qemu-arm64
qemu-x86_64

[   17.345491] ==================================================================
[   17.345934] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   17.346064] Read of size 8 at addr fff00000c7943540 by task kunit_try_catch/200
[   17.346178] 
[   17.346245] CPU: 1 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT 
[   17.346424] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.346475] Hardware name: linux,dummy-virt (DT)
[   17.346536] Call trace:
[   17.346654]  show_stack+0x20/0x38 (C)
[   17.346885]  dump_stack_lvl+0x8c/0xd0
[   17.346985]  print_report+0x118/0x608
[   17.347085]  kasan_report+0xdc/0x128
[   17.347159]  __asan_report_load8_noabort+0x20/0x30
[   17.347423]  workqueue_uaf+0x480/0x4a8
[   17.347531]  kunit_try_run_case+0x170/0x3f0
[   17.347799]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.348049]  kthread+0x328/0x630
[   17.348155]  ret_from_fork+0x10/0x20
[   17.348264] 
[   17.348308] Allocated by task 200:
[   17.348370]  kasan_save_stack+0x3c/0x68
[   17.348457]  kasan_save_track+0x20/0x40
[   17.348534]  kasan_save_alloc_info+0x40/0x58
[   17.348629]  __kasan_kmalloc+0xd4/0xd8
[   17.348740]  __kmalloc_cache_noprof+0x15c/0x3c0
[   17.348861]  workqueue_uaf+0x13c/0x4a8
[   17.348962]  kunit_try_run_case+0x170/0x3f0
[   17.349085]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.349190]  kthread+0x328/0x630
[   17.349288]  ret_from_fork+0x10/0x20
[   17.349392] 
[   17.349437] Freed by task 48:
[   17.349492]  kasan_save_stack+0x3c/0x68
[   17.349578]  kasan_save_track+0x20/0x40
[   17.349658]  kasan_save_free_info+0x4c/0x78
[   17.349742]  __kasan_slab_free+0x6c/0x98
[   17.349821]  kfree+0x214/0x3c8
[   17.349925]  workqueue_uaf_work+0x18/0x30
[   17.350002]  process_one_work+0x530/0xf98
[   17.350084]  worker_thread+0x8ac/0xf28
[   17.350163]  kthread+0x328/0x630
[   17.350300]  ret_from_fork+0x10/0x20
[   17.350391] 
[   17.350430] Last potentially related work creation:
[   17.350487]  kasan_save_stack+0x3c/0x68
[   17.350577]  kasan_record_aux_stack+0xb4/0xc8
[   17.350673]  __queue_work+0x65c/0x1010
[   17.350768]  queue_work_on+0xbc/0xf8
[   17.350834]  workqueue_uaf+0x210/0x4a8
[   17.350902]  kunit_try_run_case+0x170/0x3f0
[   17.350976]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   17.351105]  kthread+0x328/0x630
[   17.351185]  ret_from_fork+0x10/0x20
[   17.351249] 
[   17.351306] The buggy address belongs to the object at fff00000c7943540
[   17.351306]  which belongs to the cache kmalloc-32 of size 32
[   17.351433] The buggy address is located 0 bytes inside of
[   17.351433]  freed 32-byte region [fff00000c7943540, fff00000c7943560)
[   17.351567] 
[   17.351633] The buggy address belongs to the physical page:
[   17.351722] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107943
[   17.351858] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   17.351964] page_type: f5(slab)
[   17.352050] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   17.352179] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   17.352281] page dumped because: kasan: bad access detected
[   17.352348] 
[   17.352383] Memory state around the buggy address:
[   17.352447]  fff00000c7943400: 00 00 00 fc fc fc fc fc 00 00 03 fc fc fc fc fc
[   17.352543]  fff00000c7943480: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   17.352637] >fff00000c7943500: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   17.352724]                                            ^
[   17.352803]  fff00000c7943580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.352892]  fff00000c7943600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.352975] ==================================================================

[   17.429289] ==================================================================
[   17.429899] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   17.430622] Read of size 8 at addr ffff888102319300 by task kunit_try_catch/217
[   17.431354] 
[   17.431545] CPU: 0 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250512 #1 PREEMPT(voluntary) 
[   17.431685] Tainted: [B]=BAD_PAGE, [N]=TEST
[   17.431728] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   17.431773] Call Trace:
[   17.431804]  <TASK>
[   17.431842]  dump_stack_lvl+0x73/0xb0
[   17.431932]  print_report+0xd1/0x650
[   17.431994]  ? __virt_addr_valid+0x1db/0x2d0
[   17.432060]  ? workqueue_uaf+0x4d6/0x560
[   17.432099]  ? kasan_complete_mode_report_info+0x64/0x200
[   17.432145]  ? workqueue_uaf+0x4d6/0x560
[   17.432205]  kasan_report+0x141/0x180
[   17.432250]  ? workqueue_uaf+0x4d6/0x560
[   17.432325]  __asan_report_load8_noabort+0x18/0x20
[   17.432365]  workqueue_uaf+0x4d6/0x560
[   17.432420]  ? __pfx_workqueue_uaf+0x10/0x10
[   17.432482]  ? __schedule+0x10cc/0x2b60
[   17.432526]  ? __pfx_read_tsc+0x10/0x10
[   17.432564]  ? ktime_get_ts64+0x86/0x230
[   17.432617]  kunit_try_run_case+0x1a5/0x480
[   17.432672]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.432715]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   17.432775]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   17.432810]  ? __kthread_parkme+0x82/0x180
[   17.432891]  ? preempt_count_sub+0x50/0x80
[   17.432920]  ? __pfx_kunit_try_run_case+0x10/0x10
[   17.432945]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.432969]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   17.432993]  kthread+0x337/0x6f0
[   17.433014]  ? trace_preempt_on+0x20/0xc0
[   17.433047]  ? __pfx_kthread+0x10/0x10
[   17.433097]  ? _raw_spin_unlock_irq+0x47/0x80
[   17.433130]  ? calculate_sigpending+0x7b/0xa0
[   17.433157]  ? __pfx_kthread+0x10/0x10
[   17.433179]  ret_from_fork+0x116/0x1d0
[   17.433199]  ? __pfx_kthread+0x10/0x10
[   17.433220]  ret_from_fork_asm+0x1a/0x30
[   17.433253]  </TASK>
[   17.433286] 
[   17.447362] Allocated by task 217:
[   17.447715]  kasan_save_stack+0x45/0x70
[   17.448077]  kasan_save_track+0x18/0x40
[   17.448332]  kasan_save_alloc_info+0x3b/0x50
[   17.448686]  __kasan_kmalloc+0xb7/0xc0
[   17.449001]  __kmalloc_cache_noprof+0x189/0x420
[   17.449317]  workqueue_uaf+0x152/0x560
[   17.449635]  kunit_try_run_case+0x1a5/0x480
[   17.449889]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.450142]  kthread+0x337/0x6f0
[   17.450436]  ret_from_fork+0x116/0x1d0
[   17.450967]  ret_from_fork_asm+0x1a/0x30
[   17.451585] 
[   17.451854] Freed by task 9:
[   17.452266]  kasan_save_stack+0x45/0x70
[   17.452624]  kasan_save_track+0x18/0x40
[   17.453630]  kasan_save_free_info+0x3f/0x60
[   17.453896]  __kasan_slab_free+0x56/0x70
[   17.454238]  kfree+0x222/0x3f0
[   17.454612]  workqueue_uaf_work+0x12/0x20
[   17.455001]  process_one_work+0x5ee/0xf60
[   17.455525]  worker_thread+0x725/0x1320
[   17.455832]  kthread+0x337/0x6f0
[   17.456323]  ret_from_fork+0x116/0x1d0
[   17.456645]  ret_from_fork_asm+0x1a/0x30
[   17.456993] 
[   17.457365] Last potentially related work creation:
[   17.457742]  kasan_save_stack+0x45/0x70
[   17.458694]  kasan_record_aux_stack+0xb2/0xc0
[   17.459001]  __queue_work+0x626/0xeb0
[   17.459612]  queue_work_on+0xb6/0xc0
[   17.460167]  workqueue_uaf+0x26d/0x560
[   17.460631]  kunit_try_run_case+0x1a5/0x480
[   17.460852]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   17.461308]  kthread+0x337/0x6f0
[   17.461586]  ret_from_fork+0x116/0x1d0
[   17.462102]  ret_from_fork_asm+0x1a/0x30
[   17.462802] 
[   17.463064] The buggy address belongs to the object at ffff888102319300
[   17.463064]  which belongs to the cache kmalloc-32 of size 32
[   17.464180] The buggy address is located 0 bytes inside of
[   17.464180]  freed 32-byte region [ffff888102319300, ffff888102319320)
[   17.464996] 
[   17.465291] The buggy address belongs to the physical page:
[   17.465595] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102319
[   17.466208] flags: 0x200000000000000(node=0|zone=2)
[   17.466620] page_type: f5(slab)
[   17.466881] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   17.467272] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   17.467769] page dumped because: kasan: bad access detected
[   17.468157] 
[   17.468495] Memory state around the buggy address:
[   17.468770]  ffff888102319200: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   17.469429]  ffff888102319280: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   17.469790] >ffff888102319300: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   17.470805]                    ^
[   17.471234]  ffff888102319380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.471727]  ffff888102319400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   17.472171] ==================================================================