lkml.org 
[lkml]   [2020]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 5/6] arm64/vdso: Restrict splitting VVAR VMA
From
Date
On 2/25/20 7:37 AM, Andrei Vagin wrote:
> Forbid splitting VVAR VMA resulting in a stricter ABI and reducing the
> amount of corner-cases to consider while working further on VDSO time
> namespace support.
>
> As the offset from timens to VVAR page is computed compile-time, the pages
> in VVAR should stay together and not being partically mremap()'ed.
>
> Signed-off-by: Andrei Vagin <avagin@gmail.com>

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

> ---
> arch/arm64/kernel/vdso.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
> index fb32c6f76078..c003f7ee383a 100644
> --- a/arch/arm64/kernel/vdso.c
> +++ b/arch/arm64/kernel/vdso.c
> @@ -235,6 +235,17 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
> return vmf_insert_pfn(vma, vmf->address, pfn);
> }
>
> +static int vvar_mremap(const struct vm_special_mapping *sm,
> + struct vm_area_struct *new_vma)
> +{
> + unsigned long new_size = new_vma->vm_end - new_vma->vm_start;
> +
> + if (new_size != VVAR_NR_PAGES * PAGE_SIZE)
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> static int __setup_additional_pages(enum arch_vdso_type arch_index,
> struct mm_struct *mm,
> struct linux_binprm *bprm,
> @@ -315,6 +326,7 @@ static struct vm_special_mapping aarch32_vdso_spec[C_PAGES] = {
> {
> .name = "[vvar]",
> .fault = vvar_fault,
> + .mremap = vvar_mremap,
> },
> {
> .name = "[vdso]",
> @@ -497,6 +509,7 @@ static struct vm_special_mapping vdso_spec[A_PAGES] __ro_after_init = {
> {
> .name = "[vvar]",
> .fault = vvar_fault,
> + .mremap = vvar_mremap,
> },
> {
> .name = "[vdso]",
>

--
Regards,
Vincenzo

\
 
 \ /
  Last update: 2020-04-09 14:05    [W:0.720 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site