lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202404261237.C703A7B1F4@keescook>
Date: Fri, 26 Apr 2024 12:38:17 -0700
From: Kees Cook <keescook@...omium.org>
To: Mickaël Salaün <mic@...ikod.net>
Cc: Christian Brauner <brauner@...nel.org>,
	Jakub Kicinski <kuba@...nel.org>, Mark Brown <broonie@...nel.org>,
	Shengyu Li <shengyu.li.evgeny@...il.com>,
	Shuah Khan <shuah@...nel.org>,
	"David S . Miller" <davem@...emloft.net>,
	Günther Noack <gnoack@...gle.com>,
	Will Drewry <wad@...omium.org>,
	kernel test robot <oliver.sang@...el.com>,
	linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v1 2/5] selftests/landlock: Fix FS tests when run on a
 private mount point

On Fri, Apr 26, 2024 at 07:22:49PM +0200, Mickaël Salaün wrote:
> 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 on different Linux distributions,
> with different mount point configurations.

Which distros did what?

> 
> Cc: Günther Noack <gnoack@...gle.com>
> Fixes: 41cca0542d7c ("selftests/harness: Fix TEST_F()'s vfork handling")
> Signed-off-by: Mickaël Salaün <mic@...ikod.net>
> Link: https://lore.kernel.org/r/20240426172252.1862930-3-mic@digikod.net

Reviewed-by: Kees Cook <keescook@...omium.org>

-Kees

> ---
>  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
> 

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