Re: [PATCH] x86/mm: disable preemption during CR3 read+write

From: Rik van Riel
Date: Fri Aug 05 2016 - 10:38:44 EST


On Fri, 2016-08-05 at 15:37 +0200, Sebastian Andrzej Siewior wrote:
>Â
> +++ b/arch/x86/include/asm/tlbflush.h
> @@ -135,7 +135,14 @@ static inline void
> cr4_set_bits_and_update_boot(unsigned long mask)
> Â
> Âstatic inline void __native_flush_tlb(void)
> Â{
> + /*
> + Â* if current->mm == NULL then we borrow a mm which may
> change during a
> + Â* task switch and therefore we must not be preempted while
> we write CR3
> + Â* back.
> + Â*/
> + preempt_disable();
> Â native_write_cr3(native_read_cr3());
> + preempt_enable();
> Â}

That is one subtle race!

Acked-by: Rik van Riel <riel@xxxxxxxxxx>

--

All Rights Reversed.

Attachment: signature.asc
Description: This is a digitally signed message part