On 02.01.2017 04:44, David Holland wrote:
> On Sat, Dec 31, 2016 at 08:57:16PM +0000, Kamil Rytarowski wrote:
> > Update TODO.ptrace
> >
> > Mark exect(3) for removal, there is no use-case for it. exec() is already
> > monitored and emits SIGTRAP when traced.
>
> Historically exect() is used by debuggers to start debuggees. While
> it's equivalent to using PT_TRACE_ME followed by execve(), I think the
> result is that the new process first stops immediately after the exec
> finishes so that the debugger doesn't have to worry about stepping
> through the exec call in its own code.
>
> This doesn't mean it shouldn't go away (or as much away as it can,
> that is, to COMPAT_70) but I'm not convinced there's no case for it.
>
So, can I change exect(3) to something like:
int
exect(const char *path, char *const argv[], char *const envp[])
{
if (ptrace(PT_TRACE_ME, 0, NULL, 0) == -1)
return -1;
return execve(path, argv, envp);
}
The current implementation of exect(3) (at least philosophically)
predates SIGTRAP on exec().
Personally, I have no opinion neither preference on it either way.
Attachment:
signature.asc
Description: OpenPGP digital signature