summaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/vdso.c
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2021-02-05 16:09:14 +0100
committerVasily Gorbik <gor@linux.ibm.com>2021-02-09 15:57:05 +0100
commit214b3564869cd93258616411962a6fceef2c5ec7 (patch)
tree2dc0bd2a03c842ffdd987329968c0b951b8df841 /arch/s390/kernel/vdso.c
parents390/vdso: put vdso datapage in a separate vma (diff)
downloadlinux-214b3564869cd93258616411962a6fceef2c5ec7.tar.xz
linux-214b3564869cd93258616411962a6fceef2c5ec7.zip
s390/vdso: move data page before code pages
For consistency with x86 and arm64 move the data page before code pages. Similar to commit 601255ae3c98 ("arm64: vdso: move data page before code pages"). Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel/vdso.c')
-rw-r--r--arch/s390/kernel/vdso.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index 968b263f64b4..31920b76ae6d 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -74,7 +74,8 @@ early_initcall(vdso_getcpu_init); /* Must be called before SMP init */
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
{
- unsigned long addr, vdso_text_start, vdso_text_len, vdso_mapping_len;
+ unsigned long vdso_text_len, vdso_mapping_len;
+ unsigned long vvar_start, vdso_text_start;
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
int rc;
@@ -85,25 +86,24 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
return -EINTR;
vdso_text_len = vdso_pages << PAGE_SHIFT;
vdso_mapping_len = vdso_text_len + PAGE_SIZE;
- addr = get_unmapped_area(NULL, 0, vdso_mapping_len, 0, 0);
- rc = addr;
- if (IS_ERR_VALUE(addr))
+ vvar_start = get_unmapped_area(NULL, 0, vdso_mapping_len, 0, 0);
+ rc = vvar_start;
+ if (IS_ERR_VALUE(vvar_start))
goto out;
+ vma = _install_special_mapping(mm, vvar_start, PAGE_SIZE,
+ VM_READ|VM_MAYREAD|VM_PFNMAP,
+ &vvar_mapping);
+ rc = PTR_ERR(vma);
+ if (IS_ERR(vma))
+ goto out;
+ vdso_text_start = vvar_start + PAGE_SIZE;
/* VM_MAYWRITE for COW so gdb can set breakpoints */
- vdso_text_start = addr;
- vma = _install_special_mapping(mm, addr, vdso_text_len,
+ vma = _install_special_mapping(mm, vdso_text_start, vdso_text_len,
VM_READ|VM_EXEC|
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
&vdso_mapping);
- rc = PTR_ERR(vma);
- if (IS_ERR(vma))
- goto out;
- addr += vdso_text_len;
- vma = _install_special_mapping(mm, addr, PAGE_SIZE,
- VM_READ|VM_MAYREAD|VM_PFNMAP,
- &vvar_mapping);
if (IS_ERR(vma)) {
- do_munmap(mm, vdso_text_start, vdso_text_len, NULL);
+ do_munmap(mm, vvar_start, PAGE_SIZE, NULL);
rc = PTR_ERR(vma);
} else {
current->mm->context.vdso_base = vdso_text_start;