Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5584674img; Wed, 27 Mar 2019 11:09:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8plySnyoRWCE+eNAaHNndnlRiW8Yi3QL/wqAOY5Ajp57ILzW5sxYWL7bYXEhwRS3LQEav X-Received: by 2002:a63:3188:: with SMTP id x130mr34379055pgx.64.1553710175788; Wed, 27 Mar 2019 11:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553710175; cv=none; d=google.com; s=arc-20160816; b=Uc+GfJdRymy4dT16tvcFwmnKG4gMEJePi1op5Oqrqz7upbS5nuh0iJxFY1G9GuQmUw /AimAsMo0QiLHGW7QQXtP6vr9Zbgl1snbQWLRaruaPD/UtPAUIuum+RsUB/S2bQX80uw Oaxj0zJzvYKOXjAKgyKC8bo+fTXQrnXNczIgxtrUfmBLIOgCT7iBJQFHtmBCn+3vVHjl HnUPmYM0QscuZuDGFqSKdIHr+3/nNmlOyMKlfpVzYOtteRHfNfNJ7VNFUHQkAw/vWWru 0QZMmE4wfgWkQ2tCc9qHpetrFKYrjOP9rDCOE1O2i0GarRRolmfofzgoDrUceI1gtKpg cD7A== 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 :dkim-signature; bh=bd17eIELLyyAGMkUZ+phDfHNcp6c4Go9y8BpO4ZFPYY=; b=JZikiTyzdFXYtKgDnCbjVJF+dhuF+vu2A4PihdP+5BAQ0SN/e0WL3fo5hwmTHQO4em 8kiubEOF1K6OdpzlVhL6tEfB0qgt74FKhxeJyh7QUmkP89PSVu3sO5u2vG504wDea9rz AtAGIW2JgesRjlb0bCLvwSs2si37G+tpkzaaKSyx3le9GUfcTxaJtU1ULV9GElKlZ5KQ mPT6qIi2vraW4kq/7dMOVEtgWdQCqlg4A/nvgVdZSyZsK5PiQQFxZwQ6OEbhJSpW+Xw2 EzSlWg3iakQFgGEdpEtqGXxi0Um1rpM8imy9gm7DrxzO2B7EZPypueBx+mcsX5FSk/O+ 8kIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aDN5vgXg; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si2792902pgi.431.2019.03.27.11.09.19; Wed, 27 Mar 2019 11:09:35 -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=aDN5vgXg; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731568AbfC0SGm (ORCPT + 99 others); Wed, 27 Mar 2019 14:06:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:48286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387968AbfC0SGh (ORCPT ); Wed, 27 Mar 2019 14:06:37 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DB67421734; Wed, 27 Mar 2019 18:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709996; bh=sxtYnsIQngx0yYgIvLXLddPljEIXcT77fqa43VhPKiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aDN5vgXg4D6RFugf/xSVuEDJ6F3w2cI9plBtnvybvCuPUMaa6LHO5RN2sYpj6xVvk QfxfmyakhkoTFOYXfcvn0uqwQfJhpbStwGevzF6BStUDIQ+8dNgxCxmDm1lrOHUAMK xal5QbvY/Luk9or7LXlRTj+BR5LeKwzbXJjE0ft8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tycho Andersen , Shuah Khan , Sasha Levin , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 149/262] selftests: skip seccomp get_metadata test if not real root Date: Wed, 27 Mar 2019 14:00:04 -0400 Message-Id: <20190327180158.10245-149-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore 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 3aa415dd2128e478ea3225b59308766de0e94d6b ] The get_metadata() test requires real root, so let's skip it if we're not real root. Note that I used XFAIL here because that's what the test does later if CONFIG_CHEKCKPOINT_RESTORE happens to not be enabled. After looking at the code, there doesn't seem to be a nice way to skip tests defined as TEST(), since there's no return code (I tried exit(KSFT_SKIP), but that didn't work either...). So let's do it this way to be consistent, and easier to fix when someone comes along and fixes it. Signed-off-by: Tycho Andersen Acked-by: Kees Cook Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/seccomp/seccomp_bpf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 7e632b465ab4..6d7a81306f8a 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -2971,6 +2971,12 @@ TEST(get_metadata) struct seccomp_metadata md; long ret; + /* Only real root can get metadata. */ + if (geteuid()) { + XFAIL(return, "get_metadata requires real root"); + return; + } + ASSERT_EQ(0, pipe(pipefd)); pid = fork(); -- 2.19.1