summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@collabora.com>2021-02-05 13:43:21 -0500
committerThomas Gleixner <tglx@linutronix.de>2021-02-06 00:21:42 +0100
commit36a6c843fd0d8e02506681577e96dabd203dd8e8 (patch)
tree5d235696ba455e2ad85d78592489ad818efdf851 /tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
parent6342adcaa683c2b705c24ed201dc11b35854c88d (diff)
downloadlinux-36a6c843fd0d8e02506681577e96dabd203dd8e8.tar.gz
linux-36a6c843fd0d8e02506681577e96dabd203dd8e8.tar.bz2
linux-36a6c843fd0d8e02506681577e96dabd203dd8e8.zip
entry: Use different define for selector variable in SUD
Michael Kerrisk suggested that, from an API perspective, it is a bad idea to share the PR_SYS_DISPATCH_ defines between the prctl operation and the selector variable. Therefore, define two new constants to be used by SUD's selector variable and update the corresponding documentation and test cases. While this changes the API syscall user dispatch has never been part of a Linux release, it will show up for the first time in 5.11. Suggested-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20210205184321.2062251-1-krisman@collabora.com
Diffstat (limited to 'tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c')
-rw-r--r--tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c b/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
index 6689f1183dbf..073a03702ff5 100644
--- a/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
+++ b/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
@@ -22,6 +22,8 @@
# define PR_SET_SYSCALL_USER_DISPATCH 59
# define PR_SYS_DISPATCH_OFF 0
# define PR_SYS_DISPATCH_ON 1
+# define SYSCALL_DISPATCH_FILTER_ALLOW 0
+# define SYSCALL_DISPATCH_FILTER_BLOCK 1
#endif
#ifdef __NR_syscalls
@@ -55,8 +57,8 @@ unsigned long trapped_call_count = 0;
unsigned long native_call_count = 0;
char selector;
-#define SYSCALL_BLOCK (selector = PR_SYS_DISPATCH_ON)
-#define SYSCALL_UNBLOCK (selector = PR_SYS_DISPATCH_OFF)
+#define SYSCALL_BLOCK (selector = SYSCALL_DISPATCH_FILTER_BLOCK)
+#define SYSCALL_UNBLOCK (selector = SYSCALL_DISPATCH_FILTER_ALLOW)
#define CALIBRATION_STEP 100000
#define CALIBRATE_TO_SECS 5
@@ -170,7 +172,7 @@ int main(void)
syscall(MAGIC_SYSCALL_1);
#ifdef TEST_BLOCKED_RETURN
- if (selector == PR_SYS_DISPATCH_OFF) {
+ if (selector == SYSCALL_DISPATCH_FILTER_ALLOW) {
fprintf(stderr, "Failed to return with selector blocked.\n");
exit(-1);
}