why do we put code onto the stack when doing a signal?

Ingo Molnar (mingo@pc5829.hil.siemens.at)
Mon, 14 Apr 1997 17:25:39 +0200 (MET DST)

the x86 case:

__put_user(0x0000b858, CODE(0)); /* popl %eax ; movl $,%eax */
__put_user(0x80cd0000, CODE(4)); /* int $0x80 */
__put_user(__NR_sigreturn, CODE(2));

this looks like the only code that is put onto the stack. This is a static
sequence of instructions, why cant we put this into a shared read-only,
executable mmap()-ed area? [say into libc].

the rest of the stack manipulation (iBCS2 compliant stack frame) has to go
onto the stack, but i dont really understand why the above code has to go
there ... maybe i'm missing something, but not even clone() seems to need
this code too badly.

the only 'execution path manipulation' we have to do is to modify the
return address, IMHO.

-- mingo