Hay
Date
Dec. 9, 2024, 6:35 a.m.

Environment
qemu-arm64
qemu-x86_64

[   25.394358] ==================================================================
[   25.395953] BUG: KASAN: invalid-free in kmem_cache_invalid_free+0x184/0x3b8
[   25.396878] Free of addr fff00000c650b001 by task kunit_try_catch/199
[   25.397976] 
[   25.398250] CPU: 0 UID: 0 PID: 199 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   25.400138] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.400749] Hardware name: linux,dummy-virt (DT)
[   25.401351] Call trace:
[   25.401745]  show_stack+0x20/0x38 (C)
[   25.402262]  dump_stack_lvl+0x8c/0xd0
[   25.402869]  print_report+0x118/0x5e0
[   25.403423]  kasan_report_invalid_free+0xb0/0xd8
[   25.404047]  check_slab_allocation+0xfc/0x108
[   25.404647]  __kasan_slab_pre_free+0x2c/0x48
[   25.405510]  kmem_cache_free+0xf0/0x470
[   25.406101]  kmem_cache_invalid_free+0x184/0x3b8
[   25.406742]  kunit_try_run_case+0x14c/0x3d0
[   25.407906]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.408627]  kthread+0x24c/0x2d0
[   25.409137]  ret_from_fork+0x10/0x20
[   25.409677] 
[   25.410029] Allocated by task 199:
[   25.410525]  kasan_save_stack+0x3c/0x68
[   25.411320]  kasan_save_track+0x20/0x40
[   25.411905]  kasan_save_alloc_info+0x40/0x58
[   25.412618]  __kasan_slab_alloc+0xa8/0xb0
[   25.413209]  kmem_cache_alloc_noprof+0x108/0x398
[   25.413879]  kmem_cache_invalid_free+0x12c/0x3b8
[   25.414469]  kunit_try_run_case+0x14c/0x3d0
[   25.415014]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   25.416288]  kthread+0x24c/0x2d0
[   25.416821]  ret_from_fork+0x10/0x20
[   25.417385] 
[   25.417692] The buggy address belongs to the object at fff00000c650b000
[   25.417692]  which belongs to the cache test_cache of size 200
[   25.418828] The buggy address is located 1 bytes inside of
[   25.418828]  200-byte region [fff00000c650b000, fff00000c650b0c8)
[   25.420540] 
[   25.420798] The buggy address belongs to the physical page:
[   25.421305] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10650b
[   25.422728] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   25.424466] page_type: f5(slab)
[   25.425191] raw: 0bfffe0000000000 fff00000c11623c0 dead000000000122 0000000000000000
[   25.426049] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   25.427371] page dumped because: kasan: bad access detected
[   25.428003] 
[   25.428323] Memory state around the buggy address:
[   25.428886]  fff00000c650af00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.429617]  fff00000c650af80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.430518] >fff00000c650b000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   25.431425]                    ^
[   25.431812]  fff00000c650b080: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
[   25.432409]  fff00000c650b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.434534] ==================================================================

