syzbot


BUG: unable to handle kernel paging request in eventfd_ctx_put

Status: upstream: reported C repro on 2022/09/24 11:47
Reported-by: syzbot+6f0c896c5a9449a10ded@syzkaller.appspotmail.com
Fix commit: 7353633814f6 KVM: x86/xen: Fix eventfd error handling in kvm_xen_eventfd_assign()
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 79d, last: 47d

Cause bisection: introduced by (bisect log) :
commit 2fd6df2f2b47d4301b1ee0fe9d627d1c061a5988
Author: Joao Martins <joao.m.martins@oracle.com>
Date: Thu Mar 3 15:41:19 2022 +0000

  KVM: x86/xen: intercept EVTCHNOP_send from guests

Crash: BUG: unable to handle kernel paging request in eventfd_ctx_put (log)
Repro: C syz .config

Sample crash report:
L1TF CPU bug present and SMT on, data leak possible. See CVE-2018-3646 and https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/l1tf.html for details.
BUG: unable to handle page fault for address: ffffffffffffffea
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD bc8f067 P4D bc8f067 PUD bc91067 PMD 0 
Oops: 0002 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 3604 Comm: syz-executor716 Not tainted 6.0.0-syzkaller-09039-ga6afa4199d3d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
RIP: 0010:arch_atomic_fetch_sub arch/x86/include/asm/atomic.h:190 [inline]
RIP: 0010:atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:177 [inline]
RIP: 0010:__refcount_sub_and_test include/linux/refcount.h:272 [inline]
RIP: 0010:__refcount_dec_and_test include/linux/refcount.h:315 [inline]
RIP: 0010:refcount_dec_and_test include/linux/refcount.h:333 [inline]
RIP: 0010:kref_put include/linux/kref.h:64 [inline]
RIP: 0010:eventfd_ctx_put+0x1e/0x110 fs/eventfd.c:112
Code: 0f 1f 84 00 00 00 00 00 0f 1f 40 00 41 54 55 48 89 fd 53 bb ff ff ff ff e8 8f 64 8f ff be 04 00 00 00 48 89 ef e8 d2 7c dc ff <f0> 0f c1 5d 00 bf 01 00 00 00 89 de e8 31 61 8f ff 83 fb 01 74 35
RSP: 0018:ffffc90003e3f748 EFLAGS: 00010246
RAX: 0000000000000001 RBX: 00000000ffffffff RCX: ffffffff81ebb2ae
RDX: fffffbfffffffffe RSI: 0000000000000004 RDI: ffffffffffffffea
RBP: ffffffffffffffea R08: 0000000000000001 R09: ffffffffffffffed
R10: fffffbfffffffffd R11: 000000000008c07c R12: 0000000000000020
R13: ffffffffffffffea R14: ffffc90003ef1000 R15: 00000000ffffffea
FS:  0000555555c6c300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffea CR3: 000000007b193000 CR4: 00000000003526e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 kvm_xen_eventfd_assign arch/x86/kvm/xen.c:1721 [inline]
 kvm_xen_setattr_evtchn arch/x86/kvm/xen.c:1780 [inline]
 kvm_xen_hvm_set_attr+0x563/0x1610 arch/x86/kvm/xen.c:486
 kvm_arch_vm_ioctl+0xe39/0x18b0 arch/x86/kvm/x86.c:6786
 kvm_vm_ioctl+0x15df/0x2380 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4811
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl fs/ioctl.c:856 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fcc8c639bb9
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff36e19048 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fcc8c639bb9
RDX: 00000000200005c0 RSI: 000000004048aec9 RDI: 0000000000000004
RBP: 00007fcc8c5fdd60 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fcc8c5fddf0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
CR2: ffffffffffffffea
---[ end trace 0000000000000000 ]---
RIP: 0010:arch_atomic_fetch_sub arch/x86/include/asm/atomic.h:190 [inline]
RIP: 0010:atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:177 [inline]
RIP: 0010:__refcount_sub_and_test include/linux/refcount.h:272 [inline]
RIP: 0010:__refcount_dec_and_test include/linux/refcount.h:315 [inline]
RIP: 0010:refcount_dec_and_test include/linux/refcount.h:333 [inline]
RIP: 0010:kref_put include/linux/kref.h:64 [inline]
RIP: 0010:eventfd_ctx_put+0x1e/0x110 fs/eventfd.c:112
Code: 0f 1f 84 00 00 00 00 00 0f 1f 40 00 41 54 55 48 89 fd 53 bb ff ff ff ff e8 8f 64 8f ff be 04 00 00 00 48 89 ef e8 d2 7c dc ff <f0> 0f c1 5d 00 bf 01 00 00 00 89 de e8 31 61 8f ff 83 fb 01 74 35
RSP: 0018:ffffc90003e3f748 EFLAGS: 00010246
RAX: 0000000000000001 RBX: 00000000ffffffff RCX: ffffffff81ebb2ae
RDX: fffffbfffffffffe RSI: 0000000000000004 RDI: ffffffffffffffea
RBP: ffffffffffffffea R08: 0000000000000001 R09: ffffffffffffffed
R10: fffffbfffffffffd R11: 000000000008c07c R12: 0000000000000020
R13: ffffffffffffffea R14: ffffc90003ef1000 R15: 00000000ffffffea
FS:  0000555555c6c300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffea CR3: 000000007b193000 CR4: 00000000003526e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	0f 1f 84 00 00 00 00 	nopl   0x0(%rax,%rax,1)
   7:	00
   8:	0f 1f 40 00          	nopl   0x0(%rax)
   c:	41 54                	push   %r12
   e:	55                   	push   %rbp
   f:	48 89 fd             	mov    %rdi,%rbp
  12:	53                   	push   %rbx
  13:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  18:	e8 8f 64 8f ff       	callq  0xff8f64ac
  1d:	be 04 00 00 00       	mov    $0x4,%esi
  22:	48 89 ef             	mov    %rbp,%rdi
  25:	e8 d2 7c dc ff       	callq  0xffdc7cfc
