Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2076165ybp; Thu, 10 Oct 2019 01:45:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/7nraAlahDZZcoV9jzf+tw78vrgLa6rCIPSYRVmeEjzGpn4mp0q+I2IPw1GqwB2o/fg0h X-Received: by 2002:a05:6402:21c2:: with SMTP id bi2mr7069454edb.8.1570697129762; Thu, 10 Oct 2019 01:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697129; cv=none; d=google.com; s=arc-20160816; b=iHDbuonGrVB6x19c7uVFsq6NNoFAiDbiRIPw40ZP6SURXJQPanARB/1rfWyNKziChb eEg1oouD3dQv2dB5LqTnTMd9GSX2ASchax/ChfxPUyz5u/TFRq/TCMrWohmLPUFRTrhQ g4uVCIznsL5p2xr+2BoDz1iOzkVs9ADUMgikVqjQju1XnPgpT8vDb1VKGOrCUS3Fi4x3 FOqU5+GIJ/xONFG9gt594QldLeG1dJN+Eqthd50oVOSJc8pw7YdLwNeITSbTjzxIm8Tt hlwTcNNmMlz6dmaMjdA3F3AAKgRsvWZhDOFWQUFm/EUErWU+lEsrpidqwqziXlAGTJSo M0Tg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dCRkUQBDn3VOZKKz/koRcZZZvJQQ8M7l9Y79Q8zINik=; b=IX/dbTvnLkbgL6caMtDWX+YLGF/Q7wIHgFSAEC3hBF1H4c0fo5mX+5cziIg3ERMrPZ ru1w4kyaK4gyNs/t+neYGgyd1ayVVzTeRHVYIWZWCjx3ZXZrGNwgEgOum5BUDonbnZUw glNa6Aokyuiuhl28EcaFgve5ag3G+EqHCA4HkMpj4EPgj6HSGyV4rCtliWHRbs3GP5Mn lV/QvllJujm2vBdcvvAVeo8co5WThVrojC+gt7rEl/DzD1DtLlrH6tDPvS5bTNLWomv/ td/rrxX5oT43EiZJhQKyjrGo/NNhZOTMPVTTFYWr9uCAOvKZTJ8AWRtf+spSb08bM1RB A5QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cWJUcn6P; 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 a53si3387126edc.175.2019.10.10.01.45.06; Thu, 10 Oct 2019 01:45:29 -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; dkim=pass header.i=@kernel.org header.s=default header.b=cWJUcn6P; 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 S2388562AbfJJImb (ORCPT + 99 others); Thu, 10 Oct 2019 04:42:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:47052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388553AbfJJIm2 (ORCPT ); Thu, 10 Oct 2019 04:42:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0AB0021A4C; Thu, 10 Oct 2019 08:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696947; bh=KeGk7ekKKZHY2R8nLwGcjBusx9sdG8nRc9xvnHtfSGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cWJUcn6P+X/f7KNGk6XnEWSD/k2/Ag/5pyLumXm0NSC4j9+q6RdtzM20YBAJhLouE SBg1uNtl2asCRMczi+B+y8OYL52FI7UydhWuL5xVEz8poEaMltBSn+MIUSxabONezJ oBHI9as7ctzwDWOJiBlthE4YckSFpwTrd5PT7I3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tycho Andersen , Kees Cook , Shuah Khan , Sasha Levin Subject: [PATCH 5.3 110/148] selftests/seccomp: fix build on older kernels Date: Thu, 10 Oct 2019 10:36:11 +0200 Message-Id: <20191010083617.811699368@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Tycho Andersen [ Upstream commit 88282297fff00796e81f5e67734a6afdfb31fbc4 ] The seccomp selftest goes to some length to build against older kernel headers, viz. all the #ifdefs at the beginning of the file. Commit 201766a20e30 ("ptrace: add PTRACE_GET_SYSCALL_INFO request") introduces some additional macros, but doesn't do the #ifdef dance. Let's add that dance here to avoid: gcc -Wl,-no-as-needed -Wall seccomp_bpf.c -lpthread -o seccomp_bpf In file included from seccomp_bpf.c:51: seccomp_bpf.c: In function ‘tracer_ptrace’: seccomp_bpf.c:1787: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:1787:2: note: in expansion of macro ‘EXPECT_EQ’ EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY ^~~~~~~~~ seccomp_bpf.c:1787: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:1787:2: note: in expansion of macro ‘EXPECT_EQ’ EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY ^~~~~~~~~ seccomp_bpf.c:1788:6: error: ‘PTRACE_EVENTMSG_SYSCALL_EXIT’ undeclared (first use in this function); did you mean ‘PTRACE_EVENT_EXIT’? : PTRACE_EVENTMSG_SYSCALL_EXIT, msg); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../kselftest_harness.h:608:13: note: in definition of macro ‘__EXPECT’ __typeof__(_expected) __exp = (_expected); \ ^~~~~~~~~ seccomp_bpf.c:1787:2: note: in expansion of macro ‘EXPECT_EQ’ EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY ^~~~~~~~~ make: *** [Makefile:12: seccomp_bpf] Error 1 [skhan@linuxfoundation.org: Fix checkpatch error in commit log] Signed-off-by: Tycho Andersen Fixes: 201766a20e30 ("ptrace: add PTRACE_GET_SYSCALL_INFO request") Acked-by: Kees Cook Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/seccomp/seccomp_bpf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 6ef7f16c4cf52..7f8b5c8982e3b 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -199,6 +199,11 @@ struct seccomp_notif_sizes { }; #endif +#ifndef PTRACE_EVENTMSG_SYSCALL_ENTRY +#define PTRACE_EVENTMSG_SYSCALL_ENTRY 1 +#define PTRACE_EVENTMSG_SYSCALL_EXIT 2 +#endif + #ifndef seccomp int seccomp(unsigned int op, unsigned int flags, void *args) { -- 2.20.1