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

Environment
qemu-arm64
qemu-x86_64

[   37.605903] ==================================================================
[   37.607096] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x64/0x70
[   37.607928] Read of size 4 at addr fff00000c65b0200 by task swapper/1/0
[   37.608524] 
[   37.608829] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Tainted: G    B            N 6.12.0-next-20241120 #1
[   37.610342] Tainted: [B]=BAD_PAGE, [N]=TEST
[   37.611125] Hardware name: linux,dummy-virt (DT)
[   37.611840] Call trace:
[   37.612277]  show_stack+0x20/0x38 (C)
[   37.612773]  dump_stack_lvl+0x8c/0xd0
[   37.613738]  print_report+0x118/0x5e0
[   37.614431]  kasan_report+0xc8/0x118
[   37.614945]  __asan_report_load4_noabort+0x20/0x30
[   37.615636]  rcu_uaf_reclaim+0x64/0x70
[   37.616138]  rcu_core+0xa54/0x1df8
[   37.616686]  rcu_core_si+0x18/0x30
[   37.617251]  handle_softirqs+0x374/0xb20
[   37.618320]  __do_softirq+0x1c/0x28
[   37.618780]  ____do_softirq+0x18/0x30
[   37.619343]  call_on_irq_stack+0x24/0x58
[   37.619909]  do_softirq_own_stack+0x24/0x38
[   37.620547]  __irq_exit_rcu+0x1fc/0x318
[   37.621135]  irq_exit_rcu+0x1c/0x80
[   37.622111]  el1_interrupt+0x38/0x58
[   37.622610]  el1h_64_irq_handler+0x18/0x28
[   37.623178]  el1h_64_irq+0x6c/0x70
[   37.623819]  arch_local_irq_enable+0x4/0x8 (P)
[   37.624534]  default_idle_call+0x6c/0x78 (L)
[   37.625127]  do_idle+0x384/0x4e8
[   37.626113]  cpu_startup_entry+0x68/0x80
[   37.626722]  secondary_start_kernel+0x288/0x340
[   37.627320]  __secondary_switched+0xc0/0xc8
[   37.627962] 
[   37.628308] Allocated by task 187:
[   37.628825]  kasan_save_stack+0x3c/0x68
[   37.629362]  kasan_save_track+0x20/0x40
[   37.630478]  kasan_save_alloc_info+0x40/0x58
[   37.631035]  __kasan_kmalloc+0xd4/0xd8
[   37.631619]  __kmalloc_cache_noprof+0x15c/0x3c8
[   37.632177]  rcu_uaf+0xb0/0x2d0
[   37.632700]  kunit_try_run_case+0x14c/0x3d0
[   37.633394]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.634426]  kthread+0x24c/0x2d0
[   37.635140]  ret_from_fork+0x10/0x20
[   37.635767] 
[   37.636259] Freed by task 0:
[   37.636775]  kasan_save_stack+0x3c/0x68
[   37.637428]  kasan_save_track+0x20/0x40
[   37.638245]  kasan_save_free_info+0x4c/0x78
[   37.639041]  __kasan_slab_free+0x6c/0x98
[   37.639753]  kfree+0x114/0x3d0
[   37.640327]  rcu_uaf_reclaim+0x28/0x70
[   37.640808]  rcu_core+0xa54/0x1df8
[   37.641231]  rcu_core_si+0x18/0x30
[   37.642299]  handle_softirqs+0x374/0xb20
[   37.642895]  __do_softirq+0x1c/0x28
[   37.643519] 
[   37.643966] Last potentially related work creation:
[   37.644721]  kasan_save_stack+0x3c/0x68
[   37.645472]  __kasan_record_aux_stack+0xbc/0xe8
[   37.646482]  kasan_record_aux_stack_noalloc+0x14/0x20
[   37.647009]  __call_rcu_common.constprop.0+0x74/0xa18
[   37.647821]  call_rcu+0x18/0x30
[   37.648484]  rcu_uaf+0x14c/0x2d0
[   37.648910]  kunit_try_run_case+0x14c/0x3d0
[   37.650035]  kunit_generic_run_threadfn_adapter+0x88/0x100
[   37.650969]  kthread+0x24c/0x2d0
[   37.651373]  ret_from_fork+0x10/0x20
[   37.651859] 
[   37.652190] The buggy address belongs to the object at fff00000c65b0200
[   37.652190]  which belongs to the cache kmalloc-32 of size 32
[   37.653171] The buggy address is located 0 bytes inside of
[   37.653171]  freed 32-byte region [fff00000c65b0200, fff00000c65b0220)
[   37.655206] 
[   37.655626] The buggy address belongs to the physical page:
[   37.656421] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1065b0
[   37.657648] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
[   37.658660] page_type: f5(slab)
[   37.659182] raw: 0bfffe0000000000 fff00000c0001780 dead000000000122 0000000000000000
[   37.660003] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   37.660907] page dumped because: kasan: bad access detected
[   37.661424] 
[   37.661785] Memory state around the buggy address:
[   37.662434]  fff00000c65b0100: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
[   37.663836]  fff00000c65b0180: 00 00 05 fc fc fc fc fc 00 00 07 fc fc fc fc fc
[   37.664660] >fff00000c65b0200: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
[   37.665839]                    ^
[   37.666251]  fff00000c65b0280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.666945]  fff00000c65b0300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   37.667712] ==================================================================

