• Dave Hansen's avatar
    x86/pti: Fix boot warning from Global-bit setting · 58e65b51
    Dave Hansen authored
    commit 231df823c4f04176f607afc4576c989895cff40e
    
    The pageattr.c code attempts to process "faults" when it goes looking
    for PTEs to change and finds non-present entries.  It allows these
    faults in the linear map which is "expected to have holes", but
    WARN()s about them elsewhere, like when called on the kernel image.
    
    However, change_page_attr_clear() is now called on the kernel image in the
    process of trying to clear the Global bit.
    
    This trips the warning in __cpa_process_fault() if a non-present PTE is
    encountered in the kernel image.  The "holes" in the kernel image result
    from free_init_pages()'s use of set_memory_np().  These holes are totally
    fine, and result from normal operation, just as they would be in the kernel
    linear map.
    
    Just silence the warning when holes in the kernel image are encountered.
    
    Fixes: 39114b7a (x86/pti: Never implicitly clear _PAGE_GLOBAL for kernel image)
    Reported-by: default avatarMariusz Ceier <mceier@gmail.com>
    Reported-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
    Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Tested-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
    Acked-by: default avatarIngo Molnar <mingo@kernel.org>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: Nadav Amit <namit@vmware.com>
    Cc: Kees Cook <keescook@google.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: linux-mm@kvack.org
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Arjan van de Ven <arjan@linux.intel.com>
    Link: https://lkml.kernel.org/r/20180420222021.1C7D2B3F@viggo.jf.intel.com
    
    58e65b51
pageattr.c 50.3 KB