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]
Date:   Fri, 19 Mar 2021 17:20:04 +0200
From:   Jarkko Sakkinen <jarkko@...nel.org>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Dave Hansen <dave.hansen@...ux.intel.com>,
        linux-kernel@...r.kernel.org, linux-tip-commits@...r.kernel.org,
        Ingo Molnar <mingo@...nel.org>, x86@...nel.org
Subject: Re: [tip: x86/sgx] selftests/sgx: Improve error detection and
 messages

On Fri, Mar 19, 2021 at 03:58:07PM +0100, Borislav Petkov wrote:
> On Fri, Mar 19, 2021 at 11:38:44AM -0000, tip-bot2 for Dave Hansen wrote:
> >  tools/testing/selftests/sgx/load.c | 66 ++++++++++++++++++++++-------
> >  tools/testing/selftests/sgx/main.c |  2 +-
> >  2 files changed, 53 insertions(+), 15 deletions(-)
> 
> Anything against some more tweaks ontop?

Nope :-)

> ---
> diff --git a/tools/testing/selftests/sgx/load.c b/tools/testing/selftests/sgx/load.c
> index 4c149f46d798..f441ac34b4d4 100644
> --- a/tools/testing/selftests/sgx/load.c
> +++ b/tools/testing/selftests/sgx/load.c
> @@ -156,7 +156,7 @@ bool encl_load(const char *path, struct encl *encl)
>  	 * the owner or in the owning group.
>  	 */
>  	if (!(sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
> -		fprintf(stderr, "no execute permissions on device file\n");
> +		fprintf(stderr, "no execute permissions on device file %s\n", device_path);
>  		goto err;
>  	}
>  
> @@ -167,12 +167,15 @@ bool encl_load(const char *path, struct encl *encl)
>  	}
>  	munmap(ptr, PAGE_SIZE);
>  
> +#define ERR_MSG \
> +"mmap() succeeded for PROT_READ, but failed for PROT_EXEC.\n" \
> +" Check that current user has execute permissions on %s and \n" \
> +" that /dev does not have noexec set: mount | grep \"/dev .*noexec\"\n" \
> +" If so, remount it executable: mount -o remount,exec /dev\n\n"
> +
>  	ptr = mmap(NULL, PAGE_SIZE, PROT_EXEC, MAP_SHARED, fd, 0);
>  	if (ptr == (void *)-1) {
> -		perror("ERROR: mmap for exec");
> -		fprintf(stderr, "mmap() succeeded for PROT_READ, but failed for PROT_EXEC\n");
> -		fprintf(stderr, "check that user has execute permissions on %s and\n", device_path);
> -		fprintf(stderr, "that /dev does not have noexec set: 'mount | grep \"/dev .*noexec\"'\n");
> +		fprintf(stderr, ERR_MSG, device_path);
>  		goto err;
>  	}
>  	munmap(ptr, PAGE_SIZE);
> 
> 
> -- 
> Regards/Gruss,
>     Boris.
> 
> https://people.kernel.org/tglx/notes-about-netiquette
> 

Printing device path is a good sanity thing to have, thanks.

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