Hay
Date
Nov. 27, 2024, 3:37 a.m.

Environment
qemu-arm64
qemu-x86_64

[   51.111184] ==================================================================
[   51.111831] BUG: KASAN: slab-use-after-free in strlen+0xa8/0xb0
[   51.112999] Read of size 1 at addr fff00000c616c150 by task kunit_try_catch/248
[   51.114790] 
[   51.115073] CPU: 0 UID: 0 PID: 248 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   51.116652] Tainted: [B]=BAD_PAGE, [N]=TEST
[   51.117601] Hardware name: linux,dummy-virt (DT)
[   51.118801] Call trace:
[   51.119349]  show_stack+0x20/0x38 (C)
[   51.119855]  dump_stack_lvl+0x8c/0xd0
[   51.120466]  print_report+0x118/0x5e0
[   51.121091]  kasan_report+0xc8/0x118
[   51.121986]  __asan_report_load1_noabort+0x20/0x30
[   51.122774]  strlen+0xa8/0xb0
[   51.123388]  kasan_strings+0x320/0x8f8
[   51.124072]  kunit_try_run_case+0x14c/0x3d0
[   51.124834]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   51.126006]  kthread+0x24c/0x2d0
[   51.126595]  ret_from_fork+0x10/0x20
[   51.127307] 
[   51.127823] Allocated by task 248:
[   51.128417]  kasan_save_stack+0x3c/0x68
[   51.129084]  kasan_save_track+0x20/0x40
[   51.129625]  kasan_save_alloc_info+0x40/0x58
[   51.130331]  __kasan_kmalloc+0xd4/0xd8
[   51.130928]  __kmalloc_cache_noprof+0x15c/0x3c0
[   51.131975]  kasan_strings+0xb4/0x8f8
[   51.132469]  kunit_try_run_case+0x14c/0x3d0
[   51.133913]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   51.134649]  kthread+0x24c/0x2d0
[   51.135127]  ret_from_fork+0x10/0x20
[   51.135708] 
[   51.136097] Freed by task 248:
[   51.136762]  kasan_save_stack+0x3c/0x68
[   51.138036]  kasan_save_track+0x20/0x40
[   51.139361]  kasan_save_free_info+0x4c/0x78
[   51.140319]  __kasan_slab_free+0x6c/0x98
[   51.140953]  kfree+0x114/0x3c8
[   51.141938]  kasan_strings+0x128/0x8f8
[   51.142744]  kunit_try_run_case+0x14c/0x3d0
[   51.143362]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   51.144076]  kthread+0x24c/0x2d0
[   51.144617]  ret_from_fork+0x10/0x20
[   51.145251] 
[   51.145603] The buggy address belongs to the object at fff00000c616c140
[   51.145603]  which belongs to the cache kmalloc-32 of size 32
[   51.147168] The buggy address is located 16 bytes inside of
[   51.147168]  freed 32-byte region [fff00000c616c140, fff00000c616c160)
[   51.148571] 
[   51.148864] The buggy address belongs to the physical page:
[   51.150283] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10616c
[   51.151255] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   51.152180] page_type: f5(slab)
[   51.152844] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   51.154164] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   51.155108] page dumped because: kasan: bad access detected
[   51.155817] 
[   51.156168] Memory state around the buggy address:
[   51.156868]  fff00000c616c000: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   51.158022]  fff00000c616c080: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   51.159817] >fff00000c616c100: 00 00 07 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   51.160490]                                                  ^
[   51.161895]  fff00000c616c180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   51.163773]  fff00000c616c200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   51.165209] ==================================================================

