Received: by 10.223.176.46 with SMTP id f43csp1157326wra; Fri, 19 Jan 2018 07:40:33 -0800 (PST) X-Google-Smtp-Source: ACJfBougbrAbejjDApTLIgTbJp49zjdUZgcpWlIIlvvjXaKAYu/+MJHQNkBoaktkXElmcGVjef6H X-Received: by 10.98.82.68 with SMTP id g65mr32893520pfb.212.1516376433590; Fri, 19 Jan 2018 07:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516376433; cv=none; d=google.com; s=arc-20160816; b=oqC8QN59kJpq/yFkasTn7niQR3eyBRgzS2J1lnbVfiu/i04KvzmdPirOXGzLUQtyLT jr5B506inZ2DRgub16vbPdOxa/6cRTkt0aPYmRLBG+SXZSxAjaiFUar+qPbBNVkthMxH ZvGk6y1cT6AdKDCNbhY8OREMYljbJnUsP9rJ8cMcNdYucl4oenDek0PhxNN5edhtQ/6O hB08fu4PmcspWfl9B8UwFBqqQAKcmFl83CDqcz9WR+8FkbYuo243aP1AjlMtPDXL5VPU 1v044B9maT/a8LsYPYqPzb9RkzZXJPJdJ2SiFPeGJSEWBs/562EPa26N9JFBhwVWaALx /SzQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=cQ1dzZv/jhyu8MVuDkLKkidc1TrKXix1pyAUOVvnWJ0=; b=yM4sntgpL8ZP7ypR1beR4T5SSARjprgzQ+d6iOeSFEpr+0a3N5jYnQ9l3GbvlWdy2k O3VroWJyW7PATwHDQTnxA7H6qiaRoQm4UHg/qwNPZlK9TG8ziAded8PHhrAsdtLX18Y2 l+gdOChK+5Fyurkm3Mq5O9Ebd1Wos6zaBJpFlOkRva+3+i5klEVcj36XIudXNBHSOFu9 sZgTQiuCKiIQHnVt8Dg5ZcbLnuTc9qJUmIWXr/ZlGXTrtjMB5Lhx+4yTF4xI0UDpLHNp XvuH5xPHbIw5siAHww+ApwwzBW8r41mx5wSA9MTcFpkJxn5qPyMj7lYTXRwYzm4at6R1 0Csw== 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 f18si8494628pga.543.2018.01.19.07.40.19; Fri, 19 Jan 2018 07:40:33 -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 S1755864AbeASPjg (ORCPT + 99 others); Fri, 19 Jan 2018 10:39:36 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:43966 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755813AbeASPja (ORCPT ); Fri, 19 Jan 2018 10:39:30 -0500 Received: from localhost (unknown [109.190.253.13]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EEF361020; Fri, 19 Jan 2018 15:39:28 +0000 (UTC) Date: Fri, 19 Jan 2018 16:38:53 +0100 From: Greg Kroah-Hartman To: Tom Lendacky Cc: Gabriel C , Borislav Petkov , x86@kernel.org, Brijesh Singh , linux-kernel@vger.kernel.org, Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner Subject: Re: [PATCH v3 0/5] x86: SME: BSP/SME microcode update fix Message-ID: <20180119153853.GA9995@kroah.com> References: <20180110192544.6026.17285.stgit@tlendack-t1.amdoffice.net> <20180111183313.7ub2t3xkeko5yb3z@pd.tnic> <68544677-2cbc-b41e-2db0-5799ef84d592@gmail.com> <20180119151150.GB9033@kroah.com> <47ab23e7-c3e8-0edd-a7ac-019bd0e47a02@amd.com> <20180119153524.GB1214@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180119153524.GB1214@kroah.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 19, 2018 at 04:35:24PM +0100, Greg Kroah-Hartman wrote: > On Fri, Jan 19, 2018 at 09:27:47AM -0600, Tom Lendacky wrote: > > On 1/19/2018 9:11 AM, Greg Kroah-Hartman wrote: > > > On Fri, Jan 19, 2018 at 09:03:52AM -0600, Tom Lendacky wrote: > > >> On 1/15/2018 4:47 PM, Gabriel C wrote: > > >>> On 11.01.2018 19:33, Borislav Petkov wrote: > > >>>> On Wed, Jan 10, 2018 at 01:25:45PM -0600, Tom Lendacky wrote: > > >>>>> This patch series addresses an issue when SME is active and the BSP > > >>>>> is attempting to check for and load microcode during load_ucode_bsp(). > > >>>>> Since the initrd has not been decrypted (yet) and the virtual address > > >>>>> of the initrd treats the memory as encrypted, the CPIO archive parsing > > >>>>> fails to locate the microcode. > > >>>>> > > >>>>> This series moves the encryption of the initrd into the early boot code > > >>>>> and encrypts it at the same time that the kernel is encrypted.  Since > > >>>>> the initrd is now encrypted, the CPIO archive parsing succeeds in > > >>>>> properly locating the microcode. > > >>>>> > > >>>>> The following patches are included in this fix: > > >>>>> - Cleanup register saving in arch/x86/mm/mem_encrypt_boot.S > > >>>>> - Reduce parameters and complexity for creating the SME PGD mappings > > >>>>> - Centralize the use of the PMD flags used in sme_encrypt_kernel() in > > >>>>>    preparation for using PTE flags also. > > >>>>> - Prepare sme_encrypt_kernel() to handle PAGE aligned encryption, not > > >>>>>    just 2MB large page aligned encryption. > > >>>>> - Encrypt the initrd in sme_encrypt_kernel() when the kernel is being > > >>>>>    encrypted. > > >>>>> > > >>>>> This patch series is based on tip/master. > > >>>>> > > >>>>> --- > > >>>>> > > >>>>> Changes from v2: > > >>>>> - General code cleanup based on feedback. > > >>>>> > > >>>>> Changes from v1: > > >>>>> - Additional patch to cleanup the register saving performed in > > >>>>>    arch/x86/mm/mem_encrypt_boot.S in prep for changes made in the > > >>>>>    remainder of the patchset. > > >>>>> - Additional patch to reduce parameters and complexity for creating the > > >>>>>    SME PGD mappings by introducing and using a structure for referencing > > >>>>>    the PGD to populate, the pagetable allocation area, the > > >>>>> virtual/physical > > >>>>>    addresses being mapped and the pagetable flags to be used. > > >>>>> - Consolidate PMD/PTE mapping code to reduce duplication. > > >>>>> > > >>>>> Tom Lendacky (5): > > >>>>>        x86/mm: Cleanup register saving in mem_encrypt_boot.S > > >>>>>        x86/mm: Use a struct to reduce parameters for SME PGD mapping > > >>>>>        x86/mm: Centralize PMD flags in sme_encrypt_kernel() > > >>>>>        x86/mm: Prepare sme_encrypt_kernel() for PAGE aligned encryption > > >>>>>        x86/mm: Encrypt the initrd earlier for BSP microcode update > > >>>>> > > >>>>> > > >>>>>   arch/x86/include/asm/mem_encrypt.h |    4 > > >>>>>   arch/x86/kernel/head64.c           |    4 > > >>>>>   arch/x86/kernel/setup.c            |   10 - > > >>>>>   arch/x86/mm/mem_encrypt.c          |  356 > > >>>>> ++++++++++++++++++++++++++---------- > > >>>>>   arch/x86/mm/mem_encrypt_boot.S     |   80 ++++---- > > >>>>>   5 files changed, 308 insertions(+), 146 deletions(-) > > >>>> > > >>>> All 5: > > >>>> > > >>>> Reviewed-by: Borislav Petkov > > >>>> > > >>> > > >>> Guys , are these patches going to be part of 4.15 ? > > >>> > > >>> With mem_encrypt=on without these patches microcode loading doesn't > > >>> work right. Also @stable 4.14 would need the fixes too. > > >> > > >> It looks like these patches have been pulled into 4.15. I did forget > > >> to cc stable, so I'll follow-up with a separate email to have these > > >> back-ported to the 4.14 stable tree. > > > > > > What are the git commit ids? That's all I need :) > > > > Hi Greg, > > > > Here are the commit ids: > > 1303880179e6 (“x86/mm: Clean up register saving in the __enc_copy() assembly code”) > > bacf6b499e11 (“x86/mm: Use a struct to reduce parameters for SME PGD mapping”) > > 2b5d00b6c2cd (“x86/mm: Centralize PMD flags in sme_encrypt_kernel()”) > > cc5f01e28d6c (“x86/mm: Prepare sme_encrypt_kernel() for PAGE aligned encryption”) > > 107cd2532181 (“x86/mm: Encrypt the initrd earlier for BSP microcode update”) > > > > The last commit won't apply cleanly on 4.14. There was a change in > > arch/x86/kernel/setup.c for SEV support. The actual patch to that file > > is very small it just removes the call to sme_early_encrypt() and the > > associated comment. I can submit a new version of that patch if you > > want, just let me know. > > A backported version of that would be great, thanks. > > And are any of these needed in older kernels like 4.4 and 4.9? Oh nevermind, this is for a feature that is not in older kernels, sorry for the noise. greg k-h