[   25.538818] ==================================================================
[   25.539945] BUG: KASAN: invalid-free in kmem_cache_invalid_free+0x1d9/0x470
[   25.540576] Free of addr ffff88810240f001 by task kunit_try_catch/218
[   25.541503] 
[   25.541825] CPU: 1 UID: 0 PID: 218 Comm: kunit_try_catch Tainted: G    B            N 6.13.0-rc2-next-20241209 #1
[   25.543019] Tainted: [B]=BAD_PAGE, [N]=TEST
[   25.543477] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   25.544495] Call Trace:
[   25.544879]  <TASK>
[   25.545144]  dump_stack_lvl+0x73/0xb0
[   25.545716]  print_report+0xd1/0x640
[   25.546283]  ? __virt_addr_valid+0x1db/0x2d0
[   25.546983]  ? kmem_cache_invalid_free+0x1d9/0x470
[   25.547407]  ? kasan_complete_mode_report_info+0x2a/0x200
[   25.548148]  ? kmem_cache_invalid_free+0x1d9/0x470
[   25.548751]  kasan_report_invalid_free+0xc0/0xf0
[   25.549279]  ? kmem_cache_invalid_free+0x1d9/0x470
[   25.549728]  ? kmem_cache_invalid_free+0x1d9/0x470
[   25.550307]  check_slab_allocation+0x11f/0x130
[   25.550673]  __kasan_slab_pre_free+0x28/0x40
[   25.551081]  kmem_cache_free+0xee/0x420
[   25.551691]  ? kmem_cache_alloc_noprof+0x11e/0x3e0
[   25.552030]  ? kmem_cache_invalid_free+0x1d9/0x470
[   25.552631]  kmem_cache_invalid_free+0x1d9/0x470
[   25.553737]  ? __pfx_kmem_cache_invalid_free+0x10/0x10
[   25.554350]  ? finish_task_switch.isra.0+0x153/0x700
[   25.554951]  ? __switch_to+0x5d9/0xf60
[   25.555356]  ? __pfx_read_tsc+0x10/0x10
[   25.555859]  ? ktime_get_ts64+0x86/0x230
[   25.556608]  kunit_try_run_case+0x1b3/0x490
[   25.557418]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.557840]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   25.558648]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   25.559593]  ? __kthread_parkme+0x82/0x160
[   25.560418]  ? preempt_count_sub+0x50/0x80
[   25.560833]  ? __pfx_kunit_try_run_case+0x10/0x10
[   25.561510]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   25.562562]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.563372]  kthread+0x257/0x310
[   25.563760]  ? __pfx_kthread+0x10/0x10
[   25.564768]  ret_from_fork+0x41/0x80
[   25.565476]  ? __pfx_kthread+0x10/0x10
[   25.565875]  ret_from_fork_asm+0x1a/0x30
[   25.566840]  </TASK>
[   25.567354] 
[   25.567519] Allocated by task 218:
[   25.568284]  kasan_save_stack+0x3d/0x60
[   25.568697]  kasan_save_track+0x18/0x40
[   25.569713]  kasan_save_alloc_info+0x3b/0x50
[   25.570513]  __kasan_slab_alloc+0x91/0xa0
[   25.570710]  kmem_cache_alloc_noprof+0x11e/0x3e0
[   25.571359]  kmem_cache_invalid_free+0x158/0x470
[   25.572168]  kunit_try_run_case+0x1b3/0x490
[   25.572585]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   25.573804]  kthread+0x257/0x310
[   25.574547]  ret_from_fork+0x41/0x80
[   25.575132]  ret_from_fork_asm+0x1a/0x30
[   25.575605] 
[   25.575829] The buggy address belongs to the object at ffff88810240f000
[   25.575829]  which belongs to the cache test_cache of size 200
[   25.577665] The buggy address is located 1 bytes inside of
[   25.577665]  200-byte region [ffff88810240f000, ffff88810240f0c8)
[   25.578714] 
[   25.579048] The buggy address belongs to the physical page:
[   25.579651] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10240f
[   25.581372] flags: 0x200000000000000(node=0|zone=2)
[   25.581964] page_type: f5(slab)
[   25.582225] raw: 0200000000000000 ffff888101012b40 dead000000000122 0000000000000000
[   25.582851] raw: 0000000000000000 00000000800f000f 00000000f5000000 0000000000000000
[   25.583684] page dumped because: kasan: bad access detected
[   25.584698] 
[   25.585141] Memory state around the buggy address:
[   25.585471]  ffff88810240ef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.586613]  ffff88810240ef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.587249] >ffff88810240f000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   25.588226]                    ^
[   25.588787]  ffff88810240f080: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
[   25.589519]  ffff88810240f100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   25.590533] ==================================================================