* 2a:	f0 0f c1 5d 00       	lock xadd %ebx,0x0(%rbp) <-- trapping instruction
  2f:	bf 01 00 00 00       	mov    $0x1,%edi
  34:	89 de                	mov    %ebx,%esi
  36:	e8 31 61 8f ff       	callq  0xff8f616c
  3b:	83 fb 01             	cmp    $0x1,%ebx
  3e:	74 35                	je     0x75

Crashes (7):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce 2022/10/09 06:26 upstream a6afa4199d3d aea5da89 .config log report syz C BUG: unable to handle kernel paging request in eventfd_ctx_put
ci-upstream-kasan-gce 2022/09/20 11:58 upstream 521a547ced64 7c41a9ba .config log report syz C BUG: unable to handle kernel paging request in eventfd_ctx_put
ci-upstream-kasan-gce-386 2022/10/09 06:09 upstream a6afa4199d3d aea5da89 .config log report syz C BUG: unable to handle kernel paging request in eventfd_ctx_put
ci-upstream-kasan-gce-386 2022/09/20 14:25 upstream 521a547ced64 7c41a9ba .config log report syz C BUG: unable to handle kernel paging request in eventfd_ctx_put
ci-upstream-linux-next-kasan-gce-root 2022/10/22 18:54 linux-next 4d48f589d294 c0b80a55 .config log report syz C BUG: unable to handle kernel paging request in eventfd_ctx_put
ci-upstream-kasan-gce 2022/10/08 16:21 upstream e8bc52cb8df8 aea5da89 .config log report info BUG: unable to handle kernel paging request in eventfd_ctx_put
ci-upstream-kasan-gce 2022/09/20 11:45 upstream 521a547ced64 7c41a9ba .config log report info BUG: unable to handle kernel paging request in eventfd_ctx_put
* Struck through repros no longer work on HEAD.