lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D428BE51-20DA-42C5-A2B0-B264D7564700@antgroup.com>
Date: Wed, 24 Apr 2024 19:50:49 +0800
From: "Bojun Zhu" <zhubojun.zbj@...group.com>
To: Jarkko Sakkinen <jarkko@...nel.org>
Cc: "Huang, Kai" <kai.huang@...el.com>,
  "linux-sgx@...r.kernel.org" <linux-sgx@...r.kernel.org>,
  "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
  "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
  "刘双(轩屹)" <ls123674@...group.com>,
  "Chatre, Reinette" <reinette.chatre@...el.com>,
  "Bojun Zhu" <zhubojun.zbj@...group.com>
Subject: Re: [RFC PATCH 1/1] x86/sgx: Explicitly give up the CPU in EDMM's
 ioctl() to avoid softlockup

Hi Jarkko,

> On Apr 24, 2024, at 18:42, Jarkko Sakkinen <jarkko@...nel.org> wrote:
> 
> On Wed Apr 24, 2024 at 10:02 AM EEST, Jarkko Sakkinen wrote:
>> On Wed Apr 24, 2024 at 9:46 AM EEST, Bojun Zhu wrote:
>>> Based on the the discussion among you, Jarkko and Reinette,
>>> I will keep the need_resched() and wrap the logic in using sgx_resched(),
>>> as suggested by Jarkko.
>> 
>> Sounds like a plan :-)
> 
> In sgx_ioc_enclave_add_pages() "if (!c)" check might cause possibly
> some  confusion.
> 
> Reason for it is that in "transaction sense" the operation can
> be only meaningfully restarted when no pages have not been added
> as MRENCLAVE checksum cannot be reset.
> 
> BR, Jarkko
> 


Thanks for your reminder.

According to the SGX hardware specification, similar to "ADD PAGES”,
the operations in  "MODT PAGEs” and  "REMOVE PAGEs(at runtime)”  
can be only meaningfully restarted when no page has been handled.

For the following code in sgx_ioc_enclave_add_pages():

```c
if (signal_pending(current)) {
	if (!c)
		ret = -ERESTARTSYS;

	break;
}
```
I still have some questions:

It seems that the variable "ret" is set to 0 if there is **some** EPC pages have been 
added when interrupted by signal(Supposed that sgx_encl_add_page() 
always returns successfully).

Shall we set the return value as "-EINTR" if the context is interrupted by 
signal when some EPC pages have been added?
(BTW, return values contain -EINTR as shown in
https://elixir.bootlin.com/linux/latest/source/arch/x86/kernel/cpu/sgx/ioctl.c#L402)

Please correct me if misunderstood it.

Regards,
Bojun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