rv when execve succeeds...

Dmitry V. Levin ldv at altlinux.org
Wed Aug 9 17:48:00 UTC 2017


On Wed, Aug 09, 2017 at 01:16:19PM -0400, DJ Delorie wrote:
> "Dmitry V. Levin" <ldv at altlinux.org> writes:
> > Why should we pretend that execve/execveat don't return if they actually
> > do return?
> 
> If execve() succeeds, the calling image no longer exists... what does it
> return *to* ?

It's returned to the new image and is available in the same register as on
exiting other syscalls.

> The man page even says:
> 
>   "execve() does not return on success,"
> 
> Hence the philosophical question - does the user *expect* to see "= 0"
> in the trace when execve succeeds, or not?

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.

> 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.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170809/a6df196a/attachment.bin>


More information about the Strace-devel mailing list