This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/21913] static binaries SIGSEGV in __brk when host's gcc is pie-by-default (i386)
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sun, 06 Aug 2017 22:46:27 +0000
- Subject: [Bug libc/21913] static binaries SIGSEGV in __brk when host's gcc is pie-by-default (i386)
- Auto-submitted: auto-generated
- References: <bug-21913-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=21913
--- Comment #7 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 aaddc88d7aafc1965cb2a3aa3c17da4dd53ddd21 (commit)
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=aaddc88d7aafc1965cb2a3aa3c17da4dd53ddd21
commit aaddc88d7aafc1965cb2a3aa3c17da4dd53ddd21
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 is slower than #2 and #3, but 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.
-----------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.