diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2007-05-02 13:27:12 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:12 -0400 |
commit | d4f7a2c18e59e0304a1c733589ce14fc02fec1bd (patch) | |
tree | 99c64275f7eb50925aad71a74ae083ececdbb795 /include/asm-i386 | |
parent | a6c4e076ee4c1ea670e4faa55814e63dd08e3f29 (diff) |
[PATCH] i386: Relocate VDSO ELF headers to match mapped location with COMPAT_VDSO
Some versions of libc can't deal with a VDSO which doesn't have its
ELF headers matching its mapped address. COMPAT_VDSO maps the VDSO at
a specific system-wide fixed address. Previously this was all done at
build time, on the grounds that the fixed VDSO address is always at
the top of the address space. However, a hypervisor may reserve some
of that address space, pushing the fixmap address down.
This patch does the adjustment dynamically at runtime, depending on
the runtime location of the VDSO fixmap.
[ Patch has been through several hands: Jan Beulich wrote the orignal
version; Zach reworked it, and Jeremy converted it to relocate phdrs
as well as sections. ]
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Zachary Amsden <zach@vmware.com>
Cc: "Jan Beulich" <JBeulich@novell.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Roland McGrath <roland@redhat.com>
Diffstat (limited to 'include/asm-i386')
-rw-r--r-- | include/asm-i386/elf.h | 28 | ||||
-rw-r--r-- | include/asm-i386/fixmap.h | 8 |
2 files changed, 12 insertions, 24 deletions
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index 952b3ee3c9bb..d304ab4161ff 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h | |||
@@ -133,39 +133,31 @@ extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct | |||
133 | #define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs) | 133 | #define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs) |
134 | 134 | ||
135 | #define VDSO_HIGH_BASE (__fix_to_virt(FIX_VDSO)) | 135 | #define VDSO_HIGH_BASE (__fix_to_virt(FIX_VDSO)) |
136 | #define VDSO_BASE ((unsigned long)current->mm->context.vdso) | 136 | #define VDSO_CURRENT_BASE ((unsigned long)current->mm->context.vdso) |
137 | 137 | #define VDSO_PRELINK 0 | |
138 | #ifdef CONFIG_COMPAT_VDSO | ||
139 | # define VDSO_COMPAT_BASE VDSO_HIGH_BASE | ||
140 | # define VDSO_PRELINK VDSO_HIGH_BASE | ||
141 | #else | ||
142 | # define VDSO_COMPAT_BASE VDSO_BASE | ||
143 | # define VDSO_PRELINK 0 | ||
144 | #endif | ||
145 | 138 | ||
146 | #define VDSO_SYM(x) \ | 139 | #define VDSO_SYM(x) \ |
147 | (VDSO_COMPAT_BASE + (unsigned long)(x) - VDSO_PRELINK) | 140 | (VDSO_CURRENT_BASE + (unsigned long)(x) - VDSO_PRELINK) |
148 | 141 | ||
149 | #define VDSO_HIGH_EHDR ((const struct elfhdr *) VDSO_HIGH_BASE) | 142 | #define VDSO_HIGH_EHDR ((const struct elfhdr *) VDSO_HIGH_BASE) |
150 | #define VDSO_EHDR ((const struct elfhdr *) VDSO_COMPAT_BASE) | 143 | #define VDSO_EHDR ((const struct elfhdr *) VDSO_CURRENT_BASE) |
151 | 144 | ||
152 | extern void __kernel_vsyscall; | 145 | extern void __kernel_vsyscall; |
153 | 146 | ||
154 | #define VDSO_ENTRY VDSO_SYM(&__kernel_vsyscall) | 147 | #define VDSO_ENTRY VDSO_SYM(&__kernel_vsyscall) |
155 | 148 | ||
156 | #ifndef CONFIG_COMPAT_VDSO | ||
157 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES | ||
158 | struct linux_binprm; | 149 | struct linux_binprm; |
150 | |||
151 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES | ||
159 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, | 152 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, |
160 | int executable_stack); | 153 | int executable_stack); |
161 | #endif | ||
162 | 154 | ||
163 | extern unsigned int vdso_enabled; | 155 | extern unsigned int vdso_enabled; |
164 | 156 | ||
165 | #define ARCH_DLINFO \ | 157 | #define ARCH_DLINFO \ |
166 | do if (vdso_enabled) { \ | 158 | do if (vdso_enabled) { \ |
167 | NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \ | 159 | NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \ |
168 | NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE); \ | 160 | NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_CURRENT_BASE); \ |
169 | } while (0) | 161 | } while (0) |
170 | 162 | ||
171 | #endif | 163 | #endif |
diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h index 3e9f610c35df..e5651b2a585a 100644 --- a/include/asm-i386/fixmap.h +++ b/include/asm-i386/fixmap.h | |||
@@ -19,13 +19,9 @@ | |||
19 | * Leave one empty page between vmalloc'ed areas and | 19 | * Leave one empty page between vmalloc'ed areas and |
20 | * the start of the fixmap. | 20 | * the start of the fixmap. |
21 | */ | 21 | */ |
22 | #ifndef CONFIG_COMPAT_VDSO | ||
23 | extern unsigned long __FIXADDR_TOP; | 22 | extern unsigned long __FIXADDR_TOP; |
24 | #else | 23 | #define FIXADDR_USER_START __fix_to_virt(FIX_VDSO) |
25 | #define __FIXADDR_TOP 0xfffff000 | 24 | #define FIXADDR_USER_END __fix_to_virt(FIX_VDSO - 1) |
26 | #define FIXADDR_USER_START __fix_to_virt(FIX_VDSO) | ||
27 | #define FIXADDR_USER_END __fix_to_virt(FIX_VDSO - 1) | ||
28 | #endif | ||
29 | 25 | ||
30 | #ifndef __ASSEMBLY__ | 26 | #ifndef __ASSEMBLY__ |
31 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |