Merge pull request #20 from ricmm/fix-new-kernels
Add protection key to calc_vm_prot_bits() on kernels >= 4.5.0
This commit is contained in:
commit
509055876b
1 changed files with 6 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue