syzbot


KASAN: stack-out-of-bounds Write in copy_process

Status: closed as invalid on 2024/09/13 10:29
Subsystems: kernel
[Documentation on labels]
First crash: 108d, last: 108d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 general protection fault in copy_process 3 1062d 1134d 0/1 auto-closed as invalid on 2022/05/09 22:13
linux-4.14 general protection fault in copy_process 1 1378d 1378d 0/1 auto-closed as invalid on 2021/06/27 14:40

Sample crash report:
==================================================================
BUG: KASAN: stack-out-of-bounds in symbol_string+0xb6/0x3b0 lib/vsprintf.c:987
Write of size 666 at addr ffffc900090e74e0 by task syz.3.48/5557

CPU: 0 UID: 0 PID: 5557 Comm: syz.3.48 Tainted: G      D            6.11.0-rc4-next-20240820-syzkaller #0
Tainted: [D]=DIE
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 </TASK>

The buggy address belongs to stack of task syz.3.48/5557

The buggy address belongs to the virtual mapping at
 [ffffc900090e0000, ffffc900090e9000) created by:
 copy_process+0x5d1/0x3d50 kernel/fork.c:2206

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88804e6dee88 pfn:0x4e6de
memcg:ffff88802496fb02
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: ffff88804e6dee88 0000000000000000 00000001ffffffff ffff88802496fb02
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 5475, tgid 5475 (syz.1.31), ts 91455685686, free_ts 86850602565
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1517
 prep_new_page mm/page_alloc.c:1525 [inline]
 get_page_from_freelist+0x3004/0x30c0 mm/page_alloc.c:3476
 __alloc_pages_noprof+0x29e/0x780 mm/page_alloc.c:4743
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
 vm_area_alloc_pages mm/vmalloc.c:3600 [inline]
 __vmalloc_area_node mm/vmalloc.c:3669 [inline]
 __vmalloc_node_range_noprof+0xa40/0x1400 mm/vmalloc.c:3850
 alloc_thread_stack_node kernel/fork.c:314 [inline]
 dup_task_struct+0x444/0x8c0 kernel/fork.c:1115
 copy_process+0x5d1/0x3d50 kernel/fork.c:2206
 kernel_clone+0x226/0x8f0 kernel/fork.c:2787
 __do_sys_clone3 kernel/fork.c:3091 [inline]
 __se_sys_clone3+0x2cb/0x350 kernel/fork.c:3070
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 5448 tgid 5438 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1098 [inline]
 free_unref_folios+0xe8a/0x1850 mm/page_alloc.c:2699
 folios_put_refs+0x76e/0x860 mm/swap.c:1007
 free_pages_and_swap_cache+0x2ea/0x690 mm/swap_state.c:332
 __tlb_batch_free_encoded_pages mm/mmu_gather.c:136 [inline]
 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:366 [inline]
 tlb_flush_mmu+0x3a3/0x680 mm/mmu_gather.c:373
 tlb_finish_mmu+0xd4/0x200 mm/mmu_gather.c:465
 exit_mmap+0x496/0xc40 mm/mmap.c:1934
 __mmput+0x115/0x390 kernel/fork.c:1347
 exit_mm+0x220/0x310 kernel/exit.c:571
 do_exit+0x9b2/0x28e0 kernel/exit.c:926
 do_group_exit+0x207/0x2c0 kernel/exit.c:1088
 get_signal+0x176f/0x1810 kernel/signal.c:2936
 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:337
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0xc9/0x370 kernel/entry/common.c:218
 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffffc900090e7500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc900090e7580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc900090e7600: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 f2 f2 f2
                                           ^
 ffffc900090e7680: 00 00 00 f2 f2 f2 f2 f2 04 f3 f3 f3 00 00 00 00
 ffffc900090e7700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02
==================================================================
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
PGD 800000005ddbb067 P4D 800000005ddbb067 PUD 2fcb8067 PMD 0 
Oops: Oops: 0010 [#2] PREEMPT SMP KASAN PTI
CPU: 0 UID: 0 PID: 5557 Comm: syz.3.48 Tainted: G    B D            6.11.0-rc4-next-20240820-syzkaller #0
Tainted: [B]=BAD_PAGE, [D]=DIE
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:0x0
Code: Unable to access opcode bytes at 0xffffffffffffffd6.
RSP: 0018:ffffc900090e7430 EFLAGS: 00010082
RAX: ffff88807af70001 RBX: dffffc0000000000 RCX: 0000000000040000
RDX: ffffc9000a8df000 RSI: 000000000003ffff RDI: 0000000000040000
RBP: 0000000000000000 R08: ffffffff8155a2df R09: 1ffffffff2628614
R10: dffffc0000000000 R11: fffffbfff2628615 R12: 0000000000000000
R13: 0000000000000000 R14: ffffffff8e7d1aa0 R15: dffffc0000000000
FS:  00007fe42753a6c0(0000) GS:ffff8880b9000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 000000007b878000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 </TASK>
Modules linked in:
CR2: 0000000000000000
---[ end trace 0000000000000000 ]---
RIP: 2b80:.str.32+0x0/0x60
Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <73> 74 61 63 6b 2d 70 72 6f 74 65 63 74 6f 72 3a 20 4b 65 72 6e 65
RSP: 0000:ffffffff8c0995f1 EFLAGS: ffffc900090e7ab8 ORIG_RAX: 000000000000002f
RAX: 0000000041b58ab3 RBX: 0000000045e0360e RCX: 0000000000040000
RDX: ffffc9000a8df000 RSI: a1ec9a4932780c00 RDI: ffffffff8bb48368
RBP: ffff0000ffffff00 R08: ffffffff8c0995f1 R09: 00000000fffffff7
R10: ffffffff8bb497d0 R11: ffffffff8e28f9e6 R12: ffffffff8bb4b650
R13: ffffffff8e28f9f8 R14: 0000000041b58ab3 R15: ffffffff8c0995ef
FS:  00007fe42753a6c0(0000) GS:ffff8880b9000000(0000) knlGS:0000000000000000
CS:  2b80 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 000000007b878000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
  28:	00 00                	add    %al,(%rax)
* 2a:	73 74                	jae    0xa0 <-- trapping instruction
  2c:	61                   	(bad)
  2d:	63 6b 2d             	movsxd 0x2d(%rbx),%ebp
  30:	70 72                	jo     0xa4
  32:	6f                   	outsl  %ds:(%rsi),(%dx)
  33:	74 65                	je     0x9a
  35:	63 74 6f 72          	movsxd 0x72(%rdi,%rbp,2),%esi
  39:	3a 20                	cmp    (%rax),%ah
  3b:	4b                   	rex.WXB
  3c:	65 72 6e             	gs jb  0xad
  3f:	65                   	gs

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/20 20:44 linux-next bb1b0acdcd66 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Write in copy_process
* Struck through repros no longer work on HEAD.