Commit dfc11c98 authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik

s390/vdso: get rid of vdso_fault

Implement vdso mapping similar to arm64 and powerpc.
Reviewed-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 8d4be7f3
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
extern char vdso64_start[], vdso64_end[]; extern char vdso64_start[], vdso64_end[];
static unsigned int vdso_pages; static unsigned int vdso_pages;
static struct page **vdso_pagelist;
static union { static union {
struct vdso_data data[CS_BASES]; struct vdso_data data[CS_BASES];
...@@ -41,17 +40,6 @@ static int __init vdso_setup(char *str) ...@@ -41,17 +40,6 @@ static int __init vdso_setup(char *str)
} }
__setup("vdso=", vdso_setup); __setup("vdso=", vdso_setup);
static vm_fault_t vdso_fault(const struct vm_special_mapping *sm,
struct vm_area_struct *vma, struct vm_fault *vmf)
{
if (vmf->pgoff >= vdso_pages)
return VM_FAULT_SIGBUS;
vmf->page = vdso_pagelist[vmf->pgoff];
get_page(vmf->page);
return 0;
}
static int vdso_mremap(const struct vm_special_mapping *sm, static int vdso_mremap(const struct vm_special_mapping *sm,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
...@@ -59,9 +47,8 @@ static int vdso_mremap(const struct vm_special_mapping *sm, ...@@ -59,9 +47,8 @@ static int vdso_mremap(const struct vm_special_mapping *sm,
return 0; return 0;
} }
static const struct vm_special_mapping vdso_mapping = { static struct vm_special_mapping vdso_mapping = {
.name = "[vdso]", .name = "[vdso]",
.fault = vdso_fault,
.mremap = vdso_mremap, .mremap = vdso_mremap,
}; };
...@@ -113,24 +100,20 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) ...@@ -113,24 +100,20 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
static int __init vdso_init(void) static int __init vdso_init(void)
{ {
struct page **pages;
int i; int i;
vdso_pages = ((vdso64_end - vdso64_start) >> PAGE_SHIFT) + 1; vdso_pages = ((vdso64_end - vdso64_start) >> PAGE_SHIFT) + 1;
/* Make sure pages are in the correct state */ pages = kcalloc(vdso_pages + 1, sizeof(struct page *), GFP_KERNEL);
vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *), if (!pages) {
GFP_KERNEL);
if (!vdso_pagelist) {
vdso_enabled = 0; vdso_enabled = 0;
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < vdso_pages - 1; i++) { for (i = 0; i < vdso_pages - 1; i++)
struct page *pg = virt_to_page(vdso64_start + i * PAGE_SIZE); pages[i] = virt_to_page(vdso64_start + i * PAGE_SIZE);
get_page(pg); pages[vdso_pages - 1] = virt_to_page(vdso_data);
vdso_pagelist[i] = pg; pages[vdso_pages] = NULL;
} vdso_mapping.pages = pages;
vdso_pagelist[vdso_pages - 1] = virt_to_page(vdso_data);
vdso_pagelist[vdso_pages] = NULL;
get_page(virt_to_page(vdso_data));
return 0; return 0;
} }
arch_initcall(vdso_init); arch_initcall(vdso_init);
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