summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-12-12 18:13:35 +0000
committerJakub Jelinek <jakub@redhat.com>2007-12-12 18:13:35 +0000
commit574e283890a6ca92325a06dafa76ff307a8019a2 (patch)
tree055e44e24a55fb4863e5d9cdc04e320cde52ffe9 /elf
parenta162e5955f7e324be82d9318bbcbe869c66ffb86 (diff)
Updated to fedora-glibc-20071212T1051
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile2
-rw-r--r--elf/dl-load.c2
-rw-r--r--elf/elf.h2
-rw-r--r--elf/rtld.c65
4 files changed, 45 insertions, 26 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 2943acc66b..e5812e3668 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -308,7 +308,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
-Wl,-soname=$(rtld-installed-name) -T $@.lds
rm -f $@.lds
readelf -s $@ \
- | awk '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
+ | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
# interp.c exists just to get this string into the libraries.
CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 98d25b827d..94531b271f 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2274,7 +2274,7 @@ _dl_rtld_di_serinfo (struct link_map *loader, Dl_serinfo *si, bool counting)
if (counting)
{
si->dls_cnt++;
- si->dls_size += r->dirnamelen < 2 ? r->dirnamelen : 2;
+ si->dls_size += MAX (2, r->dirnamelen);
}
else
{
diff --git a/elf/elf.h b/elf/elf.h
index c541774d98..2defde0da7 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -604,6 +604,7 @@ typedef struct
#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */
#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */
+#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
/* Legal values for the note segment descriptor types for object files. */
@@ -1277,6 +1278,7 @@ typedef struct
#define HWCAP_SPARC_V9 16 /* The CPU is v9, so v8plus is ok. */
#define HWCAP_SPARC_ULTRA3 32
#define HWCAP_SPARC_BLKINIT 64 /* Sun4v with block-init/load-twin. */
+#define HWCAP_SPARC_N2 128
/* MIPS R3000 specific definitions. */
diff --git a/elf/rtld.c b/elf/rtld.c
index 7612a69324..98817d9fa0 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -833,6 +833,35 @@ rtld_lock_default_unlock_recursive (void *lock)
#endif
+static void
+security_init (void)
+{
+ /* Set up the stack checker's canary. */
+ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
+#ifdef THREAD_SET_STACK_GUARD
+ THREAD_SET_STACK_GUARD (stack_chk_guard);
+#else
+ __stack_chk_guard = stack_chk_guard;
+#endif
+
+ /* Set up the pointer guard as well, if necessary. */
+ if (GLRO(dl_pointer_guard))
+ {
+ // XXX If it is cheap, we should use a separate value.
+ uintptr_t pointer_chk_guard = stack_chk_guard;
+#ifndef HP_TIMING_NONAVAIL
+ hp_timing_t now;
+ HP_TIMING_NOW (now);
+ pointer_chk_guard ^= now;
+#endif
+#ifdef THREAD_SET_POINTER_GUARD
+ THREAD_SET_POINTER_GUARD (pointer_chk_guard);
+#endif
+ __pointer_chk_guard_local = pointer_chk_guard;
+ }
+}
+
+
/* The library search path. */
static const char *library_path attribute_relro;
/* The list preloaded objects. */
@@ -1137,7 +1166,8 @@ of this helper program; chances are you did not intend to run this program.\n\
ElfW(Addr) allocend;
/* Remember where the main program starts in memory. */
- mapstart = (main_map->l_addr + (ph->p_vaddr & ~(ph->p_align - 1)));
+ mapstart = (main_map->l_addr
+ + (ph->p_vaddr & ~(GLRO(dl_pagesize) - 1)));
if (main_map->l_map_start > mapstart)
main_map->l_map_start = mapstart;
@@ -1405,6 +1435,12 @@ of this helper program; chances are you did not intend to run this program.\n\
initialize the data structures now. */
tcbp = init_tls ();
+ /* Initialize security features. We need to do it this early
+ since otherwise the constructors of the audit libraries will
+ use different values (especially the pointer guard) and will
+ fail later on. */
+ security_init ();
+
do
{
int tls_idx = GL(dl_tls_max_dtv_idx);
@@ -1815,29 +1851,10 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (tcbp == NULL)
tcbp = init_tls ();
- /* Set up the stack checker's canary. */
- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
-#ifdef THREAD_SET_STACK_GUARD
- THREAD_SET_STACK_GUARD (stack_chk_guard);
-#else
- __stack_chk_guard = stack_chk_guard;
-#endif
-
- /* Set up the pointer guard as well, if necessary. */
- if (GLRO(dl_pointer_guard))
- {
- // XXX If it is cheap, we should use a separate value.
- uintptr_t pointer_chk_guard = stack_chk_guard;
-#ifndef HP_TIMING_NONAVAIL
- hp_timing_t now;
- HP_TIMING_NOW (now);
- pointer_chk_guard ^= now;
-#endif
-#ifdef THREAD_SET_POINTER_GUARD
- THREAD_SET_POINTER_GUARD (pointer_chk_guard);
-#endif
- __pointer_chk_guard_local = pointer_chk_guard;
- }
+ if (__builtin_expect (audit_list == NULL, 1))
+ /* Initialize security features. But only if we have not done it
+ earlier. */
+ security_init ();
if (__builtin_expect (mode, normal) != normal)
{