um: Mark stub pages mapping with VM_PFNMAP
authorRichard Weinberger <richard@nod.at>
Sun, 12 May 2013 21:26:03 +0000 (23:26 +0200)
committerRichard Weinberger <richard@nod.at>
Fri, 19 Jul 2013 08:45:17 +0000 (10:45 +0200)
Ensure that a process cannot destroy his stub pages with
using MADV_DONTNEED and friends.

Reported-by: toralf.foerster@gmx.de
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/kernel/skas/mmu.c

index ff03067a3b1496acf3725019b31ed17020ea5233..007d5503f49b79bfccbfbe842bbe630fbc625ac1 100644 (file)
@@ -123,7 +123,7 @@ void uml_setup_stubs(struct mm_struct *mm)
        /* dup_mmap already holds mmap_sem */
        err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START,
                                      VM_READ | VM_MAYREAD | VM_EXEC |
-                                     VM_MAYEXEC | VM_DONTCOPY,
+                                     VM_MAYEXEC | VM_DONTCOPY | VM_PFNMAP,
                                      mm->context.stub_pages);
        if (err) {
                printk(KERN_ERR "install_special_mapping returned %d\n", err);