[Bug libc/23264] posix_spawnp wrongly executes ENOEXEC in non compat mode

cvs-commit at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Fri Jun 8 21:07:00 GMT 2018


https://sourceware.org/bugzilla/show_bug.cgi?id=23264

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.27/master has been updated
       via  78e48cb5e5b5358c8a43f169700a27ad1374edbc (commit)
      from  0262507918cfad7223bf81b8f162b7adc7a2af01 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=78e48cb5e5b5358c8a43f169700a27ad1374edbc

commit 78e48cb5e5b5358c8a43f169700a27ad1374edbc
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Jun 6 14:07:34 2018 -0300

    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
    9ff72da471a509a8c19791efe469f47fa6977410 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

    (cherry picked from commit 283d98512272a12cb84e7798c23edbdf1adb287d)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                    |   13 ++++
 include/unistd.h                             |    2 +
 posix/Makefile                               |    4 +-
 posix/execvpe.c                              |   26 ++++++--
 posix/tst-spawn4-compat.c                    |   77 ++++++++++++++++++++++++++
 signal/tst-sigaction.c => posix/tst-spawn4.c |   54 +++++++++---------
 sysdeps/posix/spawni.c                       |    4 +-
 sysdeps/unix/sysv/linux/spawni.c             |    4 +-
 8 files changed, 146 insertions(+), 38 deletions(-)
 create mode 100644 posix/tst-spawn4-compat.c
 copy signal/tst-sigaction.c => posix/tst-spawn4.c (51%)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list