Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1024915yba; Thu, 4 Apr 2019 02:41:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNFv7npfjyrhEWBrM4qY+f0lcf8O3QCsN0aYkCMM6hME+k8zLaGnHolAnXjnLcYGrNsEuV X-Received: by 2002:aa7:920b:: with SMTP id 11mr4823626pfo.3.1554370895198; Thu, 04 Apr 2019 02:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554370895; cv=none; d=google.com; s=arc-20160816; b=pmBpLeJ8XvXARgBOJJCxQ+14JPsp9akFl8jMbPfMNPNeXzYxuc2AwPaDCSx1Oi+Pcg Ll30QT+bXSn09PMB3bhYWFs8ytX9sTt5iU8l7Z7ANuYi4FE6X2sn6mX+eH9xOjZlHVrl iuyZGEGzjZ5tYKws3vvoRXOmqrBqNtGSvpMFBZbtNLiZaHBnWK7Qn/3kMZeJPetLyxiC hUJqgtYadPITBFrecU1LbZMGvfq9DNeS0pW5WqPVEVdhqrQFL8z40xMMzoCY5wXteuXj JFOyvFQPUaMi0rBVmADQiWETGQg1w3bgSj6cnvZOwlfJBH8srwr+ic4JfYE/SJDivh9Z Jo1w== 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=DJOdbKEXHUY7FtuL6wjmoXbujZL9DH8Kv4vaBgJvH8Q=; b=rzgjqSpEeC7mLKnblgT7q7vGytTiB6z71oxzrXNTp6Abk7QjmxwLdRapawSKGPI2d1 g0ATCIpPy2qMEJ/WBWRX+QGbNS5vas7MVfaadAukaC5VlvL0iN8sHtYRZjAfolFXXuvP u/xAlmEh63ZfHa0TzSqC16xOE4LTMmx317bSjzxSpZs14+zimMIANWKwOYc0I3Vj83dL iwJfn3PPpr1ru5NY2Ct1Too8XhvqlRqjm8Z8LamT3FXO36tp4n65YAmFbVMlf6PNny3R V+138vnRmUrdorzi8DnE8NOpWmCwqsVJdaAIkxxvpyeymKNPkpGtqXGSGtrO39rpDYpW vRvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iqPGNSFI; 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 y2si5665947pgq.170.2019.04.04.02.41.20; Thu, 04 Apr 2019 02:41: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=iqPGNSFI; 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 S1731795AbfDDJD1 (ORCPT + 99 others); Thu, 4 Apr 2019 05:03:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:41108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731321AbfDDJD0 (ORCPT ); Thu, 4 Apr 2019 05:03:26 -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 D41782147C; Thu, 4 Apr 2019 09:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368606; bh=IdPP1kgzsjD8Wb3v67ymoOb7gX7zlYTjymgD1SDsHo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iqPGNSFIGIsVjah3Y/8JvpPQKmq57azujtG34gmssKzEtA7+UP8mkFKA2rgiXuUmi UR6Sxwi1Pu/LPpZC+1eUZ1/hj2q3P0Qa2acrw5ZC+bW5iDUaa07/ZWfSef50hFwSQm o1lNKRcXIHvBxOF78IB6EH6hKdzJZrDIFaBBqFaE= 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 4.19 101/187] selftests: skip seccomp get_metadata test if not real root Date: Thu, 4 Apr 2019 10:47:18 +0200 Message-Id: <20190404084607.952046935@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 83057fa9d391..14cad657bc6a 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -2920,6 +2920,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