Commit 8a8f7866 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/vdso: Don't map VDSO at a fixed address on PPC32

PPC64 removed default mapping address from VDSO in
commit 30d0b368 ("powerpc: Move 64bit VDSO to improve context
switch performance").

Do like PPC64 and let get_unmapped_area() place the VDSO mapping
at the address it wants, don't force a default address.

This allows randomisation of VDSO address.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/cba76f5a5b01fcc49415e632d92c11c1c5998cab.1660843877.git.christophe.leroy@csgroup.eu
parent c814bf95
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
#ifndef _ASM_POWERPC_VDSO_H #ifndef _ASM_POWERPC_VDSO_H
#define _ASM_POWERPC_VDSO_H #define _ASM_POWERPC_VDSO_H
/* Default map addresses for 32bit vDSO */
#define VDSO32_MBASE 0x100000
#define VDSO_VERSION_STRING LINUX_2.6.15 #define VDSO_VERSION_STRING LINUX_2.6.15
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -200,28 +200,19 @@ static int __arch_setup_additional_pages(struct linux_binprm *bprm, int uses_int ...@@ -200,28 +200,19 @@ static int __arch_setup_additional_pages(struct linux_binprm *bprm, int uses_int
if (is_32bit_task()) { if (is_32bit_task()) {
vdso_spec = &vdso32_spec; vdso_spec = &vdso32_spec;
vdso_size = &vdso32_end - &vdso32_start; vdso_size = &vdso32_end - &vdso32_start;
vdso_base = VDSO32_MBASE;
} else { } else {
vdso_spec = &vdso64_spec; vdso_spec = &vdso64_spec;
vdso_size = &vdso64_end - &vdso64_start; vdso_size = &vdso64_end - &vdso64_start;
/*
* On 64bit we don't have a preferred map address. This
* allows get_unmapped_area to find an area near other mmaps
* and most likely share a SLB entry.
*/
vdso_base = 0;
} }
mappings_size = vdso_size + vvar_size; mappings_size = vdso_size + vvar_size;
mappings_size += (VDSO_ALIGNMENT - 1) & PAGE_MASK; mappings_size += (VDSO_ALIGNMENT - 1) & PAGE_MASK;
/* /*
* pick a base address for the vDSO in process space. We try to put it * Pick a base address for the vDSO in process space.
* at vdso_base which is the "natural" base for it, but we might fail
* and end up putting it elsewhere.
* Add enough to the size so that the result can be aligned. * Add enough to the size so that the result can be aligned.
*/ */
vdso_base = get_unmapped_area(NULL, vdso_base, mappings_size, 0, 0); vdso_base = get_unmapped_area(NULL, 0, mappings_size, 0, 0);
if (IS_ERR_VALUE(vdso_base)) if (IS_ERR_VALUE(vdso_base))
return vdso_base; return vdso_base;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment