public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* CcProbeLib not working for runtime calls
@ 2022-08-17 11:04 Gerd Hoffmann
  2022-08-18  1:47 ` [edk2-devel] " Min Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2022-08-17 11:04 UTC (permalink / raw)
  To: devel; +Cc: min.m.xu

  Hi,

https://bugzilla.redhat.com/show_bug.cgi?id=2114858

I think the call chain is:

-> linux does efi runtime call
  -> some debug message printed
    -> OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
      -> MdePkg/Library/BaseIoLibIntrinsic (IoWriteFifo8)
        -> OvmfPkg/Library/CcProbeLib (CcProbe)
          -> page fault when trying to access WorkArea

Hmm.

We could probably reserve the workarea page and register it for a
runtime mapping etc.  I suspect that'll only crash the in simliar ways a
little later because the tdx/sev code is not prepared to work on runtime
calls.  I'm also not sure this is possible to make work at all given
that #vc/#ve faults are handled by the linux kernel not ovmf at this
point.

So have CcProbe just return CcGuestTypeNonEncrypted when called at
runtime, hoping that the linux kernel handles #vc / #ve faults properly
should they occur?

take care,
  Gerd


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] CcProbeLib not working for runtime calls
  2022-08-17 11:04 CcProbeLib not working for runtime calls Gerd Hoffmann
@ 2022-08-18  1:47 ` Min Xu
  2022-08-18  4:58   ` Gerd Hoffmann
  0 siblings, 1 reply; 4+ messages in thread
From: Min Xu @ 2022-08-18  1:47 UTC (permalink / raw)
  To: devel@edk2.groups.io, kraxel@redhat.com; +Cc: Xu, Min M

On August 17, 2022 7:05 PM, Gerd Hoffmann wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=2114858
> 
> I think the call chain is:
> 
> -> linux does efi runtime call
>   -> some debug message printed
>     -> OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
>       -> MdePkg/Library/BaseIoLibIntrinsic (IoWriteFifo8)
>         -> OvmfPkg/Library/CcProbeLib (CcProbe)
>           -> page fault when trying to access WorkArea
> 

I think this bug shares the same root cause. https://bugzilla.tianocore.org/show_bug.cgi?id=3974
And there is a fix awaiting for review. https://edk2.groups.io/g/devel/message/91132

Gerd, what's your thought?

Thanks
Min


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] CcProbeLib not working for runtime calls
  2022-08-18  1:47 ` [edk2-devel] " Min Xu
@ 2022-08-18  4:58   ` Gerd Hoffmann
  2022-08-19  3:39     ` Min Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2022-08-18  4:58 UTC (permalink / raw)
  To: Xu, Min M; +Cc: devel@edk2.groups.io

On Thu, Aug 18, 2022 at 01:47:37AM +0000, Xu, Min M wrote:
> On August 17, 2022 7:05 PM, Gerd Hoffmann wrote:
> > https://bugzilla.redhat.com/show_bug.cgi?id=2114858
> > 
> > I think the call chain is:
> > 
> > -> linux does efi runtime call
> >   -> some debug message printed
> >     -> OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> >       -> MdePkg/Library/BaseIoLibIntrinsic (IoWriteFifo8)
> >         -> OvmfPkg/Library/CcProbeLib (CcProbe)
> >           -> page fault when trying to access WorkArea
> > 
> 
> I think this bug shares the same root cause. https://bugzilla.tianocore.org/show_bug.cgi?id=3974

Yes, highly likely this is the same.

> And there is a fix awaiting for review. https://edk2.groups.io/g/devel/message/91132

Hmm.  When the tdx/sev code actually works properly in runtime mode we
should be able to reserve the workarea, mark it as runtime memory
(SetMemorySpaceAttributes) and access it from runtime code, so we don't
need two different ways to figure what CC mode we are running in.

take care,
  Gerd


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] CcProbeLib not working for runtime calls
  2022-08-18  4:58   ` Gerd Hoffmann
@ 2022-08-19  3:39     ` Min Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Min Xu @ 2022-08-19  3:39 UTC (permalink / raw)
  To: kraxel@redhat.com; +Cc: devel@edk2.groups.io, Xu, Min M

On August 18, 2022 12:58 PM, Gerd Hoffmann wrote:
> On Thu, Aug 18, 2022 at 01:47:37AM +0000, Xu, Min M wrote:
> > On August 17, 2022 7:05 PM, Gerd Hoffmann wrote:
> > > https://bugzilla.redhat.com/show_bug.cgi?id=2114858
> > >
> > > I think the call chain is:
> > >
> > > -> linux does efi runtime call
> > >   -> some debug message printed
> > >     -> OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> > >       -> MdePkg/Library/BaseIoLibIntrinsic (IoWriteFifo8)
> > >         -> OvmfPkg/Library/CcProbeLib (CcProbe)
> > >           -> page fault when trying to access WorkArea
> > >
> >
> > I think this bug shares the same root cause.
> > https://bugzilla.tianocore.org/show_bug.cgi?id=3974
> 
> Yes, highly likely this is the same.
> 
> > And there is a fix awaiting for review.
> > https://edk2.groups.io/g/devel/message/91132
> 
> Hmm.  When the tdx/sev code actually works properly in runtime mode we
> should be able to reserve the workarea, mark it as runtime memory
> (SetMemorySpaceAttributes) and access it from runtime code, so we don't
> need two different ways to figure what CC mode we are running in.
Yes. I will submit a patch to fix it.

Thanks
Min

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-19  3:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-17 11:04 CcProbeLib not working for runtime calls Gerd Hoffmann
2022-08-18  1:47 ` [edk2-devel] " Min Xu
2022-08-18  4:58   ` Gerd Hoffmann
2022-08-19  3:39     ` Min Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox