[PATCH] posix: Fix posix_spawnpi to not execute invalid binaries in non compat mode (BZ#23264)

Florian Weimer fweimer@redhat.com
Fri Jun 8 13:29:00 GMT 2018


On 06/06/2018 08:11 PM, Adhemerval Zanella wrote:

> +/* Same as __EXECVPE, but does not try to issue ENOEXEC files.  */
> +int
> +__execvpex (const char *file, char *const argv[], char *const envp[])

“does not try to execute NOEXEC files”

> +#define EXPECTED_EXIT_CODE 65
> +#define STR_HELPER(x) #x
> +#define STR(x) STR_HELPER(x)

Is the STR macro really worth it?

> +  const char script[] = "exit " STR(EXPECTED_EXIT_CODE);
> +  write (fd, script, sizeof (script) - 1);

xwrite?

> +  const char script[] = "echo it should not happen";
> +  write (fd, script, sizeof (script) - 1);

Likewise xwrite.

Patch looks okay to me otherwise.

Thanks,
Florian



More information about the Libc-alpha mailing list