UBUNTU: SAUCE: nx-emu: use upstream ASLR when possible
authorKees Cook <kees.cook@canonical.com>
Fri, 5 Nov 2010 20:05:37 +0000 (13:05 -0700)
committerLeann Ogasawara <leann.ogasawara@canonical.com>
Mon, 28 Mar 2011 13:50:19 +0000 (06:50 -0700)
Only perform ASCII-armor ASLR when nx-emulation is happening.

Signed-off-by: Kees Cook <kees.cook@canonical.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>

arch/x86/mm/mmap.c

index 619fff6..ff3a3bf 100644 (file)
@@ -131,9 +131,12 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
        } else {
                mm->mmap_base = mmap_base();
                mm->get_unmapped_area = arch_get_unmapped_area_topdown;
+#ifdef CONFIG_X86_32
                if (!(current->personality & READ_IMPLIES_EXEC)
+                   && !(__supported_pte_mask & _PAGE_NX)
                    && mmap_is_ia32())
                        mm->get_unmapped_exec_area = arch_get_unmapped_exec_area;
+#endif
                mm->unmap_area = arch_unmap_area_topdown;
        }
 }