This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/20480] Patch: ifunc not executable, crashes sudo qemu


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

--- Comment #19 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, master has been updated
       via  b5c45e83753b27dc538dff2d55d4410c385cf3a4 (commit)
      from  d62f9ec0cce26a275ec68f4564814041a33395b1 (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=b5c45e83753b27dc538dff2d55d4410c385cf3a4

commit b5c45e83753b27dc538dff2d55d4410c385cf3a4
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon Aug 27 16:16:43 2018 -0300

    Fix ifunc support with DT_TEXTREL segments (BZ#20480)

    Currently, DT_TEXTREL is incompatible with IFUNC.  When DT_TEXTREL or
    DF_TEXTREL is seen, the dynamic linker calls __mprotect on the segments
    with PROT_READ|PROT_WRITE before applying dynamic relocations. It leads
    to segfault when performing IFUNC resolution (which requires PROT_EXEC
    as well for the IFUNC resolver).

    This patch makes it call __mprotect with extra PROT_WRITE bit, which
    will keep the PROT_EXEC bit if exists, and thus fixes the segfault.
    FreeBSD rtld libexec/rtld-elf/rtld.c (reloc_textrel_prot) does the same.

    Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
    sparc64-linux-gnu, sparcv9-linux-gnu, and armv8-linux-gnueabihf.

        Adam J. Richte  <adam_richter2004@yahoo.com>
        Adhemerval Zanella  <adhemerval.zanella@linaro.org>
        Fangrui Song  <maskray@google.com>

        [BZ #20480]
        * config.h.in (CAN_TEXTREL_IFUNC): New define.
        * configure.ac: Add check if linker supports textrel relocation with
        ifunc.
        * elf/dl-reloc.c (_dl_relocate_object): Use all required flags on
        DT_TEXTREL segments, not only PROT_READ and PROT_WRITE.
        * elf/Makefile (ifunc-pie-tests): Add tst-ifunc-textrel.
        (CFLAGS-tst-ifunc-textrel.c): New rule.
        * elf/tst-ifunc-textrel.c: New file.

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

Summary of changes:
 ChangeLog                                          |   15 ++++++
 config.make.in                                     |    1 +
 configure                                          |   47 ++++++++++++++++++++
 configure.ac                                       |   35 +++++++++++++++
 elf/Makefile                                       |    4 ++
 elf/dl-reloc.c                                     |   20 +++-----
 .../tst-cet-legacy-3.c => elf/tst-ifunc-textrel.c  |   28 ++++++++----
 7 files changed, 128 insertions(+), 22 deletions(-)
 copy sysdeps/x86/tst-cet-legacy-3.c => elf/tst-ifunc-textrel.c (66%)

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]