Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5723147rwp; Mon, 17 Jul 2023 08:31:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlGyjWy1YJrhkKIKDjTJweeUlQKqe/e6BHEnfphTRcleJoy+Q+S7fyT4KyBqFvfYYL85y6VJ X-Received: by 2002:a17:906:6492:b0:973:d06d:545f with SMTP id e18-20020a170906649200b00973d06d545fmr10877620ejm.24.1689607882161; Mon, 17 Jul 2023 08:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689607882; cv=none; d=google.com; s=arc-20160816; b=CVB10F1hTK7PnhX5zR/gX9D/5WCP/DJclp1m7k0mI9srdrQY6cOjLboaHeY9avsdMu /f0jvVy+Qb479XXiKPH3vCWpFOjvKFQjKahw0YJKv4BpuSTs9L1h+hF0AwLT4QDZz+fL KKlyE9fpkb4n6WTdsVjXOIy6d+AgRnkBPLQW4isMLzgpfOEihvreawUzkKIX18Dh4LKx el1g7zcNkEAouPvHl6VMsLhZOZt0pazifSYMFf46Q6xs7RaRhtpyl26H3NovabP1XbI+ lHob582WKns1MP19qkayFBxd63TCthuvX3ZkrTjCRraMxiAeDM4zS/JzTVlJn4mIrCFU lOqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=LyF9saCIb1YQ+2hNH02FlAdCvSji8nBzmsd0lrHbBwk=; fh=seS/sEikBvsmMY4Jkt2o9Ao/cOTvpvMyMOMtQjO7QMI=; b=XDhlr+HxZXVbwyERSVGDFu+sH1nZNtgZRv8vasUgXMYdx780szw/x9YgS8EkSi+7c0 UH9cEVrBoxvPvpktij/PnJK2uBUlbCR5duHunJNSLB0d6wIS4oEZ7tM8fjdUmvpx+jQf BqRyG3B0hJHIDjCtJd7Lh0fIuGIcGN9Vs25JJjixjdjAYUJxQauseR4i/a/I3eUn0V7O HFrmRHx0x3lPAgwvdGthpIolOvmWBV4NQP85hcpdCYT2KlvK2GEGlR19rFI3JjiB7bVE YKsd/rvmKuZp6asjhcDL7iVoiVggMvqIubSflKrqA8ud2cHREA8XkrBfOUiqk2mx56by s6ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J4fmjA4I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a1709067e0b00b00992f81122e9si12645392ejr.340.2023.07.17.08.30.53; Mon, 17 Jul 2023 08:31:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J4fmjA4I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230193AbjGQO4y (ORCPT + 99 others); Mon, 17 Jul 2023 10:56:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbjGQO4w (ORCPT ); Mon, 17 Jul 2023 10:56:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F09A10C0; Mon, 17 Jul 2023 07:56:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 17FAD610FB; Mon, 17 Jul 2023 14:56:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F949C433C9; Mon, 17 Jul 2023 14:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689605810; bh=fMVMLDyaT91QMS4Y0JqnqMsVXKFXNflrRoMtl9SJR0k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=J4fmjA4IrIiL5blX9/bh3cQWJdD7r2RrzlJ5sQWbdRx+emBJ9qnfSPhzsIfp4fARl KUMfdReB5CkdxvD93jRzR+sHsQF7ZRUJeCEflWspo+xG53qDP6PhOkCqFRD3fuBUsc oiY76T1DxZ52Eh1AW/4ZRnOFYr4vyvZcN/bbXNKmccEJdFF10Ql07jUYm1/yyEHtS0 zPGezh34UnfoN9pwTypMk9DhBQD4feVL6h/pKyzAYu4xMLisuudukbivDZm7p/F7YY Rm+NH3q2h+UE5DHILPyUUrweFs+gaEziQVyf8LqfGQJ9Dpub7mzTdZI6WEgI60C6Bv OCZzddguyylUQ== Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2b703d7ed3aso70294721fa.1; Mon, 17 Jul 2023 07:56:50 -0700 (PDT) X-Gm-Message-State: ABy/qLaQ3ijffJgCvCjS1efISVHewFdNe2eaYx6r08wjQw1u4OzFXyT9 wtY/ZzwS2oQYMeFqbGX/nfrVvknorOn1047WI7c= X-Received: by 2002:a2e:700b:0:b0:2b6:cff1:cd1c with SMTP id l11-20020a2e700b000000b002b6cff1cd1cmr8535527ljc.34.1689605808535; Mon, 17 Jul 2023 07:56:48 -0700 (PDT) MIME-Version: 1.0 References: <20230601072043.24439-1-ltao@redhat.com> <20230713100459.GEZK/MS69XbphJa+tN@fat_crate.local> In-Reply-To: From: Ard Biesheuvel Date: Mon, 17 Jul 2023 16:56:37 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] x86/kexec: Add EFI config table identity mapping for kexec kernel To: Tao Liu Cc: Borislav Petkov , tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, bhe@redhat.com, dyoung@redhat.com, kexec@lists.infradead.org, linux-efi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Jul 2023 at 15:53, Tao Liu wrote: > > Hi Borislav, > > On Thu, Jul 13, 2023 at 6:05=E2=80=AFPM Borislav Petkov wr= ote: > > > > On Thu, Jun 01, 2023 at 03:20:44PM +0800, Tao Liu wrote: > > > arch/x86/kernel/machine_kexec_64.c | 35 ++++++++++++++++++++++++++--= -- > > > 1 file changed, 31 insertions(+), 4 deletions(-) > > > > Ok, pls try this totally untested thing. > > > > Thx. > > > > --- > > diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/= sev.c > > index 09dc8c187b3c..fefe27b2af85 100644 > > --- a/arch/x86/boot/compressed/sev.c > > +++ b/arch/x86/boot/compressed/sev.c > > @@ -404,13 +404,20 @@ void sev_enable(struct boot_params *bp) > > if (bp) > > bp->cc_blob_address =3D 0; > > > > + /* Check for the SME/SEV support leaf */ > > + eax =3D 0x80000000; > > + ecx =3D 0; > > + native_cpuid(&eax, &ebx, &ecx, &edx); > > + if (eax < 0x8000001f) > > + return; > > + > > /* > > * Setup/preliminary detection of SNP. This will be sanity-chec= ked > > * against CPUID/MSR values later. > > */ > > snp =3D snp_init(bp); > > > > - /* Check for the SME/SEV support leaf */ > > + /* Recheck the SME/SEV support leaf */ > > eax =3D 0x80000000; > > ecx =3D 0; > > native_cpuid(&eax, &ebx, &ecx, &edx); > > > Thanks a lot for the patch above! Sorry for the late response. I have > compiled and tested it locally against 6.5.0-rc1, though it can pass > the early stage of kexec kernel bootup, OK, so that proves that the cc_blob table access is the culprit here. That still means that kexec on SEV is likely to explode in the exact same way should anyone attempt that. > however the kernel will panic > occasionally later. The test machine is the one with Intel Atom > x6425RE cpu which encountered the page fault issue of missing efi > config table. > Agree with Boris that this seems entirely unrelated. > ...snip... > [ 21.360763] nvme0n1: p1 p2 p3 > [ 21.364207] igc 0000:03:00.0: PTM enabled, 4ns granularity > [ 21.421097] pps pps1: new PPS source ptp1 > [ 21.425396] igc 0000:03:00.0 (unnamed net_device) (uninitialized): PHC= added > [ 21.457005] igc 0000:03:00.0: 4.000 Gb/s available PCIe bandwidth > (5.0 GT/s PCIe x1 link) > [ 21.465210] igc 0000:03:00.0 eth1: MAC: ...snip... > [ 21.473424] igc 0000:03:00.0 enp3s0: renamed from eth1 > [ 21.479446] BUG: kernel NULL pointer dereference, address: 00000000000= 00008 > [ 21.486405] #PF: supervisor read access in kernel mode > [ 21.491519] mmc1: Failed to initialize a non-removable card > [ 21.491538] #PF: error_code(0x0000) - not-present page > [ 21.502229] PGD 0 P4D 0 > [ 21.504773] Oops: 0000 [#1] PREEMPT SMP NOPTI > [ 21.509133] CPU: 3 PID: 402 Comm: systemd-udevd Not tainted 6.5.0-rc1+= #1 > [ 21.515905] Hardware name: ...snip... Why are you snipping the hardware name?