On Wed Apr 24, 2024 at 8:44 PM EEST, Jarkko Sakkinen wrote: > On Wed Apr 24, 2024 at 2:50 PM EEST, Bojun Zhu wrote: > > 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). > > Ah, ok. > > Returning zero is right thing to do because it also returns count of > pages successfully added. I.e. the function does not guarantee that > all pages are processsed but it does guarantee that the system is in > predictable state. > > It could be that e.g. sgx_alloc_epc_page() calls fails. > > So, it is a bit like how read system call works. Good that you asked that had rethink for a while. What I would suggest that you just put out 2nd verson out and then we see where it is going. For sgx_ioc_encl_add_pages() it is important to maintain exact semantics as we need to maintain backwards compatibility. BR, Jarkko