Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
arm64/vdso: Restrict splitting VVAR VMA
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Vincenzo Frascino <[email protected]>
Reviewed-by: Dmitry Safonov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Catalin Marinas <[email protected]>
  • Loading branch information
avagin authored and ctmarinas committed Jul 24, 2020
1 parent ee3cda8 commit bcf9964
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions arch/arm64/kernel/vdso.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,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 vdso_abi abi,
struct mm_struct *mm,
struct linux_binprm *bprm,
Expand Down Expand Up @@ -302,6 +313,7 @@ static struct vm_special_mapping aarch32_vdso_maps[] = {
[AA32_MAP_VVAR] = {
.name = "[vvar]",
.fault = vvar_fault,
.mremap = vvar_mremap,
},
[AA32_MAP_VDSO] = {
.name = "[vdso]",
Expand Down Expand Up @@ -468,6 +480,7 @@ static struct vm_special_mapping aarch64_vdso_maps[] __ro_after_init = {
[AA64_MAP_VVAR] = {
.name = "[vvar]",
.fault = vvar_fault,
.mremap = vvar_mremap,
},
[AA64_MAP_VDSO] = {
.name = "[vdso]",
Expand Down

0 comments on commit bcf9964

Please sign in to comment.