From: Shuah Khan <skhan@linuxfoundation.org>
To: Reinette Chatre <reinette.chatre@intel.com>,
jarkko@kernel.org, dave.hansen@linux.intel.com,
linux-sgx@vger.kernel.org, shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH V2 1/4] selftests/sgx: Fix NULL-pointer-dereference upon early test failure
Date: Wed, 2 Feb 2022 11:59:26 -0700 [thread overview]
Message-ID: <e188c62e-f75e-2bec-b544-76063098611d@linuxfoundation.org> (raw)
In-Reply-To: <e6d3c912-5382-bab5-3eb8-40a9d6b8a293@intel.com>
On 2/2/22 11:52 AM, Reinette Chatre wrote:
> Hi Shuah and Dave,
>
> On 2/2/2022 10:01 AM, Shuah Khan wrote:
>> On 2/1/22 3:47 PM, Reinette Chatre wrote:
>>> == Background ==
>>>
>>> The SGX selftests track parts of the enclave binaries in an array:
>>> encl->segment_tbl[]. That array is dynamically allocated early
>>> (but not first) in the test's lifetime. The array is referenced
>>> at the end of the test in encl_delete().
>>>
>>> == Problem ==
>>>
>>> encl->segment_tbl[] can be NULL if the test fails before its
>>> allocation. That leads to a NULL-pointer-dereference in encl_delete().
>>> This is triggered during early failures of the selftest like if the
>>> enclave binary ("test_encl.elf") is deleted.
>>>
>>> == Solution ==
>>>
>>
>> "==" usage looks a bit odd in the change log.
>
> This is a new trend in the x86/ area and I was asked to modify the commit
> message to follow suit in:
> https://lore.kernel.org/linux-sgx/df2248d2-eb61-22d6-3a51-d8091f9eaad6@intel.com/
>
>
Good to know. Thanks for the link.
>>
>> The rest looks good to me. I can take this through kselftest tree, if not,
>>
>> Acked-by: Shuah Khan <skhan@linuxfoundation.org>
>>
>
> Thank you very much for reviewing the changes.
>
> None of the patches in this series have external dependencies (all patches
> in the "Fixes:" can be found in v5.17-rc1) but my understanding is that Dave
> (for now) prefers to take them via the tip.git tree. This is because there
> are more SGX features and tests for those features [1] in flight to the
> SGX area and at least for now it would make things easier if the changes to
> the SGX selftests are contained in the same tree.
>
> Dave: please do correct me if I am wrong.
>
Sounds good to me.
thanks,
-- Shuah
next prev parent reply other threads:[~2022-02-02 18:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-01 22:47 [PATCH V2 0/4] selftests/sgx: Early enclave loading error path fixes Reinette Chatre
2022-02-01 22:47 ` [PATCH V2 1/4] selftests/sgx: Fix NULL-pointer-dereference upon early test failure Reinette Chatre
2022-02-02 18:01 ` Shuah Khan
2022-02-02 18:52 ` Reinette Chatre
2022-02-02 18:59 ` Shuah Khan [this message]
2022-02-20 20:02 ` Jarkko Sakkinen
2022-02-22 20:05 ` Reinette Chatre
2022-02-23 15:43 ` Jarkko Sakkinen
2022-02-01 22:47 ` [PATCH V2 2/4] selftests/sgx: Do not attempt enclave build without valid enclave Reinette Chatre
2022-02-02 18:03 ` Shuah Khan
2022-02-20 19:04 ` Jarkko Sakkinen
2022-02-01 22:47 ` [PATCH V2 3/4] selftests/sgx: Ensure enclave data available during debug print Reinette Chatre
2022-02-02 18:04 ` Shuah Khan
2022-02-20 19:04 ` Jarkko Sakkinen
2022-02-01 22:47 ` [PATCH V2 4/4] selftests/sgx: Remove extra newlines in test output Reinette Chatre
2022-02-02 18:04 ` Shuah Khan
2022-02-20 19:05 ` Jarkko Sakkinen
2022-02-02 18:06 ` [PATCH V2 0/4] selftests/sgx: Early enclave loading error path fixes 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=e188c62e-f75e-2bec-b544-76063098611d@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=jarkko@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=shuah@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).