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 libc/21913] static binaries SIGSEGV in __brk when host's gcc is pie-by-default (i386)


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

--- 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, hjl/pr21913 has been created
        at  5b4dd7f1b6694f49d5773ff131986cd619c13c9d (commit)

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

commit 5b4dd7f1b6694f49d5773ff131986cd619c13c9d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jul 19 14:32:42 2017 -0700

    i386: Add _startup_sbrk and _startup_fatal [BZ #21913]

    On Linux/x86, there are 3 ways to make a system call:

    1. call *%gs:SYSINFO_OFFSET.  This requires TLS initialization.
    2. call *_dl_sysinfo.  This requires relocation of _dl_sysinfo.
    3. int $0x80.  This works everywhere.

    When an object file is compiled with PIC, #1 is prefered since it is
    faster than #3 and doesn't require relocation of _dl_sysinfo.  For
    dynamic executables, ld.so initializes TLS.  However, for static
    executables, before TLS is initialized by __libc_setup_tls, #3 should
    be used for syscalls.  This patch adds _startup_sbrk and _startup_fatal
    to be used in static executables before __libc_setup_tls is called.  By
    default, they are defined to __sbrk and __libc_fatal, respectively.  On
    x86, a special _startup_sbrk is provided and _startup_fatal is turned
    into ABORT_INSTRUCTION.

        [BZ #21913]
        * csu/libc-tls.c: Include <startup.h>.
        (__libc_setup_tls): Call _startup_sbrk instead of __sbrk.  Call
        _startup_fatal instead of __libc_fatal.
        * elf/dl-tunables.c: Include <startup.h>.
        (tunables_strdup): Call _startup_sbrk instead of __sbrk.
        * sysdeps/generic/startup.h: New file.
        * sysdeps/unix/sysv/linux/i386/startup.h: Likewise.
        * sysdeps/unix/sysv/linux/i386/startup_sbrk.c: Likewise.
        * sysdeps/unix/sysv/linux/i386/Makefile (sysdep_routine): Add
        startup_sbrk if default to PIC.
        (static-only-routines): Likewise.

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

--- Comment #4 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, hjl/pie/static has been created
        at  bdf68a2a6f8a53684378b4d495d05a4db2d3b16e (commit)

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

commit bdf68a2a6f8a53684378b4d495d05a4db2d3b16e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jul 18 10:42:48 2017 -0700

    Use hidden visibility for libc.a with PIC

    Size comparison of static PIE elf/ldconfig:

    On x86-64:
            text           data     bss     dec     hex
    Before: 866113        22952    6336  895401   da9a9
    After : 865921        22952    6336  895209   da8e9
    On i686:
            text           data     bss     dec     hex
    Before: 782692        12296    3748  798736   c3010
    After : 781153        12280    3748  797181   c29fd

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5c2d331c8b1be24ccefa6ec47df969557e7fb609

commit 5c2d331c8b1be24ccefa6ec47df969557e7fb609
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 17 13:53:52 2017 -0700

    Add _dl_relocate_static_pie

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3c7e37d0fefe01fc851a7bf9a685ca67013ac54e

commit 3c7e37d0fefe01fc851a7bf9a685ca67013ac54e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 17 08:54:40 2017 -0700

    Define pie-default/default-pie-ldflag for --enable-static-pie

    1. Add $(pie-default) to CFLAGS-.o and CFLAGS-.op.
    2. Add $(default-pie-ldflag) to +link-static-before-libc.
    3. Define +prectorT/+postctorT to $(+prectorS)/$(+postctorS).

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e32bbfdf481a485cd7e177c8949032d013016657

commit e32bbfdf481a485cd7e177c8949032d013016657
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jul 18 05:58:21 2017 -0700

    x86-64: Check if linker supports static PIE

    Need the linker with fix for:

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

    Binutils 2.29 is OK.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ebf1796e7d7f476ab16f0cf7de56874d3504dd1f

commit ebf1796e7d7f476ab16f0cf7de56874d3504dd1f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 17 08:36:45 2017 -0700

    Add --enable-static-pie

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d93968ee86681ceae8e114173561f120e05f3ba2

commit d93968ee86681ceae8e114173561f120e05f3ba2
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Jul 23 05:26:26 2017 -0700

    Check if -static and -pie work together

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5548e9d5ae48c2401f23e446feacd4255017a54a

commit 5548e9d5ae48c2401f23e446feacd4255017a54a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Jul 21 05:07:19 2017 -0700

    Check if -static-pie works

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=070ec388ccc29f0d2c86d4113d7abacd7bbd76ab

commit 070ec388ccc29f0d2c86d4113d7abacd7bbd76ab
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 17 08:17:32 2017 -0700

    Check if linker supports --no-dynamic-linker

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7f7ff317da23e4e3010698e49321143190104c83

commit 7f7ff317da23e4e3010698e49321143190104c83
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jul 19 14:32:42 2017 -0700

    i386: Add _startup_sbrk and _startup_fatal [BZ #21913]

        [BZ #21913]
        * csu/libc-tls.c: Include <startup.h>.
        (__libc_setup_tls): Call _startup_sbrk instead of __sbrk.  Call
        _startup_fatal instead of __libc_fatal.
        * elf/dl-tunables.c: Include <startup.h>.
        (tunables_strdup): Call _startup_sbrk instead of __sbrk.
        * sysdeps/generic/startup.h: New file.
        * sysdeps/unix/sysv/linux/i386/startup.h: Likewise.
        * sysdeps/unix/sysv/linux/i386/startup_sbrk.c: Likewise.
        * sysdeps/unix/sysv/linux/i386/Makefile (sysdep_routine): Add
        startup_sbrk if default to PIC.
        (static-only-routines): Likewise.

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

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