From: "joeyli" <jlee@suse.com>
To: devel@edk2.groups.io, kraxel@redhat.com
Cc: "Lee, Chun-Yi" <joeyli.kernel@gmail.com>,
Min M Xu <min.m.xu@intel.com>, Jiewen Yao <jiewen.yao@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
James Bottomley <jejb@linux.ibm.com>,
Erdem Aktas <erdemaktas@google.com>
Subject: Re: [edk2-devel] [PATCH] OvmfPkg/PlatformInitLib: Fix integrity checking failed of NvVarStore in some cases
Date: Wed, 14 Dec 2022 22:24:01 +0800 [thread overview]
Message-ID: <20221214142401.GZ11807@linux-l9pv.suse> (raw)
In-Reply-To: <20221214134516.GY11807@linux-l9pv.suse>
Hi,
On Wed, Dec 14, 2022 at 09:46:36PM +0800, joeyli wrote:
> Hi Gerd,
>
> Thanks for your response!
>
> On Wed, Dec 14, 2022 at 07:15:28AM +0100, Gerd Hoffmann via groups.io wrote:
> > Hi,
> >
> > > When the variable store has those variables, then system booting/rebooting will
> > > hangs in a ASSERT:
> > >
> > > NvVarStore Variable header State was invalid.
> > > ASSERT
> > > /mnt/working/source_code-git/edk2/OvmfPkg/Library/PlatformInitLib/Platform.c(819):
> > > ((BOOLEAN)(0==1))
> >
> > I'm wondering how you manage to trigger this assert?
> >
>
> Sorry for I forgot to put my testing environment in patch description.
> My testing is on qemu with OVMF:
>
> - edk2-master or edk2-stable202211
> build --verbose --debug=1 -D SECURE_BOOT_ENABLE -D TPM_ENABLE -D TPM_CONFIG_ENABLE \
> -D NETWORK_IP6_ENABLE -D NETWORK_HTTP_BOOT_ENABLE -a X64 -b DEBUG -t GCC5 \
> -p OvmfPkg/OvmfPkgX64.dsc -D FD_SIZE_4MB -D NETWORK_TLS_ENABLE
>
> - qemu-7.1.0 with libvirt-8.0.0
> pc-q35 with pflash type and nvram:
> <type arch='x86_64' machine='pc-q35-3.1'>hvm</type>
> <loader readonly='yes' secure='no' type='pflash'>/usr/share/qemu/ovmf-x86_64-code.bin</loader>
> <nvram template='/usr/share/qemu/ovmf-x86_64-vars.bin'>/var/lib/libvirt/qemu/nvram/opensuseTW_VARS.fd</nvram>
>
> - grub2 2.06 and Linux kernel 6.1.0-rc5
>
I forgot shim-15.7, the fallback mechanism created new boot entry and
update bootorder in a new *_VARS.fd :
FSOpen: Open '\EFI\opensuse\boot.csv' Success
UpdateVariable() - Boot0003, 8BE4DF61-93CA-11D2-AA0D-00E098032B8C
FlushHobVariableToFlash() - Boot0003, 8BE4DF61-93CA-11D2-AA0D-00E098032B8C
UpdateVariable() - BootOrder, 8BE4DF61-93CA-11D2-AA0D-00E098032B8C
L1870, State = 0x3F
State &= VAR_DELETED = 0x3D <-- state of BootOrder
FlushHobVariableToFlash() - BootOrder, 8BE4DF61-93CA-11D2-AA0D-00E098032B8C
Joey Lee
> Two test cases, both of them can reproduce the assert:
>
> - First booting to grub2 menu, then "virsh destroy" the guest.
> The second boot hangs in the "NvVarStore Variable header State was invalid." assert
>
> - First boot to Linux kernel 6.1.0-rc5, bash shell prompt shows up.
> Then run shutdown or reboot command.
> The second boot hangs in in the "NvVarStore Variable header State was invalid." assert
>
> > > Adding more log to UpdateVariable() and PlatformValidateNvVarStore(), we
> > > can see there have some variables have 0x3C or 0x3D state in store.
> > > e.g.
> >
> > PlatformValidateNvVarStore() validates the varstore in ROM before
> > copying it to RAM. The normal UpdateVariable() cycle changes the
> > copy in RAM ...
> >
>
> Yes, in the first boot, those variables have 0x3C or 0x3C state be
> created. After shutdown or reboot, system hangs in the second boot.
> The assert shows up in debug log.
>
> Thanks a lot!
> Joey Lee
next prev parent reply other threads:[~2022-12-14 14:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-13 15:55 [PATCH] OvmfPkg/PlatformInitLib: Fix integrity checking failed of NvVarStore in some cases Lee, Chun-Yi
2022-12-14 6:15 ` Gerd Hoffmann
2022-12-14 13:46 ` [edk2-devel] " joeyli
2022-12-14 14:12 ` Gerd Hoffmann
2022-12-14 15:24 ` joeyli
2022-12-14 14:24 ` joeyli [this message]
2022-12-14 6:53 ` Yao, Jiewen
2022-12-14 15:05 ` [edk2-devel] " joeyli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221214142401.GZ11807@linux-l9pv.suse \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox