[edk2-devel] ovmf miscompiles with gcc-12

Jiri Slaby jirislaby at kernel.org
Tue Jun 7 11:14:20 UTC 2022


On 07. 06. 22, 13:07, Gerd Hoffmann wrote:
> On Tue, Jun 07, 2022 at 12:38:46PM +0200, Jiri Slaby wrote:
>> Hi,
>>
>> On 07. 06. 22, 12:31, Gerd Hoffmann wrote:
>>>> The reason is TemporaryRamMigration() overwrites rbp unconditionally -- it
>>>> adds an offset to rbp even if rbp is NOT used as a frame pointer
>>>
>>>> Now, what is the right way to fix this? Do the SetJump/LongJump in assembly
>>>> and wrap it into push rbp/pop rbp?
>>>
>>> push/pop rbp will break in case frame pointers are used, no?
>>
>> Yes, see the downstream bug at:
>>
>> https://bugzilla.suse.com/show_bug.cgi?id=1199597#c45
>>
>> and read further.
>>
>>> I think essentially the code needs to know whenever frame pointers are
>>> used or not and then update (or not) rbp depending on that.  Update
>>> compiler flags to explicitly set -f(no-)omit-frame-pointer, also add
>>> -D OMIT_FRAME_POINTER=1, the compile conditionally on OMIT_FRAME_POINTER?
>>
>> Yes, the comment above mentions this too (cf. CONFIG_FRAME_POINTER in the
>> kernel). So see the downstream bugzilla for discussion.
> 
> Ok.  So what is the status here?  Someone working on patches?

I don't know of anybody. I only tracked it down, reported and worked 
around locally by:
--- a/OvmfPkg/Sec/SecMain.c
+++ b/OvmfPkg/Sec/SecMain.c
@@ -928,7 +928,7 @@ SecStartupPhase2 (
    CpuDeadLoop ();
  }

-EFI_STATUS
+EFI_STATUS __attribute__((optimize("-fno-omit-frame-pointer")))
  EFIAPI
  TemporaryRamMigration (
    IN CONST EFI_PEI_SERVICES  **PeiServices,

>> The upstream bugzilla needs an account which I don't have and cannot create
>> automatically. It needs manual intervention and I am too lazy to do so.
> 
> It's just an email though:
>    https://github.com/tianocore/tianocore.github.io/wiki/Reporting-Issues

As I wrote earlier, there is a bug created by the openSUSE ovmf 
maintainer (Joey):
https://bugzilla.tianocore.org/show_bug.cgi?id=3934

If there is any input needed from me, I might reconsider... So far, it's 
stuck.

regards,
-- 
js


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




More information about the edk2-devel-archive mailing list