NOMMU bogus syscall return values

Rich Felker dalias at libc.org
Fri Mar 4 02:21:48 UTC 2016


On Fri, Mar 04, 2016 at 02:39:38AM +0300, Dmitry V. Levin wrote:
> On Wed, Mar 02, 2016 at 09:29:24PM -0500, Rich Felker wrote:
> > On Thu, Mar 03, 2016 at 05:16:18AM +0300, Dmitry V. Levin wrote:
> > > On Wed, Mar 02, 2016 at 08:28:30PM -0500, Rich Felker wrote:
> [...]
> > > > What should be done about daemonized tracer mode?
> > > 
> > > If we could switch stack before clone and then switch stack back in the
> > > child process, it would be a relatively simple change.
> > > Otherwise I don't see any simple options.
> > 
> > I think it's possible to switch stack in the parent via sigaltstack
> > and raise, after which the cloned child can longjmp back to the stack
> > that was the parent's.
> 
> This might work.  Whatever signal is chosen, its handler and mask would
> have to be restored before the final execve call.

The handler and mask could be restored before even calling clone;
actually, the whole machinery could be implemented as a wrapper for
clone that lets you pick whether the child runs a new function on a
new stack with the parent returning (like normal clone) or the parent
runs a new function on a new stack (with the child returning).

> > Alternatively the child could just re-enter
> > main() on a new stack with a global var set to indicate that it's the
> > tracer child.
> 
> I think it would be too risky to let the main bulk of strace code run
> on the new stack.

Just in terms of stack size available? Or something else?

Rich




More information about the Strace-devel mailing list