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

Environment
qemu-arm64
qemu-x86_64

[   37.425862] ==================================================================
[   37.427428] BUG: KASAN: slab-use-after-free in strlen+0xa8/0xb0
[   37.428637] Read of size 1 at addr fff00000c6a4c550 by task kunit_try_catch/248
[   37.430155] 
[   37.430581] CPU: 1 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   37.431721] Tainted: [B]=BAD_PAGE, [N]=TEST
[   37.432761] Hardware name: linux,dummy-virt (DT)
[   37.433231] Call trace:
[   37.434403]  show_stack+0x20/0x38 (C)
[   37.435359]  dump_stack_lvl+0x8c/0xd0
[   37.436010]  print_report+0x118/0x5e0
[   37.436325]  kasan_report+0xc8/0x118
[   37.437429]  __asan_report_load1_noabort+0x20/0x30
[   37.438731]  strlen+0xa8/0xb0
[   37.439421]  kasan_strings+0x320/0x8f8
[   37.440192]  kunit_try_run_case+0x14c/0x3d0
[   37.440945]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.441633]  kthread+0x24c/0x2d0
[   37.442179]  ret_from_fork+0x10/0x20
[   37.442837] 
[   37.443217] Allocated by task 248:
[   37.445206]  kasan_save_stack+0x3c/0x68
[   37.446263]  kasan_save_track+0x20/0x40
[   37.447117]  kasan_save_alloc_info+0x40/0x58
[   37.447961]  __kasan_kmalloc+0xd4/0xd8
[   37.449035]  __kmalloc_cache_noprof+0x15c/0x3c8
[   37.449930]  kasan_strings+0xb4/0x8f8
[   37.450914]  kunit_try_run_case+0x14c/0x3d0
[   37.451810]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.452965]  kthread+0x24c/0x2d0
[   37.453987]  ret_from_fork+0x10/0x20
[   37.454292] 
[   37.454500] Freed by task 248:
[   37.454888]  kasan_save_stack+0x3c/0x68
[   37.455702]  kasan_save_track+0x20/0x40
[   37.456208]  kasan_save_free_info+0x4c/0x78
[   37.457831]  __kasan_slab_free+0x6c/0x98
[   37.458345]  kfree+0x114/0x3d0
[   37.459064]  kasan_strings+0x128/0x8f8
[   37.459616]  kunit_try_run_case+0x14c/0x3d0
[   37.460364]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.461221]  kthread+0x24c/0x2d0
[   37.462452]  ret_from_fork+0x10/0x20
[   37.463109] 
[   37.463480] The buggy address belongs to the object at fff00000c6a4c540
[   37.463480]  which belongs to the cache kmalloc-32 of size 32
[   37.465373] The buggy address is located 16 bytes inside of
[   37.465373]  freed 32-byte region [fff00000c6a4c540, fff00000c6a4c560)
[   37.467890] 
[   37.468255] The buggy address belongs to the physical page:
[   37.468896] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106a4c
[   37.470965] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   37.471787] page_type: f5(slab)
[   37.472062] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   37.473086] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   37.474701] page dumped because: kasan: bad access detected
[   37.475573] 
[   37.476247] Memory state around the buggy address:
[   37.476864]  fff00000c6a4c400: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   37.478328]  fff00000c6a4c480: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   37.479367] >fff00000c6a4c500: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   37.480284]                                                  ^
[   37.481280]  fff00000c6a4c580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.481937]  fff00000c6a4c600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.483404] ==================================================================

