在 2021-10-15 07:43,Peter Xu 写道:
On Thu, Oct 14, 2021 at 05:15:48PM +0800, Lin Ma wrote:
Since kernel v5.11, Unprivileged user (without SYS_CAP_PTRACE
capability)
must pass UFFD_USER_MODE_ONLY to userfaultd in case
unprivileged_userfaultfd
sysctl knob is 0.
Please refer to https://lwn.net/Articles/819834/ and the kernel
commits:
37cd0575 userfaultfd: add UFFD_USER_MODE_ONLY
d0d4730a userfaultfd: add user-mode only option to
unprivileged_userfaultfd sysctl knob
This patch set adds a migration capability to pass UFFD_USER_MODE_ONLY
for postcopy migration.
Then it's at least no KVM, no vhost, am I right? Could I ask is there
a real
user behind this? Thanks,
Well, The "user-mode-only" has nothing to do with qemu's user-mode
emulation.
The unprivileged_userfaultfd sysctl knob controls whether unprivileged
users can use the userfaultfd system calls.
set it to 1 to allow unprivileged users to use the userfaultfd system
calls.
set it to 0 to restrict userfaultfd to only privileged users (with
SYS_CAP_PTRACE capability).
If host's unprivileged_userfaultfd sysctl knob is 0(The default value of
this knob is changed to 0 since host kernel v5.11):
Qemu must pass the UFFD_USER_MODE_ONLY flag when creating userfaultfd
object for postcopy migration in case qemu runs as unprivileged user.
Before host kernel v5.11, If host's unprivileged_userfaultfd sysctl knob
is 0, Then postcopy migration is not allowed in case qemu runs as
unprivileged user.
Thanks,
Lin