On Aug 1, 2022, at 3:50 PM, Axel Rasmussen axelrasmussen@google.com wrote:
⚠ External Email
On Mon, Aug 1, 2022 at 12:53 PM Nadav Amit namit@vmware.com wrote:
On Aug 1, 2022, at 10:13 AM, Axel Rasmussen axelrasmussen@google.com wrote:
Ah, that I think is more or less what my series already proposes, if I understand you correctly.
The usage is:
fd = open(/dev/userfaultfd) /* This FD is only useful for creating new userfaultfds */ uffd = ioctl(fd, USERFAULTFD_IOC_NEW) /* Now you get a real uffd */ close(fd); /* No longer needed now that we have a real uffd */
/* Use uffd to register, COPY, CONTINUE, whatever */
One thing we could do now or in the future is extend USERFAULTFD_IOC_NEW to take a pid as an argument, to support creating uffds for remote processes.
And then we get the benefit of permissions for /dev nodes working very naturally - they default to root, but can be configured by the sysadmin via chown/chmod, or udev rules, or whatever.
Oh. Stupid me. Then yes, using the /dev/userfaultfd is in line with other usage models, such as KVM. And reading from each file descriptor is indeed providing different output.