Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6386270ybe; Wed, 18 Sep 2019 02:36:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFSDaUdnBNtOqTdFzMBnXHZZGpEF39ddNHd0JYNJdbcWGY2rkxmXXX3yjnFrjxkJmgI2ty X-Received: by 2002:a17:906:1903:: with SMTP id a3mr8496225eje.112.1568799375579; Wed, 18 Sep 2019 02:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568799375; cv=none; d=google.com; s=arc-20160816; b=sqtGj/PBWYKymHUmeyIcZHRDTMJuWJjzZHU9rXD9OBY1AXkvaXY5nIcp12mF2N+Xmc xwdkX7GqZUYKGA1hAu2+6lctF1TBpfEBDNiLMrcTMCMv1V8mdPrGNfBAyRdsWI2vF4Fh csPw2OJcryDNjZP0W1YqqKKY3tvx9At1BH/4yFTQQs+1VdI346w8lPRRH35X4R11gvoT QFNCl8r1nYZjcUvndoU/pctlpHslpbCng6B4k5Awua//yiCbablafVYoXvnyF5zsJafd z9SdfqX5roVxn9djTk3JLCQZi1YgGu3IGEgl9mZF7Yu1Vjb6lv25Q//xr3fQC/KhCzLX Qk1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WcB6aeOFhUhsrLDsSu4vqLZyYz9UdK+EeZw5wiZIlu0=; b=bUzofr3Debs+PNSD+zEKoTw5dqxtkNIAM43+m1s5Id7Pk0Pl2HOdlpCNG5jB0d7nlc o7WaAt/fU//SdgUrCuLI2SbNp3Pi9E6+6ndUpCinAnX9jVkOmuxlVXaGW0xp5yNCWqP3 P9nri09Q1+bbpF2oW5fpQNMnv0NCaONjD5PRVEz3wbI2Pohe6QWumSKQH9/oln60bgiH tq5P8sO5MRskNtN8b5rrDN8dJrf9kkqKEe80gv5pEwCX7pO2/RLJW6FHVTqlovGUSy2W 4cQ+oK/BYesQK35gFB+w/YQ2JJ4VJ9FGywqQf5GzUlwLem54ihslKWqzu+Md/eRjSArO +B5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k16si2583517ejo.7.2019.09.18.02.35.52; Wed, 18 Sep 2019 02:36:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730586AbfIRIss (ORCPT + 99 others); Wed, 18 Sep 2019 04:48:48 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:41699 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730502AbfIRIsq (ORCPT ); Wed, 18 Sep 2019 04:48:46 -0400 Received: from static-dcd-cqq-121001.business.bouyguestelecom.com ([212.194.121.1] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iAVdf-0004BF-BN; Wed, 18 Sep 2019 08:48:39 +0000 From: Christian Brauner To: keescook@chromium.org, luto@amacapital.net Cc: 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, Christian Brauner , Tycho Andersen , Tyler Hicks , stable@vger.kernel.org Subject: [PATCH 2/4] seccomp: add two missing ptrace ifdefines Date: Wed, 18 Sep 2019 10:48:31 +0200 Message-Id: <20190918084833.9369-3-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190918084833.9369-1-christian.brauner@ubuntu.com> References: <20190918084833.9369-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") 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