[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eea239f3-720d-0f53-6c8a-85050f44be53@intel.com>
Date: Fri, 19 Mar 2021 08:59:46 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Borislav Petkov <bp@...en8.de>, Jarkko Sakkinen <jarkko@...nel.org>
Cc: Kai Huang <kai.huang@...el.com>, x86@...nel.org,
linux-sgx@...r.kernel.org, dave.hansen@...ux.intel.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/sgx: Avoid returning NULL in __sgx_alloc_epc_page()
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.
Powered by blists - more mailing lists