public inbox for linux-sgx@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Borislav Petkov <bp@alien8.de>, Jarkko Sakkinen <jarkko@kernel.org>
Cc: Kai Huang <kai.huang@intel.com>,
	x86@kernel.org, linux-sgx@vger.kernel.org,
	dave.hansen@linux.intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/sgx: Avoid returning NULL in __sgx_alloc_epc_page()
Date: Fri, 19 Mar 2021 08:59:46 -0700	[thread overview]
Message-ID: <eea239f3-720d-0f53-6c8a-85050f44be53@intel.com> (raw)
In-Reply-To: <20210319155249.GK6251@zn.tnic>

On 3/19/21 8:52 AM, Borislav Petkov wrote:
> On Fri, Mar 19, 2021 at 05:22:56PM +0200, Jarkko Sakkinen wrote:
>> I did misread it for the first time.
>>
>> So let's sanity: you *are* going to squash the patches together because
>> that way it's factors easier to backport the whole thing?
>>
>> Is this the correct understanding?
> I squashed Kai's fix because I don't want to break people's bisection if
> they land between your patch and his fix. They're already troubled enough
> chasing an issue, don't want to have them get a NULL ptr in sgx land.
> 
> Now, looking at dhansen's fix: what can happen if nid is uninitialized?
> AFAICT, we'll end up in
> 
> static inline int __next_node(int n, const nodemask_t *srcp)
> {
>         return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
> }
> 
> with n uninitialized and depending on its value it'll either return
> MAX_NUMNODES so we'll try to allocate on the first node or try to
> allocate on some other node.
> 
> Now, if you think that that is still problematic enough for enclave
> creation, then I'll fold his patch too.
> 
> So yes, the main reason is usability and not breaking bisection.
> 
> So, what would you prefer?

It's probably best to squash my patch in.  The uninitialized value could
*theoretically* cause the search to start at the wrong node and then end
before every node has been visited.  That could cause premature
allocation failures.

But, I seriously doubt anyone will notice either way.

  reply	other threads:[~2021-03-19 16:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19  4:06 [PATCH] x86/sgx: Avoid returning NULL in __sgx_alloc_epc_page() Kai Huang
2021-03-19  5:42 ` Jarkko Sakkinen
2021-03-19  8:45 ` Borislav Petkov
2021-03-19  9:01   ` Kai Huang
2021-03-19  9:12     ` Kai Huang
2021-03-19 14:50     ` Jarkko Sakkinen
2021-03-19 14:59       ` Borislav Petkov
2021-03-19 15:22         ` Jarkko Sakkinen
2021-03-19 15:52           ` Borislav Petkov
2021-03-19 15:59             ` Dave Hansen [this message]
2021-03-19 16:09               ` Borislav Petkov
2021-03-19 14:49   ` Jarkko Sakkinen

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=eea239f3-720d-0f53-6c8a-85050f44be53@intel.com \
    --to=dave.hansen@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=jarkko@kernel.org \
    --cc=kai.huang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.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