Re: rt_sigreturn rejects a substitute stack frame as invalid.

From: Mikael Pettersson
Date: Mon Aug 18 2014 - 07:00:03 EST


Steven Stewart-Gallus writes:
> Hello,
>
> I'm not totally sure that GLibc's setcontext is safe to use in a
> signal handler. So, I decided I was going to play things safe and let
> rt_sigreturn switch stacks for me instead. However, rt_sigreturn seems
> to reject my substitute stack frame as invalid and I'm not sure why.

I did similar things at my previous work (doing dynamic binary
instrumentation and virtualization of user-space binaries; can't
share the code alas, it's proprietary), but my code operated
directly on top of the kernel/user-space API, using the actual
kernel/user-space data structures rather than glibc's fake ones.

If you're sure that it's the kernel's rt_sigreturn and not whatever
glibc runs before it that complains, then a simple way of debugging
this is to modify your kernel to printk some diagnostics whenever
rt_sigreturn decides to error out.

You may also want to check out the 'pth' package.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/