[   28.305327] ==================================================================
[   28.306524] BUG: KASAN: slab-use-after-free in strlen+0x8f/0xb0
[   28.307534] Read of size 1 at addr ffff888102a18a90 by task kunit_try_catch/267
[   28.308293] 
[   28.308543] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241122 #1
[   28.309344] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.309794] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.310817] Call Trace:
[   28.311772]  <TASK>
[   28.312231]  dump_stack_lvl+0x73/0xb0
[   28.312725]  print_report+0xd1/0x640
[   28.313114]  ? __virt_addr_valid+0x1db/0x2d0
[   28.313654]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.314290]  kasan_report+0x102/0x140
[   28.314801]  ? strlen+0x8f/0xb0
[   28.315300]  ? strlen+0x8f/0xb0
[   28.315627]  __asan_report_load1_noabort+0x18/0x20
[   28.316158]  strlen+0x8f/0xb0
[   28.316586]  kasan_strings+0x432/0xb60
[   28.317180]  ? __pfx_kasan_strings+0x10/0x10
[   28.317537]  ? __schedule+0xc3e/0x2790
[   28.317817]  ? __pfx_read_tsc+0x10/0x10
[   28.318776]  ? ktime_get_ts64+0x84/0x230
[   28.319315]  kunit_try_run_case+0x1b3/0x490
[   28.320059]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.320732]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.321410]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.321985]  ? __kthread_parkme+0x82/0x160
[   28.322374]  ? preempt_count_sub+0x50/0x80
[   28.322953]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.323254]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.323605]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.324234]  kthread+0x257/0x310
[   28.324645]  ? __pfx_kthread+0x10/0x10
[   28.325177]  ret_from_fork+0x41/0x80
[   28.325853]  ? __pfx_kthread+0x10/0x10
[   28.326939]  ret_from_fork_asm+0x1a/0x30
[   28.327652]  </TASK>
[   28.328020] 
[   28.328241] Allocated by task 267:
[   28.329249]  kasan_save_stack+0x3d/0x60
[   28.329802]  kasan_save_track+0x18/0x40
[   28.330245]  kasan_save_alloc_info+0x3b/0x50
[   28.331802]  __kasan_kmalloc+0xb7/0xc0
[   28.332278]  __kmalloc_cache_noprof+0x184/0x410
[   28.332568]  kasan_strings+0xb3/0xb60
[   28.332846]  kunit_try_run_case+0x1b3/0x490
[   28.333218]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.334189]  kthread+0x257/0x310
[   28.334578]  ret_from_fork+0x41/0x80
[   28.335022]  ret_from_fork_asm+0x1a/0x30
[   28.335593] 
[   28.335814] Freed by task 267:
[   28.336317]  kasan_save_stack+0x3d/0x60
[   28.336731]  kasan_save_track+0x18/0x40
[   28.337355]  kasan_save_free_info+0x3f/0x60
[   28.337644]  __kasan_slab_free+0x56/0x70
[   28.337999]  kfree+0x123/0x3f0
[   28.338339]  kasan_strings+0x13a/0xb60
[   28.339041]  kunit_try_run_case+0x1b3/0x490
[   28.340140]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.340739]  kthread+0x257/0x310
[   28.341015]  ret_from_fork+0x41/0x80
[   28.341272]  ret_from_fork_asm+0x1a/0x30
[   28.341541] 
[   28.341741] The buggy address belongs to the object at ffff888102a18a80
[   28.341741]  which belongs to the cache kmalloc-32 of size 32
[   28.343400] The buggy address is located 16 bytes inside of
[   28.343400]  freed 32-byte region [ffff888102a18a80, ffff888102a18aa0)
[   28.344622] 
[   28.344949] The buggy address belongs to the physical page:
[   28.345319] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a18
[   28.345850] flags: 0x200000000000000(node=0|zone=2)
[   28.346172] page_type: f5(slab)
[   28.346410] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.347779] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.348631] page dumped because: kasan: bad access detected
[   28.349136] 
[   28.349379] Memory state around the buggy address:
[   28.349774]  ffff888102a18980: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.350737]  ffff888102a18a00: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.351240] >ffff888102a18a80: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   28.351887]                          ^
[   28.352347]  ffff888102a18b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.352714]  ffff888102a18b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.353093] ==================================================================