[Pal/Linux-SGX] Set PAL_ERRNO to PAL_ERROR_INTERRUPTED when interrupted by host signal

Current Linux-SGX PAL signal handling unwinds all inner PAL frames if
host signal interrupts Graphene while it waits on a long syscall.
Because PAL frames are unwound, all inner logic of PAL setting PAL_ERRNO
= PAL_ERROR_INTERRUPTED (using the _DkRaiseFailure() flow) is skipped.
This commit retrofits this logic.
This commit is contained in:
Dmitrii Kuvaiskii
2019-04-25 12:17:17 -07:00
parent 315c7b60ff
commit 8bf06ca6cc
+5
View File
@@ -410,6 +410,11 @@ void _DkHandleExternalEvent (PAL_NUM event, sgx_context_t * uc)
arch_store_frame(&frame->arch);
}
/* We only end up in _DkHandleExternalEvent() if interrupted during
* host syscall; Dk* function will be unwound, so we must inform LibOS
* layer that PAL was interrupted (by setting PAL_ERRNO). */
_DkRaiseFailure(PAL_ERROR_INTERRUPTED);
if (!_DkGenericSignalHandle(event, 0, frame, NULL)
&& event != PAL_EVENT_RESUME)
_DkThreadExit();