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] [day] [month] [year] [list]
Message-Id: <20220507142630.56f7ee13658d6fd78cc2d88f@linux-foundation.org>
Date:   Sat, 7 May 2022 14:26:30 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Joel Savitz <jsavitz@...hat.com>
Cc:     linux-kernel@...r.kernel.org, Shuah Khan <shuah@...nel.org>,
        Nico Pache <npache@...hat.com>, linux-mm@...ck.org,
        linux-kselftest@...r.kernel.org,
        Sidhartha Kumar <sidhartha.kumar@...cle.com>
Subject: Re: [PATCH] selftests: clarify common error when running gup_test

On Mon,  2 May 2022 18:49:42 -0400 Joel Savitz <jsavitz@...hat.com> wrote:

> 
> The gup_test binary will fail showing only the output of perror("open") in
> the case that /sys/kernel/debug/gup_test is not found. This will almost
> always be due to CONFIG_GUP_TEST not being set, which enables
> compilation of a kernel that provides this file.
> 
> Add a short error message to clarify this failure and point the user to
> the solution.
> 
> --- a/tools/testing/selftests/vm/gup_test.c
> +++ b/tools/testing/selftests/vm/gup_test.c
> @@ -18,6 +18,8 @@
>  #define FOLL_WRITE	0x01	/* check pte is writable */
>  #define FOLL_TOUCH	0x02	/* mark page accessed */
>  
> +#define GUP_TEST_FILE "/sys/kernel/debug/gup_test"
> +
>  static unsigned long cmd = GUP_FAST_BENCHMARK;
>  static int gup_fd, repeats = 1;
>  static unsigned long size = 128 * MB;
> @@ -204,9 +206,11 @@ int main(int argc, char **argv)
>  	if (write)
>  		gup.gup_flags |= FOLL_WRITE;
>  
> -	gup_fd = open("/sys/kernel/debug/gup_test", O_RDWR);
> +	gup_fd = open(GUP_TEST_FILE, O_RDWR);
>  	if (gup_fd == -1) {
>  		perror("open");
> +		fprintf(stderr, "Unable to open %s: check that CONFIG_GUP_TEST=y\n",
> +				GUP_TEST_FILE);
>  		exit(1);
>  	}
>  

Sidhartha did a similar thing:
https://lkml.kernel.org/r/20220405214809.3351223-1-sidhartha.kumar@oracle.com

(Which is now in mm-stable at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm)

Although in retroreview, it should have printed that to stderr rather
than to stdout.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