syzbot


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

Status: upstream: reported C repro on 2023/04/02 16:05
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+65da5dbeacebf1b0fb83@syzkaller.appspotmail.com
First crash: 397d, last: 66d
Fix bisection: the issue occurs on the latest tested release (bisect log)
Crash: INFO: rcu detected stall in corrupted (log)
Repro: syz .config
  
Bug presence (2)
Date Name Commit Repro Result
2024/04/28 linux-6.1.y (ToT) f2295faba5e8 C [report] INFO: rcu detected stall in corrupted
2024/04/28 upstream (ToT) 2c8159388952 C Didn't crash
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream BUG: unable to handle kernel paging request in copy_from_kernel_nofault (2) mm C 2 21d 31d 22/26 upstream: reported C repro on 2024/04/02 05:19
upstream BUG: unable to handle kernel paging request in copy_from_kernel_nofault mm C done 5 67d 166d 26/26 fixed on 2024/03/29 01:33
linux-5.15 BUG: unable to handle kernel paging request in copy_from_kernel_nofault origin:upstream C done 2 67d 169d 3/3 fixed on 2024/03/28 13:37
android-5-15 BUG: unable to handle kernel paging request in copy_from_kernel_nofault origin:upstream missing-backport C 75 4d05h 170d 0/2 upstream: reported C repro on 2023/11/15 17:36
android-6-1 BUG: unable to handle kernel paging request in copy_from_kernel_nofault origin:upstream missing-backport C done inconclusive 77 2d02h 170d 0/2 upstream: reported C repro on 2023/11/15 17:20
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2023/09/16 18:25 7h21m fix candidate upstream job log (1)
2023/06/03 10:32 58m bisect fix linux-6.1.y job log (0) log
2023/05/04 08:58 1h07m bisect fix linux-6.1.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: stack-out-of-bounds in copy_from_kernel_nofault+0xa0/0x2c0 mm/maccess.c:35
Write of size 8 at addr ffffc90006a6fa88 by task syz-executor.4/17204

CPU: 0 PID: 17204 Comm: syz-executor.4 Not tainted 6.1.22-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 copy_from_kernel_nofault+0xa0/0x2c0 mm/maccess.c:35
 get_kernel_gp_address arch/x86/kernel/traps.c:590 [inline]
 __exc_general_protection arch/x86/kernel/traps.c:768 [inline]
 exc_general_protection+0x312/0x4f0 arch/x86/kernel/traps.c:728
 asm_exc_general_protection+0x22/0x30 arch/x86/include/asm/idtentry.h:564
RIP: 0010:bpf_prog_test_run_xdp+0x7ff/0x1130 net/bpf/test_run.c:1398
Code: 89 df 48 8b 74 24 58 e8 0f 2b 00 00 31 ff 44 89 e6 e8 65 9b d0 f8 45 85 e4 74 0a e8 fb 97 d0 f8 e9 57 01 00 00 48 8b 44 24 48 <42> 80 3c 30 00 4c 8b 64 24 10 74 0d 48 8b bc 24 88 00 00 00 e8 f8
RSP: 0018:ffffc90006a6fb80 EFLAGS: 00010246
RAX: 1ffff92000d4df91 RBX: 0000000000000000 RCX: ffff888022179d40
RDX: ffff888022179d40 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90006a6fd30 R08: ffffffff88b8f59b R09: ffffed100442f3a9
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000
R13: ffffffff88b8d854 R14: 0000000000000000 R15: ffffc90006a6fc60
 bpf_prog_test_run+0x32f/0x3a0 kernel/bpf/syscall.c:3628
 __sys_bpf+0x3eb/0x6c0 kernel/bpf/syscall.c:4981
 __do_sys_bpf kernel/bpf/syscall.c:5067 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5065 [inline]
 __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5065
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fbe5be8c0f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fbe5cb63168 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fbe5bfabf80 RCX: 00007fbe5be8c0f9
RDX: 0000000000000048 RSI: 0000000020000200 RDI: 000000000000000a
RBP: 00007fbe5bee7b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe82ee769f R14: 00007fbe5cb63300 R15: 0000000000022000
 </TASK>

The buggy address belongs to stack of task syz-executor.4/17204
KASAN internal error: frame info validation failed; invalid marker: 0

