glibc/sysdeps/posix
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
..
alarm.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
clock_getres.c hurd: Avoid some PLTs in libc and librt 2018-04-02 19:07:52 +00:00
clock.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
closedir.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ctermid.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
cuserid.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dirfd.c hurd: Avoid PLT for dirfd 2018-04-05 01:52:29 +02:00
dirstream.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dl-fileid.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dup2.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dup.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
euidaccess.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
fdopendir.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
flock.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
fpathconf.c Reject invalid definitions of _POSIX_CHOWN_RESTRICTED, _POSIX_NO_TRUNC, _POSIX_VDISABLE 2018-01-29 22:21:21 +01:00
gai_strerror-strs.h * sysdeps/posix/gai_strerror.c: Complete rewrite. Avoid relocations. 2005-12-20 17:53:00 +00:00
gai_strerror.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
getaddrinfo.c Switch IDNA implementation to libidn2 [BZ #19728] [BZ #19729] [BZ #22247] 2018-05-23 15:27:24 +02:00
getcwd.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
getdtsz.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
gethostname.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
gettimeofday.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
isatty.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
isfdtype.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
killpg.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
libc_fatal.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Makefile NPTL: Refactor named semaphore code to use shm-directory.h 2014-12-12 15:01:30 -08:00
mkfifo.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mkfifoat.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
nice.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
open64.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
opendir.c Assume O_DIRECTORY for opendir 2018-04-03 08:57:17 -03:00
pathconf.c Reject invalid definitions of _POSIX_CHOWN_RESTRICTED, _POSIX_NO_TRUNC, _POSIX_VDISABLE 2018-01-29 22:21:21 +01:00
pause.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
posix_fallocate64.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
posix_fallocate.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pread64.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pread.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
preadv2.c preadv2/pwritev2: Handle offset == -1 [BZ #22753] 2018-02-02 10:46:26 +01:00
preadv64.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
preadv64v2.c preadv2/pwritev2: Handle offset == -1 [BZ #22753] 2018-02-02 10:46:26 +01:00
preadv_common.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
preadv.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
profil.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pwrite64.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pwrite.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pwritev2.c preadv2/pwritev2: Handle offset == -1 [BZ #22753] 2018-02-02 10:46:26 +01:00
pwritev64.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pwritev64v2.c preadv2/pwritev2: Handle offset == -1 [BZ #22753] 2018-02-02 10:46:26 +01:00
pwritev_common.c hurd: Fix pwritev* 2018-01-07 13:31:36 +01:00
pwritev.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
raise.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
readdir_r.c Consolidate Linux readdir{64}{_r} implementation 2018-04-06 17:49:02 -03:00
readdir.c Consolidate Linux readdir{64}{_r} implementation 2018-04-06 17:49:02 -03:00
readv.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
remove.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
rename.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
rewinddir.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
seekdir.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
shm_open.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
shm_unlink.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
shm-directory.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
shm-directory.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sigblock.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sigignore.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sigintr.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
signal.c Filter out NPTL internal signals (BZ #22391) 2018-04-03 13:30:49 -03:00
sigpause.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sigset.c Filter out NPTL internal signals (BZ #22391) 2018-04-03 13:30:49 -03:00
sigsetmask.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sigsuspend.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sigwait.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sleep.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
spawni.c posix: Fix posix_spawnp to not execute invalid binaries in non compat mode (BZ#23264) 2018-06-08 17:27:46 -03:00
sprofil.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Subdirs Make sysdeps/posix bring in login subdir. 2015-07-23 17:04:22 -07:00
sysconf.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
system.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sysv_signal.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
telldir.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tempname.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
time.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
timespec_get.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
truncate.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ttyname_r.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ttyname.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ulimit.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
usleep.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
utime.c Add missing start-of-file descriptive comment. 2018-03-06 09:21:04 +01:00
utimes.c Add missing start-of-file descriptive comment. 2018-03-06 09:21:04 +01:00
wait3.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wait.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
waitid.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
writev.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00