diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-02-25 12:10:57 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-02-25 12:13:02 +0100 |
commit | 035c012e32c11e84d64905efaf55e74f704d3668 (patch) | |
tree | 7b08a9e9cbd8e4dd2e420cd6b7c204aeb5d61ccc /sysdeps/unix/sysv/linux/powerpc/libc-start.c | |
parent | a79328c745219dcb395070cdcd3be065a8347f24 (diff) | |
download | glibc-035c012e32c11e84d64905efaf55e74f704d3668.tar.gz glibc-035c012e32c11e84d64905efaf55e74f704d3668.tar.xz glibc-035c012e32c11e84d64905efaf55e74f704d3668.zip |
Reduce the statically linked startup code [BZ #23323]
It turns out the startup code in csu/elf-init.c has a perfect pair of ROP gadgets (see Marco-Gisbert and Ripoll-Ripoll, "return-to-csu: A New Method to Bypass 64-bit Linux ASLR"). These functions are not needed in dynamically-linked binaries because DT_INIT/DT_INIT_ARRAY are already processed by the dynamic linker. However, the dynamic linker skipped the main program for some reason. For maximum backwards compatibility, this is not changed, and instead, the main map is consulted from __libc_start_main if the init function argument is a NULL pointer. For statically linked binaries, the old approach based on linker symbols is still used because there is nothing else available. A new symbol version __libc_start_main@@GLIBC_2.34 is introduced because new binaries running on an old libc would not run their ELF constructors, leading to difficult-to-debug issues.
Diffstat (limited to 'sysdeps/unix/sysv/linux/powerpc/libc-start.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/libc-start.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c index 66f5effe8a..4d681dad06 100644 --- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c +++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c @@ -41,12 +41,12 @@ struct startup_info }; int -__libc_start_main (int argc, char **argv, - char **ev, - ElfW (auxv_t) * auxvec, - void (*rtld_fini) (void), - struct startup_info *stinfo, - char **stack_on_entry) +__libc_start_main_impl (int argc, char **argv, + char **ev, + ElfW (auxv_t) * auxvec, + void (*rtld_fini) (void), + struct startup_info *stinfo, + char **stack_on_entry) { /* the PPC SVR4 ABI says that the top thing on the stack will be a NULL pointer, so if not we assume that we're being called @@ -99,3 +99,4 @@ __libc_start_main (int argc, char **argv, stinfo->init, stinfo->fini, rtld_fini, stack_on_entry); } +DEFINE_LIBC_START_MAIN_VERSION |