libsystrap icon indicating copy to clipboard operation
libsystrap copied to clipboard

sigaltstack

Open stephenrkell opened this issue 4 years ago • 1 comments

I haven't tested it but am pretty sure programs using sigaltstack will screw with one or more things.

stephenrkell avatar May 11 '21 17:05 stephenrkell

Indeed our stack-copying hack in do-syscall.h assumes we can copy all the way back from the current top-of-stack to the trap site's top-of-stack (marked by the saved stack pointer in the signal frame). If we're not on the same stack, that's a problem.

We can easily split that case off. It gets interesting on the return path though. Currently we do two sigreturns for each clone()-servicing trap, which is pretty wacky. Probably the way to handle it is to overwrite pretcode in the child's sigframe, to instead use a fake restorer that doesn't do sigreturn. We can do that before the child is spawned.

Again remember that trap/signal-based handling needs to go away anyway, so don't spend too much time on this.

stephenrkell avatar Aug 06 '21 09:08 stephenrkell