From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B7A3C4332F for ; Wed, 2 Feb 2022 15:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345546AbiBBPl7 (ORCPT ); Wed, 2 Feb 2022 10:41:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231710AbiBBPlw (ORCPT ); Wed, 2 Feb 2022 10:41:52 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98B5BC061714; Wed, 2 Feb 2022 07:41:52 -0800 (PST) Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 7AA111EC059D; Wed, 2 Feb 2022 16:41:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1643816506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=Cwn6fgc2bkMiYdHSqTZKAKhqw+1pduKMoFZH27YbT8Y=; b=o29kCM74d+MyTiTqpcCxRpbljquvzyplNJBA+CMkf8knQDxYiY21qy8QBJGKGgAy1eum37 TpbIkuA177QV71dnBX46PXwEGcU86EURDpaXwBrW6u7QPwYWPhR8yBGcwwX4EnlOnVcpRZ GdB+9E+CacxFSZxCsUivyJA0/dxmY80= Date: Wed, 2 Feb 2022 16:41:46 +0100 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , brijesh.ksingh@gmail.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v9 18/43] x86/kernel: Validate ROM memory before accessing when SEV-SNP is active Message-ID: References: <20220128171804.569796-1-brijesh.singh@amd.com> <20220128171804.569796-19-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220128171804.569796-19-brijesh.singh@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022 at 11:17:39AM -0600, Brijesh Singh wrote: > @@ -197,11 +198,21 @@ static int __init romchecksum(const unsigned char *rom, unsigned long length) > > void __init probe_roms(void) > { > - const unsigned char *rom; > unsigned long start, length, upper; > + const unsigned char *rom; > unsigned char c; > int i; > > + /* > + * The ROM memory is not part of the E820 system RAM and is not pre-validated > + * by the BIOS. The kernel page table maps the ROM region as encrypted memory, > + * the SEV-SNP requires the encrypted memory must be validated before the > + * access. Validate the ROM before accessing it. > + */ Lemme massage it: /* * The ROM memory range is not part of the e820 table and is therefore not * pre-validated by BIOS. The kernel page table maps the ROM region as encrypted * memory, and SEV-SNP requires encrypted memory to be validated before access. * Do that here. */ -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette