Hay
Date
May 23, 2025, 11:07 p.m.

Environment
qemu-arm64
qemu-x86_64

[   27.804136] ==================================================================
[   27.804661] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x170/0x310
[   27.804911] Write of size 33 at addr fff00000c775e080 by task kunit_try_catch/188
[   27.805315] 
[   27.805683] CPU: 0 UID: 0 PID: 188 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc7 #1 PREEMPT 
[   27.806063] Tainted: [B]=BAD_PAGE, [N]=TEST
[   27.806155] Hardware name: linux,dummy-virt (DT)
[   27.806382] Call trace:
[   27.806651]  show_stack+0x20/0x38 (C)
[   27.807107]  dump_stack_lvl+0x8c/0xd0
[   27.807499]  print_report+0x118/0x608
[   27.807636]  kasan_report+0xdc/0x128
[   27.807753]  kasan_check_range+0x100/0x1a8
[   27.807899]  __asan_memset+0x34/0x78
[   27.808036]  kmalloc_uaf_memset+0x170/0x310
[   27.808245]  kunit_try_run_case+0x170/0x3f0
[   27.808633]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.809299]  kthread+0x328/0x630
[   27.809551]  ret_from_fork+0x10/0x20
[   27.809864] 
[   27.809998] Allocated by task 188:
[   27.810151]  kasan_save_stack+0x3c/0x68
[   27.810271]  kasan_save_track+0x20/0x40
[   27.810382]  kasan_save_alloc_info+0x40/0x58
[   27.810510]  __kasan_kmalloc+0xd4/0xd8
[   27.810618]  __kmalloc_cache_noprof+0x15c/0x3c0
[   27.810744]  kmalloc_uaf_memset+0xb8/0x310
[   27.810857]  kunit_try_run_case+0x170/0x3f0
[   27.810977]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.811111]  kthread+0x328/0x630
[   27.812082]  ret_from_fork+0x10/0x20
[   27.812513] 
[   27.812573] Freed by task 188:
[   27.812656]  kasan_save_stack+0x3c/0x68
[   27.812759]  kasan_save_track+0x20/0x40
[   27.813061]  kasan_save_free_info+0x4c/0x78
[   27.813329]  __kasan_slab_free+0x6c/0x98
[   27.813651]  kfree+0x214/0x3c8
[   27.814072]  kmalloc_uaf_memset+0x11c/0x310
[   27.814324]  kunit_try_run_case+0x170/0x3f0
[   27.814649]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   27.814904]  kthread+0x328/0x630
[   27.815219]  ret_from_fork+0x10/0x20
[   27.815361] 
[   27.815427] The buggy address belongs to the object at fff00000c775e080
[   27.815427]  which belongs to the cache kmalloc-64 of size 64
[   27.815620] The buggy address is located 0 bytes inside of
[   27.815620]  freed 64-byte region [fff00000c775e080, fff00000c775e0c0)
[   27.815812] 
[   27.815870] The buggy address belongs to the physical page:
[   27.816610] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10775e
[   27.817427] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   27.817738] page_type: f5(slab)
[   27.817972] raw: 0bfffe0000000000 fff00000c00018c0 dead000000000122 0000000000000000
[   27.818150] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   27.818597] page dumped because: kasan: bad access detected
[   27.818718] 
[   27.818770] Memory state around the buggy address:
[   27.818870]  fff00000c775df80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   27.819007]  fff00000c775e000: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   27.819138] >fff00000c775e080: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   27.819256]                    ^
[   27.819341]  fff00000c775e100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.820394]  fff00000c775e180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   27.821558] ==================================================================

