skip-if-exec-format-error doesn't work #116
Labels
bug
Confirmed to be a bug in libxcrypt.
help wanted
The libxcrypt core developers do not plan to work on this themselves but would review a PR.
only-tests
Issues that cause test failures but do not affect normal use of the library.
I have discovered that skip-if-exec-format-error doesn't work reliably. Observe:
but
What on earth? Turns out that on most Unixes, the C library routine
execvp
will run/bin/sh argv...
if the attempt to invokeargv[0]
fails with ENOEXEC. If there are NULs in the first few dozen bytes of the file, /bin/sh will generate the "Exec format error" message, but if they're aren't, it'll try to run the sucker as a shell script.There isn't, AFAICT, a good way to prevent this behavior, short of reimplementing
execvp
by hand in C, which wouldn't be that bad except that, when cross-compiling (which is the only timeskip-if-exec-format-error
gets used) we'd need a C compiler for the build machine as well as the host. I'm arguing with myself about whether it's worth the hassle.The text was updated successfully, but these errors were encountered: