Message ID | 20240124141357.1243457-2-terry.tritton@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-37094-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1020363dyi; Wed, 24 Jan 2024 06:22:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQzQxC7yfW2UIOV17Nr/birHsDyuiY+N7nYyxtIKJh7DrNZ4dNomRo8xhaCBcHkJbVpc2f X-Received: by 2002:a17:90b:480b:b0:290:2405:aee7 with SMTP id kn11-20020a17090b480b00b002902405aee7mr1688134pjb.11.1706106157583; Wed, 24 Jan 2024 06:22:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706106157; cv=pass; d=google.com; s=arc-20160816; b=DEEZvnm2dVPx48m6b+NqZMGZfCrXX98qhtTe7n1kGT9Rbg2tUBNG/ERNUvi2lKYOo3 xu39TMLbWsgvGyWdtHPw14+pLA5MuoGOb8L1TEAlhNBxwB6yoMgIfj0vFg5zbIa86PsI NCkzuIDrWdSyNtPOKphz/2lJT47L+2Vharwr4lJtOHZg/H+yfZEQ2yedfO0+JAvPNOl7 2xeEuHbOOPJUQBopFFkdt/VEnV3pxThKSeCKzA/VWRM/RV8PhuZnq+fJ4cvp8My7Tgzp n8mHSEgRdwPTrYgqXWOgG5YW9wUqmDGgPx0o4P+5LscRoQ9ZoWx/Zmy04QrGIoUojQBp jkOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=kXWpKvuuFDRe0zzHcqHQWgdjThR4TPIPgqd6iq0g85c=; fh=pA9JhLexjB+OV5pnnYNCIXkC6iVsJegx2ipdtlnT5ok=; b=QK3GZif+OsHLZwvNWwZFf+y3iIavKtAiEaDWunvwsortINA4T1Ed8lag5sraZ3sN1W eUgn+8XmkWCZx+8VwC0f6e2maZcixXROKLfGBjOpbGO0gGvj9nV5BQi2Js6IKrs0GNfX B2CAJIw/wYcmPqgjtm9c88Tj2qEzNtkcuaRUVZBT1KKG4V40JyzJ5TZlHfJGdzk18kkd zOBmJ6SMMMAvgxVYVLDSiZkb82z2S3ptImk7vW6yZpy0XuVwEKgi9K6aGZB0oHacu2OA vX9sFwIToztLI0hOJPWdSyXHG9lj3ov01m5lcsMSd43EnQnZcXch4jUpvtjVOLqIZs41 CsbA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uoHhygbg; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-37094-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37094-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n7-20020a17090ade8700b00290cf4ad827si3060471pjv.169.2024.01.24.06.22.37 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 06:22:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37094-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uoHhygbg; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-37094-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37094-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DF00B295192 for <ouuuleilei@gmail.com>; Wed, 24 Jan 2024 14:15:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D1D67A73D; Wed, 24 Jan 2024 14:15:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uoHhygbg" Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D12E563115 for <linux-kernel@vger.kernel.org>; Wed, 24 Jan 2024 14:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706105717; cv=none; b=N/MG+5gvAjjCFwU9gmozgkiu5hpdaQKADpZOwy8T433vkJKbvB4m6FTVs7MOOWGKT3h67RAADxjEdoi+On0dJ4n8EhOxnFznC46Ws5CcGPc7+IzIk6UHGSXfCeI453nknY3KW4HPnUZbyc7ZYdlILf2dxewxqdHpKAkIxXj0d+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706105717; c=relaxed/simple; bh=cE2W5KfsS/6abmLqZjvi1Wi0V0vV3k55AMuKwFWLxQQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hsh9NIcJ+9lrFDqFkygUONnmiuXU/iyLiMsDElYPgo/tZzqyRiUMavSl17mKM1mZ6UHn4VIQ+bHCTYkIfPERKTQ0qMu0dnzm/3M8xFAv1av/WuGS38+dSXadK8kxbL1Fhr39N5foapmZIynRaQxfnDha3s1sl3SjgNbVoLSWJJI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=uoHhygbg; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-51008c86ecbso2178240e87.2 for <linux-kernel@vger.kernel.org>; Wed, 24 Jan 2024 06:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706105714; x=1706710514; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kXWpKvuuFDRe0zzHcqHQWgdjThR4TPIPgqd6iq0g85c=; b=uoHhygbgkRGKW0AOymPGmBPfX+S8edJ2CS3+AQkFdE4A4dzLgoDwtON3QVLisH6zIc oQALN+yZSjNjlYOfSpYmNwsDbEpj4YkD2RnveO3UZEqS/lQUlso29Rgmd7ez0L4SZh3Z M1OUB4POLJ2Z/FKVgM84h4oQwqDjylVlJvNTCGAcAHrPMlGO4bN8HDj7zvrE127IIL6L IWtIQWvZbTlRaJcWzX9AZlDyAPdCdRXJKrC8lhuvR2DwfAQhT6MqZqWnO9ZhpGrPTBZh /DrhFyyDRyLBu+V/Sl5+/heE3LHNNjswkaT6B/NGM7N4pUH2GNqdZZ7p2OMDBAgz9Z5o fEsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706105714; x=1706710514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kXWpKvuuFDRe0zzHcqHQWgdjThR4TPIPgqd6iq0g85c=; b=u6dXnLftXVDYMkBOsBxNMCOZXg+8yoUUlNJoED4evVpLcgDbACSEKCDZdi81vMsb3v 81w7ZNwegqhT8Z+rfinZPNHMiXmnQmym0cwwD969FKBh+Zqmd6DZ2dAFzIUqIQHCc/fS OjXcoEgnpM9WWjNKdnyW6ahLTe+3IgIAow9o+awZtCqT7FsFiIXHUmJaVmP5tcB8kUY0 AD/phsEDdPLUE8TlPBSGRZSlrh+vFHvpWMGdWWGp5gHn8f5BN/0c4YoRx519BCc2IfpC REIF/TDhqdXeyxzOBbte7IFBknqiiDsooIrv/qZ94lSyHq82a7DoIt/XhtobGHVKBXQI xfWg== X-Gm-Message-State: AOJu0Yz8xssWj9IcCO1Z79brDMB/ZdHyfpvRsQknqZYar1AM7giRN8sN k/ceLBqrWukrJcM0bL5Cev7d8kiiqJ0rQ/8K9NaUMrIFfwRFwFddZuGHUJjgRL0= X-Received: by 2002:a05:6512:2210:b0:50e:74ea:525c with SMTP id h16-20020a056512221000b0050e74ea525cmr3950398lfu.3.1706105713953; Wed, 24 Jan 2024 06:15:13 -0800 (PST) Received: from ttritton.c.googlers.com.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id vu3-20020a170907a64300b00a2d7f63dd71sm12399097ejc.29.2024.01.24.06.15.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 06:15:13 -0800 (PST) From: Terry Tritton <terry.tritton@linaro.org> To: keescook@chromium.org, luto@amacapital.net, wad@chromium.org, shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, peter.griffin@linaro.org, kernel-team@android.com, bettyzhou@google.com, Terry Tritton <terry.tritton@linaro.org> Subject: [PATCH 1/3] selftests/seccomp: Handle EINVAL on unshare(CLONE_NEWPID) Date: Wed, 24 Jan 2024 14:13:55 +0000 Message-ID: <20240124141357.1243457-2-terry.tritton@linaro.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240124141357.1243457-1-terry.tritton@linaro.org> References: <20240124141357.1243457-1-terry.tritton@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788981970800799292 X-GMAIL-MSGID: 1788981970800799292 |
Series |
selftests/seccomp seccomp_bpf test fixes
|
|
Commit Message
Terry Tritton
Jan. 24, 2024, 2:13 p.m. UTC
unshare(CLONE_NEWPID) can return EINVAL if the kernel does not have the
CONFIG_PID_NS option enabled.
Add a check on these calls to skip the test if we receive EINVAL.
Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
---
tools/testing/selftests/seccomp/seccomp_bpf.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 38f651469968..5e705674b706 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -3709,7 +3709,12 @@ TEST(user_notification_sibling_pid_ns) ASSERT_GE(pid, 0); if (pid == 0) { - ASSERT_EQ(unshare(CLONE_NEWPID), 0); + ASSERT_EQ(unshare(CLONE_NEWPID), 0) { + if (errno == EPERM) + SKIP(return, "CLONE_NEWPID requires CAP_SYS_ADMIN"); + else if (errno == EINVAL) + SKIP(return, "CLONE_NEWPID is invalid (missing CONFIG_PID_NS?)"); + } pid2 = fork(); ASSERT_GE(pid2, 0); @@ -3727,6 +3732,8 @@ TEST(user_notification_sibling_pid_ns) ASSERT_EQ(unshare(CLONE_NEWPID), 0) { if (errno == EPERM) SKIP(return, "CLONE_NEWPID requires CAP_SYS_ADMIN"); + else if (errno == EINVAL) + SKIP(return, "CLONE_NEWPID is invalid (missing CONFIG_PID_NS?)"); } ASSERT_EQ(errno, 0);