linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org,
	linux-sgx@vger.kernel.org,
	Reinette Chatre <reinette.chatre@intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 3/5] selftests/sgx: Dump enclave memory map
Date: Tue, 15 Jun 2021 16:07:40 +0300	[thread overview]
Message-ID: <20210615130740.3axsxi2m2ozqfofm@kernel.org> (raw)
In-Reply-To: <c18409da-dd2b-c813-d7dd-bad81db102bd@linuxfoundation.org>

On Mon, Jun 14, 2021 at 10:45:43AM -0600, Shuah Khan wrote:
> On 6/11/21 10:27 PM, Jarkko Sakkinen wrote:
> > On Fri, Jun 11, 2021 at 04:45:19PM -0600, Shuah Khan wrote:
> > > On 6/10/21 2:30 AM, Jarkko Sakkinen wrote:
> > > > Often, it's useful to check whether /proc/self/maps looks sane when
> > > > dealing with memory mapped objects, especially when they are JIT'ish
> > > > dynamically constructed objects. Therefore, dump "/dev/sgx_enclave"
> > > > matching lines from the memory map in FIXTURE_SETUP().
> > > > 
> > > > Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
> > > > ---
> > > >    tools/testing/selftests/sgx/main.c | 14 ++++++++++++++
> > > >    1 file changed, 14 insertions(+)
> > > > 
> > > > diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c
> > > > index 6da19b6bf287..14030f8b85ff 100644
> > > > --- a/tools/testing/selftests/sgx/main.c
> > > > +++ b/tools/testing/selftests/sgx/main.c
> > > > @@ -117,6 +117,8 @@ FIXTURE_SETUP(enclave)
> > > >    	Elf64_Sym *sgx_enter_enclave_sym = NULL;
> > > >    	struct vdso_symtab symtab;
> > > >    	struct encl_segment *seg;
> > > > +	char maps_line[256];
> > > > +	FILE *maps_file;
> > > >    	unsigned int i;
> > > >    	void *addr;
> > > > @@ -167,6 +169,18 @@ FIXTURE_SETUP(enclave)
> > > >    	memset(&self->run, 0, sizeof(self->run));
> > > >    	self->run.tcs = self->encl.encl_base;
> > > > +	maps_file = fopen("/proc/self/maps", "r");
> > > 
> > > I almost applied these. Does this require root access, if so,
> > > please add logic to skip the test if non-root user runs it.
> > > 
> > > Same comments for all other paths that might require root access.
> > 
> > As Dave stated, it does not. A process can inspect its own state
> > through /proc/self path. E.g. Chrome web browser uses /proc/self/exe
> > to initialize multiple instances of itself for browser tabs...
> > 
> 
> Ah yes. I missed the self part. Thanks for clarifying.
> 
> > As far as other things go, this patch set does not bind to any other
> > new OS resources.
> > 
> 
> Thank you. I will apply these for 5.14-rc1.

Thank you!

> thanks,
> -- Shuah

/Jarkko

  reply	other threads:[~2021-06-15 13:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  8:30 [PATCH v8 1/5] selftests/sgx: Rename 'eenter' and 'sgx_call_vdso' Jarkko Sakkinen
2021-06-10  8:30 ` [PATCH v8 2/5] selftests/sgx: Migrate to kselftest harness Jarkko Sakkinen
2021-06-10  8:30 ` [PATCH v8 3/5] selftests/sgx: Dump enclave memory map Jarkko Sakkinen
2021-06-11 22:45   ` Shuah Khan
2021-06-12  0:34     ` Dave Hansen
2021-06-12  4:27     ` Jarkko Sakkinen
2021-06-14 16:45       ` Shuah Khan
2021-06-15 13:07         ` Jarkko Sakkinen [this message]
2021-06-10  8:30 ` [PATCH v8 4/5] selftests/sgx: Add EXPECT_EEXIT() macro Jarkko Sakkinen
2021-06-10  8:30 ` [PATCH v8 5/5] selftests/sgx: Refine the test enclave to have storage Jarkko Sakkinen
2021-06-14 20:16   ` Shuah Khan
2021-06-15 13:13     ` Jarkko Sakkinen
2021-06-15 13:15       ` Jarkko Sakkinen
2021-06-15 21:55         ` Shuah Khan
2021-06-18  9:07           ` Jarkko Sakkinen
2021-06-10 15:45 ` [PATCH v8 1/5] selftests/sgx: Rename 'eenter' and 'sgx_call_vdso' Dave Hansen
2021-06-11 17:35   ` Shuah Khan
2021-06-11 22:47     ` Shuah Khan

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=20210615130740.3axsxi2m2ozqfofm@kernel.org \
    --to=jarkko@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.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).