Hay
Date
Dec. 3, 2024, 11:38 p.m.

Environment
qemu-arm64
qemu-x86_64

[   31.506916] ==================================================================
[   31.508284] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   31.509420] Read of size 8 at addr fff00000c58b0840 by task kunit_try_catch/189
[   31.510381] 
[   31.510858] CPU: 0 UID: 0 PID: 189 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   31.512345] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.512837] Hardware name: linux,dummy-virt (DT)
[   31.514353] Call trace:
[   31.514881]  show_stack+0x20/0x38 (C)
[   31.515546]  dump_stack_lvl+0x8c/0xd0
[   31.516083]  print_report+0x118/0x5e0
[   31.516776]  kasan_report+0xc8/0x118
[   31.517283]  __asan_report_load8_noabort+0x20/0x30
[   31.518013]  workqueue_uaf+0x480/0x4a8
[   31.518668]  kunit_try_run_case+0x14c/0x3d0
[   31.519503]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.520217]  kthread+0x24c/0x2d0
[   31.520747]  ret_from_fork+0x10/0x20
[   31.521297] 
[   31.521601] Allocated by task 189:
[   31.522247]  kasan_save_stack+0x3c/0x68
[   31.522828]  kasan_save_track+0x20/0x40
[   31.523542]  kasan_save_alloc_info+0x40/0x58
[   31.524099]  __kasan_kmalloc+0xd4/0xd8
[   31.524712]  __kmalloc_cache_noprof+0x15c/0x3c0
[   31.525626]  workqueue_uaf+0x13c/0x4a8
[   31.526451]  kunit_try_run_case+0x14c/0x3d0
[   31.526934]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.527845]  kthread+0x24c/0x2d0
[   31.528603]  ret_from_fork+0x10/0x20
[   31.529221] 
[   31.529669] Freed by task 10:
[   31.530542]  kasan_save_stack+0x3c/0x68
[   31.531139]  kasan_save_track+0x20/0x40
[   31.531913]  kasan_save_free_info+0x4c/0x78
[   31.532628]  __kasan_slab_free+0x6c/0x98
[   31.533196]  kfree+0x114/0x3c8
[   31.533734]  workqueue_uaf_work+0x18/0x30
[   31.534228]  process_one_work+0x530/0xf98
[   31.535015]  worker_thread+0x614/0xf28
[   31.536103]  kthread+0x24c/0x2d0
[   31.536624]  ret_from_fork+0x10/0x20
[   31.537216] 
[   31.537527] Last potentially related work creation:
[   31.538162]  kasan_save_stack+0x3c/0x68
[   31.538881]  kasan_record_aux_stack+0xb4/0xc8
[   31.539682]  __queue_work+0x65c/0xfd8
[   31.540523]  queue_work_on+0xbc/0xf8
[   31.541030]  workqueue_uaf+0x210/0x4a8
[   31.541527]  kunit_try_run_case+0x14c/0x3d0
[   31.542226]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.542967]  kthread+0x24c/0x2d0
[   31.543441]  ret_from_fork+0x10/0x20
[   31.544001] 
[   31.544594] The buggy address belongs to the object at fff00000c58b0840
[   31.544594]  which belongs to the cache kmalloc-32 of size 32
[   31.546080] The buggy address is located 0 bytes inside of
[   31.546080]  freed 32-byte region [fff00000c58b0840, fff00000c58b0860)
[   31.548465] 
[   31.548832] The buggy address belongs to the physical page:
[   31.549527] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1058b0
[   31.550521] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.551438] page_type: f5(slab)
[   31.551946] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   31.552876] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   31.553981] page dumped because: kasan: bad access detected
[   31.554719] 
[   31.555040] Memory state around the buggy address:
[   31.555939]  fff00000c58b0700: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   31.556688]  fff00000c58b0780: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   31.557717] >fff00000c58b0800: 00 00 00 07 fc fc fc fc fa fb fb fb fc fc fc fc
[   31.558539]                                            ^
[   31.559206]  fff00000c58b0880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.560300]  fff00000c58b0900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.561172] ==================================================================

