Hay
Date
Nov. 22, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   34.897946] ==================================================================
[   34.899308] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x480/0x4a8
[   34.900864] Read of size 8 at addr fff00000c6a70a00 by task kunit_try_catch/189
[   34.903325] 
[   34.903792] CPU: 0 UID: 0 PID: 189 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   34.905268] Tainted: [B]=BAD_PAGE, [N]=TEST
[   34.905965] Hardware name: linux,dummy-virt (DT)
[   34.906701] Call trace:
[   34.907259]  show_stack+0x20/0x38 (C)
[   34.908084]  dump_stack_lvl+0x8c/0xd0
[   34.909523]  print_report+0x118/0x5e0
[   34.910193]  kasan_report+0xc8/0x118
[   34.910655]  __asan_report_load8_noabort+0x20/0x30
[   34.911980]  workqueue_uaf+0x480/0x4a8
[   34.912763]  kunit_try_run_case+0x14c/0x3d0
[   34.914036]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.915139]  kthread+0x24c/0x2d0
[   34.915960]  ret_from_fork+0x10/0x20
[   34.916963] 
[   34.917223] Allocated by task 189:
[   34.917630]  kasan_save_stack+0x3c/0x68
[   34.919100]  kasan_save_track+0x20/0x40
[   34.919815]  kasan_save_alloc_info+0x40/0x58
[   34.920635]  __kasan_kmalloc+0xd4/0xd8
[   34.921238]  __kmalloc_cache_noprof+0x15c/0x3c8
[   34.922615]  workqueue_uaf+0x13c/0x4a8
[   34.923183]  kunit_try_run_case+0x14c/0x3d0
[   34.923965]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.926057]  kthread+0x24c/0x2d0
[   34.926582]  ret_from_fork+0x10/0x20
[   34.927277] 
[   34.928012] Freed by task 10:
[   34.929033]  kasan_save_stack+0x3c/0x68
[   34.929577]  kasan_save_track+0x20/0x40
[   34.930268]  kasan_save_free_info+0x4c/0x78
[   34.931014]  __kasan_slab_free+0x6c/0x98
[   34.931769]  kfree+0x114/0x3d0
[   34.932364]  workqueue_uaf_work+0x18/0x30
[   34.933298]  process_one_work+0x530/0xfa8
[   34.933762]  worker_thread+0x614/0xf28
[   34.934177]  kthread+0x24c/0x2d0
[   34.934758]  ret_from_fork+0x10/0x20
[   34.935806] 
[   34.936215] Last potentially related work creation:
[   34.937612]  kasan_save_stack+0x3c/0x68
[   34.938623]  __kasan_record_aux_stack+0xbc/0xe8
[   34.939661]  kasan_record_aux_stack_noalloc+0x14/0x20
[   34.940841]  __queue_work+0x654/0xfe0
[   34.941689]  queue_work_on+0xbc/0xf8
[   34.942218]  workqueue_uaf+0x210/0x4a8
[   34.943280]  kunit_try_run_case+0x14c/0x3d0
[   34.943768]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.944822]  kthread+0x24c/0x2d0
[   34.946172]  ret_from_fork+0x10/0x20
[   34.947151] 
[   34.947640] The buggy address belongs to the object at fff00000c6a70a00
[   34.947640]  which belongs to the cache kmalloc-32 of size 32
[   34.949579] The buggy address is located 0 bytes inside of
[   34.949579]  freed 32-byte region [fff00000c6a70a00, fff00000c6a70a20)
[   34.951115] 
[   34.952381] The buggy address belongs to the physical page:
[   34.953284] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106a70
[   34.954102] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   34.955705] page_type: f5(slab)
[   34.956240] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   34.957377] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   34.958930] page dumped because: kasan: bad access detected
[   34.960063] 
[   34.960355] Memory state around the buggy address:
[   34.961954]  fff00000c6a70900: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   34.962894]  fff00000c6a70980: 00 00 03 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   34.963951] >fff00000c6a70a00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   34.964820]                    ^
[   34.967350]  fff00000c6a70a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.967994]  fff00000c6a70b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.968592] ==================================================================

