diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2009-10-03 22:35:41 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-10-27 01:42:40 -0400 |
commit | 348aa3030096e61474a5537fed5bd69e70b755c0 (patch) | |
tree | 27b0f81348eacb9d3e6f987fa77e21915140969f /arch/powerpc/kernel | |
parent | 7de80284d60837f13ecb2347ba7bf57470309541 (diff) |
powerpc: Align vDSO base address
The ABI specifies a 64K alignment, we need to map the vDSO accordingly
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/vdso.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index 94e2df3cae07..137dc22afa42 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c | |||
@@ -50,6 +50,9 @@ | |||
50 | /* Max supported size for symbol names */ | 50 | /* Max supported size for symbol names */ |
51 | #define MAX_SYMNAME 64 | 51 | #define MAX_SYMNAME 64 |
52 | 52 | ||
53 | /* The alignment of the vDSO */ | ||
54 | #define VDSO_ALIGNMENT (1 << 16) | ||
55 | |||
53 | extern char vdso32_start, vdso32_end; | 56 | extern char vdso32_start, vdso32_end; |
54 | static void *vdso32_kbase = &vdso32_start; | 57 | static void *vdso32_kbase = &vdso32_start; |
55 | static unsigned int vdso32_pages; | 58 | static unsigned int vdso32_pages; |
@@ -231,15 +234,21 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
231 | * pick a base address for the vDSO in process space. We try to put it | 234 | * pick a base address for the vDSO in process space. We try to put it |
232 | * at vdso_base which is the "natural" base for it, but we might fail | 235 | * at vdso_base which is the "natural" base for it, but we might fail |
233 | * and end up putting it elsewhere. | 236 | * and end up putting it elsewhere. |
237 | * Add enough to the size so that the result can be aligned. | ||
234 | */ | 238 | */ |
235 | down_write(&mm->mmap_sem); | 239 | down_write(&mm->mmap_sem); |
236 | vdso_base = get_unmapped_area(NULL, vdso_base, | 240 | vdso_base = get_unmapped_area(NULL, vdso_base, |
237 | vdso_pages << PAGE_SHIFT, 0, 0); | 241 | (vdso_pages << PAGE_SHIFT) + |
242 | ((VDSO_ALIGNMENT - 1) & PAGE_MASK), | ||
243 | 0, 0); | ||
238 | if (IS_ERR_VALUE(vdso_base)) { | 244 | if (IS_ERR_VALUE(vdso_base)) { |
239 | rc = vdso_base; | 245 | rc = vdso_base; |
240 | goto fail_mmapsem; | 246 | goto fail_mmapsem; |
241 | } | 247 | } |
242 | 248 | ||
249 | /* Add required alignment. */ | ||
250 | vdso_base = ALIGN(vdso_base, VDSO_ALIGNMENT); | ||
251 | |||
243 | /* | 252 | /* |
244 | * Put vDSO base into mm struct. We need to do this before calling | 253 | * Put vDSO base into mm struct. We need to do this before calling |
245 | * install_special_mapping or the perf counter mmap tracking code | 254 | * install_special_mapping or the perf counter mmap tracking code |