[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1b3308a364317d36ad41961ea9cfee24aa122f02.camel@intel.com>
Date: Wed, 31 Aug 2022 01:27:58 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "linux-sgx@...r.kernel.org" <linux-sgx@...r.kernel.org>,
"Chatre, Reinette" <reinette.chatre@...el.com>,
"jarkko@...nel.org" <jarkko@...nel.org>
CC: "pmenzel@...gen.mpg.de" <pmenzel@...gen.mpg.de>,
"x86@...nel.org" <x86@...nel.org>, "bp@...en8.de" <bp@...en8.de>,
"Dhanraj, Vijay" <vijay.dhanraj@...el.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"hpa@...or.com" <hpa@...or.com>,
"haitao.huang@...ux.intel.com" <haitao.huang@...ux.intel.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/6] x86/sgx: Do not consider unsanitized pages an error
On Tue, 2022-08-30 at 15:54 -0700, Reinette Chatre wrote:
> Hi Jarkko,
>
> On 8/29/2022 8:12 PM, Jarkko Sakkinen wrote:
> > In sgx_init(), if misc_register() for the provision device fails, and
> > neither sgx_drv_init() nor sgx_vepc_init() succeeds, then ksgxd will be
> > prematurely stopped.
>
> I do not think misc_register() is required to fail for the scenario to
> be triggered (rather use "or" than "and"?). Perhaps just
> "In sgx_init(), if a failure is encountered after ksgxd is started
> (via sgx_page_reclaimer_init()) ...".
IMHO "a failure" might be too vague. For instance, failure to sgx_drv_init()
won't immediately result in ksgxd to stop prematurally. As long as KVM SGX can
be initialized successfully, sgx_init() still returns 0.
Btw I was thinking whether we should move sgx_page_reclaimer_init() to the end
of sgx_init(), after we make sure at least one of the driver and the KVM SGX is
initialized successfully. Then the code change in this patch won't be necessary
if I understand correctly. AFAICT there's no good reason to start the ksgxd at
early stage before we are sure either the driver or KVM SGX will work.
Btw currently EPC pages assigned to KVM guest cannot be reclaimed, so
theoretically ksgxd can be moved to sgx_drv_init(), but who knows someday we
will decide to make KVM guest EPC pages to be able to be reclaimed. :)
--
Thanks,
-Kai
Powered by blists - more mailing lists