Re: [PATCH 1/2] x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd
From: jarkko@xxxxxxxxxx
Date: Mon Sep 05 2022 - 06:19:00 EST
On Mon, Sep 05, 2022 at 12:44:56PM +0300, jarkko@xxxxxxxxxx wrote:
> On Mon, Sep 05, 2022 at 07:50:33AM +0000, Huang, Kai wrote:
> > On Sat, 2022-09-03 at 13:26 +0300, Jarkko Sakkinen wrote:
> > > > static int ksgxd(void *p)
> > > > {
> > > > + unsigned long left_dirty;
> > > > +
> > > > set_freezable();
> > > >
> > > > /*
> > > > * 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);
> > > > + left_dirty = __sgx_sanitize_pages(&sgx_dirty_page_list);
> > > > + pr_debug("%ld unsanitized pages\n", left_dirty);
> > > %lu
> > >
> >
> > I assume the intention is to print out the unsanitized SECS pages, but what is
> > the value of printing it? To me it doesn't provide any useful information, even
> > for debug.
>
> How do you measure "useful"?
>
> If for some reason there were unsanitized pages, I would at least
> want to know where it ended on the first value.
>
> Plus it does zero harm unless you explicitly turn it on.
I would split it though for a separate patch because it does not need
to be part of the stable fix and change it to:
if (left_dirty)
pr_debug("%lu unsanitized pages\n", left_dirty);
BR, Jarkko