[edk2-devel] [PATCH] UefiCpuPkg/MicrocodeMeasurementDxe: Fix exception

Michael D Kinney michael.d.kinney at intel.com
Tue Mar 7 23:52:47 UTC 2023


Hi Ray,

It is in an error path.  My guess is that this error path has not been used
since this bug was introduced.

Can you please merge this fix?

Mike

> -----Original Message-----
> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Ni, Ray
> Sent: Tuesday, March 7, 2023 3:24 PM
> To: devel at edk2.groups.io; Reyes, Darbin <darbin.reyes at intel.com>
> Cc: Narey, Jacob <jacob.narey at intel.com>
> Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/MicrocodeMeasurementDxe: Fix exception
> 
> Great fix.
> I am wondering why this bug was not found earlier.
> If Status is 0 (Success), #PF exception would occur when NULL pointer protection is turned on.
> If Status is 0x80000000_x (Error), #GP exception would occur because an address with only the BIT63 set is an
> invalid address.
> 
> Thanks,
> Ray
> 
> > -----Original Message-----
> > From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Darbin
> > Reyes
> > Sent: Wednesday, March 8, 2023 7:04 AM
> > To: devel at edk2.groups.io
> > Cc: Reyes, Darbin <darbin.reyes at intel.com>; Narey, Jacob
> > <jacob.narey at intel.com>
> > Subject: [edk2-devel] [PATCH] UefiCpuPkg/MicrocodeMeasurementDxe: Fix
> > exception
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4360
> >
> > An incorrect format specifier is being used in a DEBUG print,
> > specifically, a variable of type EFI_STATUS was being printed with
> > the %a format specifier (pointer to an ASCII string), thus the value of
> > the Status variable was being treated as the address of a string,
> > leading to a CPU exception, when encountered this bug manifests itself
> > as a hang near "Ready to Boot Event", with the last DEBUG print being
> > "INFO: Got MicrocodePatchHob with microcode patches starting address"
> > followed by a CPU Exception dump.
> >
> > Signed-off-by: Darbin Reyes <darbin.reyes at intel.com>
> > Reviewed-by: Jacob Narey <jacob.narey at intel.com>
> > ---
> >  UefiCpuPkg/MicrocodeMeasurementDxe/MicrocodeMeasurementDxe.c |
> > 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git
> > a/UefiCpuPkg/MicrocodeMeasurementDxe/MicrocodeMeasurementDxe.c
> > b/UefiCpuPkg/MicrocodeMeasurementDxe/MicrocodeMeasurementDxe.c
> > index 762ca159ff..5fd3b3365c 100644
> > ---
> > a/UefiCpuPkg/MicrocodeMeasurementDxe/MicrocodeMeasurementDxe.c
> > +++
> > b/UefiCpuPkg/MicrocodeMeasurementDxe/MicrocodeMeasurementDxe.c
> > @@ -238,7 +238,7 @@ MeasureMicrocodePatches (
> >         TotalMicrocodeSize)
> >
> >        );
> >
> >    } else {
> >
> > -    DEBUG ((DEBUG_ERROR, "ERROR: TpmMeasureAndLogData failed with
> > status %a!\n", Status));
> >
> > +    DEBUG ((DEBUG_ERROR, "ERROR: TpmMeasureAndLogData failed with
> > status %r!\n", Status));
> >
> >    }
> >
> >
> >
> >    FreePool (Offsets);
> >
> > --
> > 2.38.1.windows.1
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#100818):
> > https://edk2.groups.io/g/devel/message/100818
> > Mute This Topic: https://groups.io/mt/97461560/1712937
> > Group Owner: devel+owner at edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni at intel.com]
> > -=-=-=-=-=-=
> >
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100822): https://edk2.groups.io/g/devel/message/100822
Mute This Topic: https://groups.io/mt/97461560/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3943202/1813853/130120423/xyzzy [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list