Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751769AbdCNWqh convert rfc822-to-8bit (ORCPT ); Tue, 14 Mar 2017 18:46:37 -0400 Received: from terminus.zytor.com ([65.50.211.136]:53874 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750932AbdCNWqf (ORCPT ); Tue, 14 Mar 2017 18:46:35 -0400 From: "H. Peter Anvin" Message-Id: <201703142243.v2EMh8Nn010676@mail.zytor.com> Date: Tue, 14 Mar 2017 15:43:01 -0700 User-Agent: K-9 Mail for Android In-Reply-To: References: <20170314170508.100882-1-thgarnie@google.com> <20170314170508.100882-3-thgarnie@google.com> <20170314210424.GA5023@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: [PATCH v7 3/3] x86: Make the GDT remapping read-only on 64-bit To: Thomas Garnier , Pavel Machek CC: Thomas Gleixner , Ingo Molnar , Jonathan Corbet , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Lorenzo Stoakes , Kees Cook , Juergen Gross , Andy Lutomirski , Paul Gortmaker , Andrew Morton , Michal Hocko , zijun_hu , Chris Wilson , Andy Lutomirski , "Rafael J . Wysocki" , Len Brown , Jiri Kosina , Matt Fleming , Ard Biesheuvel , Boris Ostrovsky , Rusty Russell , Paolo Bonzini , Borislav Petkov , Christian Borntraeger , Frederic.Weisbecker@zytor.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2114 Lines: 45 ,"Luis R . Rodriguez" ,Stanislaw Gruszka ,Peter Zijlstra ,Josh Poimboeuf ,Vitaly Kuznetsov ,Tim Chen ,Joerg Roedel ,Message-ID: <550F6209-025A-45E2-84E2-F00A3771C0B1@zytor.com> On March 14, 2017 2:20:19 PM PDT, Thomas Garnier wrote: >On Tue, Mar 14, 2017 at 2:04 PM, Pavel Machek wrote: >> On Tue 2017-03-14 10:05:08, Thomas Garnier wrote: >>> This patch makes the GDT remapped pages read-only to prevent >corruption. >>> This change is done only on 64-bit. >>> >>> The native_load_tr_desc function was adapted to correctly handle a >>> read-only GDT. The LTR instruction always writes to the GDT TSS >entry. >>> This generates a page fault if the GDT is read-only. This change >checks >>> if the current GDT is a remap and swap GDTs as needed. This function >was >>> tested by booting multiple machines and checking hibernation works >>> properly. >>> >>> KVM SVM and VMX were adapted to use the writeable GDT. On VMX, the >>> per-cpu variable was removed for functions to fetch the original >GDT. >>> Instead of reloading the previous GDT, VMX will reload the fixmap >GDT as >>> expected. For testing, VMs were started and restored on multiple >>> configurations. >>> >>> Signed-off-by: Thomas Garnier >> >> Can we get the same change for 32-bit, too? Growing differences >> between 32 and 64 bit are a bit of a problem... >> Pavel > >It was discussed on previous versions that 32-bit read-only support >would create issues that why it was favor for 64-bit only right now. > >> >> -- >> (english) http://www.livejournal.com/~pavelmachek >> (cesky, pictures) >http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html We can't make the GDT read-only on 32 bits since we use task switches for last-resort recovery. 64 bits has IST instead. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.