]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - arch/x86/mm/hugetlbpage.c
x86/mpx: Do not allow MPX if we have mappings above 47-bit
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / mm / hugetlbpage.c
index 2824607df1081fe38a96d5e8af70e7c295e43ed5..3cf89ad00f87bda480fa2ea3d495ecfe0e53f088 100644 (file)
@@ -18,6 +18,7 @@
 #include <asm/tlbflush.h>
 #include <asm/pgalloc.h>
 #include <asm/elf.h>
+#include <asm/mpx.h>
 
 #if 0  /* This is just for testing */
 struct page *
@@ -86,7 +87,7 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file,
        info.length = len;
        info.low_limit = get_mmap_base(1);
        info.high_limit = in_compat_syscall() ?
-               tasksize_32bit() : tasksize_64bit();
+               task_size_32bit() : task_size_64bit();
        info.align_mask = PAGE_MASK & ~huge_page_mask(h);
        info.align_offset = 0;
        return vm_unmapped_area(&info);
@@ -135,6 +136,11 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 
        if (len & ~huge_page_mask(h))
                return -EINVAL;
+
+       addr = mpx_unmapped_area_check(addr, len, flags);
+       if (IS_ERR_VALUE(addr))
+               return addr;
+
        if (len > TASK_SIZE)
                return -ENOMEM;