From patchwork Sat Jan 19 00:12:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tycho Andersen X-Patchwork-Id: 10771855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 48E1D13BF for ; Sat, 19 Jan 2019 00:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38A5E30784 for ; Sat, 19 Jan 2019 00:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CC5D30764; Sat, 19 Jan 2019 00:13:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF4EA30764 for ; Sat, 19 Jan 2019 00:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730241AbfASANR (ORCPT ); Fri, 18 Jan 2019 19:13:17 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:36920 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730225AbfASAMx (ORCPT ); Fri, 18 Jan 2019 19:12:53 -0500 Received: by mail-qt1-f194.google.com with SMTP id t33so17195236qtt.4 for ; Fri, 18 Jan 2019 16:12:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8jItW+uLvTQKdFnkClt3MYaSALrSUtjdvWxFm2Tp+V0=; b=bQ8O+JdJk1X0CF7iLtOfUpCBekB4305Uki+lD67KBlRIRFieL653YusBS493IosQoR 1ZFVyoA3CdY2ojprp1a6L5V52u+ML03r8jZEj0yvDJlPDUNrDF/4tvjUKingM1+TDqwt Is9jL9VkOuPJ1T1e72Mt8Tjk2ABw45hef4SG7wiAjgdQliq2gTnQk4fM5jYURO4KD1Oh s/eHsuPbseJHcy8lgkJ/ifyF3RHwlB2TEkp2L7STJY7rOide7a0ljIAwE490vIBmIo8R WEHRCRnvcp/+ikCl7O1cWgeBW04DVvV10TuRie07IdFp2cQipwUKls9YfErkxevfLsJZ tLrg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=8jItW+uLvTQKdFnkClt3MYaSALrSUtjdvWxFm2Tp+V0=; b=Bz3Lx3m3ayZsquAWYve57h8Eat29Wh0NNGtZSJ/PqiFH3HJnix0msQ538/bXhw8Sr8 tvFjuGyu5YOSO3NDwRc4q7bAJNhE9bi+3s/8CpOwmvEkyL8/zzaW7nUBOzeOD9h3mG9Y cS6gtI3x+gPTaVjrEtLXr/p2SwGP7By8CS7U2QkDDb9doxvNda1LiDO8QcGYCBf2X5bR W2629R4Q2F3WHi5lGvTifJ6GG3WVfbKxFCCB+CQQGLKDrCVOf8KQzjFub72qfYMOkilD gF+6+wEAXJPmV7Aly6ekzU0PV3CBXvlYH0f8klXRZ9WUqLaPi3s/mI+HUEFvW6j1hvxc jSUw== X-Gm-Message-State: AJcUukcfL3rFG/QNMDImTPL1Bsm89o/mDDq6q76OOX8T1PyZ5w3QsFAY TfSCk6Hz6W/5lsOA2FiIAz96Hw== X-Google-Smtp-Source: ALg8bN5xF7YwqxNt5eBLPsVuK+1XD27YPDIMSsNo+pgqTX3SkYj1w2XBiSgsVlUACKH1tm7G7JvPlg== X-Received: by 2002:ac8:17f0:: with SMTP id r45mr17946900qtk.206.1547856772225; Fri, 18 Jan 2019 16:12:52 -0800 (PST) Received: from localhost.localdomain ([64.125.109.186]) by smtp.gmail.com with ESMTPSA id m14sm41140501qka.21.2019.01.18.16.12.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 16:12:51 -0800 (PST) From: Tycho Andersen To: Shuah Khan , Kees Cook Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Tycho Andersen Subject: [PATCH 4/6] selftests: skip seccomp get_metadata test if not real root Date: Fri, 18 Jan 2019 17:12:15 -0700 Message-Id: <20190119001217.12660-5-tycho@tycho.ws> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190119001217.12660-1-tycho@tycho.ws> References: <20190119001217.12660-1-tycho@tycho.ws> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 912a2a5430dc..ab6b6620f522 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -2929,6 +2929,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();