userfaultfd: provide pid in userfault msg - add feat union
Subsystems (2)
[email protected]
maintainerPATCH 97/119 userfaultfd: provide pid in userfault msg - add feat union
From: Andrea Arcangeli <[email protected]>
Subject: 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.
Signed-off-by Andrea Arcangeli <[email protected]>
Cc "Dr. David Alan Gilbert" <[email protected]>
Cc Alexey Perevalov <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Mike Rapoport <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
fs/userfaultfd.c | 2 +- include/uapi/linux/userfaultfd.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
fs/userfaultfd.c renamed from fs/userfaultfd.c~userfaultfd-provide-pid-in-userfault-msg-add-feat-union +1 -1
@@ -204,7 +204,7 @@ static inline struct uffd_msg userfault_*/ 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; }
include/uapi/linux/userfaultfd.h renamed from include/uapi/linux/userfaultfd.h~userfaultfd-provide-pid-in-userfault-msg-add-feat-union +3 -1
@@ -80,7 +80,9 @@ struct uffd_msg {struct {__u64 flags;__u64 address; -__u32 ptid; +union { +__u32 ptid; + } feat; } pagefault;struct {
_