From patchwork Fri Jan 5 16:31:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 123547 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1015364qgn; Fri, 5 Jan 2018 08:31:35 -0800 (PST) X-Google-Smtp-Source: ACJfBotOlYb3y6Ymg/ElUDoJtCCfn5hjOsxdAKdmjYbAwNjJIGo5hXNw7IBVtcoe3CBknyEz6t2W X-Received: by 10.99.106.138 with SMTP id f132mr3047944pgc.115.1515169895681; Fri, 05 Jan 2018 08:31:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515169895; cv=none; d=google.com; s=arc-20160816; b=Ce4AcvHFffzZTKzpfmZ1Nj9kmKl1G13nxOUMsCocvLb68wLKx2TDcFycYAmqEgGelv lR4pmK4twJpKJXPBnyQptQdRmTM1/Rhe4crSQim6/wiA9PmOM/49qYyGnOgGzH1Cck8C 57VWy7FLYQSsHfIzzkwZJx1tITKItSxS1SV2KS/ScjgyueiucNremc04aEDPJ5sWYabZ 8Kr6JhcYkFpRPuo3SymOKStEmkcJRJNiyI9bzgDydObe6XNvSuytXi5+XOj26g7S7zuL CJra9xPAMyCjlOvn447qUP2MOYfAi/e3vNtnC6JBWjr/PXesVnHAiXDI8kwUFOmIeAHf UGDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=A40yz/54PIQt8qSPk/jKy9ZkT5JgzJf5Wx5gzzuQKX4=; b=ng6tfMMuptWgN4hbB8nrz+D+Mtqn+nopCVRnuQXwx/fxH9lNnHlB0KgT2ol7GCvqrP X0Zq7ZWy1xgbSLuZrUkgdObE5NKGwKfb6McrivYFygC7pjP4mL897ZUxuXzoYL9dwVE9 3bId2daZ4J1MKsBtWyh+6bClCjM9kFOyjhvR9Vw0vWnAAqmI6GhfiedI8zVNa4Sb1cgP cZag/fwR2B2NGx8IZA01mWgfGdNa0d2tLs9qiOzwEXLbKCPm49fFGav9l/dkbcZr5TxA m8K8rHC1YE0JM+4kcJK4et0Z1DAPdeA8DprgAFrCaMbRxnZwd7a/odYkMjvVnDCpbbrq 6iLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hQiDCGjR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si4183757plo.262.2018.01.05.08.31.35; Fri, 05 Jan 2018 08:31:35 -0800 (PST) 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=@linaro.org header.s=google header.b=hQiDCGjR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752075AbeAEQbe (ORCPT + 26 others); Fri, 5 Jan 2018 11:31:34 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:45864 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751593AbeAEQbc (ORCPT ); Fri, 5 Jan 2018 11:31:32 -0500 Received: by mail-lf0-f65.google.com with SMTP id y71so5680379lfd.12 for ; Fri, 05 Jan 2018 08:31:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=A40yz/54PIQt8qSPk/jKy9ZkT5JgzJf5Wx5gzzuQKX4=; b=hQiDCGjROVh2FQF3F0xcydN7ddcJYjKbsjXr4pjhVa408LgexXD+UxlPiO8XwqYLVv TcYGQlo4tdNO8aD8JW3tvoEuqjH8gfuREW3g6Oc0hYzUR2B1s5/AyNJAXAdLaAkzzC1T uYreMFi37geg5UAGXgKd5aHHeOAZW/C4u5fHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=A40yz/54PIQt8qSPk/jKy9ZkT5JgzJf5Wx5gzzuQKX4=; b=CgsMd+oQn3G8Hqtp2ui3GzD9n6o3e45jFLFX0i8PjSuuAyRnUnFuZ1DnYCjECr/T62 Lw4H8n2pmGV+wkQibACONOmvsmNzDAPXB7/fx5lXnHkZa93sLjuca72pE4uXYrR5J7ve kciVGWpIrb3ZFS4XJy/tMR4P8f/z7HCjUufGOn+97WyoX85LhYjMU7YEXg1Oo6inWI2T PMxAlctcnwfHKZn6/xGzpBYMUQxIiBVSYicSmZapSP/1g2oRVyYNfHsEJYUUqzIQ2dgX E3MHdPHeHlkWVOrr/zVJdTo/7ADGIR52Oyw2lPVCTcO7UnihahI5Ybj50AnclAMzbkqP Bmmg== X-Gm-Message-State: AKGB3mI27UAgyhXBwISImBFUpnBJzfKZTlOHga2bwmeQslEnyn4FviCF NSmbZ1nqJQLFxSsAHTCRQ7I0CA== X-Received: by 10.46.16.149 with SMTP id 21mr2034112ljq.119.1515169891347; Fri, 05 Jan 2018 08:31:31 -0800 (PST) Received: from localhost (c-153870d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.56.21]) by smtp.gmail.com with ESMTPSA id m18sm1088495lje.21.2018.01.05.08.31.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2018 08:31:30 -0800 (PST) From: Anders Roxell To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: shuah@kernel.org, wad@chromium.org, luto@amacapital.net, keescook@chromium.org, Anders Roxell Subject: [PATCH] selftests: seccomp: fix compile error seccomp_bpf Date: Fri, 5 Jan 2018 17:31:18 +0100 Message-Id: <20180105163118.22598-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- tools/testing/selftests/seccomp/seccomp_bpf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 Tested-by: Naresh Kamboju Acked-by: Kees Cook 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)