This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] posix: Fix posix_spawnpi to not execute invalid binaries in non compat mode (BZ#23264)
- From: Florian Weimer <fweimer at redhat dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, libc-alpha at sourceware dot org
- Date: Fri, 8 Jun 2018 15:29:18 +0200
- Subject: Re: [PATCH] posix: Fix posix_spawnpi to not execute invalid binaries in non compat mode (BZ#23264)
- References: <1528308711-25964-1-git-send-email-adhemerval.zanella@linaro.org>
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