From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966869AbcHEOil (ORCPT ); Fri, 5 Aug 2016 10:38:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42240 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966716AbcHEOij (ORCPT ); Fri, 5 Aug 2016 10:38:39 -0400 Message-ID: <1470407913.13905.66.camel@redhat.com> Subject: Re: [PATCH] x86/mm: disable preemption during CR3 read+write From: Rik van Riel To: Sebastian Andrzej Siewior , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: x86@kernel.org, Borislav Petkov , Andy Lutomirski , Mel Gorman , Peter Zijlstra Date: Fri, 05 Aug 2016 10:38:33 -0400 In-Reply-To: <1470404259-26290-1-git-send-email-bigeasy@linutronix.de> References: <1470404259-26290-1-git-send-email-bigeasy@linutronix.de> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-ygw81KUwZ+4QWFNpmg93" Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 05 Aug 2016 14:38:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-ygw81KUwZ+4QWFNpmg93 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2016-08-05 at 15:37 +0200, Sebastian Andrzej Siewior wrote: >=C2=A0 > +++ b/arch/x86/include/asm/tlbflush.h > @@ -135,7 +135,14 @@ static inline void > cr4_set_bits_and_update_boot(unsigned long mask) > =C2=A0 > =C2=A0static inline void __native_flush_tlb(void) > =C2=A0{ > + /* > + =C2=A0* if current->mm =3D=3D NULL then we borrow a mm which may > change during a > + =C2=A0* task switch and therefore we must not be preempted while > we write CR3 > + =C2=A0* back. > + =C2=A0*/ > + preempt_disable(); > =C2=A0 native_write_cr3(native_read_cr3()); > + preempt_enable(); > =C2=A0} That is one subtle race! Acked-by: Rik van Riel --=20 All Rights Reversed. --=-ygw81KUwZ+4QWFNpmg93 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXpKTpAAoJEM553pKExN6DAc8H/3DhcXs3/x1K6aTFAzUfp97M 33REzE+JcAI0uWWisVPHSHAcoK8g5tGzpcXG7UuLGjPqohyB0500ukaFMFghcij8 zWCJweM49VZCPSUm7L/hpwXTkx+Ltraem6TsDuFRf3jMfSM8l500OcwocLdV4S7J tza4Gy6ZVM49Csx42jWO1Ac15oLQWJ/77/YzyGIuGkfrHtK04pCCECzdCoCdU5I7 vxINhsoo8QFoTkeAQPXWRqUmSQkZboNn6GKg+aDWGC6TVu6KLVlpfuzgmc0wN7EN ySA0IhptXVFT9GcXgqIy7Ow9XbsATyxXw8MUK2SBLi1LDrYW7Kts80N3mTVU1f4= =foAC -----END PGP SIGNATURE----- --=-ygw81KUwZ+4QWFNpmg93--