From 0e895478a172e3ccf5689a12df706f92dd0694f1 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Thu, 25 Oct 2018 10:18:55 +0900 Subject: [PATCH] mcctrl rus_mmap: make vma->vm_flags arch-dependent [Dominique: renamed arch_vm_flags to arch_rus_vm_flags] Change-Id: I5ec89b3ff80af6bf0ede342eb5816df8c78de348 Fujitsu: POSTK_DEBUG_ARCH_DEP_100 --- executer/kernel/mcctrl/arch/arm64/include/archdeps.h | 6 ++++++ executer/kernel/mcctrl/arch/x86_64/include/archdeps.h | 6 ++++++ executer/kernel/mcctrl/syscall.c | 8 +------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/executer/kernel/mcctrl/arch/arm64/include/archdeps.h b/executer/kernel/mcctrl/arch/arm64/include/archdeps.h index 6e2df253..38bc111c 100644 --- a/executer/kernel/mcctrl/arch/arm64/include/archdeps.h +++ b/executer/kernel/mcctrl/arch/arm64/include/archdeps.h @@ -13,4 +13,10 @@ static inline bool pte_is_write_combined(pte_t pte) return ((pte_val(pte) & PTE_ATTRINDX_MASK) == PFN_WRITE_COMBINED); } #endif /* POSTK_DEBUG_ARCH_DEP_12 */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) +static const unsigned long arch_rus_vm_flags = VM_RESERVED | VM_MIXEDMAP | VM_EXEC; +#else +static const unsigned long arch_rus_vm_flags = VM_DONTDUMP | VM_MIXEDMAP | VM_EXEC; +#endif #endif /* __HEADER_MCCTRL_ARM64_ARCHDEPS_H */ diff --git a/executer/kernel/mcctrl/arch/x86_64/include/archdeps.h b/executer/kernel/mcctrl/arch/x86_64/include/archdeps.h index 4656343f..fad7988b 100644 --- a/executer/kernel/mcctrl/arch/x86_64/include/archdeps.h +++ b/executer/kernel/mcctrl/arch/x86_64/include/archdeps.h @@ -13,4 +13,10 @@ static inline bool pte_is_write_combined(pte_t pte) return ((pte_flags(pte) & _PAGE_PWT) && !(pte_flags(pte) & _PAGE_PCD)); } #endif /* POSTK_DEBUG_ARCH_DEP_12 */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) +static const unsigned long arch_rus_vm_flags = VM_RESERVED | VM_MIXEDMAP; +#else +static const unsigned long arch_rus_vm_flags = VM_DONTDUMP | VM_MIXEDMAP; +#endif #endif /* __HEADER_MCCTRL_X86_64_ARCHDEPS_H */ diff --git a/executer/kernel/mcctrl/syscall.c b/executer/kernel/mcctrl/syscall.c index 80917747..4c5244b4 100644 --- a/executer/kernel/mcctrl/syscall.c +++ b/executer/kernel/mcctrl/syscall.c @@ -910,13 +910,7 @@ static struct vm_operations_struct rus_vmops = { static int rus_mmap(struct file *file, struct vm_area_struct *vma) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) -// vma->vm_flags |= VM_RESERVED | VM_DONTEXPAND | VM_MIXEDMAP; - vma->vm_flags |= VM_RESERVED | VM_MIXEDMAP; -#else -// vma->vm_flags |= VM_DONTDUMP | VM_DONTEXPAND | VM_MIXEDMAP; - vma->vm_flags |= VM_DONTDUMP | VM_MIXEDMAP; -#endif + vma->vm_flags |= arch_rus_vm_flags; vma->vm_ops = &rus_vmops; return 0; }