|
@@ -33,6 +33,7 @@
|
|
#include <asm/uaccess.h>
|
|
#include <asm/uaccess.h>
|
|
#include <asm/tlb.h>
|
|
#include <asm/tlb.h>
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/tlbflush.h>
|
|
|
|
+#include <asm/mmu_context.h>
|
|
#include "internal.h"
|
|
#include "internal.h"
|
|
|
|
|
|
static inline __attribute__((format(printf, 1, 2)))
|
|
static inline __attribute__((format(printf, 1, 2)))
|
|
@@ -622,6 +623,22 @@ static void put_nommu_region(struct vm_region *region)
|
|
__put_nommu_region(region);
|
|
__put_nommu_region(region);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * update protection on a vma
|
|
|
|
+ */
|
|
|
|
+static void protect_vma(struct vm_area_struct *vma, unsigned long flags)
|
|
|
|
+{
|
|
|
|
+#ifdef CONFIG_MPU
|
|
|
|
+ struct mm_struct *mm = vma->vm_mm;
|
|
|
|
+ long start = vma->vm_start & PAGE_MASK;
|
|
|
|
+ while (start < vma->vm_end) {
|
|
|
|
+ protect_page(mm, start, flags);
|
|
|
|
+ start += PAGE_SIZE;
|
|
|
|
+ }
|
|
|
|
+ update_protections(mm);
|
|
|
|
+#endif
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* add a VMA into a process's mm_struct in the appropriate place in the list
|
|
* add a VMA into a process's mm_struct in the appropriate place in the list
|
|
* and tree and add to the address space's page tree also if not an anonymous
|
|
* and tree and add to the address space's page tree also if not an anonymous
|
|
@@ -641,6 +658,8 @@ static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma)
|
|
mm->map_count++;
|
|
mm->map_count++;
|
|
vma->vm_mm = mm;
|
|
vma->vm_mm = mm;
|
|
|
|
|
|
|
|
+ protect_vma(vma, vma->vm_flags);
|
|
|
|
+
|
|
/* add the VMA to the mapping */
|
|
/* add the VMA to the mapping */
|
|
if (vma->vm_file) {
|
|
if (vma->vm_file) {
|
|
mapping = vma->vm_file->f_mapping;
|
|
mapping = vma->vm_file->f_mapping;
|
|
@@ -703,6 +722,8 @@ static void delete_vma_from_mm(struct vm_area_struct *vma)
|
|
|
|
|
|
kenter("%p", vma);
|
|
kenter("%p", vma);
|
|
|
|
|
|
|
|
+ protect_vma(vma, 0);
|
|
|
|
+
|
|
mm->map_count--;
|
|
mm->map_count--;
|
|
if (mm->mmap_cache == vma)
|
|
if (mm->mmap_cache == vma)
|
|
mm->mmap_cache = NULL;
|
|
mm->mmap_cache = NULL;
|