[   26.963454] ==================================================================
[   26.964251] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d8/0x560
[   26.965179] Read of size 8 at addr ffff888102984e00 by task kunit_try_catch/209
[   26.965944] 
[   26.966280] CPU: 0 UID: 0 PID: 209 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241203 #1
[   26.967511] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.968246] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.969279] Call Trace:
[   26.969925]  <TASK>
[   26.970198]  dump_stack_lvl+0x73/0xb0
[   26.970661]  print_report+0xd1/0x640
[   26.971157]  ? __virt_addr_valid+0x1db/0x2d0
[   26.971582]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.972581]  kasan_report+0x102/0x140
[   26.973146]  ? workqueue_uaf+0x4d8/0x560
[   26.973643]  ? workqueue_uaf+0x4d8/0x560
[   26.974322]  __asan_report_load8_noabort+0x18/0x20
[   26.974976]  workqueue_uaf+0x4d8/0x560
[   26.975665]  ? __pfx_workqueue_uaf+0x10/0x10
[   26.976533]  ? __schedule+0xc3e/0x2790
[   26.977158]  ? __pfx_read_tsc+0x10/0x10
[   26.977769]  ? ktime_get_ts64+0x86/0x230
[   26.978619]  kunit_try_run_case+0x1b3/0x490
[   26.979190]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.979952]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   26.980234]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.980930]  ? __kthread_parkme+0x82/0x160
[   26.981360]  ? preempt_count_sub+0x50/0x80
[   26.982222]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.983155]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.983911]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.984319]  kthread+0x257/0x310
[   26.985301]  ? __pfx_kthread+0x10/0x10
[   26.985640]  ret_from_fork+0x41/0x80
[   26.986027]  ? __pfx_kthread+0x10/0x10
[   26.986387]  ret_from_fork_asm+0x1a/0x30
[   26.987355]  </TASK>
[   26.987607] 
[   26.988176] Allocated by task 209:
[   26.988462]  kasan_save_stack+0x3d/0x60
[   26.988882]  kasan_save_track+0x18/0x40
[   26.989308]  kasan_save_alloc_info+0x3b/0x50
[   26.989797]  __kasan_kmalloc+0xb7/0xc0
[   26.990043]  __kmalloc_cache_noprof+0x184/0x410
[   26.991079]  workqueue_uaf+0x153/0x560
[   26.991486]  kunit_try_run_case+0x1b3/0x490
[   26.991862]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.992271]  kthread+0x257/0x310
[   26.992635]  ret_from_fork+0x41/0x80
[   26.993010]  ret_from_fork_asm+0x1a/0x30
[   26.993942] 
[   26.994167] Freed by task 8:
[   26.994476]  kasan_save_stack+0x3d/0x60
[   26.994959]  kasan_save_track+0x18/0x40
[   26.995389]  kasan_save_free_info+0x3f/0x60
[   26.995996]  __kasan_slab_free+0x56/0x70
[   26.996347]  kfree+0x123/0x3f0
[   26.996718]  workqueue_uaf_work+0x12/0x20
[   26.997701]  process_one_work+0x5ee/0xf60
[   26.998277]  worker_thread+0x720/0x1300
[   26.998609]  kthread+0x257/0x310
[   26.999131]  ret_from_fork+0x41/0x80
[   26.999511]  ret_from_fork_asm+0x1a/0x30
[   27.000121] 
[   27.000335] Last potentially related work creation:
[   27.000908]  kasan_save_stack+0x3d/0x60
[   27.001274]  kasan_record_aux_stack+0xb2/0xc0
[   27.001788]  __queue_work+0x626/0xe60
[   27.002660]  queue_work_on+0x74/0xa0
[   27.003069]  workqueue_uaf+0x26e/0x560
[   27.003406]  kunit_try_run_case+0x1b3/0x490
[   27.003843]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   27.004494]  kthread+0x257/0x310
[   27.004954]  ret_from_fork+0x41/0x80
[   27.005247]  ret_from_fork_asm+0x1a/0x30
[   27.005811] 
[   27.006019] The buggy address belongs to the object at ffff888102984e00
[   27.006019]  which belongs to the cache kmalloc-32 of size 32
[   27.007077] The buggy address is located 0 bytes inside of
[   27.007077]  freed 32-byte region [ffff888102984e00, ffff888102984e20)
[   27.008453] 
[   27.008699] The buggy address belongs to the physical page:
[   27.009362] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102984
[   27.010112] flags: 0x200000000000000(node=0|zone=2)
[   27.010716] page_type: f5(slab)
[   27.011088] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   27.011654] raw: 0000000000000000 0000000080400040 00000000f5000000 0000000000000000
[   27.012292] page dumped because: kasan: bad access detected
[   27.013273] 
[   27.013415] Memory state around the buggy address:
[   27.013860]  ffff888102984d00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   27.014464]  ffff888102984d80: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   27.014907] >ffff888102984e00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   27.015883]                    ^
[   27.016230]  ffff888102984e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.016779]  ffff888102984f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.017409] ==================================================================