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
This commit is contained in:
Dominique Martinet
2018-10-25 10:18:55 +09:00
parent 19659aa908
commit 0e895478a1
3 changed files with 13 additions and 7 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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;
}