Hay
Date
May 13, 2025, 12:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   19.718170] ==================================================================
[   19.718292] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   19.718429] Read of size 8 at addr fff00000c4075100 by task kunit_try_catch/200
[   19.718500] 
[   19.718604] CPU: 1 UID: 0 PID: 200 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250513 #1 PREEMPT 
[   19.718795] Tainted: [B]=BAD_PAGE, [N]=TEST
[   19.718874] Hardware name: linux,dummy-virt (DT)
[   19.718947] Call trace:
[   19.719034]  show_stack+0x20/0x38 (C)
[   19.719157]  dump_stack_lvl+0x8c/0xd0
[   19.719215]  print_report+0x118/0x608
[   19.719305]  kasan_report+0xdc/0x128
[   19.719375]  __asan_report_load8_noabort+0x20/0x30
[   19.719437]  workqueue_uaf+0x480/0x4a8
[   19.719490]  kunit_try_run_case+0x170/0x3f0
[   19.719546]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.719608]  kthread+0x328/0x630
[   19.719664]  ret_from_fork+0x10/0x20
[   19.719722] 
[   19.719747] Allocated by task 200:
[   19.719799]  kasan_save_stack+0x3c/0x68
[   19.719907]  kasan_save_track+0x20/0x40
[   19.719955]  kasan_save_alloc_info+0x40/0x58
[   19.720038]  __kasan_kmalloc+0xd4/0xd8
[   19.720117]  __kmalloc_cache_noprof+0x15c/0x3c0
[   19.720166]  workqueue_uaf+0x13c/0x4a8
[   19.720208]  kunit_try_run_case+0x170/0x3f0
[   19.720256]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.720365]  kthread+0x328/0x630
[   19.720410]  ret_from_fork+0x10/0x20
[   19.720454] 
[   19.720477] Freed by task 46:
[   19.720510]  kasan_save_stack+0x3c/0x68
[   19.720555]  kasan_save_track+0x20/0x40
[   19.720596]  kasan_save_free_info+0x4c/0x78
[   19.720644]  __kasan_slab_free+0x6c/0x98
[   19.720684]  kfree+0x214/0x3c8
[   19.720722]  workqueue_uaf_work+0x18/0x30
[   19.720768]  process_one_work+0x530/0xf98
[   19.720812]  worker_thread+0x8ac/0xf28
[   19.720852]  kthread+0x328/0x630
[   19.720895]  ret_from_fork+0x10/0x20
[   19.720937] 
[   19.720961] Last potentially related work creation:
[   19.721005]  kasan_save_stack+0x3c/0x68
[   19.721055]  kasan_record_aux_stack+0xb4/0xc8
[   19.721101]  __queue_work+0x65c/0x1010
[   19.721172]  queue_work_on+0xbc/0xf8
[   19.721226]  workqueue_uaf+0x210/0x4a8
[   19.721292]  kunit_try_run_case+0x170/0x3f0
[   19.721624]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   19.721878]  kthread+0x328/0x630
[   19.722108]  ret_from_fork+0x10/0x20
[   19.722386] 
[   19.722424] The buggy address belongs to the object at fff00000c4075100
[   19.722424]  which belongs to the cache kmalloc-32 of size 32
[   19.722522] The buggy address is located 0 bytes inside of
[   19.722522]  freed 32-byte region [fff00000c4075100, fff00000c4075120)
[   19.722596] 
[   19.722649] The buggy address belongs to the physical page:
[   19.722846] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x104075
[   19.723054] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   19.723191] page_type: f5(slab)
[   19.723251] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   19.723312] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   19.723359] page dumped because: kasan: bad access detected
[   19.723396] 
[   19.723581] Memory state around the buggy address:
[   19.723713]  fff00000c4075000: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   19.723787]  fff00000c4075080: 00 00 00 fc fc fc fc fc 00 00 00 07 fc fc fc fc
[   19.723867] >fff00000c4075100: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   19.723942]                    ^
[   19.723987]  fff00000c4075180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.724088]  fff00000c4075200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.724135] ==================================================================

