]> git.proxmox.com Git - mirror_qemu.git/commit - util/trace-events
util/userfaultfd: Support /dev/userfaultfd
authorPeter Xu <peterx@redhat.com>
Tue, 7 Feb 2023 20:57:11 +0000 (15:57 -0500)
committerJuan Quintela <quintela@redhat.com>
Sat, 11 Feb 2023 15:51:09 +0000 (16:51 +0100)
commitc40c0463413b941c13fe5f99a90c02d7d6584828
treec34bd6ea8ec1f18b2313db12c20fc5d120c564fa
parent93e0932b7be2498024cd6ba8446a0fa2cb1769bc
util/userfaultfd: Support /dev/userfaultfd

Teach QEMU to use /dev/userfaultfd when it existed and fallback to the
system call if either it's not there or doesn't have enough permission.

Firstly, as long as the app has permission to access /dev/userfaultfd, it
always have the ability to trap kernel faults which QEMU mostly wants.
Meanwhile, in some context (e.g. containers) the userfaultfd syscall can be
forbidden, so it can be the major way to use postcopy in a restricted
environment with strict seccomp setup.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
util/trace-events
util/userfaultfd.c