summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2021-06-17 16:18:34 -0700
committerKees Cook <keescook@chromium.org>2021-06-28 12:49:52 -0700
commit9a03abc16c77062c73972df08206f1031862d9b4 (patch)
tree57c53c58148e08481b5c9d6bc674c7256be21c7d
parent62ddb91b7771626658c382c2b849a058f1586123 (diff)
selftests/seccomp: Avoid using "sysctl" for report
Instead of depending on "sysctl" being installed, just use "grep -H" for sysctl status reporting. Additionally report kernel version for easier comparisons. Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r--tools/testing/selftests/seccomp/seccomp_benchmark.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/testing/selftests/seccomp/seccomp_benchmark.c b/tools/testing/selftests/seccomp/seccomp_benchmark.c
index 363cad755042..6e5102a7d7c9 100644
--- a/tools/testing/selftests/seccomp/seccomp_benchmark.c
+++ b/tools/testing/selftests/seccomp/seccomp_benchmark.c
@@ -145,9 +145,13 @@ int main(int argc, char *argv[])
setbuf(stdout, NULL);
+ printf("Running on:\n");
+ system("uname -a");
+
printf("Current BPF sysctl settings:\n");
- system("sysctl net.core.bpf_jit_enable");
- system("sysctl net.core.bpf_jit_harden");
+ /* Avoid using "sysctl" which may not be installed. */
+ system("grep -H . /proc/sys/net/core/bpf_jit_enable");
+ system("grep -H . /proc/sys/net/core/bpf_jit_harden");
if (argc > 1)
samples = strtoull(argv[1], NULL, 0);