syzbot


KASAN: slab-out-of-bounds Read in __switch_to

Status: upstream: reported on 2025/07/01 02:03
Reported-by: syzbot+25b4ff4cee9dba982876@syzkaller.appspotmail.com
First crash: 13d, last: 13d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream Internal error in __switch_to arm 2 409d 405d 0/29 auto-obsoleted due to no activity on 2024/08/29 02:57

Sample crash report:
loop3: detected capacity change from 0 to 4096
ntfs3: loop3: Different NTFS' sector size (1024) and media sector size (512)
==================================================================
BUG: KASAN: slab-out-of-bounds in read_ti_thread_flags include/linux/thread_info.h:127 [inline]
BUG: KASAN: slab-out-of-bounds in switch_to_extra arch/x86/kernel/process.h:17 [inline]
BUG: KASAN: slab-out-of-bounds in __switch_to+0x5ea/0x1080 arch/x86/kernel/process_64.c:628
Read of size 8 at addr ffff88807c821dbf by task syz.3.535/6285

CPU: 1 PID: 6285 Comm: syz.3.535 Not tainted 6.1.142-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0xa8/0x220 mm/kasan/report.c:427
 kasan_report+0x10b/0x140 mm/kasan/report.c:531
 read_ti_thread_flags include/linux/thread_info.h:127 [inline]
 switch_to_extra arch/x86/kernel/process.h:17 [inline]
 __switch_to+0x5ea/0x1080 arch/x86/kernel/process_64.c:628
 context_switch kernel/sched/core.c:5244 [inline]
 __schedule+0x10e9/0x40d0 kernel/sched/core.c:6561
 schedule+0xb9/0x180 kernel/sched/core.c:6637
 schedule_timeout+0x97/0x280 kernel/time/timer.c:1941
 do_wait_for_common kernel/sched/completion.c:85 [inline]
 __wait_for_common kernel/sched/completion.c:106 [inline]
 wait_for_common kernel/sched/completion.c:117 [inline]
 wait_for_completion+0x2b9/0x590 kernel/sched/completion.c:138
 rdmsr_safe_on_cpu+0x139/0x210 arch/x86/lib/msr-smp.c:183
 msr_read+0x10a/0x1b0 arch/x86/kernel/msr.c:67
 vfs_read+0x2c0/0x920 fs/read_write.c:468
 ksys_read+0x143/0x240 fs/read_write.c:613
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f285818e929
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f28590b3038 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f28583b5fa0 RCX: 00007f285818e929
RDX: 0000000000018ff8 RSI: 0000200000019680 RDI: 0000000000000005
RBP: 00007f2858210b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f28583b5fa0 R15: 00007ffc24ab5088
 </TASK>

Allocated by task 4237:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x6b/0x80 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 kmem_cache_alloc_node+0x14d/0x320 mm/slub.c:3443
 alloc_task_struct_node kernel/fork.c:172 [inline]
 dup_task_struct+0x57/0x6b0 kernel/fork.c:981
 copy_process+0x5bd/0x4020 kernel/fork.c:2181
 kernel_clone+0x225/0x8b0 kernel/fork.c:2757
 __do_sys_clone kernel/fork.c:2898 [inline]
 __se_sys_clone kernel/fork.c:2882 [inline]
 __x64_sys_clone+0x17c/0x1d0 kernel/fork.c:2882
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486
 task_work_add+0x79/0x330 kernel/task_work.c:48
 task_tick_numa kernel/sched/fair.c:3145 [inline]
 task_tick_fair+0x8fa/0xb30 kernel/sched/fair.c:11868
 scheduler_tick+0x1ea/0x570 kernel/sched/core.c:5520
 update_process_times+0x177/0x1b0 kernel/time/timer.c:1874
 tick_sched_handle kernel/time/tick-sched.c:254 [inline]
 tick_sched_timer+0x37d/0x560 kernel/time/tick-sched.c:1501
 __run_hrtimer kernel/time/hrtimer.c:1752 [inline]
 __hrtimer_run_queues+0x515/0xd60 kernel/time/hrtimer.c:1816
 hrtimer_interrupt+0x3c5/0x9c0 kernel/time/hrtimer.c:1878
 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1107 [inline]
 __sysvec_apic_timer_interrupt+0x153/0x5a0 arch/x86/kernel/apic/apic.c:1124
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1118 [inline]
 sysvec_apic_timer_interrupt+0x9b/0xc0 arch/x86/kernel/apic/apic.c:1118
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:691

