Original Test case:
Use sigaction(2) to set a signal handler for SIGUSR1.
There are 4 test cases:
1) Set SA_RESETHAND and SA_SIGINFO.
When the handler runs, SA_SIGINFO should be set.
2) Set SA_RESETHAND. When the handler runs,
SIGUSR1 should be masked (SA_RESETHAND makes
sigaction behave as if SA_NODEFER was not set).
3) Same as case 2, but when the handler is established,
sa_mask is set to include SIGUSR1. Ensure that SIGUSR1
is indeed masked even if SA_RESETHAND is set.
4) A signal generated from an interface or condition
that does not provide siginfo (such as pthread_kill(3))
should invoke the handler with a non-NULL siginfo pointer.
Problem/Issue:
The test case 2 is failed with below error message.
sigaction01 2 TFAIL : sigaction01.c:146: SA_RESETHAND should cause sig tobe masked when the handler executes.
Thread 6 "ENCLAVE" hit Breakpoint 2, handler (sig=10, sip=0x7fe040b46c28, ucp=0x7fe040b46c60) at sigaction01.c:90
90 sigaction01.c: No such file or directory.
(gdb) s
98 in sigaction01.c
(gdb) s
90 in sigaction01.c
(gdb) c
Continuing.
sigaction01 1 TPASS : SA_RESETHAND did not cause SA_SIGINFO to be cleared
Thread 6 "ENCLAVE" hit Breakpoint 2, handler (sig=10, sip=0x7fe040b46c28, ucp=0x7fe040b46c60) at sigaction01.c:90
90 sigaction01.c: No such file or directory.
(gdb) s
98 in sigaction01.c
(gdb) s
90 in sigaction01.c
(gdb) s
98 in sigaction01.c
(gdb)
Original Test case: Use sigaction(2) to set a signal handler for SIGUSR1. There are 4 test cases: 1) Set SA_RESETHAND and SA_SIGINFO. When the handler runs, SA_SIGINFO should be set. 2) Set SA_RESETHAND. When the handler runs, SIGUSR1 should be masked (SA_RESETHAND makes sigaction behave as if SA_NODEFER was not set). 3) Same as case 2, but when the handler is established, sa_mask is set to include SIGUSR1. Ensure that SIGUSR1 is indeed masked even if SA_RESETHAND is set. 4) A signal generated from an interface or condition that does not provide siginfo (such as pthread_kill(3)) should invoke the handler with a non-NULL siginfo pointer.
Problem/Issue: The test case 2 is failed with below error message. sigaction01 2 TFAIL : sigaction01.c:146: SA_RESETHAND should cause sig tobe masked when the handler executes.
SGX_LKL is not blocked/masked the SIGUSR1 signal when the signal mask was read inside the registered application's signal handler.
GDB Logs: