rv when execve succeeds...

DJ Delorie dj at redhat.com
Wed Aug 9 19:14:49 UTC 2017


"Dmitry V. Levin" <ldv at altlinux.org> writes:
> This "= 0" has been printed all these years, so it's quite logical to
> suppose that the user expects to see "= 0" and might be quite surprised
> to see something else like "= 11" instead.

Well, it *used* to print 11, I suppose 0 is better than 11 :-)

>> Where in any of the traced
>> programs is that "= 0" available for inspection?
>
> It's in the register.  On x86_64 it's %rax, on s390 it's %r2, etc.

It's not about whether they expect to see "= 0" vs "= 11" - it's about
whether they expect to see *anything at all*.

I mean, at the C program level, does the user have access to that?
Should we be implying that execve() *returned* to the user's program?
By using a syntax that implies return of control to the caller, we may
be confusing the user into thinking that the exec failed, but returned a
zero to their program.

We could add some other way of indicating success that doesn't imply
control was returned to the caller, like printing " (success)" instead
of " = 0" there.




More information about the Strace-devel mailing list