lkml.org 
[lkml]   [2022]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] x86/sgx: Do not consider unsanitized pages an error
On Thu, Aug 25, 2022 at 11:51:18AM -0700, Dave Hansen wrote:
> On 8/25/22 01:08, Jarkko Sakkinen wrote:
> > + /* Can happen, when the initialization is retracted: */
> > + if (verbose && dirty_count > 0)
> > + pr_info("%d unsanitized pages\n", dirty_count);
> > }
> >
> > static bool sgx_reclaimer_age(struct sgx_epc_page *epc_page)
> > @@ -394,11 +403,8 @@ static int ksgxd(void *p)
> > * Sanitize pages in order to recover from kexec(). The 2nd pass is
> > * required for SECS pages, whose child pages blocked EREMOVE.
> > */
> > - __sgx_sanitize_pages(&sgx_dirty_page_list);
> > - __sgx_sanitize_pages(&sgx_dirty_page_list);
> > -
> > - /* sanity check: */
> > - WARN_ON(!list_empty(&sgx_dirty_page_list));
> > + __sgx_sanitize_pages(&sgx_dirty_page_list, false);
> > + __sgx_sanitize_pages(&sgx_dirty_page_list, true);
>
> This is backwards, IMNHO.
>
> Make __sgx_sanitize_pages() return the number of pages that it leaves
> dirty.
>
> __sgx_sanitize_pages(&sgx_dirty_page_list)
> left_dirty = __sgx_sanitize_pages(&sgx_dirty_page_list);
> if (left_dirty)
> pr_warn(...);

I like this and my patch has already the counter in place
so why not.

> That rids us of the mystery true/false and puts the pr_warn() in a place
> that makes logical sense. Then, let's either *not* do the
>
> pr_err_ratelimited(EREMOVE_ERROR_MESSAGE, ret, ret);
>
> at all, or make it an unconditional pr_warn_ratelimited(). They're not
> going to be common and multiple messages are virtually worthless anyway.
>
> I actually think a common tracepoint, or out-of-line ENCLS/ENCLU
> functions that can be easily ftraced are a much better idea than a
> one-off pr_whatever().

I like the tracepoint idea more than out-of-line ENCLS/ENCLU
because out-of-line is more "intrusive" change to the code
semantics than a tracepoint.

BR, Jarkko

\
 
 \ /
  Last update: 2022-08-25 21:23    [W:0.139 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site