diff options
author | 2022-07-22 13:15:13 -0700 | |
---|---|---|
committer | 2022-07-29 18:07:17 -0700 | |
commit | 914eedcb9ba0ff53c3380829a024b7cef16accfb (patch) | |
tree | 7dedb63781cb7dd8e166163899bc451ce6aa0665 /mm/memcontrol.c | |
parent | hugetlb_cgroup: fix wrong hugetlb cgroup numa stat (diff) | |
download | linux-914eedcb9ba0ff53c3380829a024b7cef16accfb.tar.gz linux-914eedcb9ba0ff53c3380829a024b7cef16accfb.tar.bz2 linux-914eedcb9ba0ff53c3380829a024b7cef16accfb.zip |
userfaultfd: don't fail on unrecognized features
The basic interaction for setting up a userfaultfd is, userspace issues
a UFFDIO_API ioctl, and passes in a set of zero or more feature flags,
indicating the features they would prefer to use.
Of course, different kernels may support different sets of features
(depending on kernel version, kconfig options, architecture, etc).
Userspace's expectations may also not match: perhaps it was built
against newer kernel headers, which defined some features the kernel
it's running on doesn't support.
Currently, if userspace passes in a flag we don't recognize, the
initialization fails and we return -EINVAL. This isn't great, though.
Userspace doesn't have an obvious way to react to this; sure, one of the
features I asked for was unavailable, but which one? The only option it
has is to turn off things "at random" and hope something works.
Instead, modify UFFDIO_API to just ignore any unrecognized feature
flags. The interaction is now that the initialization will succeed, and
as always we return the *subset* of feature flags that can actually be
used back to userspace.
Now userspace has an obvious way to react: it checks if any flags it
asked for are missing. If so, it can conclude this kernel doesn't
support those, and it can either resign itself to not using them, or
fail with an error on its own, or whatever else.
Link: https://lkml.kernel.org/r/20220722201513.1624158-1-axelrasmussen@google.com
Signed-off-by: Axel Rasmussen <axelrasmussen@google.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
0 files changed, 0 insertions, 0 deletions