From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C0C6C4CECE for ; Wed, 18 Sep 2019 09:15:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 777BA218AF for ; Wed, 18 Sep 2019 09:15:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726558AbfIRJPV (ORCPT ); Wed, 18 Sep 2019 05:15:21 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:42732 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbfIRJPV (ORCPT ); Wed, 18 Sep 2019 05:15:21 -0400 Received: from static-dcd-cqq-121001.business.bouyguestelecom.com ([212.194.121.1] helo=elm) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iAW3O-0006i4-C9; Wed, 18 Sep 2019 09:15:14 +0000 Date: Wed, 18 Sep 2019 11:15:12 +0200 From: Tyler Hicks To: Christian Brauner Cc: keescook@chromium.org, luto@amacapital.net, jannh@google.com, wad@chromium.org, shuah@kernel.org, ast@kernel.org, daniel@iogearbox.net, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Tycho Andersen , stable@vger.kernel.org Subject: Re: [PATCH 2/4] seccomp: add two missing ptrace ifdefines Message-ID: <20190918091512.GA5088@elm> References: <20190918084833.9369-1-christian.brauner@ubuntu.com> <20190918084833.9369-3-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190918084833.9369-3-christian.brauner@ubuntu.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 2019-09-18 10:48:31, Christian Brauner wrote: > Add tw missing ptrace ifdefines to avoid compilation errors on systems > that do not provide PTRACE_EVENTMSG_SYSCALL_ENTRY or > PTRACE_EVENTMSG_SYSCALL_EXIT or: > > gcc -Wl,-no-as-needed -Wall seccomp_bpf.c -lpthread -o seccomp_bpf > In file included from seccomp_bpf.c:52:0: > seccomp_bpf.c: In function ‘tracer_ptrace’: > seccomp_bpf.c:1792:20: error: ‘PTRACE_EVENTMSG_SYSCALL_ENTRY’ undeclared (first use in this function); did you mean ‘PTRACE_EVENT_CLONE’? > EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY > ^ > ../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’ > __typeof__(_expected) __exp = (_expected); \ > ^~~~~~~~~ > seccomp_bpf.c:1792:2: note: in expansion of macro ‘EXPECT_EQ’ > EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY > ^~~~~~~~~ > seccomp_bpf.c:1792:20: note: each undeclared identifier is reported only once for each function it appears in > EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY > ^ > ../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’ > __typeof__(_expected) __exp = (_expected); \ > ^~~~~~~~~ > seccomp_bpf.c:1792:2: note: in expansion of macro ‘EXPECT_EQ’ > EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY > ^~~~~~~~~ > seccomp_bpf.c:1793:6: error: ‘PTRACE_EVENTMSG_SYSCALL_EXIT’ undeclared (first use in this function); did you mean ‘PTRACE_EVENTMSG_SYSCALL_ENTRY’? > : PTRACE_EVENTMSG_SYSCALL_EXIT, msg); > ^ > ../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’ > __typeof__(_expected) __exp = (_expected); \ > ^~~~~~~~~ > seccomp_bpf.c:1792:2: note: in expansion of macro ‘EXPECT_EQ’ > EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY > ^~~~~~~~~ > > Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace") I think this Fixes line is incorrect and should be changed to: Fixes: 201766a20e30 ("ptrace: add PTRACE_GET_SYSCALL_INFO request") With that changed, Reviewed-by: Tyler Hicks Tyler > Signed-off-by: Christian Brauner > Cc: Kees Cook > Cc: Andy Lutomirski > Cc: Will Drewry > Cc: Shuah Khan > Cc: Alexei Starovoitov > Cc: Daniel Borkmann > Cc: Martin KaFai Lau > Cc: Song Liu > Cc: Yonghong Song > Cc: Tycho Andersen > CC: Tyler Hicks > Cc: Jann Horn > Cc: stable@vger.kernel.org > Cc: linux-kselftest@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: bpf@vger.kernel.org > --- > tools/testing/selftests/seccomp/seccomp_bpf.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c > index 6ef7f16c4cf5..ee52eab01800 100644 > --- a/tools/testing/selftests/seccomp/seccomp_bpf.c > +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c > @@ -155,6 +155,14 @@ struct seccomp_data { > #ifndef PTRACE_SECCOMP_GET_METADATA > #define PTRACE_SECCOMP_GET_METADATA 0x420d > > +#ifndef PTRACE_EVENTMSG_SYSCALL_ENTRY > +#define PTRACE_EVENTMSG_SYSCALL_ENTRY 1 > +#endif > + > +#ifndef PTRACE_EVENTMSG_SYSCALL_EXIT > +#define PTRACE_EVENTMSG_SYSCALL_EXIT 2 > +#endif > + > struct seccomp_metadata { > __u64 filter_off; /* Input: which filter */ > __u64 flags; /* Output: filter's flags */ > -- > 2.23.0 >