Browse Source

[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.
Dmitrii Kuvaiskii 6 years ago
parent
commit
8bf06ca6cc
1 changed files with 5 additions and 0 deletions
  1. 5 0
      Pal/src/host/Linux-SGX/db_exception.c

+ 5 - 0
Pal/src/host/Linux-SGX/db_exception.c

@@ -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();