lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 9 Aug 2017 19:07:14 +0200
From:   Dmitry Vyukov <dvyukov@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>,
        Radim Krčmář <rkrcmar@...hat.com>,
        KVM list <kvm@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        David Hildenbrand <david@...hat.com>,
        P J P <ppandit@...hat.com>,
        James Mattson <jmattson@...gle.com>,
        Xiao Guangrong <guangrong.xiao@...ux.intel.com>,
        Haozhong Zhang <haozhong.zhang@...el.com>,
        Wanpeng Li <kernellwp@...il.com>,
        Steve Rutherford <srutherford@...gle.com>
Cc:     syzkaller <syzkaller@...glegroups.com>
Subject: kvm: WARNING in kvm_arch_vcpu_ioctl_run

Hello,

syzkaller fuzzer has hit the following WARNING in kvm_arch_vcpu_ioctl_run.
This is easily reproducible and reproducer is attached at the bottom.
The report is on upstream commit
26c5cebfdb6ca799186f1e56be7d6f2480c5012c. This requires setting
kvm-intel.unrestricted_guest=0 on the machine, with
unrestricted_guest=1 the WARNING does not happen. Output of the
program is:

ret1=0 exit_reason=17 suberror=1
ret2=0 exit_reason=8 suberror=65530


WARNING: CPU: 1 PID: 2850 at arch/x86/kvm/x86.c:7223
kvm_arch_vcpu_ioctl_run+0x213/0x5870 arch/x86/kvm/x86.c:7223
CPU: 1 PID: 2850 Comm: a.out Not tainted 4.13.0-rc3+ #445
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 panic+0x1e4/0x417 kernel/panic.c:180
 __warn+0x1c4/0x1d9 kernel/panic.c:541
 report_bug+0x211/0x2d0 lib/bug.c:183
 fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:190
 do_trap_no_signal arch/x86/kernel/traps.c:224 [inline]
 do_trap+0x260/0x390 arch/x86/kernel/traps.c:273
 do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:310
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:323
 invalid_op+0x1e/0x30 arch/x86/entry/entry_64.S:846
RIP: 0010:kvm_arch_vcpu_ioctl_run+0x213/0x5870 arch/x86/kvm/x86.c:7222
RSP: 0018:ffff8800627cf670 EFLAGS: 00010297
RAX: ffff880066c44480 RBX: ffff88006b07f000 RCX: ffff880067d0845c
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880067d08260
RBP: ffff8800627cfa40 R08: 0000000000000001 R09: 0000000000000000
R10: ffff8800627cfa58 R11: 0000000000000000 R12: 0000000000000001
R13: 0000000000000000 R14: ffff88006b934880 R15: ffff880067d08040
 kvm_vcpu_ioctl+0x64c/0x1010 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2592
 vfs_ioctl fs/ioctl.c:45 [inline]
 do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:685
 SYSC_ioctl fs/ioctl.c:700 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
 entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x44ccc9
RSP: 002b:00007f9ecbc37db8 EFLAGS: 00000297 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000044ccc9
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 0000000000000082 R08: 00007f9ecbc38700 R09: 0000000000000000
R10: 00007f9ecbc38700 R11: 0000000000000297 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f9ecbc389c0 R15: 00007f9ecbc38700



// autogenerated by syzkaller (http://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/kvm.h>
#include <stdio.h>

int kvmcpu;
struct kvm_run *run;

void* thr(void* arg)
{
  int res;
  res = ioctl(kvmcpu, KVM_RUN, 0);
  printf("ret1=%d exit_reason=%d suberror=%d\n",
      res, run->exit_reason, run->internal.suberror);
  return 0;
}

void test()
{
  int i, kvm, kvmvm;
  pthread_t th[4];

  kvm = open("/dev/kvm", O_RDWR);
  kvmvm = ioctl(kvm, KVM_CREATE_VM, 0);
  kvmcpu = ioctl(kvmvm, KVM_CREATE_VCPU, 0);
  run = (struct kvm_run*)mmap(0, 4096, PROT_READ|PROT_WRITE,
MAP_SHARED, kvmcpu, 0);
  srand(getpid());
  for (i = 0; i < 4; i++) {
    pthread_create(&th[i], 0, thr, 0);
    usleep(rand() % 10000);
  }
  for (i = 0; i < 4; i++)
    pthread_join(th[i], 0);
}

int main()
{
  for (;;) {
    int pid = fork();
    if (pid < 0)
      exit(1);
    if (pid == 0) {
      test();
      exit(0);
    }
    int status;
    while (waitpid(pid, &status, __WALL) != pid) {}
  }
  return 0;
}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