• Axel Rasmussen's avatar
    selftests: vm: add hugetlb_shared userfaultfd test to run_vmtests.sh · a722d705
    Axel Rasmussen authored
    Patch series "userfaultfd: add /dev/userfaultfd for fine grained access
    control", v7.
    
    Why not ...?
    ============
    
    - Why not /proc/[pid]/userfaultfd? Two main points (additional discussion [1]):
    
        - /proc/[pid]/* files are all owned by the user/group of the process, and
          they don't really support chmod/chown. So, without extending procfs it
          doesn't solve the problem this series is trying to solve.
    
        - The main argument *for* this was to support creating UFFDs for remote
          processes. But, that use case clearly calls for CAP_SYS_PTRACE, so to
          support this we could just use the UFFD syscall as-is.
    
    - Why not use a syscall? Access to syscalls is generally controlled by
      capabilities. We don't have a capability which is used for userfaultfd access
      without also granting more / other permissions as well, and adding a new
      capability was rejected [2].
    
        - It's possible a LSM could be used to control access instead, but I have
          some concerns. I don't think this approach would be as easy to use,
          particularly if we were to try to solve this with something heavyweight
          like SELinux. Maybe we could pursue adding a new LSM specifically for
          this user case, but it may be too narrow of a case to justify that.
    
    [1]: https://patchwork.kernel.org/project/linux-mm/cover/20220719195628.3415852-1-axelrasmussen@google.com/
    [2]: https://lore.kernel.org/lkml/686276b9-4530-2045-6bd8-170e5943abe4@schaufler-ca.com/T/
    
    
    This patch (of 5):
    
    This not being included was just a simple oversight.  There are certain
    features (like minor fault support) which are only enabled on shared
    mappings, so without including hugetlb_shared we actually lose a
    significant amount of test coverage.
    
    Link: https://lkml.kernel.org/r/20220808175614.3885028-1-axelrasmussen@google.com
    Link: https://lkml.kernel.org/r/20220808175614.3885028-2-axelrasmussen@google.comSigned-off-by: default avatarAxel Rasmussen <axelrasmussen@google.com>
    Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    Reviewed-by: default avatarPeter Xu <peterx@redhat.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Dmitry V. Levin <ldv@altlinux.org>
    Cc: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Nadav Amit <namit@vmware.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Zhang Yi <yi.zhang@huawei.com>
    Cc: Mike Rapoport <rppt@linux.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    a722d705
run_vmtests.sh 4.82 KB