]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
KVM/x86: remove WARN_ON() for when vm_munmap() fails
authorEric Biggers <ebiggers@google.com>
Thu, 1 Feb 2018 01:30:21 +0000 (17:30 -0800)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 15 Mar 2018 13:28:49 +0000 (08:28 -0500)
commit55a4a47b0b5160db893127a53ffc6ec6aa56a11c
tree8ae9f9a6c61f8fb8d2842ccf8c2e14c59794e4b2
parenta04c389c55f58b7829942996d608b1c6641607e5
KVM/x86: remove WARN_ON() for when vm_munmap() fails

BugLink: http://bugs.launchpad.net/bugs/1755179
commit 103c763c72dd2df3e8c91f2d7ec88f98ed391111 upstream.

On x86, special KVM memslots such as the TSS region have anonymous
memory mappings created on behalf of userspace, and these mappings are
removed when the VM is destroyed.

It is however possible for removing these mappings via vm_munmap() to
fail.  This can most easily happen if the thread receives SIGKILL while
it's waiting to acquire ->mmap_sem.   This triggers the 'WARN_ON(r < 0)'
in __x86_set_memory_region().  syzkaller was able to hit this, using
'exit()' to send the SIGKILL.  Note that while the vm_munmap() failure
results in the mapping not being removed immediately, it is not leaked
forever but rather will be freed when the process exits.

It's not really possible to handle this failure properly, so almost
every other caller of vm_munmap() doesn't check the return value.  It's
a limitation of having the kernel manage these mappings rather than
userspace.

So just remove the WARN_ON() so that users can't spam the kernel log
with this warning.

Fixes: f0d648bdf0a5 ("KVM: x86: map/unmap private slots in __x86_set_memory_region")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
arch/x86/kvm/x86.c