提交 498513c7 编写于 作者: R Ricardo Mendoza

Add protection key to calc_vm_prot_bits() if building under kernel >= 4.5.0

上级 8e262fe5
......@@ -33,6 +33,7 @@
#include <linux/bitops.h>
#include <linux/mutex.h>
#include <linux/shmem_fs.h>
#include <linux/version.h>
#include "ashmem.h"
#define ASHMEM_NAME_PREFIX "dev/ashmem/"
......@@ -373,8 +374,13 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
}
/* requested protection bits must match our allowed protection mask */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
if (unlikely((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
calc_vm_prot_bits(PROT_MASK, 0))) {
#else
if (unlikely((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask)) &
calc_vm_prot_bits(PROT_MASK))) {
#endif
ret = -EPERM;
goto out;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册