At this point, my own research into the problem can be provided as a partial answer.
Firstly, I found this article old and do not cite any official sources of information: http://zwillow.blogspot.com/2007/04/linux-signal-handling-is-broken.html . This is a current quote:
The second problem: you cannot use setcontext () to leave the signal handler and switch to another, previously saved context. (Or, for that matter, you cannot use it to return to the same context that is passed as an argument to the signal handler.) In other words, a signal handler, for example
static void sighandler( int signo, siginfo_t *psi, void *pv) { memcpy(puc_old, pv, sizeof(ucontext_t)); setcontext(puc_another); }
does not work. It does not restore the signal mask specified in puc_other, does not restore the alternative signal stack, etc. However, this scheme works flawlessly on Solaris.
If someone can confirm the Solaris part, it will be appreciated.
Secondly, after talking with the teacher at the university, I realized that setting up / exchanging the context with the signal handler is not as straightforward as it happens in other situations. Unfortunately, the person who explained this to me could not provide more detailed information at that time.
Thus, both of my sources do not seem completely reliable, but, nevertheless, are clues.