Received: by 10.223.176.46 with SMTP id f43csp965714wra; Fri, 19 Jan 2018 05:01:05 -0800 (PST) X-Google-Smtp-Source: ACJfBoubpqrlDt6XLfYfB2WX91OA+pcitYokLndfGxQxwIAR44tFJCTp6qshzeHeU0kyU0iyyfW/ X-Received: by 10.98.204.75 with SMTP id a72mr38343181pfg.211.1516366865272; Fri, 19 Jan 2018 05:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516366865; cv=none; d=google.com; s=arc-20160816; b=pjjl0FyvK32ozyzZSgYB32X2m/VDZmT6LcWYwWPGw3934F75mxLE+NQyJ27uha8YEc Gs0s5eecdQEoQ0Tsc7J1bQd7tf0W2HRV354rYOXJZ0TTV3HHr7oabqbzcMgyt5gPzDcA 9gWqooos8wQcsSO6IIDqQUqfxqaI1c2bQ5g0416QX0I9DHJIFTdOfG1hMobo68JWIKXb kHzmqRqx3gSrM1iPSI209L1issVynJ9u+7Xl66TjPzHn7lMOqPqXGQ9CE3qhyAazZV4M coYJiqnj0U/ixCgTduvlVx4zph2/Lwj5/Bvm2P5AT3b2uDP5UCy+XKp4444mjWtT76ps 3xPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=InhNa2XZneyAa+J/WEXGeba5zEU6nStGvhQBDsfmdHA=; b=c+zobUB+s8mJaJ2qzCOTFodf1/iDg51lp8H73IvI9nxvGpyp+rvlmk3B1Tfznf1yKn J4SSmoobBu0ImWn3x6NgbJTDnv9MFClsOlmc/eIH16AEbiA5ebfsiV8UYCIQ6uuRdR28 Zm741rCz+d5PQ9WqbRzurhTsObz6Q9fiaU7UjWgF8lQHZDCLQn/m1wyCuB6e+TLPL4xW ZalcohrPG7pJ0z3YRc2I4fmgEaHb1Ryz9X6s+6iD+WmGcT1LFNcYV10GkJ2vkLZ0VGEZ g5ZJzcAmKDrR9X+umQ9X/s6oZALPynkC5xBhjemVJJC/NfDi7czADRJyo/nOMTmYDGtL JwLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u19si8844224pfh.154.2018.01.19.05.00.50; Fri, 19 Jan 2018 05:01:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755208AbeASM63 (ORCPT + 99 others); Fri, 19 Jan 2018 07:58:29 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:32780 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753332AbeASM6W (ORCPT ); Fri, 19 Jan 2018 07:58:22 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 740528017A; Fri, 19 Jan 2018 13:58:20 +0100 (CET) Date: Fri, 19 Jan 2018 13:58:20 +0100 From: Pavel Machek To: Joerg Roedel Cc: Joerg Roedel , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long Subject: Re: [RFC PATCH 00/16] PTI support for x86-32 Message-ID: <20180119125819.GA17936@amd> References: <1516120619-1159-1-git-send-email-joro@8bytes.org> <20180119105527.GB29725@amd> <20180119110726.odea3h3smcjyicnk@suse.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NzB8fVQJ5HfG6fxh" Content-Disposition: inline In-Reply-To: <20180119110726.odea3h3smcjyicnk@suse.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri 2018-01-19 12:07:26, Joerg Roedel wrote: > Hey Pavel, >=20 > On Fri, Jan 19, 2018 at 11:55:28AM +0100, Pavel Machek wrote: > > Thanks for doing the work. > >=20 > > I tried applying it on top of -next, and that did not succeed. Let me > > try Linus tree... >=20 > Thanks for your help with testing this patch-set, but I recommend to > wait for the next version, as review already found a couple of bugs that > might crash your system. For example there are NMI cases that might > crash your machine because the NMI happens in kernel mode before the cr3 > switch. VM86 mode is also definitly broken. Thanks for heads-up. I guess I can disable NMI avoid VM86. CONFIG_X86_PTDUMP_CORE should be responsible for boot fail. Disabling it is not at all easy, as CONFIG_EMBEDDED selects CONFIG_EXPERTS selects CONFIG_DEBUG_KERNEL selects CONFIG_X86_PTDUMP_CORE. (Crazy, if you ask me). You may want to test with that enabled. Patch below might fix it. (Signed-off-by: me). Tests so far: kernel boots in qemu. Whole system boots on thinkpad T40p, vulnerabities/meltdown says mitigation: PTI.. so I guess it works. Tested-by: me. :-) Best regards, Pavel diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 2a4849e..896b53b 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -543,7 +543,11 @@ EXPORT_SYMBOL_GPL(ptdump_walk_pgd_level_debugfs); static void ptdump_walk_user_pgd_level_checkwx(void) { #ifdef CONFIG_PAGE_TABLE_ISOLATION +#ifdef CONFIG_X86_64 pgd_t *pgd =3D (pgd_t *) &init_top_pgt; +#else + pgd_t *pgd =3D swapper_pg_dir; +#endif =20 if (!static_cpu_has(X86_FEATURE_PTI)) return; --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --NzB8fVQJ5HfG6fxh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlph62sACgkQMOfwapXb+vJiIQCgqBDHc+te64tub1fd2ysUnYzO zUIAn0KcVe+znFkXmNnlqNlZM3gHxU1P =TNq4 -----END PGP SIGNATURE----- --NzB8fVQJ5HfG6fxh--