Skip to content
  • Kirill A. Shutemov's avatar
    x86/mpx: Do not allow MPX if we have mappings above 47-bit · 44b04912
    Kirill A. Shutemov authored and Ingo Molnar's avatar Ingo Molnar committed
    
    
    MPX (without MAWA extension) cannot handle addresses above 47 bits, so we
    need to make sure that MPX cannot be enabled if we already have a VMA above
    the boundary and forbid creating such VMAs once MPX is enabled.
    
    The patch implements mpx_unmapped_area_check() which is called from all
    variants of get_unmapped_area() to check if the requested address fits
    mpx.
    
    On enabling MPX, we check if we already have any vma above 47-bit
    boundary and forbit the enabling if we do.
    
    As long as DEFAULT_MAP_WINDOW is equal to TASK_SIZE_MAX, the change is
    nop. It will change when we allow userspace to have mappings above
    47-bits.
    
    Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/20170716225954.74185-6-kirill.shutemov@linux.intel.com
    
    
    [ Readability edits. ]
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    44b04912