Re: general protection fault in strncpy_from_user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 21, 2017 at 11:58 AM, syzbot
<bot+4407b50097e2449f5defd27ea4773d6fbd2cb8b2@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
> Hello,
>
> syzkaller hit the following crash on
> f3b5ad89de16f5d42e8ad36fbdf85f705c1ae051
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/master
> compiler: gcc (GCC) 7.1.1 20170620
> .config is attached
> Raw console output is attached.
>
> Unfortunately, I don't have any reproducer for this bug yet.
>
>
> R13: 0000000000a6f7ff R14: 00007f99fe4069c0 R15: 000000000000000f
> kasan: CONFIG_KASAN_INLINE enabled
> kasan: GPF could be caused by NULL-ptr deref or user memory access
> general protection fault: 0000 [#1] SMP KASAN
> Dumping ftrace buffer:
>    (ftrace buffer empty)
> Modules linked in:
> CPU: 1 PID: 5026 Comm: syz-executor7 Not tainted 4.15.0-rc3+ #225
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> FAULT_FLAG_ALLOW_RETRY missing 30
> CPU: 0 PID: 5038 Comm: syz-executor1 Not tainted 4.15.0-rc3+ #225
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x194/0x257 lib/dump_stack.c:53
>  handle_userfault+0x12fa/0x24c0 fs/userfaultfd.c:427
>  do_anonymous_page mm/memory.c:3121 [inline]
>  handle_pte_fault mm/memory.c:3935 [inline]
>  __handle_mm_fault+0x32a3/0x3ce0 mm/memory.c:4061
>  handle_mm_fault+0x334/0x8d0 mm/memory.c:4098
>  __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1429
>  do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1504
>  page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1094
> RIP: 0010:do_strncpy_from_user lib/strncpy_from_user.c:45 [inline]
> RIP: 0010:strncpy_from_user+0x185/0x430 lib/strncpy_from_user.c:118
> RSP: 0018:ffff880191c4fd78 EFLAGS: 00010246
> RAX: 0000000000010000 RBX: ffff880191c4fe10 RCX: ffffffff8259ab43
> RDX: 0000000000000000 RSI: ffffc900028be000 RDI: ffff880191c4fdd8
> RBP: ffff880191c4fe38 R08: ffff8801db21a780 R09: ffff8801c4632640
> R10: 0000000000000000 R11: ffffed00388c66c7 R12: 0000000000000fe4
> R13: 0000000000000fe4 R14: 0000000020012000 R15: 8080808080808080
>  getname_flags+0x10e/0x580 fs/namei.c:149
>  getname fs/namei.c:209 [inline]
>  SYSC_symlinkat fs/namei.c:4121 [inline]
>  SyS_symlinkat fs/namei.c:4112 [inline]
>  SYSC_symlink fs/namei.c:4145 [inline]
>  SyS_symlink+0x7d/0x240 fs/namei.c:4143
>  entry_SYSCALL_64_fastpath+0x1f/0x96
> RIP: 0033:0x452a39
> RSP: 002b:00007f99fe447c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000058
> RAX: ffffffffffffffda RBX: 00000000007580d8 RCX: 0000000000452a39
> RDX: 0000000000000000 RSI: 0000000020001000 RDI: 0000000020012000
> RBP: 000000000000039b R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f3728
> R13: 00000000ffffffff R14: 00007f99fe4486d4 R15: 000000000000000a
> FAULT_FLAG_ALLOW_RETRY missing 30
> CPU: 0 PID: 5057 Comm: syz-executor1 Not tainted 4.15.0-rc3+ #225
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x194/0x257 lib/dump_stack.c:53
>  handle_userfault+0x12fa/0x24c0 fs/userfaultfd.c:427
>  do_anonymous_page mm/memory.c:3121 [inline]
>  handle_pte_fault mm/memory.c:3935 [inline]
>  __handle_mm_fault+0x32a3/0x3ce0 mm/memory.c:4061
>  handle_mm_fault+0x334/0x8d0 mm/memory.c:4098
>  __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1429
>  do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1504
>  page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1094
> RIP: 0010:copy_user_generic_unrolled+0x9e/0xc0
> arch/x86/lib/copy_user_64.S:74
> RSP: 0018:ffff8801c9d9fe78 EFLAGS: 00010202
> RAX: 0000000000000004 RBX: 0000000020013000 RCX: 0000000000000004
> RDX: 0000000000000004 RSI: 0000000020013000 RDI: ffff8801c9d9fed8
> RBP: ffff8801c9d9fea8 R08: ffffed00393b3fdb R09: ffffed00393b3fdb
> R10: 0000000000000001 R11: ffffed00393b3fdb R12: 0000000000000004
> R13: ffff8801c9d9fed8 R14: 00007ffffffff000 R15: 0000000020013004
>  copy_from_user include/linux/uaccess.h:147 [inline]
>  do_sched_setscheduler+0x7b/0x1e0 kernel/sched/core.c:4325
>  SYSC_sched_setscheduler kernel/sched/core.c:4421 [inline]
>  SyS_sched_setscheduler+0xd/0x20 kernel/sched/core.c:4416
>  entry_SYSCALL_64_fastpath+0x1f/0x96
> RIP: 0033:0x452a39
> RSP: 002b:00007f99fe3e4c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000090
> RAX: ffffffffffffffda RBX: 0000000000758300 RCX: 0000000000452a39
> RDX: 0000000020013000 RSI: 0000000000000000 RDI: 0000000000000089
> RBP: 0000000000000447 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f4748
> R13: 00000000ffffffff R14: 00007f99fe3e56d4 R15: 0000000000000010
> FAULT_FLAG_ALLOW_RETRY missing 30
> CPU: 0 PID: 5055 Comm: syz-executor1 Not tainted 4.15.0-rc3+ #225
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x194/0x257 lib/dump_stack.c:53
>  handle_userfault+0x12fa/0x24c0 fs/userfaultfd.c:427
>  do_anonymous_page mm/memory.c:3121 [inline]
>  handle_pte_fault mm/memory.c:3935 [inline]
>  __handle_mm_fault+0x32a3/0x3ce0 mm/memory.c:4061
>  handle_mm_fault+0x334/0x8d0 mm/memory.c:4098
>  __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1429
>  do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1504
>  page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1094
> RIP: 0010:do_strncpy_from_user lib/strncpy_from_user.c:61 [inline]
> RIP: 0010:strncpy_from_user+0x25c/0x430 lib/strncpy_from_user.c:118
> RSP: 0018:ffff8801c685fd78 EFLAGS: 00010246
> RAX: 0000000000010000 RBX: 0000000000000000 RCX: ffffffff8259ac1a
> RDX: 0000000000000000 RSI: ffffc900029c0000 RDI: ffff8801c685fdd8
> RBP: ffff8801c685fe38 R08: ffff8801db21a780 R09: ffff8801c4f26540
> R10: 0000000000000000 R11: ffffed00389e4ea7 R12: 0000000000000000
> R13: 0000000020012000 R14: 0000000020012000 R15: 8080808080808080
>  getname_flags+0x10e/0x580 fs/namei.c:149
>  getname fs/namei.c:209 [inline]
>  SYSC_symlinkat fs/namei.c:4121 [inline]
>  SyS_symlinkat fs/namei.c:4112 [inline]
>  SYSC_symlink fs/namei.c:4145 [inline]
>  SyS_symlink+0x7d/0x240 fs/namei.c:4143
>  entry_SYSCALL_64_fastpath+0x1f/0x96
> RIP: 0033:0x452a39
> RSP: 002b:00007f99fe405c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000058
> RAX: ffffffffffffffda RBX: 00007f99fe406700 RCX: 0000000000452a39
> RDX: 0000000000000000 RSI: 0000000020001000 RDI: 0000000020012000
> RBP: 0000000000a6f880 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000212 R12: 0000000000000000
> R13: 0000000000a6f7ff R14: 00007f99fe4069c0 R15: 000000000000000f
> FAULT_FLAG_ALLOW_RETRY missing 30
> CPU: 0 PID: 5029 Comm: syz-executor1 Not tainted 4.15.0-rc3+ #225
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x194/0x257 lib/dump_stack.c:53
>  handle_userfault+0x12fa/0x24c0 fs/userfaultfd.c:427
>  do_anonymous_page mm/memory.c:3121 [inline]
>  handle_pte_fault mm/memory.c:3935 [inline]
>  __handle_mm_fault+0x32a3/0x3ce0 mm/memory.c:4061
>  handle_mm_fault+0x334/0x8d0 mm/memory.c:4098
>  __do_page_fault+0x5c9/0xc90 arch/x86/mm/fault.c:1429
>  do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1504
>  page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1094
> RIP: 0010:copy_user_enhanced_fast_string+0xe/0x20
> arch/x86/lib/copy_user_64.S:180
> RSP: 0018:ffff88019240f6f8 EFLAGS: 00010202
> RAX: ffffed0038956d8d RBX: 0000000020012f18 RCX: 00000000000000e8
> RDX: 00000000000000e8 RSI: 0000000020012f18 RDI: ffff8801c4ab6b80
> RBP: ffff88019240f728 R08: ffffed0038956d8d R09: ffffed0038956d8d
> R10: 000000000000001d R11: ffffed0038956d8c R12: 00000000000000e8
> R13: ffff8801c4ab6b80 R14: 00007ffffffff000 R15: 0000000020013000
>  copy_from_user include/linux/uaccess.h:147 [inline]
>  memdup_user+0x54/0x90 mm/util.c:168
>  xfrm_user_policy+0xcf/0x6d0 net/xfrm/xfrm_state.c:2054
>  do_ip_setsockopt.isra.12+0xfb0/0x31f0 net/ipv4/ip_sockglue.c:1161
>  ip_setsockopt+0x3a/0xb0 net/ipv4/ip_sockglue.c:1248
>  tcp_setsockopt+0x82/0xd0 net/ipv4/tcp.c:2872
>  sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2968
>  SYSC_setsockopt net/socket.c:1829 [inline]
>  SyS_setsockopt+0x189/0x360 net/socket.c:1808
>  entry_SYSCALL_64_fastpath+0x1f/0x96
> RIP: 0033:0x452a39
> RSP: 002b:00007f99fe468c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000036
> RAX: ffffffffffffffda RBX: 0000000000758020 RCX: 0000000000452a39
> RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000000017
> RBP: 00000000000000e1 R08: 00000000000000e8 R09: 0000000000000000
> R10: 0000000020012f18 R11: 0000000000000212 R12: 00000000006ef5b8
> R13: 00000000ffffffff R14: 00007f99fe4696d4 R15: 0000000000000000
> RIP: 0010:native_write_cr4+0x4/0x10 arch/x86/include/asm/special_insns.h:76
> RSP: 0018:ffff8801c5bcf5a0 EFLAGS: 00010093
> RAX: ffff8801c5714000 RBX: 00000000001606e0 RCX: ffffffff811a2a92
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000001606e0
> RBP: ffff8801c5bcf5a0 R08: 1ffff10038b79e0f R09: 0000000000000004
> R10: ffff8801c5bcf510 R11: 0000000000000004 R12: 0000000000000093
> R13: ffff8801c5714000 R14: ffff8801db514850 R15: ffff8801db514850
> FS:  0000000001296940(0000) GS:ffff8801db500000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f99fe4276d4 CR3: 0000000005e22006 CR4: 00000000001626e0
> Call Trace:
>  __write_cr4 arch/x86/include/asm/paravirt.h:76 [inline]
>  __cr4_set arch/x86/include/asm/tlbflush.h:180 [inline]
>  cr4_clear_bits arch/x86/include/asm/tlbflush.h:203 [inline]
>  kvm_cpu_vmxoff arch/x86/kvm/vmx.c:3582 [inline]
>  hardware_disable+0x34a/0x4b0 arch/x86/kvm/vmx.c:3588
>  kvm_arch_hardware_disable+0x35/0xd0 arch/x86/kvm/x86.c:7982
>  hardware_disable_nolock+0x30/0x40
> arch/x86/kvm/../../../virt/kvm/kvm_main.c:3310
>  on_each_cpu+0xca/0x1b0 kernel/smp.c:604
>  hardware_disable_all_nolock+0x3e/0x50
> arch/x86/kvm/../../../virt/kvm/kvm_main.c:3328
>  hardware_disable_all arch/x86/kvm/../../../virt/kvm/kvm_main.c:3334
> [inline]
>  kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:742 [inline]
>  kvm_put_kvm+0x956/0xdf0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:755
>  kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:766
>  __fput+0x327/0x7e0 fs/file_table.c:210
>  ____fput+0x15/0x20 fs/file_table.c:244
>  task_work_run+0x199/0x270 kernel/task_work.c:113
>  exit_task_work include/linux/task_work.h:22 [inline]
>  do_exit+0x9bb/0x1ad0 kernel/exit.c:865
>  do_group_exit+0x149/0x400 kernel/exit.c:968
>  SYSC_exit_group kernel/exit.c:979 [inline]
>  SyS_exit_group+0x1d/0x20 kernel/exit.c:977
>  entry_SYSCALL_64_fastpath+0x1f/0x96
> RIP: 0033:0x452a39
> RSP: 002b:0000000000a6fa08 EFLAGS: 00000202 ORIG_RAX: 00000000000000e7
> RAX: ffffffffffffffda RBX: 0000000000758048 RCX: 0000000000452a39
> RDX: 0000000000452a39 RSI: 000000000076bd10 RDI: 0000000000000000
> RBP: 0000000000000000 R08: 0000000000000029 R09: 0000000000000000
> R10: 000000000076bd08 R11: 0000000000000202 R12: 0000000000a6f9b0
> R13: 0000000000758020 R14: 000000000000021e R15: 000000000000001d
> Code: 0f 1f 80 00 00 00 00 55 48 89 e5 0f 20 d8 5d c3 0f 1f 80 00 00 00 00
> 55 48 89 e5 0f 22 df 5d c3 0f 1f 80 00 00 00 00 55 48 89 e5 <0f> 22 e7 5d c3
> 0f 1f 80 00 00 00 00 55 48 89 e5 44 0f 20 c0 5d
> RIP: native_write_cr4+0x4/0x10 arch/x86/include/asm/special_insns.h:76 RSP:
> ffff8801c5bcf5a0
> ---[ end trace da73006052b376dc ]---


Let's assume this is invalid free in pcrypt which caused a bunch of
random consequences:

#syz dup: KASAN: use-after-free Read in __list_del_entry_valid (2)


> ---
> This bug is generated by a dumb bot. It may contain errors.
> See https://goo.gl/tpsmEJ for details.
> Direct all questions to syzkaller@xxxxxxxxxxxxxxxx.
> Please credit me with: Reported-by: syzbot <syzkaller@xxxxxxxxxxxxxxxx>
>
> syzbot will keep track of this bug report.
> Once a fix for this bug is merged into any tree, reply to this email with:
> #syz fix: exact-commit-title
> To mark this as a duplicate of another syzbot report, please reply with:
> #syz dup: exact-subject-of-another-report
> If it's a one-off invalid bug report, please reply with:
> #syz invalid
> Note: if the crash happens again, it will cause creation of a new bug
> report.
> Note: all commands must start from beginning of the line in the email body.
>
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller-bugs+unsubscribe@xxxxxxxxxxxxxxxx.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-bugs/001a1141c43adad8980560d792e1%40google.com.
> For more options, visit https://groups.google.com/d/optout.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux