Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753627AbeAFC3j (ORCPT + 1 other); Fri, 5 Jan 2018 21:29:39 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:44373 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753538AbeAFC3h (ORCPT ); Fri, 5 Jan 2018 21:29:37 -0500 X-Google-Smtp-Source: ACJfBosJg4YvWbsZZFyRpqpxp2m1qHWw8eOuJ8qydiUbotDf8+OUHNN0CDbhlF+kBR6EKuVGe3/W554iUh6hFI+QPxU= MIME-Version: 1.0 In-Reply-To: <20180105163118.22598-1-anders.roxell@linaro.org> References: <20180105163118.22598-1-anders.roxell@linaro.org> From: Naresh Kamboju Date: Sat, 6 Jan 2018 07:59:34 +0530 Message-ID: Subject: Re: [PATCH] selftests: seccomp: fix compile error seccomp_bpf To: Anders Roxell Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , wad@chromium.org, Andy Lutomirski , Kees Cook Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 5 January 2018 at 22:01, Anders Roxell wrote: > 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. > > Signed-off-by: Anders Roxell Thanks for the patch Anders. Tested-by: Naresh Kamboju > --- > tools/testing/selftests/seccomp/seccomp_bpf.c | 4 ++-- > 1 file 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, > > if (nr == __NR_getpid) > change_syscall(_metadata, tracee, __NR_getppid); > - if (nr == __NR_open) > + if (nr == __NR_openat) > change_syscall(_metadata, tracee, -1); > } > > @@ -1792,7 +1792,7 @@ TEST_F(TRACE_syscall, ptrace_syscall_dropped) > true); > > /* Tracer should skip the open syscall, resulting in EPERM. */ > - EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_open)); > + EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_openat)); > } > > TEST_F(TRACE_syscall, syscall_allowed) > -- > 2.11.0 >