Hay
Date
Dec. 4, 2024, 3:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   34.423764] ==================================================================
[   34.424977] BUG: KASAN: slab-use-after-free in mempool_uaf_helper+0x314/0x340
[   34.425703] Read of size 1 at addr fff00000c66e1900 by task kunit_try_catch/215
[   34.426843] 
[   34.427958] CPU: 1 UID: 0 PID: 215 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   34.429289] Tainted: [B]=BAD_PAGE, [N]=TEST
[   34.430566] Hardware name: linux,dummy-virt (DT)
[   34.431179] Call trace:
[   34.431713]  show_stack+0x20/0x38 (C)
[   34.432388]  dump_stack_lvl+0x8c/0xd0
[   34.433007]  print_report+0x118/0x5e0
[   34.433606]  kasan_report+0xc8/0x118
[   34.434165]  __asan_report_load1_noabort+0x20/0x30
[   34.434976]  mempool_uaf_helper+0x314/0x340
[   34.435605]  mempool_kmalloc_uaf+0xbc/0x118
[   34.436237]  kunit_try_run_case+0x14c/0x3d0
[   34.436798]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.437602]  kthread+0x24c/0x2d0
[   34.438225]  ret_from_fork+0x10/0x20
[   34.438773] 
[   34.439243] Allocated by task 215:
[   34.439690]  kasan_save_stack+0x3c/0x68
[   34.440354]  kasan_save_track+0x20/0x40
[   34.440925]  kasan_save_alloc_info+0x40/0x58
[   34.441526]  __kasan_mempool_unpoison_object+0x11c/0x180
[   34.442155]  remove_element+0x130/0x1f8
[   34.442846]  mempool_alloc_preallocated+0x58/0xc0
[   34.443567]  mempool_uaf_helper+0xa4/0x340
[   34.444229]  mempool_kmalloc_uaf+0xbc/0x118
[   34.444761]  kunit_try_run_case+0x14c/0x3d0
[   34.445485]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.446143]  kthread+0x24c/0x2d0
[   34.446840]  ret_from_fork+0x10/0x20
[   34.447429] 
[   34.447871] Freed by task 215:
[   34.448358]  kasan_save_stack+0x3c/0x68
[   34.449086]  kasan_save_track+0x20/0x40
[   34.449612]  kasan_save_free_info+0x4c/0x78
[   34.450184]  __kasan_mempool_poison_object+0xc0/0x150
[   34.451113]  mempool_free+0x28c/0x328
[   34.451719]  mempool_uaf_helper+0x104/0x340
[   34.452406]  mempool_kmalloc_uaf+0xbc/0x118
[   34.453001]  kunit_try_run_case+0x14c/0x3d0
[   34.453597]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.454402]  kthread+0x24c/0x2d0
[   34.455016]  ret_from_fork+0x10/0x20
[   34.455558] 
[   34.455922] The buggy address belongs to the object at fff00000c66e1900
[   34.455922]  which belongs to the cache kmalloc-128 of size 128
[   34.457405] The buggy address is located 0 bytes inside of
[   34.457405]  freed 128-byte region [fff00000c66e1900, fff00000c66e1980)
[   34.458804] 
[   34.459125] The buggy address belongs to the physical page:
[   34.459892] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1066e1
[   34.460979] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   34.461757] page_type: f5(slab)
[   34.462348] raw: 0bfffe0000000000 fff00000c0001a00 dead000000000122 0000000000000000
[   34.463391] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   34.464309] page dumped because: kasan: bad access detected
[   34.464949] 
[   34.465317] Memory state around the buggy address:
[   34.465939]  fff00000c66e1800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   34.466946]  fff00000c66e1880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.467845] >fff00000c66e1900: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   34.468778]                    ^
[   34.469229]  fff00000c66e1980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.470119]  fff00000c66e1a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   34.471063] ==================================================================
[   34.533199] ==================================================================
[   34.534885] BUG: KASAN: slab-use-after-free in mempool_uaf_helper+0x314/0x340
[   34.535836] Read of size 1 at addr fff00000c6643240 by task kunit_try_catch/219
[   34.537503] 
[   34.538048] CPU: 0 UID: 0 PID: 219 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   34.539615] Tainted: [B]=BAD_PAGE, [N]=TEST
[   34.540045] Hardware name: linux,dummy-virt (DT)
[   34.540831] Call trace:
[   34.541518]  show_stack+0x20/0x38 (C)
[   34.542662]  dump_stack_lvl+0x8c/0xd0
[   34.543256]  print_report+0x118/0x5e0
[   34.543852]  kasan_report+0xc8/0x118
[   34.544430]  __asan_report_load1_noabort+0x20/0x30
[   34.545151]  mempool_uaf_helper+0x314/0x340
[   34.545843]  mempool_slab_uaf+0xb8/0x110
[   34.546341]  kunit_try_run_case+0x14c/0x3d0
[   34.547708]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.548382]  kthread+0x24c/0x2d0
[   34.549103]  ret_from_fork+0x10/0x20
[   34.550460] 
[   34.550783] Allocated by task 219:
[   34.551284]  kasan_save_stack+0x3c/0x68
[   34.551811]  kasan_save_track+0x20/0x40
[   34.552513]  kasan_save_alloc_info+0x40/0x58
[   34.553297]  __kasan_mempool_unpoison_object+0xbc/0x180
[   34.554014]  remove_element+0x16c/0x1f8
[   34.554569]  mempool_alloc_preallocated+0x58/0xc0
[   34.555288]  mempool_uaf_helper+0xa4/0x340
[   34.555985]  mempool_slab_uaf+0xb8/0x110
[   34.556575]  kunit_try_run_case+0x14c/0x3d0
[   34.558263]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.559014]  kthread+0x24c/0x2d0
[   34.559541]  ret_from_fork+0x10/0x20
[   34.560363] 
[   34.560691] Freed by task 219:
[   34.561116]  kasan_save_stack+0x3c/0x68
[   34.562744]  kasan_save_track+0x20/0x40
[   34.563363]  kasan_save_free_info+0x4c/0x78
[   34.563925]  __kasan_mempool_poison_object+0xc0/0x150
[   34.564611]  mempool_free+0x28c/0x328
[   34.565287]  mempool_uaf_helper+0x104/0x340
[   34.566013]  mempool_slab_uaf+0xb8/0x110
[   34.566714]  kunit_try_run_case+0x14c/0x3d0
[   34.567339]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   34.568009]  kthread+0x24c/0x2d0
[   34.569015]  ret_from_fork+0x10/0x20
[   34.569584] 
[   34.569942] The buggy address belongs to the object at fff00000c6643240
[   34.569942]  which belongs to the cache test_cache of size 123
[   34.571946] The buggy address is located 0 bytes inside of
[   34.571946]  freed 123-byte region [fff00000c6643240, fff00000c66432bb)
[   34.573287] 
[   34.573669] The buggy address belongs to the physical page:
[   34.574914] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106643
[   34.576060] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   34.577037] page_type: f5(slab)
[   34.577499] raw: 0bfffe0000000000 fff00000c6651140 dead000000000122 0000000000000000
[   34.578763] raw: 0000000000000000 0000000080150015 00000000f5000000 0000000000000000
[   34.579425] page dumped because: kasan: bad access detected
[   34.580246] 
[   34.580546] Memory state around the buggy address:
[   34.581371]  fff00000c6643100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   34.582260]  fff00000c6643180: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   34.583673] >fff00000c6643200: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
[   34.584497]                                            ^
[   34.585245]  fff00000c6643280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   34.586359]  fff00000c6643300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   34.587253] ==================================================================

