Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1374419lqa; Mon, 29 Apr 2024 06:59:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVhP0D6tTYWDw4hb3BvCZrkvcMqclg0TF7jptgDQWd5kP4m4uOQWAgkbbe6F8CH1IjDIBJrqR/gshmCa92f86Ii0uoOloV6mbgLiNidHg== X-Google-Smtp-Source: AGHT+IFjKb7YG1mcQbFQonsem+vXOADr9gUoy8qZKz962Mc+QW3Mo07JoTuohxvcQZJQ8ZqoOatn X-Received: by 2002:a17:902:d2c8:b0:1e4:c75e:aae2 with SMTP id n8-20020a170902d2c800b001e4c75eaae2mr13855095plc.59.1714399199122; Mon, 29 Apr 2024 06:59:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714399199; cv=pass; d=google.com; s=arc-20160816; b=ZIVs7kFIkqt7uWxpJkRAOk0au+uyGN4Vbtkwo9ygmvRW84GMW3JFgXcgZeavHMueDN SDJ9vJ2Zu2505kqyTHoWgWuyL2VN/RaeJd7aViFx37GCP9ks79tgHUe41Uhoazjxv0fZ migKvV++IYMQi3R8M+2MmTvkty8ezBd7QyzFmC0G4BhlP+YDwQBIMpdiEd27HFbZar9R 7WQSxGdyl9xX9YpA3NshHM/4eD0piRk+vqDpXs0EPTYoHbj3vw/iO9TM7EwzrCvYk9eL bfYZm0/QVIoSJTZqXVy3cxu9/+ykR6fHl6dw60BikbOPyy7YSzF0o+2dG8+w/ALBMyaL jHfA== 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=zIC0mOZcP3Iob5VwrppsV1etjjUaZz8zsVjmpQzIJgs=; fh=T/ngxZ/rchirObc+ozpAMGxUCKvTk1uHXxRS2gfk1OI=; b=QN9nI2onOF/BTbEq/UQbanEr53tHLNfyvkTs7PK7u3Us9tY9izD10+tPXX+F4Tw3lP /LIpOQKJgy0LJUUuxr2w4+kCReqQBrkVH9SLuAWo5lb5UOoKXDnXfqg1O6E7gNskopZy YwsTzUM/lHjTcZLvfKL8O4WX+9p2116iO1YqeYP52Erdxspa6CT7oHsT5YjGdrfwlC0g 2R6K+FcZA0kC6CRbQkqDfe6g5Jm+AcYvgJbxp036qzOmzpGwZYXKK65C5DQBhKfP6Tbk VIxhnwAlyoIv+dQpctk8tNRiTXlcsWWjoJ5QsVI1JyLnw+feVCy1Hfufts05iJKRhJIR cc+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=ezLsVoiC; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-162332-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162332-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k5-20020a170902ce0500b001e9043deab4si17371959plg.611.2024.04.29.06.59.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 06:59:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162332-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=ezLsVoiC; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-162332-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162332-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5E4CFB2D49E for ; Mon, 29 Apr 2024 13:10:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42FDA74BE2; Mon, 29 Apr 2024 13:09:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="ezLsVoiC" Received: from smtp-42ad.mail.infomaniak.ch (smtp-42ad.mail.infomaniak.ch [84.16.66.173]) (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 C75BE54900 for ; Mon, 29 Apr 2024 13:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714396190; cv=none; b=LkJZXDFYErZXw/JLMkNW2yR8es8joJ7oAU+GHtkf/4miFxH4WHXNeIeHj83qdZZsM2IrFJ/1uJmyN/F7CthPqhOaDs7N0cbjHk2++iTbbDVMhLfsqYLUkR/uKm4lFudkI9MKIZ2ybVer7CH4pd7J0vaC1Vx6FDYnzCKb1AAaXtE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714396190; c=relaxed/simple; bh=IpmTWCvbM5Y1BZCTiLdiFP10tZDAQxPRcR3dUY7GJf8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TVBJAzXuE77PoP5WPZE17MMMmu1X0H45HpBLzhMPKbp/w91tsr+TelGjenGrBqt57FKBbUNG+hoSCJ5XgFDtnhArTYywoZn28casYbDX33Rjoqx0tLX7xPsp5xopseJ2wdm+eWJuXMBD7euAbqTCioHuhsYu2Z4n9q5fyf1ESxU= 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=ezLsVoiC; arc=none smtp.client-ip=84.16.66.173 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-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4VSkFJ1jbczDkv; Mon, 29 Apr 2024 15:09:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1714396179; bh=IpmTWCvbM5Y1BZCTiLdiFP10tZDAQxPRcR3dUY7GJf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ezLsVoiCFzgvsCgCrNXZ8hf/DCYlSzatU9p4feD05MUOMMS8F4/1lf64/SPzedaHc UNYNKmbodTv+L26KKSM3epkhgPsdng4AlsGCF2Sw7vn9hiNeihS6pHER5wWCXzFSbs HB5BF0JG3Yt1FKQe6MG0ZWeFDgP2EZWLpZM7QaOk= Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4VSkFH3GSvzLbZ; Mon, 29 Apr 2024 15:09:39 +0200 (CEST) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: Christian Brauner , Jakub Kicinski , Kees Cook , Mark Brown , 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 , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Shuah Khan Subject: [PATCH v2 2/9] selftests/landlock: Fix FS tests when run on a private mount point Date: Mon, 29 Apr 2024 15:09:24 +0200 Message-ID: <20240429130931.2394118-3-mic@digikod.net> In-Reply-To: <20240429130931.2394118-1-mic@digikod.net> References: <20240429130931.2394118-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/20240429130931.2394118-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.44.0