The buggy address belongs to the virtual mapping at
 [ffffc90006a68000, ffffc90006a71000) created by:
 copy_process+0x637/0x4020 kernel/fork.c:2087

The buggy address belongs to the physical page:
page:ffffea000071bec0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1c6fb
memcg:ffff888145d01f02
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ffff888145d01f02
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 17201, tgid 17201 (syz-executor.4), ts 903650785456, free_ts 888834892014
 prep_new_page mm/page_alloc.c:2540 [inline]
 get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
 vm_area_alloc_pages mm/vmalloc.c:2975 [inline]
 __vmalloc_area_node mm/vmalloc.c:3043 [inline]
 __vmalloc_node_range+0x962/0x1360 mm/vmalloc.c:3213
 alloc_thread_stack_node kernel/fork.c:311 [inline]
 dup_task_struct+0x3e5/0x6d0 kernel/fork.c:977
 copy_process+0x637/0x4020 kernel/fork.c:2087
 kernel_clone+0x222/0x920 kernel/fork.c:2676
 __do_sys_clone kernel/fork.c:2817 [inline]
 __se_sys_clone kernel/fork.c:2801 [inline]
 __x64_sys_clone+0x231/0x280 kernel/fork.c:2801
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1460 [inline]
 free_pcp_prepare mm/page_alloc.c:1510 [inline]
 free_unref_page_prepare+0xf5e/0x1110 mm/page_alloc.c:3388
 free_unref_page_list+0x107/0x810 mm/page_alloc.c:3530
 release_pages+0x2836/0x2b40 mm/swap.c:1055
 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:254 [inline]
 tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261
 tlb_finish_mmu+0xce/0x1f0 mm/mmu_gather.c:361
 exit_mmap+0x2c2/0x8b0 mm/mmap.c:3100
 __mmput+0x115/0x3c0 kernel/fork.c:1188
 exit_mm+0x226/0x300 kernel/exit.c:563
 do_exit+0x67e/0x2300 kernel/exit.c:856
 do_group_exit+0x202/0x2b0 kernel/exit.c:1019
 get_signal+0x16f7/0x17d0 kernel/signal.c:2858
 arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:869
 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:297
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86

Memory state around the buggy address:
 ffffc90006a6f980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90006a6fa00: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 f2
>ffffc90006a6fa80: f2 f2 f2 f2 00 00 f2 f2 00 00 00 f2 f2 f2 f2 f2
                      ^
 ffffc90006a6fb00: 04 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90006a6fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
   0:	89 df                	mov    %ebx,%edi
   2:	48 8b 74 24 58       	mov    0x58(%rsp),%rsi
   7:	e8 0f 2b 00 00       	callq  0x2b1b
   c:	31 ff                	xor    %edi,%edi
   e:	44 89 e6             	mov    %r12d,%esi
  11:	e8 65 9b d0 f8       	callq  0xf8d09b7b
  16:	45 85 e4             	test   %r12d,%r12d
  19:	74 0a                	je     0x25
  1b:	e8 fb 97 d0 f8       	callq  0xf8d0981b
  20:	e9 57 01 00 00       	jmpq   0x17c
  25:	48 8b 44 24 48       	mov    0x48(%rsp),%rax
* 2a:	42 80 3c 30 00       	cmpb   $0x0,(%rax,%r14,1) <-- trapping instruction
  2f:	4c 8b 64 24 10       	mov    0x10(%rsp),%r12
  34:	74 0d                	je     0x43
  36:	48 8b bc 24 88 00 00 	mov    0x88(%rsp),%rdi
  3d:	00
  3e:	e8                   	.byte 0xe8
  3f:	f8                   	clc

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/04/02 16:05 linux-6.1.y 3b29299e5f60 f325deb0 .config console log report syz [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf KASAN: stack-out-of-bounds Write in copy_from_kernel_nofault
2024/02/26 22:05 linux-6.1.y 81e1dc2f7001 da36a36b .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf BUG: unable to handle kernel paging request in copy_from_kernel_nofault
2023/11/15 17:44 linux-6.1.y fb2635ac69ab cb976f63 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf BUG: unable to handle kernel paging request in copy_from_kernel_nofault
* Struck through repros no longer work on HEAD.