Skip to content
  • Daniele Buono's avatar
    ff76097a
    coroutine: add check for SafeStack in sigaltstack · ff76097a
    Daniele Buono authored
    
    
    Current implementation of LLVM's SafeStack is not compatible with
    code that uses an alternate stack created with sigaltstack().
    Since coroutine-sigaltstack relies on sigaltstack(), it is not
    compatible with SafeStack. The resulting binary is incorrect, with
    different coroutines sharing the same unsafe stack and producing
    undefined behavior at runtime.
    
    In the future LLVM may provide a SafeStack implementation compatible with
    sigaltstack(). In the meantime, if SafeStack is desired, the coroutine
    implementation from coroutine-ucontext should be used.
    As a safety check, add a control in coroutine-sigaltstack to throw a
    preprocessor #error if SafeStack is enabled and we are trying to
    use coroutine-sigaltstack to implement coroutines.
    
    Signed-off-by: default avatarDaniele Buono <dbuono@linux.vnet.ibm.com>
    Message-id: 20200529205122.714-3-dbuono@linux.vnet.ibm.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    ff76097a
    coroutine: add check for SafeStack in sigaltstack
    Daniele Buono authored
    
    
    Current implementation of LLVM's SafeStack is not compatible with
    code that uses an alternate stack created with sigaltstack().
    Since coroutine-sigaltstack relies on sigaltstack(), it is not
    compatible with SafeStack. The resulting binary is incorrect, with
    different coroutines sharing the same unsafe stack and producing
    undefined behavior at runtime.
    
    In the future LLVM may provide a SafeStack implementation compatible with
    sigaltstack(). In the meantime, if SafeStack is desired, the coroutine
    implementation from coroutine-ucontext should be used.
    As a safety check, add a control in coroutine-sigaltstack to throw a
    preprocessor #error if SafeStack is enabled and we are trying to
    use coroutine-sigaltstack to implement coroutines.
    
    Signed-off-by: default avatarDaniele Buono <dbuono@linux.vnet.ibm.com>
    Message-id: 20200529205122.714-3-dbuono@linux.vnet.ibm.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Loading