diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2020-09-27 09:16:28 +0000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2020-12-04 01:01:16 +1100 |
commit | 526a9c4a7234cccf6d900c6e82d79356f974cbfd (patch) | |
tree | d02cd9ecb6785a4d5f41cf9e70430ca2c152a209 /arch/powerpc/kernel/vdso.c | |
parent | c1bab64360e6850ca54305d2f1902dac829c9752 (diff) | |
download | linux-526a9c4a7234cccf6d900c6e82d79356f974cbfd.tar.gz |
powerpc/vdso: Provide vdso_remap()
Provide vdso_remap() through _install_special_mapping() and
drop arch_remap().
This adds a test of the size and returns -EINVAL if the size
is not correct.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/373c66f768fa9cc8890f3b55462209a98c522326.1601197618.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/kernel/vdso.c')
-rw-r--r-- | arch/powerpc/kernel/vdso.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index 67fb4c7e504c..2b975759a04d 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c @@ -115,13 +115,37 @@ struct lib64_elfinfo unsigned long text; }; +static int vdso_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma, + unsigned long text_size) +{ + unsigned long new_size = new_vma->vm_end - new_vma->vm_start; + + if (new_size != text_size + PAGE_SIZE) + return -EINVAL; + + current->mm->context.vdso_base = new_vma->vm_start; + + return 0; +} + +static int vdso32_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma) +{ + return vdso_mremap(sm, new_vma, &vdso32_end - &vdso32_start); +} + +static int vdso64_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma) +{ + return vdso_mremap(sm, new_vma, &vdso64_end - &vdso64_start); +} static struct vm_special_mapping vdso32_spec __ro_after_init = { .name = "[vdso]", + .mremap = vdso32_mremap, }; static struct vm_special_mapping vdso64_spec __ro_after_init = { .name = "[vdso]", + .mremap = vdso64_mremap, }; /* |