[   25.172579] ==================================================================
[   25.173850] BUG: KASAN: slab-use-after-free in mempool_uaf_helper+0x394/0x400
[   25.174922] Read of size 1 at addr ffff888102992a00 by task kunit_try_catch/235
[   25.175616] 
[   25.175898] CPU: 1 UID: 0 PID: 235 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   25.178603] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.179014] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.180249] Call Trace:
[   25.180543]  <TASK>
[   25.180793]  dump_stack_lvl+0x73/0xb0
[   25.181797]  print_report+0xd1/0x640
[   25.182179]  ? __virt_addr_valid+0x1db/0x2d0
[   25.182897]  ? kasan_complete_mode_report_info+0x64/0x200
[   25.183326]  kasan_report+0x102/0x140
[   25.184015]  ? mempool_uaf_helper+0x394/0x400
[   25.184905]  ? mempool_uaf_helper+0x394/0x400
[   25.185528]  __asan_report_load1_noabort+0x18/0x20
[   25.186044]  mempool_uaf_helper+0x394/0x400
[   25.186382]  ? __pfx_mempool_uaf_helper+0x10/0x10
[   25.187058]  ? finish_task_switch.isra.0+0x153/0x700
[   25.188161]  mempool_kmalloc_uaf+0xb3/0x100
[   25.189137]  ? __pfx_mempool_kmalloc_uaf+0x10/0x10
[   25.189971]  ? __switch_to+0x5d9/0xf60
[   25.190988]  ? __pfx_mempool_kmalloc+0x10/0x10
[   25.191549]  ? __pfx_mempool_kfree+0x10/0x10
[   25.192082]  ? __pfx_read_tsc+0x10/0x10
[   25.192535]  ? ktime_get_ts64+0x86/0x230
[   25.193684]  kunit_try_run_case+0x1b3/0x490
[   25.194143]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.195177]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   25.196261]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.197008]  ? __kthread_parkme+0x82/0x160
[   25.197763]  ? preempt_count_sub+0x50/0x80
[   25.198554]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.199312]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.200197]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.201162]  kthread+0x257/0x310
[   25.201786]  ? __pfx_kthread+0x10/0x10
[   25.202305]  ret_from_fork+0x41/0x80
[   25.203012]  ? __pfx_kthread+0x10/0x10
[   25.203961]  ret_from_fork_asm+0x1a/0x30
[   25.204812]  </TASK>
[   25.205003] 
[   25.205661] Allocated by task 235:
[   25.206044]  kasan_save_stack+0x3d/0x60
[   25.206538]  kasan_save_track+0x18/0x40
[   25.207353]  kasan_save_alloc_info+0x3b/0x50
[   25.207946]  __kasan_mempool_unpoison_object+0x1a9/0x200
[   25.209171]  remove_element+0x11e/0x190
[   25.209745]  mempool_alloc_preallocated+0x4d/0x90
[   25.210038]  mempool_uaf_helper+0x97/0x400
[   25.210855]  mempool_kmalloc_uaf+0xb3/0x100
[   25.212015]  kunit_try_run_case+0x1b3/0x490
[   25.212444]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.213083]  kthread+0x257/0x310
[   25.213518]  ret_from_fork+0x41/0x80
[   25.214480]  ret_from_fork_asm+0x1a/0x30
[   25.215036] 
[   25.215415] Freed by task 235:
[   25.216095]  kasan_save_stack+0x3d/0x60
[   25.216832]  kasan_save_track+0x18/0x40
[   25.217595]  kasan_save_free_info+0x3f/0x60
[   25.218158]  __kasan_mempool_poison_object+0x131/0x1d0
[   25.218524]  mempool_free+0x2ec/0x380
[   25.219148]  mempool_uaf_helper+0x11b/0x400
[   25.219977]  mempool_kmalloc_uaf+0xb3/0x100
[   25.220924]  kunit_try_run_case+0x1b3/0x490
[   25.221842]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.223045]  kthread+0x257/0x310
[   25.223662]  ret_from_fork+0x41/0x80
[   25.223877]  ret_from_fork_asm+0x1a/0x30
[   25.224066] 
[   25.224236] The buggy address belongs to the object at ffff888102992a00
[   25.224236]  which belongs to the cache kmalloc-128 of size 128
[   25.225735] The buggy address is located 0 bytes inside of
[   25.225735]  freed 128-byte region [ffff888102992a00, ffff888102992a80)
[   25.227749] 
[   25.227949] The buggy address belongs to the physical page:
[   25.228485] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102992
[   25.230027] flags: 0x200000000000000(node=0|zone=2)
[   25.231575] page_type: f5(slab)
[   25.232584] raw: 0200000000000000 ffff888100041a00 dead000000000122 0000000000000000
[   25.234628] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[   25.235239] page dumped because: kasan: bad access detected
[   25.235815] 
[   25.236011] Memory state around the buggy address:
[   25.236477]  ffff888102992900: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   25.237423]  ffff888102992980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.238261] >ffff888102992a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   25.238984]                    ^
[   25.239228]  ffff888102992a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.240122]  ffff888102992b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   25.241154] ==================================================================
[   25.298489] ==================================================================
[   25.299507] BUG: KASAN: slab-use-after-free in mempool_uaf_helper+0x394/0x400
[   25.300961] Read of size 1 at addr ffff8881029a0240 by task kunit_try_catch/239
[   25.302715] 
[   25.303095] CPU: 1 UID: 0 PID: 239 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc1-next-20241204 #1
[   25.304873] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.305758] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.306470] Call Trace:
[   25.306750]  <TASK>
[   25.307298]  dump_stack_lvl+0x73/0xb0
[   25.308459]  print_report+0xd1/0x640
[   25.308816]  ? __virt_addr_valid+0x1db/0x2d0
[   25.309172]  ? kasan_complete_mode_report_info+0x64/0x200
[   25.310032]  kasan_report+0x102/0x140
[   25.310574]  ? mempool_uaf_helper+0x394/0x400
[   25.311228]  ? mempool_uaf_helper+0x394/0x400
[   25.312076]  __asan_report_load1_noabort+0x18/0x20
[   25.312770]  mempool_uaf_helper+0x394/0x400
[   25.313419]  ? __pfx_mempool_uaf_helper+0x10/0x10
[   25.313826]  ? finish_task_switch.isra.0+0x153/0x700
[   25.314395]  mempool_slab_uaf+0xae/0x100
[   25.314902]  ? __pfx_mempool_slab_uaf+0x10/0x10
[   25.315386]  ? __switch_to+0x5d9/0xf60
[   25.315985]  ? __pfx_mempool_alloc_slab+0x10/0x10
[   25.316516]  ? __pfx_mempool_free_slab+0x10/0x10
[   25.317100]  ? __pfx_read_tsc+0x10/0x10
[   25.317446]  ? ktime_get_ts64+0x86/0x230
[   25.318054]  kunit_try_run_case+0x1b3/0x490
[   25.318481]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.319084]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   25.319780]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.320217]  ? __kthread_parkme+0x82/0x160
[   25.320832]  ? preempt_count_sub+0x50/0x80
[   25.321300]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.321901]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.322636]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.323301]  kthread+0x257/0x310
[   25.323824]  ? __pfx_kthread+0x10/0x10
[   25.324170]  ret_from_fork+0x41/0x80
[   25.324690]  ? __pfx_kthread+0x10/0x10
[   25.325097]  ret_from_fork_asm+0x1a/0x30
[   25.325715]  </TASK>
[   25.326008] 
[   25.326304] Allocated by task 239:
[   25.326697]  kasan_save_stack+0x3d/0x60
[   25.327276]  kasan_save_track+0x18/0x40
[   25.327699]  kasan_save_alloc_info+0x3b/0x50
[   25.328239]  __kasan_mempool_unpoison_object+0x1bb/0x200
[   25.328857]  remove_element+0x11e/0x190
[   25.329363]  mempool_alloc_preallocated+0x4d/0x90
[   25.329857]  mempool_uaf_helper+0x97/0x400
[   25.330402]  mempool_slab_uaf+0xae/0x100
[   25.330835]  kunit_try_run_case+0x1b3/0x490
[   25.331388]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.331876]  kthread+0x257/0x310
[   25.332334]  ret_from_fork+0x41/0x80
[   25.332822]  ret_from_fork_asm+0x1a/0x30
[   25.333347] 
[   25.333697] Freed by task 239:
[   25.334049]  kasan_save_stack+0x3d/0x60
[   25.334603]  kasan_save_track+0x18/0x40
[   25.335179]  kasan_save_free_info+0x3f/0x60
[   25.335779]  __kasan_mempool_poison_object+0x131/0x1d0
[   25.336197]  mempool_free+0x2ec/0x380
[   25.336776]  mempool_uaf_helper+0x11b/0x400
[   25.337266]  mempool_slab_uaf+0xae/0x100
[   25.337673]  kunit_try_run_case+0x1b3/0x490
[   25.338386]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.338975]  kthread+0x257/0x310
[   25.339361]  ret_from_fork+0x41/0x80
[   25.339870]  ret_from_fork_asm+0x1a/0x30
[   25.340225] 
[   25.340468] The buggy address belongs to the object at ffff8881029a0240
[   25.340468]  which belongs to the cache test_cache of size 123
[   25.341527] The buggy address is located 0 bytes inside of
[   25.341527]  freed 123-byte region [ffff8881029a0240, ffff8881029a02bb)
[   25.342766] 
[   25.343021] The buggy address belongs to the physical page:
[   25.343643] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029a0
[   25.345219] flags: 0x200000000000000(node=0|zone=2)
[   25.345696] page_type: f5(slab)
[   25.346032] raw: 0200000000000000 ffff8881029973c0 dead000000000122 0000000000000000
[   25.346956] raw: 0000000000000000 0000000080150015 00000000f5000000 0000000000000000
[   25.347831] page dumped because: kasan: bad access detected
[   25.348492] 
[   25.348836] Memory state around the buggy address:
[   25.349435]  ffff8881029a0100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.350537]  ffff8881029a0180: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   25.351430] >ffff8881029a0200: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
[   25.352101]                                            ^
[   25.352751]  ffff8881029a0280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   25.353371]  ffff8881029a0300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.354104] ==================================================================