Return-path: Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fA80O-0001E6-Uw for speck@linutronix.de; Sun, 22 Apr 2018 07:57:45 +0200 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E61C18A9FD for ; Sun, 22 Apr 2018 05:57:37 +0000 (UTC) Received: from washington.bos.jonmasters.org (ovpn-120-103.rdu2.redhat.com [10.10.120.103]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE0171208F60 for ; Sun, 22 Apr 2018 05:57:37 +0000 (UTC) Subject: [MODERATED] Re: [patch 04/11] [PATCH v2 04/10] Linux Patch #4 References: <20180420022613.057637144@localhost.localdomain> <20180420161533.GK13977@pd.tnic> <20180420163936.GA4615@localhost.localdomain> <20180420170331.GL13977@pd.tnic> <20180420171730.GA5333@localhost.localdomain> From: Jon Masters Message-ID: <326893a1-87d8-17cb-df21-3a519a4cb2b8@redhat.com> Date: Sun, 22 Apr 2018 01:57:37 -0400 MIME-Version: 1.0 In-Reply-To: <20180420171730.GA5333@localhost.localdomain> Content-Type: multipart/mixed; boundary="ZalBl7gaHZ7cr5ZeWQAZRrAUXtALEbFmG"; protected-headers="v1" To: speck@linutronix.de List-ID: This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --ZalBl7gaHZ7cr5ZeWQAZRrAUXtALEbFmG Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 04/20/2018 01:17 PM, speck for Konrad Rzeszutek Wilk wrote: > On Fri, Apr 20, 2018 at 07:03:31PM +0200, speck for Borislav Petkov wro= te: >> and that function then picks apart which bits the host supports and se= ts >> them accordingly and filters out the reserved bits. You might call the= >> function then: >> >> x86_set_spec_ctrl(); >=20 >> >> and its counterpart >> >> x86_restore_spec_ctrl(); >=20 > Right. I am going to assume it would have an 'u64' as parameter. Looking at this, I think we actually want this to be: x86_set_guest_spec_ctrl(u64 guest_spec_ctrl); x86_restore_kernel_spec_ctrl(u64 guest_spec_ctrl); The logic will be to take whatever we saved at boot (x86_spec_ctrl_base) and then flip whatever bits are requested (or none). I suppose it's reasonable/desirable to not allow a guest to set bits we don't know about in case those would somehow impact us. So for now that means checking IBRS and MDD bits on guest entry and restoring kernel if they don't happen to match when coming back out of a guest. Paolo: you'll also want to medium term ponder the init path for svm->spec_ctrl because zero /may/ not make sense forever. Jon. --=20 Computer Architect | Sent from my Fedora powered laptop --ZalBl7gaHZ7cr5ZeWQAZRrAUXtALEbFmG--