Skip to content

Commit

Permalink
selftests/seccomp: Avoid using "sysctl" for report
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kees Cook committed Jun 28, 2021
1 parent 62ddb91 commit 9a03abc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/testing/selftests/seccomp/seccomp_benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9a03abc

Please sign in to comment.