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: <1c8674a0-d220-4349-88ea-780f0fed8545@linuxfoundation.org>
Date: Thu, 24 Oct 2024 08:26:59 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: zhouyuhang <zhouyuhang1010@....com>, brauner@...nel.org,
 sforshee@...nel.org, shuah@...nel.org
Cc: linux-fsdevel@...r.kernel.org, linux-kselftest@...r.kernel.org,
 linux-kernel@...r.kernel.org, zhouyuhang <zhouyuhang@...inos.cn>,
 Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] selftests/mount_setattr: fix idmap_mount_tree_invalid
 failed to run

On 10/24/24 03:50, zhouyuhang wrote:
> From: zhouyuhang <zhouyuhang@...inos.cn>
> 
> Test case idmap_mount_tree_invalid failed to run on the newer kernel
> with the following output:
> 
>   #  RUN           mount_setattr_idmapped.idmap_mount_tree_invalid ...
>   # mount_setattr_test.c:1428:idmap_mount_tree_invalid:Expected sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr,  sizeof(attr)) (0) ! = 0 (0)
>   # idmap_mount_tree_invalid: Test terminated by assertion
> 
> This is because tmpfs is mounted at "/mnt/A", and tmpfs already
> contains the flag FS_ALLOW_IDMAP after the commit 7a80e5b8c6fa ("shmem:
> support idmapped mounts for tmpfs"). So calling sys_mount_setattr here
> returns 0 instead of -EINVAL as expected.
> 
> Ramfs is mounted at "/mnt/B" and does not support idmap mounts.
> So we can use "/mnt/B" instead of "/mnt/A" to make the test run
> successfully with the following output:
> 
>   # Starting 1 tests from 1 test cases.
>   #  RUN           mount_setattr_idmapped.idmap_mount_tree_invalid ...
>   #            OK  mount_setattr_idmapped.idmap_mount_tree_invalid
>   ok 1 mount_setattr_idmapped.idmap_mount_tree_invalid
>   # PASSED: 1 / 1 tests passed.
> 

Sounds like this code is testing this very condition passing
in invalid mount to see what happens. If that is the intent
this patch is incorrect.

> Signed-off-by: zhouyuhang <zhouyuhang@...inos.cn>
> ---
>   tools/testing/selftests/mount_setattr/mount_setattr_test.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/mount_setattr/mount_setattr_test.c b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> index c6a8c732b802..54552c19bc24 100644
> --- a/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> +++ b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
> @@ -1414,7 +1414,7 @@ TEST_F(mount_setattr_idmapped, idmap_mount_tree_invalid)
>   	ASSERT_EQ(expected_uid_gid(-EBADF, "/tmp/B/b", 0, 0, 0), 0);
>   	ASSERT_EQ(expected_uid_gid(-EBADF, "/tmp/B/BB/b", 0, 0, 0), 0);
>   
> -	open_tree_fd = sys_open_tree(-EBADF, "/mnt/A",
> +	open_tree_fd = sys_open_tree(-EBADF, "/mnt/B",
>   				     AT_RECURSIVE |
>   				     AT_EMPTY_PATH |
>   				     AT_NO_AUTOMOUNT |

thanks,
-- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