Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1171151lqo; Sat, 11 May 2024 10:16:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWRpoPKIZ7Ftmdbkar0tKgNriUvaFAoJDOYuyuHUAfzjjkvXc/yRB6m/MmDQVyLagqqUPu88oUL8ensfl8ZTlFxS2w6AgCWciU2aoh7cA== X-Google-Smtp-Source: AGHT+IE0fBNRvbuiPElxwkiiDyiUXQ7GawesZNyCD5lQyOW+3qNmAPIMW1q/JAUbW+PzZ40AVWsw X-Received: by 2002:a17:906:b1d3:b0:a59:9a68:7327 with SMTP id a640c23a62f3a-a5a2d66aa45mr391121566b.54.1715447766779; Sat, 11 May 2024 10:16:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715447766; cv=pass; d=google.com; s=arc-20160816; b=yu8f23R5nPiq1AdAGq39BI6IVslDIVEhZNCcbEbSaNHpUeN39dyIZerFRMQDEbVWCC Z5CloNiK4oN8JIXBMMGXTS7lnCDVim2JQzVqAbgRJZ1375CGYV/coA9WyzWkcNMtuXZe Vihtb3HTrY0M8SNGO7uftKCTLyh7E55NWA6rvJXkyK8eu2TtDkuUy2GVcItB8xASzVVT R6Ofz7Qi2pnYWvwAmLu7OaIQey2lgZsYVa+4aQilsicuDhyROexVHYclCSDyKNF2FB7b LYuS9R6B0lT7MWdeMagRVec1jq8wbgchDdGxi8/fIy5XejN0NOsSFa/ficp5z/2OQ3kQ JPqg== 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=BOAMdKa6zMCZ8yXBmY/WMF8aDinkuEUhN8IHqnGG5tA=; fh=h2xHIZSGiUwuZyladnT9pE6uX086qy42ByZk41PjzSs=; b=Xl+oEXmNHe7Woit3JwtaZLJuvEl1l4pMSYLKCT7VWXI22vnoXzN+A2iFG/osDCLjUy Av8VYV/mOV9BHLAlWu6bLCSx02UvMv3UUd+chHw7CiXz2g04oTUG0ryd6kUGUh38mPJZ jLlDxshNXeBRk6kLR5b8K89EnHX8/qTxXZvAOoQj+ilUJ45lVJa8GuugX3SbITMvjbjQ qmDoObgauCHsf8tVsUIHAvrVsrMsVW4zAsukvYomPfVUSY/F6I4p0YDJXXmUKJKgv3n8 3X6tx/euv1xkTYSOXtEigZqvwbjkfHbXWZTOmLsRVqo/IeqU1D/lAw6iJQbOZbPr/6le FctQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=gfqOwzmW; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-176657-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176657-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba5651si328881266b.601.2024.05.11.10.16.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 10:16:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176657-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=gfqOwzmW; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-176657-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176657-linux.lists.archive=gmail.com@vger.kernel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 833C11F21B7F for ; Sat, 11 May 2024 17:16:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 378A13A8D8; Sat, 11 May 2024 17:15:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="gfqOwzmW" Received: from smtp-42ae.mail.infomaniak.ch (smtp-42ae.mail.infomaniak.ch [84.16.66.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C771D1BC4F for ; Sat, 11 May 2024 17:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715447704; cv=none; b=s75Pdgvv7wqZ3ox10ooy8lp4WpqrASuLC3Ax6BA1XYcOSMT95IXVMZ4rh+JIcUKZ6Prkg3b5C6Y9i4uE4bQD2jgOdKs54EypnGZ80wspjfD9Dm4UBPwrRWwPdrR3MLf6Uw9P99HIBp5rVRFYZRXbiIfqm0QKCTBYZeeQOm4MyoU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715447704; c=relaxed/simple; bh=7YexxkTj1uuMmulLuHFcKF1u4yf9zWrpmFdXbDjUUew=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hkPHX/p1NLrxHDC++c/OjmoD+YAcYobtm+zN1Lxfew2SwALmD7/2ri3vj2+fL28XtfjtHFZnC6cOs0L0d94aU6lhRgl8CfjciTs9eBBIhEnEBhaQxfVYSlVYs1MiOmYqY8Y9g9V2R3g2N25k1p/8OmjoXHgjj0imexRkolEmjRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=gfqOwzmW; arc=none smtp.client-ip=84.16.66.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net Received: from smtp-3-0000.mail.infomaniak.ch (smtp-3-0000.mail.infomaniak.ch [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4VcC6j4l9Nzlhq; Sat, 11 May 2024 19:14:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digikod.net; s=20191114; t=1715447693; bh=BOAMdKa6zMCZ8yXBmY/WMF8aDinkuEUhN8IHqnGG5tA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gfqOwzmWgq26VJdO5r+2pUX1fnIVDnjds6dUYGUuKCRG05yD0VhlhJWYHajvnVU7J UiCgAZnpi6SjAUM/8yTKx64V3LSKJDrhZoia1tU3/cSOSuVLU0YVJg13Mx5SFGODTk uoFFPa/QPlodaf3CfDHfqYRyLzclXop5fgct9+Ks= Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4VcC6h5cQRz7lK; Sat, 11 May 2024 19:14:52 +0200 (CEST) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: Christian Brauner , Greg Kroah-Hartman , Jakub Kicinski , Kees Cook , Linus Torvalds , Mark Brown , Sasha Levin , Sean Christopherson , Shengyu Li , Shuah Khan , Shuah Khan Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Bagas Sanjaya , Brendan Higgins , David Gow , "David S . Miller" , Florian Fainelli , =?UTF-8?q?G=C3=BCnther=20Noack?= , Jon Hunter , Ron Economos , Ronald Warsow , Stephen Rothwell , Will Drewry , kernel test robot , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v7 02/10] selftests/landlock: Fix FS tests when run on a private mount point Date: Sat, 11 May 2024 19:14:37 +0200 Message-ID: <20240511171445.904356-3-mic@digikod.net> In-Reply-To: <20240511171445.904356-1-mic@digikod.net> References: <20240511171445.904356-1-mic@digikod.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Infomaniak-Routing: alpha According to the test environment, the mount point of the test's working directory may be shared or not, which changes the visibility of the nested "tmp" mount point for the test's parent process calling umount("tmp"). This was spotted while running tests in containers [1], where mount points are private. Cc: Günther Noack Cc: Shuah Khan Link: https://github.com/landlock-lsm/landlock-test-tools/pull/4 [1] Fixes: 41cca0542d7c ("selftests/harness: Fix TEST_F()'s vfork handling") Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240511171445.904356-3-mic@digikod.net --- Changes since v1: * Update commit description. --- tools/testing/selftests/landlock/fs_test.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c index 9a6036fbf289..46b9effd53e4 100644 --- a/tools/testing/selftests/landlock/fs_test.c +++ b/tools/testing/selftests/landlock/fs_test.c @@ -293,7 +293,15 @@ static void prepare_layout(struct __test_metadata *const _metadata) static void cleanup_layout(struct __test_metadata *const _metadata) { set_cap(_metadata, CAP_SYS_ADMIN); - EXPECT_EQ(0, umount(TMP_DIR)); + if (umount(TMP_DIR)) { + /* + * According to the test environment, the mount point of the + * current directory may be shared or not, which changes the + * visibility of the nested TMP_DIR mount point for the test's + * parent process doing this cleanup. + */ + ASSERT_EQ(EINVAL, errno); + } clear_cap(_metadata, CAP_SYS_ADMIN); EXPECT_EQ(0, remove_path(TMP_DIR)); } -- 2.45.0