Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751050AbeAPA5Z (ORCPT + 1 other); Mon, 15 Jan 2018 19:57:25 -0500 Received: from mail-wr0-f173.google.com ([209.85.128.173]:37693 "EHLO mail-wr0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750764AbeAPA5X (ORCPT ); Mon, 15 Jan 2018 19:57:23 -0500 X-Google-Smtp-Source: ACJfBotKRS1Eh5gLZYuyubL0bub5kWFwzjgyhjEGbMZ0jub1fKdBcCRovpo+NcEcmkTh39Xb5jS4lw== Date: Tue, 16 Jan 2018 01:57:19 +0100 From: Ingo Molnar To: Laura Abbott Cc: Thomas Gleixner , Andy Lutomirski , Willy Tarreau , Peter Zijlstra , Borislav Petkov , X86 ML , Linux Kernel Mailing List , David Woodhouse , stable Subject: Re: [PATCH] x86/pti: Fix !PCID and sanitize defines Message-ID: <20180116005719.ijy4yl3hs2wz4pug@gmail.com> References: <2e58f6f0-008f-397f-8eca-f40d3d3d2e4b@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2e58f6f0-008f-397f-8eca-f40d3d3d2e4b@redhat.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: * Laura Abbott wrote: > On 01/13/2018 03:23 PM, Thomas Gleixner wrote: > > The switch to the user space page tables in the low level ASM code sets > > unconditionally bit 12 and bit 11 of CR3. Bit 12 is switching the base > > address of the page directory to the user part, bit 11 is switching the > > PCID to the PCID associated with the user page tables. > > > > This fails on a machine which lacks PCID support because bit 11 is set in > > CR3. Bit 11 is reserved when PCID is inactive. > > > > While the Intel SDM claims that the reserved bits are ignored when PCID is > > disabled, the AMD APM states that they should be cleared. > > > > This went unnoticed as the AMD APM was not checked when the code was > > developed and reviewed and test systems with Intel CPUs never failed to > > boot. The report is against a Centos 6 host where the guest fails to boot, > > so it's not yet clear whether this is a virt issue or can happen on real > > hardware too, but thats irrelevant as the AMD APM clearly ask for clearing > > the reserved bits. > > > > Make sure that on non PCID machines bit 11 is not set by the page table > > switching code. > > > > Andy suggested to rename the related bits and masks so they are clearly > > describing what they should be used for, which is done as well for clarity. > > > > That split could have been done with alternatives but the macro hell is > > horrible and ugly. This can be done on top if someone cares to remove the > > extra orq. For now it's a straight forward fix. > > > > Original reporter confirmed it fixes the problem. Thanks for the > prompt response. Thanks for the confirmation. Now the fix is upstream and Greg queued it up as well earlier today, so this fix is part of the next -stable iteration as well. Thanks, Ingo