[   11.711636] ==================================================================
[   11.712123] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d6/0x560
[   11.712946] Read of size 8 at addr ffff8881026bb240 by task kunit_try_catch/217
[   11.713686] 
[   11.713826] CPU: 1 UID: 0 PID: 217 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc6-next-20250513 #1 PREEMPT(voluntary) 
[   11.713877] Tainted: [B]=BAD_PAGE, [N]=TEST
[   11.713888] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   11.713908] Call Trace:
[   11.713920]  <TASK>
[   11.713937]  dump_stack_lvl+0x73/0xb0
[   11.713966]  print_report+0xd1/0x650
[   11.713988]  ? __virt_addr_valid+0x1db/0x2d0
[   11.714011]  ? workqueue_uaf+0x4d6/0x560
[   11.714032]  ? kasan_complete_mode_report_info+0x64/0x200
[   11.714054]  ? workqueue_uaf+0x4d6/0x560
[   11.714076]  kasan_report+0x141/0x180
[   11.714098]  ? workqueue_uaf+0x4d6/0x560
[   11.714124]  __asan_report_load8_noabort+0x18/0x20
[   11.714145]  workqueue_uaf+0x4d6/0x560
[   11.714192]  ? __pfx_workqueue_uaf+0x10/0x10
[   11.714216]  ? __schedule+0x10cc/0x2b60
[   11.714238]  ? __pfx_read_tsc+0x10/0x10
[   11.714258]  ? ktime_get_ts64+0x86/0x230
[   11.714282]  kunit_try_run_case+0x1a5/0x480
[   11.714306]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.714328]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   11.714351]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   11.714372]  ? __kthread_parkme+0x82/0x180
[   11.714393]  ? preempt_count_sub+0x50/0x80
[   11.714418]  ? __pfx_kunit_try_run_case+0x10/0x10
[   11.714441]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.714470]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   11.714493]  kthread+0x337/0x6f0
[   11.714530]  ? trace_preempt_on+0x20/0xc0
[   11.714554]  ? __pfx_kthread+0x10/0x10
[   11.714575]  ? _raw_spin_unlock_irq+0x47/0x80
[   11.714595]  ? calculate_sigpending+0x7b/0xa0
[   11.714627]  ? __pfx_kthread+0x10/0x10
[   11.714649]  ret_from_fork+0x116/0x1d0
[   11.714667]  ? __pfx_kthread+0x10/0x10
[   11.714687]  ret_from_fork_asm+0x1a/0x30
[   11.714718]  </TASK>
[   11.714730] 
[   11.728587] Allocated by task 217:
[   11.728929]  kasan_save_stack+0x45/0x70
[   11.729405]  kasan_save_track+0x18/0x40
[   11.729558]  kasan_save_alloc_info+0x3b/0x50
[   11.730203]  __kasan_kmalloc+0xb7/0xc0
[   11.730591]  __kmalloc_cache_noprof+0x189/0x420
[   11.731023]  workqueue_uaf+0x152/0x560
[   11.731161]  kunit_try_run_case+0x1a5/0x480
[   11.731711]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.732204]  kthread+0x337/0x6f0
[   11.732426]  ret_from_fork+0x116/0x1d0
[   11.732574]  ret_from_fork_asm+0x1a/0x30
[   11.732932] 
[   11.733113] Freed by task 44:
[   11.733403]  kasan_save_stack+0x45/0x70
[   11.733669]  kasan_save_track+0x18/0x40
[   11.733815]  kasan_save_free_info+0x3f/0x60
[   11.733958]  __kasan_slab_free+0x56/0x70
[   11.734361]  kfree+0x222/0x3f0
[   11.734501]  workqueue_uaf_work+0x12/0x20
[   11.734666]  process_one_work+0x5ee/0xf60
[   11.735080]  worker_thread+0x725/0x1320
[   11.735477]  kthread+0x337/0x6f0
[   11.735872]  ret_from_fork+0x116/0x1d0
[   11.736286]  ret_from_fork_asm+0x1a/0x30
[   11.736670] 
[   11.736760] Last potentially related work creation:
[   11.737183]  kasan_save_stack+0x45/0x70
[   11.737479]  kasan_record_aux_stack+0xb2/0xc0
[   11.737634]  __queue_work+0x626/0xeb0
[   11.737762]  queue_work_on+0xb6/0xc0
[   11.737911]  workqueue_uaf+0x26d/0x560
[   11.738047]  kunit_try_run_case+0x1a5/0x480
[   11.738396]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   11.738971]  kthread+0x337/0x6f0
[   11.739334]  ret_from_fork+0x116/0x1d0
[   11.739515]  ret_from_fork_asm+0x1a/0x30
[   11.739796] 
[   11.739867] The buggy address belongs to the object at ffff8881026bb240
[   11.739867]  which belongs to the cache kmalloc-32 of size 32
[   11.741051] The buggy address is located 0 bytes inside of
[   11.741051]  freed 32-byte region [ffff8881026bb240, ffff8881026bb260)
[   11.741962] 
[   11.742038] The buggy address belongs to the physical page:
[   11.742251] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1026bb
[   11.743053] flags: 0x200000000000000(node=0|zone=2)
[   11.743518] page_type: f5(slab)
[   11.743882] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   11.744414] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   11.744651] page dumped because: kasan: bad access detected
[   11.744838] 
[   11.744909] Memory state around the buggy address:
[   11.745367]  ffff8881026bb100: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   11.746123]  ffff8881026bb180: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   11.746369] >ffff8881026bb200: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   11.747086]                                            ^
[   11.747635]  ffff8881026bb280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.748316]  ffff8881026bb300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   11.748978] ==================================================================