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

Environment
qemu-arm64
qemu-x86_64

[   31.535848] ==================================================================
[   31.536893] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   31.537797] Write of size 33 at addr fff00000c66d2400 by task kunit_try_catch/175
[   31.538448] 
[   31.538885] CPU: 0 UID: 0 PID: 175 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   31.540479] Tainted: [B]=BAD_PAGE, [N]=TEST
[   31.541100] Hardware name: linux,dummy-virt (DT)
[   31.541617] Call trace:
[   31.542085]  show_stack+0x20/0x38 (C)
[   31.543048]  dump_stack_lvl+0x8c/0xd0
[   31.543706]  print_report+0x118/0x5e0
[   31.544295]  kasan_report+0xc8/0x118
[   31.544870]  kasan_check_range+0x100/0x1a8
[   31.545446]  __asan_memset+0x34/0x78
[   31.546102]  kmalloc_uaf_memset+0x170/0x310
[   31.547051]  kunit_try_run_case+0x14c/0x3d0
[   31.547701]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.548483]  kthread+0x24c/0x2d0
[   31.549048]  ret_from_fork+0x10/0x20
[   31.549638] 
[   31.549986] Allocated by task 175:
[   31.550793]  kasan_save_stack+0x3c/0x68
[   31.551324]  kasan_save_track+0x20/0x40
[   31.551973]  kasan_save_alloc_info+0x40/0x58
[   31.552657]  __kasan_kmalloc+0xd4/0xd8
[   31.553235]  __kmalloc_cache_noprof+0x15c/0x3c0
[   31.553775]  kmalloc_uaf_memset+0xb8/0x310
[   31.554721]  kunit_try_run_case+0x14c/0x3d0
[   31.555365]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.556143]  kthread+0x24c/0x2d0
[   31.556743]  ret_from_fork+0x10/0x20
[   31.557339] 
[   31.557718] Freed by task 175:
[   31.559206]  kasan_save_stack+0x3c/0x68
[   31.559792]  kasan_save_track+0x20/0x40
[   31.560456]  kasan_save_free_info+0x4c/0x78
[   31.561061]  __kasan_slab_free+0x6c/0x98
[   31.561680]  kfree+0x114/0x3c8
[   31.562236]  kmalloc_uaf_memset+0x11c/0x310
[   31.562966]  kunit_try_run_case+0x14c/0x3d0
[   31.563772]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   31.564619]  kthread+0x24c/0x2d0
[   31.565262]  ret_from_fork+0x10/0x20
[   31.565911] 
[   31.566595] The buggy address belongs to the object at fff00000c66d2400
[   31.566595]  which belongs to the cache kmalloc-64 of size 64
[   31.567877] The buggy address is located 0 bytes inside of
[   31.567877]  freed 64-byte region [fff00000c66d2400, fff00000c66d2440)
[   31.569158] 
[   31.569589] The buggy address belongs to the physical page:
[   31.570495] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1066d2
[   31.571483] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   31.572335] page_type: f5(slab)
[   31.572819] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   31.573790] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   31.575011] page dumped because: kasan: bad access detected
[   31.575716] 
[   31.576101] Memory state around the buggy address:
[   31.576856]  fff00000c66d2300: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
[   31.577685]  fff00000c66d2380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   31.579006] >fff00000c66d2400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   31.579946]                    ^
[   31.580695]  fff00000c66d2480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.581710]  fff00000c66d2500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   31.582452] ==================================================================

