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/18422] elf/tst-audit tests fail without PLT entries


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

--- Comment #3 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  58007e9e68913290b1f4f73afc1055f779a8ed5d (commit)
      from  be2e25bbd78f9fdf27bed254d02915d019c5b363 (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=58007e9e68913290b1f4f73afc1055f779a8ed5d

commit 58007e9e68913290b1f4f73afc1055f779a8ed5d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu May 28 05:06:27 2015 -0700

    Make sure that calloc is called at least once

    PLT relocations aren't required when -z now used.  Linker on master with:

    commit 25070364b0ce33eed46aa5d78ebebbec6accec7e
    Author: H.J. Lu <hjl.tools@gmail.com>
    Date:   Sat May 16 07:00:21 2015 -0700

        Don't generate PLT relocations for now binding

        There is no need for PLT relocations with -z now. We can use GOT
        relocations, which take less space, instead and replace 16-byte .plt
        entres with 8-byte .plt.got entries.

        bfd/

          * elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
          for now binding.
          (elf_i386_allocate_dynrelocs): Use .plt.got section for now
          binding.
          * elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
          section for now binding.
          (elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
          binding.

    won't generate PLT relocations with -z now.  elf/tst-audit2.c expect
    certain order of execution in ld.so. ïWith PLT relocations, the GOTPLT
    entry of calloc is update to calloc defined in tst-audit2:

    (gdb) bt
    ï ï skip_ifunc=<optimized out>, reloc_addr_arg=<optimized out>,
    ï ï version=<optimized out>, sym=<optimized out>, map=<optimized out>)
    ï ï at ../sysdeps/i386/dl-machine.h:329
    out>,
    ï ï nrelative=<optimized out>, relsize=<optimized out>,
    ï ï reladdr=<optimized out>, map=<optimized out>) at do-rel.h:137
    reloc_mode=reloc_mode@entry=0,
    ï ï consider_profiling=1, consider_profiling@entry=0) at dl-reloc.c:258
    ï ï user_entry=0xffffcf1c, auxv=0xffffd0a8) at rtld.c:2133
    ï ï start_argptr=start_argptr@entry=0xffffcfb0,
    ï ï dl_main=dl_main@entry=0xf7fda6f0 <dl_main>) at
    ../elf/dl-sysdep.c:249
    ï ïfrom /export/build/gnu/glibc-32bit/build-i686-linux/elf/ld.so
    (gdb)

    and then calloc is called:

    (gdb) c
    Continuing.

    Breakpoint 4, calloc (n=n@entry=20, m=4) at tst-audit2.c:18
    18 {
    (gdb) bt
    ï ï reloc_mode=reloc_mode@entry=0, consider_profiling=1,
    ï ï consider_profiling@entry=0) at dl-reloc.c:272
    ï ï user_entry=0xffffcf1c, auxv=0xffffd0a8) at rtld.c:2133
    ï ï start_argptr=start_argptr@entry=0xffffcfb0,
    ï ï dl_main=dl_main@entry=0xf7fda6f0 <dl_main>) at
    ../elf/dl-sysdep.c:249
    ï ïfrom /export/build/gnu/glibc-32bit/build-i686-linux/elf/ld.so
    (gdb)

    With GOT relocation, calloc in ld.so is called first:

    (gdb) bt
    ï ï consider_profiling=1) at dl-reloc.c:272
    ï ï user_entry=0xffffcf0c, auxv=0xffffd098) at rtld.c:2074
    ï ï start_argptr=start_argptr@entry=0xffffcfa0,
    ï ï dl_main=dl_main@entry=0xf7fda6c0 <dl_main>) at
    ../elf/dl-sysdep.c:249
    ï ïfrom /export/build/gnu/glibc-32bit-test/build-i686-linux/elf/ld.so
    (gdb)

    and then the GOT entry of calloc is updated:

    (gdb) bt
    ï ï skip_ifunc=<optimized out>, reloc_addr_arg=<optimized out>,
    ï ï version=<optimized out>, sym=<optimized out>, map=<optimized out>)
    ï ï at ../sysdeps/i386/dl-machine.h:329
    out>,
    ï ï nrelative=<optimized out>, relsize=<optimized out>,
    ï ï reladdr=<optimized out>, map=<optimized out>) at do-rel.h:137
    reloc_mode=reloc_mode@entry=0,
    ï ï consider_profiling=1, consider_profiling@entry=0) at dl-reloc.c:258
    ï ï user_entry=0xffffcf0c, auxv=0xffffd098) at rtld.c:2133
    ï ï start_argptr=start_argptr@entry=0xffffcfa0,
    ï ï dl_main=dl_main@entry=0xf7fda6c0 <dl_main>) at
    ../elf/dl-sysdep.c:249
    ï ïfrom /export/build/gnu/glibc-32bit-test/build-i686-linux/elf/ld.so
    (gdb)

    After that, since calloc isn't called from ld.so nor any other modules,
    magic in tst-audit2 isn't updated. ïBoth orders are correct.  This patch
    makes sure that calloc in tst-audit2.c is called at least once from ld.so.

        [BZ #18422]
        * Makefile ($(objpfx)tst-audit2): Depend on $(libdl).
        ($(objpfx)tst-audit2.out): Also depend on
        $(objpfx)tst-auditmod9b.so.
        * elf/tst-audit2.c: Include <dlfcn.h>.
        (calloc_called): New.
        (calloc): Allow to be called more than once.
        (do_test): dllopen/dlclose $ORIGIN/tst-auditmod9b.so.

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

Summary of changes:
 ChangeLog        |   11 +++++++++++
 NEWS             |    2 +-
 elf/Makefile     |    3 ++-
 elf/tst-audit2.c |   26 ++++++++++++++++++++------
 4 files changed, 34 insertions(+), 8 deletions(-)

-- 
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]