[   29.185297] ==================================================================
[   29.186749] BUG: KASAN: slab-use-after-free in rcu_uaf_reclaim+0x50/0x60
[   29.187776] Read of size 4 at addr ffff8881029e5540 by task swapper/1/0
[   29.188432] 
[   29.188660] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Tainted: G    B            N 6.12.0-next-20241120 #1
[   29.189444] Tainted: [B]=BAD_PAGE, [N]=TEST
[   29.190200] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[   29.191642] Call Trace:
[   29.191955]  <IRQ>
[   29.192316]  dump_stack_lvl+0x73/0xb0
[   29.192733]  print_report+0xd1/0x640
[   29.193317]  ? __virt_addr_valid+0x1db/0x2d0
[   29.193774]  ? kasan_complete_mode_report_info+0x64/0x200
[   29.194499]  kasan_report+0x102/0x140
[   29.194942]  ? rcu_uaf_reclaim+0x50/0x60
[   29.195473]  ? rcu_uaf_reclaim+0x50/0x60
[   29.195945]  __asan_report_load4_noabort+0x18/0x20
[   29.196609]  rcu_uaf_reclaim+0x50/0x60
[   29.197056]  rcu_core+0x680/0x1d70
[   29.197557]  ? __pfx_rcu_core+0x10/0x10
[   29.198033]  ? ktime_get+0x69/0x150
[   29.198513]  ? handle_softirqs+0x18e/0x720
[   29.198998]  rcu_core_si+0x12/0x20
[   29.199453]  handle_softirqs+0x209/0x720
[   29.199889]  ? hrtimer_interrupt+0x2fe/0x780
[   29.200534]  ? __pfx_handle_softirqs+0x10/0x10
[   29.200928]  __irq_exit_rcu+0xc9/0x110
[   29.201415]  irq_exit_rcu+0x12/0x20
[   29.202034]  sysvec_apic_timer_interrupt+0x81/0x90
[   29.202774]  </IRQ>
[   29.202955]  <TASK>
[   29.203304]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   29.204065] RIP: 0010:default_idle+0xf/0x20
[   29.204822] Code: 4c 01 c7 4c 29 c2 e9 72 ff ff ff 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d 13 f0 34 00 fb f4 <fa> c3 cc cc cc cc 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90
[   29.207374] RSP: 0000:ffff888100877de0 EFLAGS: 00010216
[   29.208447] RAX: ffff88815b100000 RBX: ffff888100845000 RCX: ffffffff98f0b925
[   29.209162] RDX: ffffed102b626b23 RSI: 0000000000000004 RDI: 000000000002ccac
[   29.209811] RBP: ffff888100877de8 R08: 0000000000000001 R09: ffffed102b626b22
[   29.210450] R10: ffff88815b135913 R11: 0000000000000000 R12: 0000000000000001
[   29.211426] R13: ffffed1020108a00 R14: ffffffff9ad72650 R15: 0000000000000000
[   29.212122]  ? ct_kernel_exit.constprop.0+0xa5/0xd0
[   29.212599]  ? arch_cpu_idle+0xd/0x20
[   29.213342]  default_idle_call+0x48/0x80
[   29.213540]  do_idle+0x310/0x3c0
[   29.213822]  ? __pfx_do_idle+0x10/0x10
[   29.214959]  ? _raw_spin_unlock_irqrestore+0x49/0x90
[   29.215751]  ? complete+0x15b/0x1d0
[   29.216788]  cpu_startup_entry+0x5c/0x70
[   29.217246]  start_secondary+0x216/0x290
[   29.217656]  ? __pfx_start_secondary+0x10/0x10
[   29.218297]  common_startup_64+0x12c/0x138
[   29.219370]  </TASK>
[   29.219561] 
[   29.219728] Allocated by task 205:
[   29.220361]  kasan_save_stack+0x3d/0x60
[   29.221023]  kasan_save_track+0x18/0x40
[   29.221949]  kasan_save_alloc_info+0x3b/0x50
[   29.222267]  __kasan_kmalloc+0xb7/0xc0
[   29.222780]  __kmalloc_cache_noprof+0x184/0x410
[   29.223841]  rcu_uaf+0xb1/0x330
[   29.224179]  kunit_try_run_case+0x1b3/0x490
[   29.224593]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   29.225122]  kthread+0x257/0x310
[   29.225428]  ret_from_fork+0x41/0x80
[   29.226381]  ret_from_fork_asm+0x1a/0x30
[   29.226648] 
[   29.226904] Freed by task 0:
[   29.227636]  kasan_save_stack+0x3d/0x60
[   29.228525]  kasan_save_track+0x18/0x40
[   29.229546]  kasan_save_free_info+0x3f/0x60
[   29.230143]  __kasan_slab_free+0x56/0x70
[   29.230955]  kfree+0x123/0x3f0
[   29.231338]  rcu_uaf_reclaim+0x1f/0x60
[   29.231782]  rcu_core+0x680/0x1d70
[   29.233210]  rcu_core_si+0x12/0x20
[   29.233535]  handle_softirqs+0x209/0x720
[   29.234528]  __irq_exit_rcu+0xc9/0x110
[   29.235088]  irq_exit_rcu+0x12/0x20
[   29.235608]  sysvec_apic_timer_interrupt+0x81/0x90
[   29.236102]  asm_sysvec_apic_timer_interrupt+0x1f/0x30
[   29.237118] 
[   29.237450] Last potentially related work creation:
[   29.237907]  kasan_save_stack+0x3d/0x60
[   29.238719]  __kasan_record_aux_stack+0xae/0xc0
[   29.239107]  kasan_record_aux_stack_noalloc+0xf/0x20
[   29.239896]  __call_rcu_common.constprop.0+0x72/0xaa0
[   29.240237]  call_rcu+0x12/0x20
[   29.240607]  rcu_uaf+0x169/0x330
[   29.241460]  kunit_try_run_case+0x1b3/0x490
[   29.242048]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[   29.242993]  kthread+0x257/0x310
[   29.243389]  ret_from_fork+0x41/0x80
[   29.244077]  ret_from_fork_asm+0x1a/0x30
[   29.244568] 
[   29.244900] The buggy address belongs to the object at ffff8881029e5540
[   29.244900]  which belongs to the cache kmalloc-32 of size 32
[   29.246768] The buggy address is located 0 bytes inside of
[   29.246768]  freed 32-byte region [ffff8881029e5540, ffff8881029e5560)
[   29.248344] 
[   29.248568] The buggy address belongs to the physical page:
[   29.249571] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1029e5
[   29.251329] flags: 0x200000000000000(node=0|zone=2)
[   29.251930] page_type: f5(slab)
[   29.252154] raw: 0200000000000000 ffff888100041780 dead000000000122 0000000000000000
[   29.253271] raw: 0000000000000000 0000000080400040 00000001f5000000 0000000000000000
[   29.254095] page dumped because: kasan: bad access detected
[   29.255090] 
[   29.255477] Memory state around the buggy address:
[   29.256229]  ffff8881029e5400: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   29.257437]  ffff8881029e5480: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
[   29.258952] >ffff8881029e5500: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
[   29.260484]                                            ^
[   29.261014]  ffff8881029e5580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.261887]  ffff8881029e5600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   29.262907] ==================================================================