Hi, On Fri, Apr 20, 2018 at 03:20:19PM -0700, Dave Hansen wrote: > Part of the global bit _setting_ patches also includes clearing the > Global bit when we do not want it. That is done with > set_memory_nonglobal(), which uses change_page_attr_clear() in > pageattr.c under the covers. > > The TLB flushing code inside pageattr.c has has checks like > BUG_ON(irqs_disabled()), looking for interrupt disabling that might > cause deadlocks. But, these also trip in early boot on certain > preempt configurations. Just copy the existing BUG_ON() sequence from > cpa_flush_range() to the other two sites and check for early boot. > > Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> > Fixes: 39114b7a7 (x86/pti: Never implicitly clear _PAGE_GLOBAL for kernel image) > Reported-by: Mariusz Ceier <mceier@xxxxxxxxx> > Reported-by: Aaro Koskinen <aaro.koskinen@xxxxxxxxx> Tested-by: Aaro Koskinen <aaro.koskinen@xxxxxxxxx> A. > Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> > Cc: Andy Lutomirski <luto@xxxxxxxxxx> > Cc: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx> > Cc: Borislav Petkov <bp@xxxxxxxxx> > Cc: Dan Williams <dan.j.williams@xxxxxxxxx> > Cc: David Woodhouse <dwmw2@xxxxxxxxxxxxx> > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> > Cc: Hugh Dickins <hughd@xxxxxxxxxx> > Cc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx> > Cc: Juergen Gross <jgross@xxxxxxxx> > Cc: Kees Cook <keescook@xxxxxxxxxx> > Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> > Cc: Nadav Amit <namit@xxxxxxxxxx> > Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> > Cc: linux-mm@xxxxxxxxx > --- > > b/arch/x86/mm/pageattr.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff -puN arch/x86/mm/pageattr.c~pti-glb-boot-problem-fix arch/x86/mm/pageattr.c > --- a/arch/x86/mm/pageattr.c~pti-glb-boot-problem-fix 2018-04-20 14:10:01.086749169 -0700 > +++ b/arch/x86/mm/pageattr.c 2018-04-20 14:10:01.090749169 -0700 > @@ -172,7 +172,7 @@ static void __cpa_flush_all(void *arg) > > static void cpa_flush_all(unsigned long cache) > { > - BUG_ON(irqs_disabled()); > + BUG_ON(irqs_disabled() && !early_boot_irqs_disabled); > > on_each_cpu(__cpa_flush_all, (void *) cache, 1); > } > @@ -236,7 +236,7 @@ static void cpa_flush_array(unsigned lon > unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */ > #endif > > - BUG_ON(irqs_disabled()); > + BUG_ON(irqs_disabled() && !early_boot_irqs_disabled); > > on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1); > > _