From: Jarkko Sakkinen <jarkko@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
Ingo Molnar <mingo@kernel.org>,
x86@kernel.org
Subject: Re: [tip: x86/sgx] selftests/sgx: Improve error detection and messages
Date: Fri, 19 Mar 2021 17:20:04 +0200 [thread overview]
Message-ID: <YFTBJDlyvyUr2mfh@kernel.org> (raw)
In-Reply-To: <20210319145807.GG6251@zn.tnic>
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
next prev parent reply other threads:[~2021-03-19 15:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 19:43 [PATCH] selftests/sgx: improve error detection and messages Dave Hansen
2021-03-19 5:37 ` Jarkko Sakkinen
2021-03-19 11:38 ` [tip: x86/sgx] selftests/sgx: Improve " tip-bot2 for Dave Hansen
2021-03-19 14:58 ` Borislav Petkov
2021-03-19 15:20 ` Jarkko Sakkinen [this message]
2021-03-19 15:33 ` Dave Hansen
2021-03-19 18:45 ` tip-bot2 for Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YFTBJDlyvyUr2mfh@kernel.org \
--to=jarkko@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox