In section SECCOMP_SET_MODE_STRICT
of man 2 seccomp, it is said that:
Note that although the calling thread can no longer call sigprocmask(2), it can use sigreturn(2) to block all signals apart from SIGKILL and SIGSTOP.
I cannot figure out how to do this. sigreturn
is a syscall
that
This sigreturn() call undoes everything that was done—changing the process's signal mask, switching signal stacks (see sigaltstack(2))—in order to invoke the signal handler.
More specifically:
Using the information that was earlier saved on the user-space stack
sigreturn() restores the process's signal mask, switches stacks, and restores the process's context (processor flags and registers, including the stack pointer and instruction pointer),
The information is stored by:
The saved process context information is placed in a ucontext_t structure (see ). That structure is visible within the signal handler as the third argument of a handler established via sigaction(2) with the SA_SIGINFO flag.
I considered it to be not possible because the following 2 reasons:
Since the
TERM
action for signal does not need to return to user space, there is no way of preventingdying
by usingatexit
or anything like that.2.Although it is possible to fill out a
ucontext_t
with man 2 getcontext or man 3 makecontext, that won't help the process to block the signal since all the system call for installing handler and masking the signal is disabled (unlesssigreturn
do the siganl mask stuff itself).