summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Syromyatnikov <evgsyr@gmail.com>2021-09-12 01:27:21 +0200
committerEugene Syromyatnikov <evgsyr@gmail.com>2021-10-11 14:39:39 +0200
commit48550c2384f3b3eb76ddccfce10ee7c35d13440d (patch)
tree9742cd18a6131cf77d3649a7da4d7f8aa1e70b07
parentc832578cf522888289293a142b4bd193518b0ce8 (diff)
downloadstrace-48550c2384f3b3eb76ddccfce10ee7c35d13440d.tar.gz
Decode process_mrelease syscall
Introduced by Linux commits v5.14-159-g884a7e5964e0 and v5.14-160-gdce491039628. * src/linux/generic/syscallent-common.h ([BASE_NR + 448]): Add process_mrelease syscall entry. * src/mem.c (SYS_FUNC(process_mrelease)): New syscall decoder. * tests/.gitignore: Add process_mrelease and process_mrelease-y. * tests/gen_tests.in (process_mrelease, process_mrelease-y): New tests. * tests/process_mrelease.c: New file. * tests/process_mrelease-y.c: Likewise. * NEWS: Mention it.
-rw-r--r--NEWS1
-rw-r--r--src/linux/generic/syscallent-common.h1
-rw-r--r--src/mem.c13
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/gen_tests.in2
-rw-r--r--tests/process_mrelease-y.c4
-rw-r--r--tests/process_mrelease.c59
-rwxr-xr-xtests/pure_executables.list2
8 files changed, 84 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 65459be4b..f0a8843f2 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Noteworthy changes in release ?.?? (????-??-??)
* Improved printing of syscall names in places where the associated
AUDIT_ARCH_* value is present (ptrace PTRACE_GET_SYSCALL_INFO request,
SIGSYS siginfo_t).
+ * Implemented decoding of process_mrelease syscall, introduced in Linux 5.15.
* Implemented decoding of SECCOMP_GET_NOTIF_SIZES operation of seccomp
syscall.
* Implemented decoding of SECCOMP_* ioctl commands.
diff --git a/src/linux/generic/syscallent-common.h b/src/linux/generic/syscallent-common.h
index b5498f1d6..124e505ea 100644
--- a/src/linux/generic/syscallent-common.h
+++ b/src/linux/generic/syscallent-common.h
@@ -32,3 +32,4 @@
[BASE_NR + 445] = { 4, TD, SEN(landlock_add_rule), "landlock_add_rule" },
[BASE_NR + 446] = { 2, TD, SEN(landlock_restrict_self), "landlock_restrict_self" },
[BASE_NR + 447] = { 1, TD, SEN(memfd_secret), "memfd_secret" },
+[BASE_NR + 448] = { 2, TD, SEN(process_mrelease), "process_mrelease" },
diff --git a/src/mem.c b/src/mem.c
index d8382af5f..d34a92118 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -319,6 +319,19 @@ SYS_FUNC(process_madvise)
return RVAL_DECODED;
}
+SYS_FUNC(process_mrelease)
+{
+ const int pidfd = tcp->u_arg[0];
+ const unsigned int flags = tcp->u_arg[1];
+
+ printfd(tcp, pidfd);
+ tprint_arg_next();
+
+ PRINT_VAL_X(flags);
+
+ return RVAL_DECODED;
+}
+
#include "xlat/mlockall_flags.h"
SYS_FUNC(mlockall)
diff --git a/tests/.gitignore b/tests/.gitignore
index 237c7c597..8cd778abc 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -708,6 +708,8 @@ prlimit64-success--pidns-translation
process_madvise
process_madvise-y
process_madvise-yy
+process_mrelease
+process_mrelease-y
process_vm_readv
process_vm_readv--pidns-translation
process_vm_writev
diff --git a/tests/gen_tests.in b/tests/gen_tests.in
index 06af2de6f..f547d61b4 100644
--- a/tests/gen_tests.in
+++ b/tests/gen_tests.in
@@ -675,6 +675,8 @@ prlimit64-success--pidns-translation check_scno_tampering; test_pidns -a36 -einj
process_madvise
process_madvise-y --trace=process_madvise -y
process_madvise-yy --trace=process_madvise -yy
+process_mrelease -a24
+process_mrelease-y -e trace=process_mrelease -y -a24 </dev/full
process_vm_readv -s5 -a37
process_vm_readv--pidns-translation test_pidns -s5 -a37 -e trace=process_vm_readv
process_vm_writev -s5 -a38
diff --git a/tests/process_mrelease-y.c b/tests/process_mrelease-y.c
new file mode 100644
index 000000000..600cd195f
--- /dev/null
+++ b/tests/process_mrelease-y.c
@@ -0,0 +1,4 @@
+#define SKIP_IF_PROC_IS_UNAVAILABLE skip_if_unavailable("/proc/self/fd/")
+#define FD0_STR "</dev/full>"
+
+#include "process_mrelease.c"
diff --git a/tests/process_mrelease.c b/tests/process_mrelease.c
new file mode 100644
index 000000000..b7c34d3ae
--- /dev/null
+++ b/tests/process_mrelease.c
@@ -0,0 +1,59 @@
+/*
+ * Check decoding of process_mrelease syscall.
+ *
+ * Copyright (c) 2021 Eugene Syromyatnikov <evgsyr@gmail.com>
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "tests.h"
+#include "scno.h"
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#ifndef SKIP_IF_PROC_IS_UNAVAILABLE
+# define SKIP_IF_PROC_IS_UNAVAILABLE
+#endif
+
+#ifndef FD0_STR
+# define FD0_STR ""
+#endif
+
+static const char *errstr;
+
+static long
+sys_process_mrelease(int pidfd, unsigned int flags)
+{
+ static const kernel_ulong_t fill =
+ (kernel_ulong_t) 0xbadc0ded00000000ULL;
+ kernel_ulong_t arg1 = fill | (unsigned int) pidfd;
+ kernel_ulong_t arg2 = fill | flags;
+ kernel_ulong_t arg3 = fill | 0xdeedefed;
+ kernel_ulong_t arg4 = fill | 0xdebeefed;
+ kernel_ulong_t arg5 = fill | 0xdecaffed;
+ kernel_ulong_t arg6 = fill | 0xdeefaced;
+
+ long rc = syscall(__NR_process_mrelease,
+ arg1, arg2, arg3, arg4, arg5, arg6);
+ errstr = sprintrc(rc);
+ return rc;
+}
+
+int
+main(void)
+{
+ SKIP_IF_PROC_IS_UNAVAILABLE;
+
+ sys_process_mrelease(-1, 0);
+ printf("process_mrelease(-1, 0) = %s\n", errstr);
+
+ sys_process_mrelease(0, 0xfacefeed);
+ printf("process_mrelease(0" FD0_STR ", 0xfacefeed) = %s\n", errstr);
+
+ puts("+++ exited with 0 +++");
+ return 0;
+}
diff --git a/tests/pure_executables.list b/tests/pure_executables.list
index 436180971..fee99dd60 100755
--- a/tests/pure_executables.list
+++ b/tests/pure_executables.list
@@ -504,6 +504,8 @@ prlimit64
process_madvise
process_madvise-y
process_madvise-yy
+process_mrelease
+process_mrelease-y
process_vm_readv
process_vm_writev
pselect6