[   12.851176] ==================================================================
[   12.851616] BUG: KASAN: slab-use-after-free in kmalloc_uaf_memset+0x1a3/0x360
[   12.851860] Write of size 33 at addr ffff888102a38e00 by task kunit_try_catch/205
[   12.852551] 
[   12.852790] CPU: 1 UID: 0 PID: 205 Comm: kunit_try_catch Tainted: G    B            N  6.15.0-rc7 #1 PREEMPT(voluntary) 
[   12.852840] Tainted: [B]=BAD_PAGE, [N]=TEST
[   12.852852] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   12.852874] Call Trace:
[   12.852888]  <TASK>
[   12.852906]  dump_stack_lvl+0x73/0xb0
[   12.852936]  print_report+0xd1/0x650
[   12.852958]  ? __virt_addr_valid+0x1db/0x2d0
[   12.852980]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.853000]  ? kasan_complete_mode_report_info+0x64/0x200
[   12.853021]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.853043]  kasan_report+0x141/0x180
[   12.853064]  ? kmalloc_uaf_memset+0x1a3/0x360
[   12.853090]  kasan_check_range+0x10c/0x1c0
[   12.853110]  __asan_memset+0x27/0x50
[   12.853129]  kmalloc_uaf_memset+0x1a3/0x360
[   12.853150]  ? __pfx_kmalloc_uaf_memset+0x10/0x10
[   12.853171]  ? sysvec_apic_timer_interrupt+0x50/0x90
[   12.853195]  ? trace_hardirqs_on+0x37/0xe0
[   12.853219]  ? __pfx_read_tsc+0x10/0x10
[   12.853239]  ? ktime_get_ts64+0x86/0x230
[   12.853265]  kunit_try_run_case+0x1a5/0x480
[   12.853289]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.853324]  ? _raw_spin_lock_irqsave+0xa1/0x100
[   12.853347]  ? __kthread_parkme+0x82/0x180
[   12.853368]  ? preempt_count_sub+0x50/0x80
[   12.853394]  ? __pfx_kunit_try_run_case+0x10/0x10
[   12.853416]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.853437]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[   12.853459]  kthread+0x337/0x6f0
[   12.853475]  ? trace_preempt_on+0x20/0xc0
[   12.853496]  ? __pfx_kthread+0x10/0x10
[   12.853514]  ? _raw_spin_unlock_irq+0x47/0x80
[   12.853533]  ? calculate_sigpending+0x7b/0xa0
[   12.853555]  ? __pfx_kthread+0x10/0x10
[   12.853573]  ret_from_fork+0x41/0x80
[   12.853593]  ? __pfx_kthread+0x10/0x10
[   12.853610]  ret_from_fork_asm+0x1a/0x30
[   12.853640]  </TASK>
[   12.853651] 
[   12.866517] Allocated by task 205:
[   12.866879]  kasan_save_stack+0x45/0x70
[   12.867302]  kasan_save_track+0x18/0x40
[   12.867633]  kasan_save_alloc_info+0x3b/0x50
[   12.867790]  __kasan_kmalloc+0xb7/0xc0
[   12.868050]  __kmalloc_cache_noprof+0x189/0x420
[   12.868468]  kmalloc_uaf_memset+0xa9/0x360
[   12.868857]  kunit_try_run_case+0x1a5/0x480
[   12.869357]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.869833]  kthread+0x337/0x6f0
[   12.870660]  ret_from_fork+0x41/0x80
[   12.871331]  ret_from_fork_asm+0x1a/0x30
[   12.871845] 
[   12.872177] Freed by task 205:
[   12.872684]  kasan_save_stack+0x45/0x70
[   12.873153]  kasan_save_track+0x18/0x40
[   12.873633]  kasan_save_free_info+0x3f/0x60
[   12.873830]  __kasan_slab_free+0x56/0x70
[   12.874546]  kfree+0x222/0x3f0
[   12.874976]  kmalloc_uaf_memset+0x12b/0x360
[   12.875571]  kunit_try_run_case+0x1a5/0x480
[   12.876223]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   12.877022]  kthread+0x337/0x6f0
[   12.877216]  ret_from_fork+0x41/0x80
[   12.877389]  ret_from_fork_asm+0x1a/0x30
[   12.878102] 
[   12.878463] The buggy address belongs to the object at ffff888102a38e00
[   12.878463]  which belongs to the cache kmalloc-64 of size 64
[   12.880013] The buggy address is located 0 bytes inside of
[   12.880013]  freed 64-byte region [ffff888102a38e00, ffff888102a38e40)
[   12.881659] 
[   12.881764] The buggy address belongs to the physical page:
[   12.881987] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102a38
[   12.882309] flags: 0x200000000000000(node=0|zone=2)
[   12.882522] page_type: f5(slab)
[   12.882681] raw: 0200000000000000 ffff8881000418c0 dead000000000122 0000000000000000
[   12.882977] raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
[   12.883264] page dumped because: kasan: bad access detected
[   12.884471] 
[   12.884944] Memory state around the buggy address:
[   12.885801]  ffff888102a38d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.886954]  ffff888102a38d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.887999] >ffff888102a38e00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
[   12.889089]                    ^
[   12.889650]  ffff888102a38e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.890708]  ffff888102a38f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   12.891782] ==================================================================