In the recent literature on system call interposition I ran into a neat trick: instead of our convoluted ways of handling clone() et al inside the signal context, we can return early from the signal handler but having fixed up the on-stack context to divert control initially into a resume-side handler. This eventually restores control to the real trap context... but because the resume-side handler runs with the same stack as at the original trap context, it probably makes things a lot easier.
I forget in which paper I read this -- need to check. But probably we should use this technique.
In the recent literature on system call interposition I ran into a neat trick: instead of our convoluted ways of handling
clone()et al inside the signal context, we can return early from the signal handler but having fixed up the on-stack context to divert control initially into a resume-side handler. This eventually restores control to the real trap context... but because the resume-side handler runs with the same stack as at the original trap context, it probably makes things a lot easier.I forget in which paper I read this -- need to check. But probably we should use this technique.