userfaultfd: decode struct uffdio_api.features as flags
* xlat/uffd_api_features.in: New file. * userfaultfd.c: Include "xlat/uffd_api_features.h". (uffdio_ioctl): Print struct uffdio_api.features using PRINT_FIELD_FLAGS64 and uffd_api_features. * NEWS: Mention this. * tests/ioctl_uffdio.c: Include "xlat.h" and "xlat/uffd_api_features.h". (main): Update expected output.
This commit is contained in:
parent
16eded4c4b
commit
6644e1f4e1
1
NEWS
1
NEWS
@ -9,6 +9,7 @@ Noteworthy changes in release ?.?? (????-??-??)
|
||||
IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_JOIN_ANYCAST,
|
||||
IPV6_LEAVE_ANYCAST, MCAST_JOIN_GROUP, and MCAST_LEAVE_GROUP options
|
||||
of setsockopt syscall.
|
||||
* Enhanced decoding of UFFDIO_API ioctl command.
|
||||
* Implemented decoding of linux socket filter programs specified
|
||||
for SO_ATTACH_FILTER and SO_ATTACH_REUSEPORT_CBPF socket options.
|
||||
* Implemented decoding of inet_diag_req_v2, inet_diag_req_compat,
|
||||
|
@ -44,6 +44,9 @@
|
||||
# include <linux/ioctl.h>
|
||||
# include <linux/userfaultfd.h>
|
||||
|
||||
#include "xlat.h"
|
||||
#include "xlat/uffd_api_features.h"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
@ -71,9 +74,11 @@ main(void)
|
||||
api_struct->features = 0;
|
||||
rc = ioctl(fd, UFFDIO_API, api_struct);
|
||||
printf("ioctl(%d, UFFDIO_API, {api=0xaa, features=0", fd);
|
||||
if (api_struct->features)
|
||||
printf(" => features=%#" PRIx64,
|
||||
(uint64_t) api_struct->features);
|
||||
if (api_struct->features) {
|
||||
printf(" => features=");
|
||||
printflags(uffd_api_features, api_struct->features,
|
||||
"UFFD_FEATURE_???");
|
||||
}
|
||||
printf(", ioctls=1<<_UFFDIO_REGISTER|"
|
||||
"1<<_UFFDIO_UNREGISTER|1<<_UFFDIO_API");
|
||||
api_struct->ioctls &= ~(1ull<<_UFFDIO_REGISTER|
|
||||
|
@ -43,6 +43,7 @@ SYS_FUNC(userfaultfd)
|
||||
# include <linux/ioctl.h>
|
||||
# include <linux/userfaultfd.h>
|
||||
|
||||
# include "xlat/uffd_api_features.h"
|
||||
# include "xlat/uffd_api_flags.h"
|
||||
# include "xlat/uffd_copy_flags.h"
|
||||
# include "xlat/uffd_register_ioctl_flags.h"
|
||||
@ -75,11 +76,10 @@ uffdio_ioctl(struct tcb *const tcp, const unsigned int code,
|
||||
tprints(", ");
|
||||
if (umove_or_printaddr(tcp, arg, &ua))
|
||||
return RVAL_DECODED | 1;
|
||||
/* Features is intended to contain some flags, but
|
||||
* there aren't any defined yet.
|
||||
*/
|
||||
PRINT_FIELD_X("{", ua, api);
|
||||
PRINT_FIELD_X(", ", ua, features);
|
||||
PRINT_FIELD_FLAGS64(", ", ua, features,
|
||||
uffd_api_features,
|
||||
"UFFD_FEATURE_???");
|
||||
entering_features = malloc(sizeof(*entering_features));
|
||||
if (entering_features) {
|
||||
*entering_features = ua.features;
|
||||
@ -90,7 +90,9 @@ uffdio_ioctl(struct tcb *const tcp, const unsigned int code,
|
||||
entering_features = get_tcb_priv_data(tcp);
|
||||
if (!entering_features
|
||||
|| *entering_features != ua.features) {
|
||||
PRINT_FIELD_X(" => ", ua, features);
|
||||
PRINT_FIELD_FLAGS64(" => ", ua, features,
|
||||
uffd_api_features,
|
||||
"UFFD_FEATURE_???");
|
||||
}
|
||||
PRINT_FIELD_FLAGS64(", ", ua, ioctls,
|
||||
uffd_api_flags,
|
||||
|
9
xlat/uffd_api_features.in
Normal file
9
xlat/uffd_api_features.in
Normal file
@ -0,0 +1,9 @@
|
||||
#val_type uint64_t
|
||||
UFFD_FEATURE_PAGEFAULT_FLAG_WP
|
||||
UFFD_FEATURE_EVENT_FORK
|
||||
UFFD_FEATURE_EVENT_REMAP
|
||||
UFFD_FEATURE_EVENT_REMOVE
|
||||
UFFD_FEATURE_MISSING_HUGETLBFS
|
||||
UFFD_FEATURE_MISSING_SHMEM
|
||||
UFFD_FEATURE_EVENT_UNMAP
|
||||
UFFD_FEATURE_EVENT_EXIT
|
Loading…
x
Reference in New Issue
Block a user