linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Dave Hansen <dave.hansen@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
	Ingo Molnar <mingo@kernel.org>,
	Jarkko Sakkinen <jarkko@kernel.org>,
	x86@kernel.org
Subject: Re: [tip: x86/sgx] selftests/sgx: Improve error detection and messages
Date: Fri, 19 Mar 2021 15:58:07 +0100	[thread overview]
Message-ID: <20210319145807.GG6251@zn.tnic> (raw)
In-Reply-To: <161615392429.398.565615269339667317.tip-bot2@tip-bot2>

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?

---
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

  reply	other threads:[~2021-03-19 14:59 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 [this message]
2021-03-19 15:20     ` Jarkko Sakkinen
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=20210319145807.GG6251@zn.tnic \
    --to=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=jarkko@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).