Skip to content

Commit bcf9964

Browse files
avaginctmarinas
authored andcommitted
arm64/vdso: Restrict splitting VVAR VMA
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]>
1 parent ee3cda8 commit bcf9964

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

arch/arm64/kernel/vdso.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,17 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
223223
return vmf_insert_pfn(vma, vmf->address, pfn);
224224
}
225225

226+
static int vvar_mremap(const struct vm_special_mapping *sm,
227+
struct vm_area_struct *new_vma)
228+
{
229+
unsigned long new_size = new_vma->vm_end - new_vma->vm_start;
230+
231+
if (new_size != VVAR_NR_PAGES * PAGE_SIZE)
232+
return -EINVAL;
233+
234+
return 0;
235+
}
236+
226237
static int __setup_additional_pages(enum vdso_abi abi,
227238
struct mm_struct *mm,
228239
struct linux_binprm *bprm,
@@ -302,6 +313,7 @@ static struct vm_special_mapping aarch32_vdso_maps[] = {
302313
[AA32_MAP_VVAR] = {
303314
.name = "[vvar]",
304315
.fault = vvar_fault,
316+
.mremap = vvar_mremap,
305317
},
306318
[AA32_MAP_VDSO] = {
307319
.name = "[vdso]",
@@ -468,6 +480,7 @@ static struct vm_special_mapping aarch64_vdso_maps[] __ro_after_init = {
468480
[AA64_MAP_VVAR] = {
469481
.name = "[vvar]",
470482
.fault = vvar_fault,
483+
.mremap = vvar_mremap,
471484
},
472485
[AA64_MAP_VDSO] = {
473486
.name = "[vdso]",

0 commit comments

Comments
 (0)