[   24.142317] ==================================================================
[   24.143137] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a4/0x360
[   24.143830] Write of size 33 at addr ffff888102470c00 by task kunit_try_catch/194
[   24.144769] 
[   24.144988] CPU: 1 UID: 0 PID: 194 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241206 #1
[   24.145686] Tainted: [B]=BAD_PAGE, [N]=TEST
[   24.146108] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   24.147226] Call Trace:
[   24.147450]  <TASK>
[   24.147853]  dump_stack_lvl+0x73/0xb0
[   24.148742]  print_report+0xd1/0x640
[   24.149289]  ? __virt_addr_valid+0x1db/0x2d0
[   24.150248]  ? kasan_complete_mode_report_info+0x64/0x200
[   24.150807]  kasan_report+0x102/0x140
[   24.152515]  ? kmalloc_uaf_memset+0x1a4/0x360
[   24.152894]  ? kmalloc_uaf_memset+0x1a4/0x360
[   24.153670]  kasan_check_range+0x10c/0x1c0
[   24.154453]  __asan_memset+0x27/0x50
[   24.154750]  kmalloc_uaf_memset+0x1a4/0x360
[   24.155737]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   24.156772]  ? __schedule+0xc70/0x27e0
[   24.157429]  ? __pfx_read_tsc+0x10/0x10
[   24.158153]  ? ktime_get_ts64+0x86/0x230
[   24.159691]  kunit_try_run_case+0x1b3/0x490
[   24.160455]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.161750]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   24.162345]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   24.162799]  ? __kthread_parkme+0x82/0x160
[   24.163792]  ? preempt_count_sub+0x50/0x80
[   24.164350]  ? __pfx_kunit_try_run_case+0x10/0x10
[   24.164833]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   24.165541]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.167589]  kthread+0x257/0x310
[   24.168207]  ? __pfx_kthread+0x10/0x10
[   24.168652]  ret_from_fork+0x41/0x80
[   24.169391]  ? __pfx_kthread+0x10/0x10
[   24.171065]  ret_from_fork_asm+0x1a/0x30
[   24.171543]  </TASK>
[   24.172097] 
[   24.172978] Allocated by task 194:
[   24.173649]  kasan_save_stack+0x3d/0x60
[   24.174132]  kasan_save_track+0x18/0x40
[   24.174546]  kasan_save_alloc_info+0x3b/0x50
[   24.176604]  __kasan_kmalloc+0xb7/0xc0
[   24.177329]  __kmalloc_cache_noprof+0x184/0x410
[   24.178533]  kmalloc_uaf_memset+0xaa/0x360
[   24.179061]  kunit_try_run_case+0x1b3/0x490
[   24.179508]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.180060]  kthread+0x257/0x310
[   24.181953]  ret_from_fork+0x41/0x80
[   24.182328]  ret_from_fork_asm+0x1a/0x30
[   24.183085] 
[   24.183297] Freed by task 194:
[   24.183626]  kasan_save_stack+0x3d/0x60
[   24.184036]  kasan_save_track+0x18/0x40
[   24.184304]  kasan_save_free_info+0x3f/0x60
[   24.185739]  __kasan_slab_free+0x56/0x70
[   24.186816]  kfree+0x123/0x3f0
[   24.188180]  kmalloc_uaf_memset+0x12c/0x360
[   24.189143]  kunit_try_run_case+0x1b3/0x490
[   24.190110]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   24.190606]  kthread+0x257/0x310
[   24.190980]  ret_from_fork+0x41/0x80
[   24.191984]  ret_from_fork_asm+0x1a/0x30
[   24.192293] 
[   24.192429] The buggy address belongs to the object at ffff888102470c00
[   24.192429]  which belongs to the cache kmalloc-64 of size 64
[   24.195025] The buggy address is located 0 bytes inside of
[   24.195025]  freed 64-byte region [ffff888102470c00, ffff888102470c40)
[   24.197223] 
[   24.197830] The buggy address belongs to the physical page:
[   24.199279] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102470
[   24.200384] flags: 0x200000000000000(node=0|zone=2)
[   24.200819] page_type: f5(slab)
[   24.201306] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   24.203106] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   24.203732] page dumped because: kasan: bad access detected
[   24.204771] 
[   24.205104] Memory state around the buggy address:
[   24.205693]  ffff888102470b00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.208160]  ffff888102470b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.208686] >ffff888102470c00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   24.208991]                    ^
[   24.209149]  ffff888102470c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.209416]  ffff888102470d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   24.209681] ==================================================================