glibc/sysdeps/unix
Adhemerval Zanella 283d985122 posix: Fix posix_spawnp to not execute invalid binaries in non compat mode (BZ#23264)
Current posix_spawnp implementation wrongly tries to execute invalid
binaries (for instance script without shebang) as a shell script in
non compat mode.  It was a regression introduced by
9ff72da471 when __spawni started to use
__execvpe instead of __execve (glibc __execvpe try to execute ENOEXEC
as shell script regardless).

This patch fixes it by using an internal symbol (__execvpex) with the
faulty semantic (since compat mode is handled by spawni.c itself).

It was reported by Daniel Drake on libc-help [1].

Checked on x86_64-linux-gnu and i686-linux-gnu.

	[BZ #23264]
	* include/unistd.h (__execvpex): New prototype.
	* posix/Makefile (tests): Add tst-spawn4.
	(tests-internal): Add tst-spawn4-compat.
	* posix/execvpe.c (__execvpe_common, __execvpex): New functions.
	* posix/tst-spawn4-compat.c: New file.
	* posix/tst-spawn4.c: Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni): Do not interpret invalid
	binaries as shell scripts.
	* sysdeps/posix/spawni.c (__spawni): Likewise.

[1] https://sourceware.org/ml/libc-help/2018-06/msg00012.html
2018-06-08 17:27:46 -03:00
..
alpha Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
arm Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
bsd hurd: Avoid some PLTs in libc and librt 2018-04-02 19:07:52 +00:00
i386 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
inet Switch IDNA implementation to libidn2 [BZ #19728] [BZ #19729] [BZ #22247] 2018-05-23 15:27:24 +02:00
mips Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
powerpc Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sh Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sysv/linux posix: Fix posix_spawnp to not execute invalid binaries in non compat mode (BZ#23264) 2018-06-08 17:27:46 -03:00
x86_64 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Implies
Makefile Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
clock_gettime.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
clock_nanosleep.c hurd: Avoid some PLTs in libc and librt 2018-04-02 19:07:52 +00:00
clock_settime.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
confstr.h
get_child_max.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
getlogin.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
getlogin_r.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
getpagesize.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
grantpt.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ifreq.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
make-syscalls.sh Make llseek a compat symbol (bug 18471). 2018-05-22 15:44:01 +00:00
s-proto-cancel.S * sysdeps/unix/Makefile: Include $(common-objpfx)s-proto-cancel.d. 2002-12-30 00:12:56 +00:00
s-proto.S
setxid.h Update. 2004-11-12 01:27:04 +00:00
sockatmark.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stime.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
syscall-template.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
syscall.S Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
syscalls.list posix: Consolidate Linux fsync syscall 2017-05-18 18:06:47 -03:00
sysdep.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00