[   26.114906] ==================================================================
[   26.116259] BUG: KASAN: slab-use-after-free in workqueue_uaf+0x4d8/0x560
[   26.116760] Read of size 8 at addr ffff888101ab05c0 by task kunit_try_catch/208
[   26.117155] 
[   26.117400] CPU: 0 UID: 0 PID: 208 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   26.118541] Tainted: [B]=BAD_PAGE, [N]=TEST
[   26.119007] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   26.119744] Call Trace:
[   26.120242]  <TASK>
[   26.120561]  dump_stack_lvl+0x73/0xb0
[   26.121094]  print_report+0xd1/0x640
[   26.121585]  ? __virt_addr_valid+0x1db/0x2d0
[   26.122602]  ? kasan_complete_mode_report_info+0x64/0x200
[   26.123155]  kasan_report+0x102/0x140
[   26.123621]  ? workqueue_uaf+0x4d8/0x560
[   26.124282]  ? workqueue_uaf+0x4d8/0x560
[   26.124711]  __asan_report_load8_noabort+0x18/0x20
[   26.125353]  workqueue_uaf+0x4d8/0x560
[   26.125711]  ? __pfx_workqueue_uaf+0x10/0x10
[   26.126462]  ? __schedule+0xc3e/0x2790
[   26.126843]  ? __pfx_read_tsc+0x10/0x10
[   26.128143]  ? ktime_get_ts64+0x84/0x230
[   26.128657]  kunit_try_run_case+0x1b3/0x490
[   26.129188]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.129711]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   26.130129]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   26.130724]  ? __kthread_parkme+0x82/0x160
[   26.131385]  ? preempt_count_sub+0x50/0x80
[   26.132013]  ? __pfx_kunit_try_run_case+0x10/0x10
[   26.132427]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   26.133606]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.134344]  kthread+0x257/0x310
[   26.134729]  ? __pfx_kthread+0x10/0x10
[   26.135364]  ret_from_fork+0x41/0x80
[   26.135766]  ? __pfx_kthread+0x10/0x10
[   26.136310]  ret_from_fork_asm+0x1a/0x30
[   26.136769]  </TASK>
[   26.137214] 
[   26.137468] Allocated by task 208:
[   26.137896]  kasan_save_stack+0x3d/0x60
[   26.138335]  kasan_save_track+0x18/0x40
[   26.139373]  kasan_save_alloc_info+0x3b/0x50
[   26.140142]  __kasan_kmalloc+0xb7/0xc0
[   26.140451]  __kmalloc_cache_noprof+0x184/0x410
[   26.141092]  workqueue_uaf+0x153/0x560
[   26.141527]  kunit_try_run_case+0x1b3/0x490
[   26.142154]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.142736]  kthread+0x257/0x310
[   26.143630]  ret_from_fork+0x41/0x80
[   26.144055]  ret_from_fork_asm+0x1a/0x30
[   26.144666] 
[   26.145059] Freed by task 54:
[   26.145361]  kasan_save_stack+0x3d/0x60
[   26.145768]  kasan_save_track+0x18/0x40
[   26.146342]  kasan_save_free_info+0x3f/0x60
[   26.146818]  __kasan_slab_free+0x56/0x70
[   26.147325]  kfree+0x123/0x3f0
[   26.147558]  workqueue_uaf_work+0x12/0x20
[   26.148678]  process_one_work+0x5ee/0xf60
[   26.149181]  worker_thread+0x720/0x1300
[   26.149592]  kthread+0x257/0x310
[   26.149922]  ret_from_fork+0x41/0x80
[   26.150314]  ret_from_fork_asm+0x1a/0x30
[   26.150633] 
[   26.151071] Last potentially related work creation:
[   26.151511]  kasan_save_stack+0x3d/0x60
[   26.152123]  __kasan_record_aux_stack+0xae/0xc0
[   26.152560]  kasan_record_aux_stack_noalloc+0xf/0x20
[   26.153344]  __queue_work+0x67e/0xf70
[   26.153713]  queue_work_on+0x74/0xa0
[   26.154139]  workqueue_uaf+0x26e/0x560
[   26.154559]  kunit_try_run_case+0x1b3/0x490
[   26.155942]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   26.156456]  kthread+0x257/0x310
[   26.156819]  ret_from_fork+0x41/0x80
[   26.157239]  ret_from_fork_asm+0x1a/0x30
[   26.157577] 
[   26.157794] The buggy address belongs to the object at ffff888101ab05c0
[   26.157794]  which belongs to the cache kmalloc-32 of size 32
[   26.159398] The buggy address is located 0 bytes inside of
[   26.159398]  freed 32-byte region [ffff888101ab05c0, ffff888101ab05e0)
[   26.160391] 
[   26.160577] The buggy address belongs to the physical page:
[   26.161339] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ab0
[   26.161745] flags: 0x200000000000000(node=0|zone=2)
[   26.163063] page_type: f5(slab)
[   26.163418] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   26.164100] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   26.165062] page dumped because: kasan: bad access detected
[   26.165601] 
[   26.165752] Memory state around the buggy address:
[   26.166434]  ffff888101ab0480: 00 00 05 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   26.167176]  ffff888101ab0500: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   26.167670] >ffff888101ab0580: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   26.169075]                                            ^
[   26.169560]  ffff888101ab0600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.170538]  ffff888101ab0680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   26.171277] ==================================================================