Skip to content

Commit a36985d

Browse files
aagittorvalds
authored andcommitted
userfaultfd: provide pid in userfault msg - add feat union
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>
1 parent 9d4ac93 commit a36985d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

fs/userfaultfd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static inline struct uffd_msg userfault_msg(unsigned long address,
204204
*/
205205
msg.arg.pagefault.flags |= UFFD_PAGEFAULT_FLAG_WP;
206206
if (features & UFFD_FEATURE_THREAD_ID)
207-
msg.arg.pagefault.ptid = task_pid_vnr(current);
207+
msg.arg.pagefault.feat.ptid = task_pid_vnr(current);
208208
return msg;
209209
}
210210

include/uapi/linux/userfaultfd.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ struct uffd_msg {
8080
struct {
8181
__u64 flags;
8282
__u64 address;
83-
__u32 ptid;
83+
union {
84+
__u32 ptid;
85+
} feat;
8486
} pagefault;
8587

8688
struct {

0 commit comments

Comments
 (0)