sigstack() doesn't do the right thing

rws%mit-bold at sri-unix.UUCP rws%mit-bold at sri-unix.UUCP
Thu Dec 22 02:49:15 AEST 1983


From:  Robert W. Scheifler <rws at mit-bold>

Description:
	sigstack() seems like this wonderful thing, allowing applications
	to field signals without modifying the normal stack.  This is
	useful, for example, when you need to control values on the stack
	to avoid garbage collection problems.  Unfortunately, to take
	advantage of a VAX instruction (REI), the sigcontext structure that is
	passed to the signal handler is always pushed onto the CURRENT stack,
	not the stack specified with sigstack().  As near as I can tell, this
	largely defeats the whole purpose of sigstack().  (Fortunately
	for my applications, namely CLU and Argus, I can guarantee that these
	5 longs won't look like heap references, so I luck out.)
Repeat-By:
	Use sigstack() and sigvec() to set up a stack and handler, and cause
	the appropriate interrupt.  Look which stack the sigcontext is on.
Fix:
	The sigcontext is only pushed on the current stack so that the
	PS+PC part can be used by the REI instruction in the signal
	trampoline code.  The fix is probably to do the REI "by hand" in
	sigcleanup() instead, or perhaps do some correctness checks on the
	PS+PC, and then update the PS+PC on the kernel stack for the REI back
	from the CHMK 139, thus collapsing what is currently an REI-to-REI
	into a single REI.



More information about the Comp.unix.wizards mailing list