aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Roxell <anders.roxell@linaro.org>2018-01-05 11:31:18 -0500
committerShuah Khan <shuahkh@osg.samsung.com>2018-01-10 10:22:39 -0500
commit912ec316686df352028afb6efec59e47a958a24d (patch)
tree2d3729ea80d2437bce229117c915e4318d88f529
parentae64f9bd1d3621b5e60d7363bc20afb46aede215 (diff)
selftests: seccomp: fix compile error seccomp_bpf
aarch64-linux-gnu-gcc -Wl,-no-as-needed -Wall -lpthread seccomp_bpf.c -o seccomp_bpf seccomp_bpf.c: In function 'tracer_ptrace': seccomp_bpf.c:1720:12: error: '__NR_open' undeclared (first use in this function) if (nr == __NR_open) ^~~~~~~~~ seccomp_bpf.c:1720:12: note: each undeclared identifier is reported only once for each function it appears in In file included from seccomp_bpf.c:48:0: seccomp_bpf.c: In function 'TRACE_syscall_ptrace_syscall_dropped': seccomp_bpf.c:1795:39: error: '__NR_open' undeclared (first use in this function) EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_open)); ^ open(2) is a legacy syscall, replaced with openat(2) since 2.6.16. Thus new architectures in the kernel, such as arm64, don't implement these legacy syscalls. Fixes: a33b2d0359a0 ("selftests/seccomp: Add tests for basic ptrace actions") Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org> Cc: stable@vger.kernel.org Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
-rw-r--r--tools/testing/selftests/seccomp/seccomp_bpf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 24dbf634e2dd..0b457e8e0f0c 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -1717,7 +1717,7 @@ void tracer_ptrace(struct __test_metadata *_metadata, pid_t tracee,
1717 1717
1718 if (nr == __NR_getpid) 1718 if (nr == __NR_getpid)
1719 change_syscall(_metadata, tracee, __NR_getppid); 1719 change_syscall(_metadata, tracee, __NR_getppid);
1720 if (nr == __NR_open) 1720 if (nr == __NR_openat)
1721 change_syscall(_metadata, tracee, -1); 1721 change_syscall(_metadata, tracee, -1);
1722} 1722}
1723 1723
@@ -1792,7 +1792,7 @@ TEST_F(TRACE_syscall, ptrace_syscall_dropped)
1792 true); 1792 true);
1793 1793
1794 /* Tracer should skip the open syscall, resulting in EPERM. */ 1794 /* Tracer should skip the open syscall, resulting in EPERM. */
1795 EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_open)); 1795 EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_openat));
1796} 1796}
1797 1797
1798TEST_F(TRACE_syscall, syscall_allowed) 1798TEST_F(TRACE_syscall, syscall_allowed)