Received: by 10.223.176.46 with SMTP id f43csp1188636wra; Fri, 19 Jan 2018 08:05:25 -0800 (PST) X-Google-Smtp-Source: ACJfBotKeYOs2OUKYwssqsWE8ukHUcXSOT2tDLYdj+mpG2ggWWCZnQnRmf68vY27KUCqyH8nzInM X-Received: by 10.98.201.69 with SMTP id k66mr6482878pfg.105.1516377924985; Fri, 19 Jan 2018 08:05:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516377924; cv=none; d=google.com; s=arc-20160816; b=YdCZ+1HsnLQ9TqXnX8tDp9Wkv8Gv2l735tcVYO+/W/GPmq+8Vr6K8SteguuA/f3Pvw Fw27ggg6KUdsdxb2vdBYsfvDuQxrC7AqpI75bzPFrQ6jTmXkAwBs/M08TnSklGFPPTio CrXHrkF/jdePGHaZX2hqsFcRIH0W44yg4tVlD8Vw2Qa1pyF5TXMFeEdP84ySdsKbWtqW ho5VALBO5Fl5dMMc8rHgFzHwjy1GgJMJpTpU6PZkvus/CM3HMVEtArChC7vA96eVavW2 7qtaJi17FxGr3J/Tfh/f80/Um0GVRDy1ooG3STqnla4xrc7q2Lw/c7NtmTUKdUHR5b9m FuPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=3PAlMuqug0/tJFyLkJSg2FAljk+GCE5d4bTKw0Gq7Rs=; b=fCL4mKKXHbkWmq5yHo/yO3+Hdoz1oBFeaNH9gCy49RkNq+ruSToNJMfhgqBDZlapkN xualzX8sJ81f/HVIdTdPrEHd/K6OQUq+PmpReJBTAqCoXrmm9gtmrOdMH9WnIo5zF8xW CXaIjXeUek1BNK1n3V4rcVUNS/8ujlZJf/JGe9I049oZYcUsojT6iJd/i07bX1X8tFO2 AnY5pxikO27PPpePA/02/k43c9uBsgopT0sDYCxwQeuG1wo2cAA64HYRGtrdwBwWKHxs 9cqzzQO/LZoDsp3gqvpGWsNhYItaknQDCi1hEtehO0iE1ltrPtFCvHHE8tXHbBsYXXua pg/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P2YO/lcA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si9406373pfd.127.2018.01.19.08.04.52; Fri, 19 Jan 2018 08:05:24 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P2YO/lcA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756089AbeASQCq (ORCPT + 99 others); Fri, 19 Jan 2018 11:02:46 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:44126 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755959AbeASQCi (ORCPT ); Fri, 19 Jan 2018 11:02:38 -0500 Received: by mail-lf0-f68.google.com with SMTP id w23so2671922lfd.11 for ; Fri, 19 Jan 2018 08:02:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=3PAlMuqug0/tJFyLkJSg2FAljk+GCE5d4bTKw0Gq7Rs=; b=P2YO/lcAvlDbs7XzyrZ91LVkNBxcFs1Sxw8vuBZlPSq4OJ+25DVYXOTRt6fxATkq7O uk7ZcWf1g434XLNpkz9j3DQc/bhX0HD/95Wv+RZ2WktYabAKEb9Sa/iSspo2TylHJzRN YWU/VBcfmw3MNLKvL0KibyAmVnCQicBLO2/g2wUfDIxVDBCmZaoVZ1QdDOtKNXpyUGpi QxbmLHZE6/TEg++cXoxbuL+nvQZpTmajhPghwrFn2XgWDI/rT183TPpq8nLg7omkHimH pA5dFE37RXw+b7OxiVbuY84WgJ0CdGgoSK+zxRxgBqUafw8xGisGhzn7wt7wIRwnHNmx jd3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=3PAlMuqug0/tJFyLkJSg2FAljk+GCE5d4bTKw0Gq7Rs=; b=lUd2CZn804429fOzZ2IEeBIMrJh0CoJw5/Gmp7LkpyUUFZOiNMwBSdMHn4VSjDUv6Q Je1X2yeklzorLEXhbJhYhMsajkoUQ20xvanRhCr5I3hsDSRfWcnsrr66/lfmBBC273eX Mwy6a2GE1N/KNrwQzM0t3WsbO6nrm6OzTHbBpKjs4e1OFIDDy9DrnvtTWFsz1L/nAV95 WavUI7K2Bg1LvO6j+k5dwPB06e9k7xlLiu0WlBNjN+75ExZEf6pEqQmqFwU8rsZrehn2 eqpMjPlCNIvHTCDtrT9uek322oelxbUVrGd57+IGS3+/S6/HLNlUQwSiKYs/dEn8XApD 3d0Q== X-Gm-Message-State: AKwxytd02igacSbzUrAofX5q265R0kol5f39V8uqsKZIKtkv8XTMXAYi jla/1Um4GzsH58jSody14Byw8NMhEBA04zTa3w== X-Received: by 10.25.93.83 with SMTP id p19mr10260026lfj.113.1516377756407; Fri, 19 Jan 2018 08:02:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.113.21 with HTTP; Fri, 19 Jan 2018 08:02:04 -0800 (PST) In-Reply-To: <3f7c5d6e-3c22-4a7f-c38f-b34b7cd1b451@amd.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> <3f7c5d6e-3c22-4a7f-c38f-b34b7cd1b451@amd.com> From: Gabriel C Date: Fri, 19 Jan 2018 17:02:04 +0100 Message-ID: Subject: Re: [PATCH v3 0/5] x86: SME: BSP/SME microcode update fix To: Tom Lendacky Cc: Greg Kroah-Hartman , Borislav Petkov , x86@kernel.org, Brijesh Singh , LKML , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-01-19 16:56 GMT+01:00 Tom Lendacky : > On 1/19/2018 9:35 AM, 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 BS= P >>>>>>>> is attempting to check for and load microcode during load_ucode_bs= p(). >>>>>>>> Since the initrd has not been decrypted (yet) and the virtual addr= ess >>>>>>>> of the initrd treats the memory as encrypted, the CPIO archive par= sing >>>>>>>> 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. Si= nce >>>>>>>> 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 mappin= gs >>>>>>>> - 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 be= ing >>>>>>>> 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 creatin= g the >>>>>>>> SME PGD mappings by introducing and using a structure for refer= encing >>>>>>>> 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 mappi= ng >>>>>>>> x86/mm: Centralize PMD flags in sme_encrypt_kernel() >>>>>>>> x86/mm: Prepare sme_encrypt_kernel() for PAGE aligned encry= ption >>>>>>>> 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=3Don 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 (=E2=80=9Cx86/mm: Clean up register saving in the __enc_= copy() assembly code=E2=80=9D) >>> bacf6b499e11 (=E2=80=9Cx86/mm: Use a struct to reduce parameters for = SME PGD mapping=E2=80=9D) >>> 2b5d00b6c2cd (=E2=80=9Cx86/mm: Centralize PMD flags in sme_encrypt_ke= rnel()=E2=80=9D) >>> cc5f01e28d6c (=E2=80=9Cx86/mm: Prepare sme_encrypt_kernel() for PAGE = aligned encryption=E2=80=9D) >>> 107cd2532181 (=E2=80=9Cx86/mm: Encrypt the initrd earlier for BSP mic= rocode update=E2=80=9D) >>> >>> 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. > > Ok, I'll send that out as soon as possible. Since it is a changed patch > I was planning to remove the Tested-by, Signed-off-by (except for my sign > off), etc. or would you prefer I leave them in this case? > I tested the series on top 4.14.13/.14 already , the conflict is trivial and easy to fix. If you wish you can keep my Tested-by. Regards, Gabriel C