aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2009-10-03 22:35:41 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-10-27 01:42:40 -0400
commit348aa3030096e61474a5537fed5bd69e70b755c0 (patch)
tree27b0f81348eacb9d3e6f987fa77e21915140969f /arch/powerpc/kernel
parent7de80284d60837f13ecb2347ba7bf57470309541 (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.c11
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
53extern char vdso32_start, vdso32_end; 56extern char vdso32_start, vdso32_end;
54static void *vdso32_kbase = &vdso32_start; 57static void *vdso32_kbase = &vdso32_start;
55static unsigned int vdso32_pages; 58static 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