Implement memfd_create syscall decoding
* memfd_create.c: New file. * Makefile.am (strace_SOURCES): Add it. * linux/dummy.h (sys_memfd_create): Remove. * pathtrace.c (pathtrace_match): Add SEN_memfd_create. * xlat/memfd_create_flags.in: New file. * tests/memfd_create.c: New file. * tests/memfd_create.expected: Likewise. * tests/memfd_create.test: New test. * tests/Makefile.am: (check_PROGRAMS): Add memfd_create. (TESTS): Add memfd_create.test. (EXTRA_DIST): Add memfd_create.expected. * tests/.gitignore: Add memfd_create.
This commit is contained in:
parent
e46534351d
commit
95b84ea641
@ -68,6 +68,7 @@ strace_SOURCES = \
|
||||
loop.c \
|
||||
lseek.c \
|
||||
mem.c \
|
||||
memfd_create.c \
|
||||
mknod.c \
|
||||
mount.c \
|
||||
mtd.c \
|
||||
|
@ -37,7 +37,6 @@
|
||||
#define sys_kcmp printargs
|
||||
#define sys_kexec_file_load printargs
|
||||
#define sys_lookup_dcookie printargs
|
||||
#define sys_memfd_create printargs
|
||||
#define sys_name_to_handle_at printargs
|
||||
#define sys_open_by_handle_at printargs
|
||||
#define sys_sched_getattr printargs
|
||||
|
12
memfd_create.c
Normal file
12
memfd_create.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include "defs.h"
|
||||
|
||||
#include "xlat/memfd_create_flags.h"
|
||||
|
||||
SYS_FUNC(memfd_create)
|
||||
{
|
||||
printstr(tcp, tcp->u_arg[0], -1);
|
||||
tprints(", ");
|
||||
printflags(memfd_create_flags, tcp->u_arg[1], "MFD_???");
|
||||
|
||||
return RVAL_DECODED | RVAL_FD;
|
||||
}
|
@ -324,6 +324,7 @@ pathtrace_match(struct tcb *tcp)
|
||||
case SEN_eventfd:
|
||||
case SEN_fanotify_init:
|
||||
case SEN_inotify_init1:
|
||||
case SEN_memfd_create:
|
||||
case SEN_perf_event_open:
|
||||
case SEN_pipe:
|
||||
case SEN_printargs:
|
||||
|
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -11,6 +11,7 @@ ip_mreq
|
||||
ipc_msg
|
||||
ipc_sem
|
||||
ipc_shm
|
||||
memfd_create
|
||||
mmap
|
||||
mmap64
|
||||
mmsg
|
||||
|
@ -22,6 +22,7 @@ check_PROGRAMS = \
|
||||
ipc_msg \
|
||||
ipc_sem \
|
||||
ipc_shm \
|
||||
memfd_create \
|
||||
mmap \
|
||||
mmap64 \
|
||||
mmsg \
|
||||
@ -88,6 +89,7 @@ TESTS = \
|
||||
stat32-v.test \
|
||||
stat64-v.test \
|
||||
statfs.test \
|
||||
memfd_create.test \
|
||||
mmap.test \
|
||||
mmap64.test \
|
||||
mmsg.test \
|
||||
@ -133,6 +135,7 @@ EXTRA_DIST = init.sh run.sh match.awk \
|
||||
ioctl.expected \
|
||||
ip_mreq.expected \
|
||||
ipc.sh \
|
||||
memfd_create.expected \
|
||||
mmsg.expected \
|
||||
net.expected \
|
||||
net-fd.expected \
|
||||
|
25
tests/memfd_create.c
Normal file
25
tests/memfd_create.c
Normal file
@ -0,0 +1,25 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#ifdef __NR_memfd_create
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
syscall(__NR_memfd_create, "strace", 7);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return 77;
|
||||
}
|
||||
|
||||
#endif
|
1
tests/memfd_create.expected
Normal file
1
tests/memfd_create.expected
Normal file
@ -0,0 +1 @@
|
||||
memfd_create\("strace", MFD_CLOEXEC\|MFD_ALLOW_SEALING\|0x4\) += -1 .*
|
11
tests/memfd_create.test
Executable file
11
tests/memfd_create.test
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Check memfd_create syscall decoding.
|
||||
|
||||
. "${srcdir=.}/init.sh"
|
||||
|
||||
run_prog
|
||||
run_strace -e memfd_create $args
|
||||
match_grep
|
||||
|
||||
exit 0
|
2
xlat/memfd_create_flags.in
Normal file
2
xlat/memfd_create_flags.in
Normal file
@ -0,0 +1,2 @@
|
||||
MFD_CLOEXEC 1
|
||||
MFD_ALLOW_SEALING 2
|
Loading…
x
Reference in New Issue
Block a user