Second to last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:486
 task_work_add+0x79/0x330 kernel/task_work.c:48
 task_tick_numa kernel/sched/fair.c:3145 [inline]
 task_tick_fair+0x8fa/0xb30 kernel/sched/fair.c:11868
 scheduler_tick+0x1ea/0x570 kernel/sched/core.c:5520
 update_process_times+0x177/0x1b0 kernel/time/timer.c:1874
 tick_sched_handle kernel/time/tick-sched.c:254 [inline]
 tick_sched_timer+0x37d/0x560 kernel/time/tick-sched.c:1501
 __run_hrtimer kernel/time/hrtimer.c:1752 [inline]
 __hrtimer_run_queues+0x515/0xd60 kernel/time/hrtimer.c:1816
 hrtimer_interrupt+0x3c5/0x9c0 kernel/time/hrtimer.c:1878
 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1107 [inline]
 __sysvec_apic_timer_interrupt+0x153/0x5a0 arch/x86/kernel/apic/apic.c:1124
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1118 [inline]
 sysvec_apic_timer_interrupt+0x9b/0xc0 arch/x86/kernel/apic/apic.c:1118
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:691

The buggy address belongs to the object at ffff88807c820000
 which belongs to the cache task_struct of size 7360
The buggy address is located 255 bytes to the right of
 7360-byte region [ffff88807c820000, ffff88807c821cc0)

The buggy address belongs to the physical page:
page:ffffea0001f20800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7c820
head:ffffea0001f20800 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff88805770ca41
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000bcd800 dead000000000003 ffff888140008500
raw: 0000000000000000 0000000000040004 00000001ffffffff ffff88805770ca41
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3614, tgid 3614 (S02sysctl), ts 14444465205, free_ts 12342934236
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328
 __alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5614
 alloc_slab_page+0x5d/0x160 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x87/0x2c0 mm/slub.c:1992
 ___slab_alloc+0xbc6/0x1220 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 kmem_cache_alloc_node+0x1e5/0x320 mm/slub.c:3443
 alloc_task_struct_node kernel/fork.c:172 [inline]
 dup_task_struct+0x57/0x6b0 kernel/fork.c:981
 copy_process+0x5bd/0x4020 kernel/fork.c:2181
 kernel_clone+0x225/0x8b0 kernel/fork.c:2757
 __do_sys_clone kernel/fork.c:2898 [inline]
 __se_sys_clone kernel/fork.c:2882 [inline]
 __x64_sys_clone+0x17c/0x1d0 kernel/fork.c:2882
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384
 free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3479
 free_contig_range+0x9d/0x150 mm/page_alloc.c:9574
 destroy_args+0xef/0x8bf mm/debug_vm_pgtable.c:1031
 debug_vm_pgtable+0x32a/0x37e mm/debug_vm_pgtable.c:1354
 do_one_initcall+0x214/0x7a0 init/main.c:1298
 do_initcall_level+0x137/0x1e4 init/main.c:1371
 do_initcalls+0x4b/0x8a init/main.c:1387
 kernel_init_freeable+0x3fa/0x5ac init/main.c:1626
 kernel_init+0x19/0x1b0 init/main.c:1514
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
 ffff88807c821c80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff88807c821d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807c821d80: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
                                        ^
 ffff88807c821e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88807c821e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/01 02:02 linux-6.1.y 7e69c33e4858 6e83b42d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: slab-out-of-bounds Read in __switch_to
* Struck through repros no longer work on HEAD.