[PATCH] Linux: Add execveat system call wrapper
Florian Weimer
fweimer@redhat.com
Fri Nov 27 17:32:43 GMT 2020
* Adhemerval Zanella via Libc-alpha:
>> +{
>> + /* Avoid implicit array coercion in syscall macros. */
>> + INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0], flags);
>> +#ifndef __ASSUME_EXECVEAT
>> + if (errno != ENOSYS)
>> + return -1;
>
> You need get the INLINE_SYSCALL_CALL and check if it was sucessful as well,
> instead of just check for the errno value. Also, this implementation always
> return '-1' (as below):
>
> int r = INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0],
> flags);
> #if __ASSUME_EXECVEAT
> return r;
> #else
> if (r == 0 || errno != ENOSYS)
> return r;
> [...]
>> + return -1;
>> +}
>
> This will make the function always return -1. Hasn't it shown in
> testing?
This is the expected behavior for execve and execveat. It does not
return successfully, which is why it is not necessary to check the value
of the INLINE_SYSCALL_CALL macro, either.
Thanks,
Florian
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
More information about the Libc-alpha
mailing list