Re: [PATCH v3 07/25] x86/sgx: Initialize virtual EPC driver even when SGX driver is disabled

From: Borislav Petkov
Date: Fri Apr 02 2021 - 15:20:08 EST


On Fri, Apr 02, 2021 at 03:42:51PM +0000, Sean Christopherson wrote:
> Nope! That's wrong, as sgx_epc_init() will not be called if sgx_drv_init()
> succeeds. And writing it as "if (sgx_drv_init() || sgx_vepc_init())" is also
> wrong since that would kill SGX when one of the drivers is alive and well.

Bah, right you are.

How about:

/* Error out only if both fail to initialize. */
ret = sgx_drv_init();

if (sgx_vepc_init() && ret)
goto err_kthread;

And yah, this looks strange so it needs the comment to explain what's
going on here.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette