userfaultfd: provide pid in userfault msg - add feat union
authorAndrea Arcangeli <aarcange@redhat.com>
Wed, 6 Sep 2017 23:23:59 +0000 (16:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Sep 2017 00:27:29 +0000 (17:27 -0700)
No ABI change, but this will make it more explicit to software that ptid
is only available if requested by passing UFFD_FEATURE_THREAD_ID to
UFFDIO_API.  The fact it's a union will also self document it shouldn't
be taken for granted there's a tpid there.

Link: http://lkml.kernel.org/r/20170802165145.22628-7-aarcange@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Alexey Perevalov <a.perevalov@samsung.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/userfaultfd.c
include/uapi/linux/userfaultfd.h

index 665bf7a930b26b5d40448f9b7ed92eea1ac7519f..5419e7da82ba5a2729f65192efa60fd38b5e1bd6 100644 (file)
@@ -204,7 +204,7 @@ static inline struct uffd_msg userfault_msg(unsigned long address,
                 */
                msg.arg.pagefault.flags |= UFFD_PAGEFAULT_FLAG_WP;
        if (features & UFFD_FEATURE_THREAD_ID)
-               msg.arg.pagefault.ptid = task_pid_vnr(current);
+               msg.arg.pagefault.feat.ptid = task_pid_vnr(current);
        return msg;
 }
 
index 2b24c28d99a734119796977a6569fcdf0577de92..d6d1f65cb3c37c7b76738f544e6b625ebff39edb 100644 (file)
@@ -80,7 +80,9 @@ struct uffd_msg {
                struct {
                        __u64   flags;
                        __u64   address;
-                       __u32   ptid;
+                       union {
+                               __u32 ptid;
+                       } feat;
                } pagefault;
 
                struct {