[   28.520924] ==================================================================
[   28.521813] BUG: KASAN: slab-use-after-free in strlen+0x8f/0xb0
[   28.522486] Read of size 1 at addr ffff888101ab9950 by task kunit_try_catch/267
[   28.522907] 
[   28.523614] CPU: 1 UID: 0 PID: 267 Comm: kunit_try_catch Tainted: G    B            N 6.12.0-next-20241127 #1
[   28.525354] Tainted: [B]=BAD_PAGE, [N]=TEST
[   28.525633] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   28.526395] Call Trace:
[   28.526689]  <TASK>
[   28.526948]  dump_stack_lvl+0x73/0xb0
[   28.527502]  print_report+0xd1/0x640
[   28.527797]  ? __virt_addr_valid+0x1db/0x2d0
[   28.529320]  ? kasan_complete_mode_report_info+0x64/0x200
[   28.530404]  kasan_report+0x102/0x140
[   28.531110]  ? strlen+0x8f/0xb0
[   28.531689]  ? strlen+0x8f/0xb0
[   28.532347]  __asan_report_load1_noabort+0x18/0x20
[   28.532808]  strlen+0x8f/0xb0
[   28.533655]  kasan_strings+0x432/0xb60
[   28.534375]  ? __pfx_kasan_strings+0x10/0x10
[   28.535094]  ? __schedule+0xc3e/0x2790
[   28.535790]  ? __pfx_read_tsc+0x10/0x10
[   28.536665]  ? ktime_get_ts64+0x84/0x230
[   28.537394]  kunit_try_run_case+0x1b3/0x490
[   28.537817]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.539101]  ? _raw_spin_lock_irqsave+0xa2/0x110
[   28.539593]  ? _raw_spin_unlock_irqrestore+0x5f/0x90
[   28.541031]  ? __kthread_parkme+0x82/0x160
[   28.541818]  ? preempt_count_sub+0x50/0x80
[   28.542525]  ? __pfx_kunit_try_run_case+0x10/0x10
[   28.543519]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   28.544501]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.545701]  kthread+0x257/0x310
[   28.546154]  ? __pfx_kthread+0x10/0x10
[   28.546364]  ret_from_fork+0x41/0x80
[   28.546546]  ? __pfx_kthread+0x10/0x10
[   28.546726]  ret_from_fork_asm+0x1a/0x30
[   28.547071]  </TASK>
[   28.547421] 
[   28.547581] Allocated by task 267:
[   28.547822]  kasan_save_stack+0x3d/0x60
[   28.548357]  kasan_save_track+0x18/0x40
[   28.548866]  kasan_save_alloc_info+0x3b/0x50
[   28.549437]  __kasan_kmalloc+0xb7/0xc0
[   28.549714]  __kmalloc_cache_noprof+0x184/0x410
[   28.550080]  kasan_strings+0xb3/0xb60
[   28.550368]  kunit_try_run_case+0x1b3/0x490
[   28.551162]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.551809]  kthread+0x257/0x310
[   28.552561]  ret_from_fork+0x41/0x80
[   28.553209]  ret_from_fork_asm+0x1a/0x30
[   28.553709] 
[   28.554130] Freed by task 267:
[   28.554507]  kasan_save_stack+0x3d/0x60
[   28.554839]  kasan_save_track+0x18/0x40
[   28.555452]  kasan_save_free_info+0x3f/0x60
[   28.556113]  __kasan_slab_free+0x56/0x70
[   28.556543]  kfree+0x123/0x3f0
[   28.556801]  kasan_strings+0x13a/0xb60
[   28.557663]  kunit_try_run_case+0x1b3/0x490
[   28.558263]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   28.558820]  kthread+0x257/0x310
[   28.559378]  ret_from_fork+0x41/0x80
[   28.559796]  ret_from_fork_asm+0x1a/0x30
[   28.560290] 
[   28.560527] The buggy address belongs to the object at ffff888101ab9940
[   28.560527]  which belongs to the cache kmalloc-32 of size 32
[   28.561489] The buggy address is located 16 bytes inside of
[   28.561489]  freed 32-byte region [ffff888101ab9940, ffff888101ab9960)
[   28.562957] 
[   28.563339] The buggy address belongs to the physical page:
[   28.563715] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101ab9
[   28.564655] flags: 0x200000000000000(node=0|zone=2)
[   28.565186] page_type: f5(slab)
[   28.565618] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   28.566439] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   28.567351] page dumped because: kasan: bad access detected
[   28.567816] 
[   28.568208] Memory state around the buggy address:
[   28.568722]  ffff888101ab9800: 00 00 07 fc fc fc fc fc 00 00 00 fc fc fc fc fc
[   28.569540]  ffff888101ab9880: 00 00 00 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   28.570332] >ffff888101ab9900: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   28.570946]                                                  ^
[   28.571597]  ffff888101ab9980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.572186]  ffff888101ab9a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   28.572896] ==================================================================