I see that the stack frame the process needs to handle signals is allocated in the function setup_rt_frame()
.
My question is: where it is de-allocated?
Thank you!
I see that the stack frame the process needs to handle signals is allocated in the function setup_rt_frame()
.
My question is: where it is de-allocated?
Thank you!
setup_rt_frame()
sets stack for Real-time signals (see man 7 signal). It does 2 main things:
rt_sigreturn()
syscall (see man 2 sigreturn for details). As you can see, once signal handler is finished, it will automatically return to sys_rt_sigreturn() function in kernel. This function will restore kernel stack from user stack and get back to interrupted user-space process.
So, answering your question:
where it is de-allocated?
It's being restored in sys_rt_sigreturn()
function.
See also:
[1] How signals work internally?
[2] Who uses POSIX realtime signals and why?
[3] Implementation of signal handling (see sections "Delivering Signals (7)" to "Delivering Signals (12)")