[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r4040 - in /fsf/trunk/libc: ChangeLog elf/rtld.c sysdeps/x86_64/dl-trampoline.S
- To: commits@xxxxxxxxxx
- Subject: [commits] r4040 - in /fsf/trunk/libc: ChangeLog elf/rtld.c sysdeps/x86_64/dl-trampoline.S
- From: eglibc@xxxxxxxxxx
- Date: Thu, 01 Nov 2007 07:03:39 -0000
Author: eglibc
Date: Thu Nov 1 00:03:37 2007
New Revision: 4040
Log:
Import glibc-mainline for 2007-11-01
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/elf/rtld.c
fsf/trunk/libc/sysdeps/x86_64/dl-trampoline.S
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Nov 1 00:03:37 2007
@@ -1,3 +1,11 @@
+2007-10-31 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Make sure
+ stack is properly aligned for the target function.
+ Correct unwind info.
+ * elf/rtld.c (dl_main): Initialize stack and pointer guard early
+ when using auditing libraries.
+
2007-10-29 Ulrich Drepper <drepper@xxxxxxxxxx>
* resolv/Versions [libresolv] (GLIBC_PRIVATE): Add
Modified: fsf/trunk/libc/elf/rtld.c
==============================================================================
--- fsf/trunk/libc/elf/rtld.c (original)
+++ fsf/trunk/libc/elf/rtld.c Thu Nov 1 00:03:37 2007
@@ -831,6 +831,35 @@
__rtld_lock_default_unlock_recursive (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. */
@@ -1405,6 +1434,12 @@
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 +1850,10 @@
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)
{
Modified: fsf/trunk/libc/sysdeps/x86_64/dl-trampoline.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/dl-trampoline.S (original)
+++ fsf/trunk/libc/sysdeps/x86_64/dl-trampoline.S Thu Nov 1 00:03:37 2007
@@ -62,8 +62,8 @@
.align 16
cfi_startproc
_dl_runtime_profile:
- subq $80, %rsp
- cfi_adjust_cfa_offset(96) # Incorporate PLT
+ subq $88, %rsp
+ cfi_adjust_cfa_offset(104) # Incorporate PLT
movq %rax, (%rsp) # Preserve registers otherwise clobbered.
movq %rdx, 8(%rsp)
movq %r8, 16(%rsp)
@@ -72,16 +72,16 @@
movq %rsi, 40(%rsp)
movq %rdi, 48(%rsp)
movq %rbp, 56(%rsp) # Information for auditors.
- leaq 96(%rsp), %rax
+ leaq 104(%rsp), %rax
movq %rax, 64(%rsp)
leaq 8(%rsp), %rcx
- movq 96(%rsp), %rdx # Load return address if needed
- movq 88(%rsp), %rsi # Copy args pushed by PLT in register.
+ movq 104(%rsp), %rdx # Load return address if needed
+ movq 96(%rsp), %rsi # Copy args pushed by PLT in register.
movq %rsi,%r11 # Multiply by 24
addq %r11,%rsi
addq %r11,%rsi
shlq $3, %rsi
- movq 80(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset
+ movq 88(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset
leaq 72(%rsp), %r8
call _dl_profile_fixup # Call resolver.
movq %rax, %r11 # Save return value
@@ -95,14 +95,15 @@
movq 32(%rsp), %rcx
movq 40(%rsp), %rsi
movq 48(%rsp), %rdi
- addq $96,%rsp # Adjust stack
- cfi_adjust_cfa_offset (-96)
+ addq $104,%rsp # Adjust stack
+ cfi_adjust_cfa_offset (-104)
jmp *%r11 # Jump to function address.
/*
- +96 return address
- +88 PLT2
- +80 PLT1
+ +104 return address
+ +96 PLT2
+ +88 PLT1
+ +80 free
+72 free
+64 %rsp
+56 %rbp
@@ -112,14 +113,14 @@
+24 %r9
+16 %r8
+8 %rdx
- %esp %rax
+ %rsp %rax
*/
- cfi_adjust_cfa_offset (96)
+ cfi_adjust_cfa_offset (104)
1: movq %rbx, 72(%rsp)
- cfi_rel_offset (1, 72)
- leaq 104(%rsp), %rsi
+ cfi_rel_offset (rbx, 72)
+ leaq 112(%rsp), %rsi
movq %rsp, %rbx
- cfi_def_cfa_register (1)
+ cfi_def_cfa_register (%rbx)
movq %r10, %rcx
addq $8, %r10
andq $0xfffffffffffffff0, %r10
@@ -133,7 +134,7 @@
movq 48(%rbx), %rdi
call *%r11
movq %rbx, %rsp
- cfi_def_cfa_register (7)
+ cfi_def_cfa_register (%rsp)
subq $72, %rsp
cfi_adjust_cfa_offset (72)
movq %rsp, %rcx
@@ -147,9 +148,10 @@
fstpt 48(%rcx)
fstpt 64(%rcx)
/*
- +168 return address
- +160 PLT2
- +152 PLT1
+ +176 return address
+ +168 PLT2
+ +160 PLT1
+ +152 free
+144 free
+136 %rsp
+128 %rbp
@@ -164,17 +166,17 @@
+32 %xmm1 result
+16 %xmm0 result
+8 %rdx result
- %esp %rax result
+ %rsp %rax result
*/
leaq 80(%rsp), %rdx
movq 144(%rsp), %rbx
- cfi_restore (1)
- movq 160(%rsp), %rsi # Copy args pushed by PLT in register.
+ cfi_restore (rbx)
+ movq 168(%rsp), %rsi # Copy args pushed by PLT in register.
movq %rsi,%r11 # Multiply by 24
addq %r11,%rsi
addq %r11,%rsi
shlq $3, %rsi
- movq 152(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset
+ movq 160(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset
call _dl_call_pltexit
movq (%rsp), %rax
movq 8(%rsp), %rdx
@@ -182,8 +184,8 @@
movups 32(%rsp), %xmm1
fldt 64(%rsp)
fldt 48(%rsp)
- addq $168, %rsp
- cfi_adjust_cfa_offset (-168)
+ addq $176, %rsp
+ cfi_adjust_cfa_offset (-176)
retq
cfi_endproc
.size _dl_runtime_profile, .-_dl_runtime_profile