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: <ec648245-c771-4e4a-b355-a86c99ad8143@lucifer.local>
Date: Thu, 15 May 2025 19:41:01 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Zi Yan <ziy@...dia.com>
Cc: Pedro Falcato <pfalcato@...e.de>, Adam Sindelar <adam@...signal.io>,
        linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] selftests/mm: skip uffd tests in madv_guard if uffd
 is not present.

Ah you got to this first :) thanks!

Could you do this with a cover letter though? It's really weird to have 2/2
reply to 1/2, I know sometimes people do that, but it's just odd, and it'd be
good to have an overview, thanks!

On Thu, May 15, 2025 at 02:23:32PM -0400, Zi Yan wrote:
> When userfaultfd is not compiled into kernel, userfaultfd() returns -1,
> causing uffd tests in madv_guard fail. Skip the tests instead.

'madv_guard'? I'd just say the guard_regions.uffd test to fail.

>
> Signed-off-by: Zi Yan <ziy@...dia.com>
> ---
>  tools/testing/selftests/mm/guard-regions.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/guard-regions.c b/tools/testing/selftests/mm/guard-regions.c
> index 0cd9d236649d..93af3d3760f9 100644
> --- a/tools/testing/selftests/mm/guard-regions.c
> +++ b/tools/testing/selftests/mm/guard-regions.c
> @@ -1453,8 +1453,21 @@ TEST_F(guard_regions, uffd)
>
>  	/* Set up uffd. */
>  	uffd = userfaultfd(0);
> -	if (uffd == -1 && errno == EPERM)
> -		ksft_exit_skip("No userfaultfd permissions, try running as root.\n");

Let's just make this all part of the same switch please!

And while I originally used ksft_exit_skip(), I think we can just use the
SKIP(return, ...) form here just fine to keep it consistent.

> +	if (uffd == -1) {
> +		switch (errno) {
> +		case EPERM:
> +			SKIP(return, "No userfaultfd permissions, try running as root.");
> +			break;
> +		case ENOSYS:
> +			SKIP(return, "userfaultfd is not supported/not enabled.");
> +			break;
> +		default:
> +			ksft_exit_fail_msg("userfaultfd failed with %s\n",
> +					   strerror(errno));
> +			break;
> +		}
> +	}
> +
>  	ASSERT_NE(uffd, -1);
>
>  	ASSERT_EQ(ioctl(uffd, UFFDIO_API, &api), 0);
> --
> 2.47.2
>

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