Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1695367lqm; Fri, 3 May 2024 03:59:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXRkvM9aCJypSTb8f3mJUZaw73Yc8m1iYe2FsPV/8CJc5Yo07NGs57GX1ZzLqH5HzeTcZJw+Gf+7EgStC3N9F3KyFlPGjFTxoyVfVEd0Q== X-Google-Smtp-Source: AGHT+IE+bFnvLmQs97crndnfwBShIsbB0v54lnHndoBIS99qmSdyQnK52/hmVLNhTBc1WwPaS9TK X-Received: by 2002:a05:620a:2907:b0:790:a937:cb10 with SMTP id m7-20020a05620a290700b00790a937cb10mr2724363qkp.7.1714733953631; Fri, 03 May 2024 03:59:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714733953; cv=pass; d=google.com; s=arc-20160816; b=EHUaMvSkGm65bx3W/kueCxVHVKoPkfclxgNYxdALu+LkttvEGPH6V213y3xQWDp/Z8 WNmnosXg0NrXWxd6R7PmFBxwcZGa0ILTD2M9wKB0os9TfCShL128OcYpnUl5r7o/ZO5g 0Me5W7Bx2hgOvOatmk3rfptq/qV4Soe79l1Dpq9G24r9GQUT5xbvuSiolagLe1wnpxS5 MxU24I20e42O9aDvlKbT7ch/nFgZwxq+dAkMlqFViUHOX71QWm/6gNTznY401kR6nt/5 m/7ltqCFRI2gfzqwjIrJPeg13dQWAwyfk4QBej0xoVEljoDJ792hF0ppUUDeJTcvC4Ky P1jw== 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=9SQ5hhHTD+8pwgq/PR+ylAPhTIh1erzYkACWKyTyY8E=; fh=pFOGWyS68KwrsEZD3Ll2e7y6RwSNe0VchkTs/n9iysY=; b=ZO4sgoGn2oDYHHs++XVkZqQpqbxsFUZaoWhbAfhTjZ2J8bBeOKISBtBHd7qez1Xkul x/TbfjBnwCon41heOcfL7KfS9tdaSB+Qcwb1QefdiOW2stIwJqPhi+yHda7sFysu6I9n eklfanWb+3+P9llCK/fl4D/oXh80tBhVe0NqMFEyGhi/AzM2jnJsLTay4OdVyfCNKm2s xtwMFoAfKtzgQdvSvG8Yk2afYkUVv19qB7v716Bl0z9Qthj1Yg0r9pVQc1N3PUY4sIoq ztMEiNlkdPTS+mOO3D0dbCKWhSyTnkKOw+aWIOrVWh1CijhjibbU5LywVnmmgPYa7SzD ePMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=jl4ORSgI; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-167550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167550-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id wh2-20020a05620a56c200b0078d77f93e76si2849157qkn.348.2024.05.03.03.59.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 03:59:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=jl4ORSgI; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-167550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167550-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5CBDF1C20A1E for ; Fri, 3 May 2024 10:59:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EA38152513; Fri, 3 May 2024 10:58:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="jl4ORSgI" Received: from smtp-190c.mail.infomaniak.ch (smtp-190c.mail.infomaniak.ch [185.125.25.12]) (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 6A2BE152160 for ; Fri, 3 May 2024 10:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.25.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714733918; cv=none; b=t3RzextZl44O8HtbUJCcR4EXavb09VFQT9mZ4I2Cz7KwgvDkhM64KzIA41hV1ASoAHgdsLSeYVHSh4bU/oXAz/pxBGqR8PdMgYYcvb826K8HGxXoAaJ6nCKMu2o+iuPL0pijWpIynD1+wA4lpOLF2rdRqz/IxM62IkUJpqFWAMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714733918; c=relaxed/simple; bh=YYgJGzqiQDWk2U/jpEaS0iynxyFT/ValkUI+CWeo/nA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oEphO83Fl/3QKxu8dewLKCuMYn94qPxkJzEFXurTl48X47tW359GdI4AOUimfCIx+pcf5zr4BpQFPsWo4kCfrZOq4XH6iys1jMg1I+q+TQAOQcGkrwRMNMmx3nQmBY5Hz1itfVbHAc2L4NEtYZPAOXkn9v6+mME53f/VeRjDOV4= 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=jl4ORSgI; arc=none smtp.client-ip=185.125.25.12 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-4-0000.mail.infomaniak.ch (smtp-4-0000.mail.infomaniak.ch [10.7.10.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4VW7891MNDzFCh; Fri, 3 May 2024 12:58:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1714733913; bh=YYgJGzqiQDWk2U/jpEaS0iynxyFT/ValkUI+CWeo/nA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jl4ORSgInVzriZlyH8Fh1bZt7ELq+4U1b5bQnofqUODUhK7HZsjSBaqC6uKAXU1mk LfXwcAvdjTv/k0iDazNVeEIKEAbrvGk+jsXNa5b2UtxIxtcEeWmvQ33q6vlzlZ2lTv ZJTKtV15YMGTt/Bdgw1F4RLtoloQlit1UTh/KRhU= Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4VW7884rhrzRXm; Fri, 3 May 2024 12:58:32 +0200 (CEST) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: Christian Brauner , Jakub Kicinski , Kees Cook , Mark Brown , Sean Christopherson , Shengyu Li , Shuah Khan Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , "David S . Miller" , =?UTF-8?q?G=C3=BCnther=20Noack?= , Will Drewry , kernel test robot , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, Shuah Khan Subject: [PATCH v5 02/10] selftests/landlock: Fix FS tests when run on a private mount point Date: Fri, 3 May 2024 12:58:12 +0200 Message-ID: <20240503105820.300927-3-mic@digikod.net> In-Reply-To: <20240503105820.300927-1-mic@digikod.net> References: <20240503105820.300927-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/20240503105820.300927-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