<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 20, 2023, 12:33 Gerd Hoffmann <<a href="mailto:kraxel@redhat.com">kraxel@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Jun 19, 2023 at 10:32:25PM +0200, Oliver Steffen wrote:<br>
> Recent versions of shim (15.6 and 15.7) crash when the newly added<br>
> EFI_MEMORY_ATTRIBUTE_PROTOCOL is provided by the firmware.  To allow<br>
> existing installations to boot, provide a workaround in form of a Pcd<br>
> that allows tuning it off at build time (defaults to 'enabled').<br>
<br>
Background:  We have untested + broken code for<br>
EFI_MEMORY_ATTRIBUTE_PROTOCOL support in the listed shim releases.<br>
<br>
Now that firmware starts to actually provide that protocol the<br>
time bomb explodes.<br><br> <br></blockquote></div></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> </blockquote></div></div><div dir="auto"><br></div><div dir="auto">Fantastic.</div><div dir="auto"><br></div><div dir="auto">This is kind of a big deal, really, and just turning it off for ArmVirtQemu does not help at all with the fact that these shim builds will crash on any platform that implements the protocol. (Including x86)</div><div dir="auto"><br></div><div dir="auto">Given that secure boot is kind of pointless on this particular platform anyway, maybe this is a good opportunity to make shim optional in the boot chain? I understand that this does not fix existing builds but shim proves to be such a problematic component that you really should not be using it if there is no need.</div><div dir="auto"><br></div><div dir="auto">As for the protocol, this has its own set of problems, and the bug in question can partly be blamed on the misdesigned api, which has separate set and clear methods. Not only does this force the implementation to traverse the page tables twice for the common case of switching between RO and XP or vice versa, it also means we lose any transactional properties of a RO <-> XP switch. I.e., if we could make it the implementation's responsibility to ensure that such a transformation either completes successfully, or otherwise, doesn't make any modifications at all, the risk of ending up in a limbo state is reduced significantly.</div><div dir="auto"><br></div><div dir="auto">So maybe there is still opportunity for specifying a MemoryAttributes2 protocol with a single method for set and clear? We could just drop the current one in that case.</div><div dir="auto"><br></div><div dir="auto">In any case, while i can see how this patch helps make all your ci status icons turn green again, it does so by papering over the underlying issue so I'm not a fan.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> --- a/ArmPkg/ArmPkg.dec<br>
> +++ b/ArmPkg/ArmPkg.dec<br>
> @@ -172,6 +172,9 @@ [PcdsFixedAtBuild.common]<br>
>    gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0xffff0000|UINT64|0x00000004<br>
>    gArmTokenSpaceGuid.PcdCpuResetAddress|0x00000000|UINT32|0x00000005<br>
>  <br>
> +  # Enable/Disable EFI_MEMORY_ATTRIBUTE_PROTOCOL<br>
> +  gArmTokenSpaceGuid.PcdEnableEfiMemoryAttributeProtocol|TRUE|BOOLEAN|0x000000EE<br>
> +<br>
>    #<br>
>    # ARM Secure Firmware PCDs<br>
>    #<br>
<br>
Given that I expect we will run into the very same problem on x64 as<br>
soon as EFI_MEMORY_ATTRIBUTE_PROTOCOL gets enabled there we should<br>
probably define the PCD in MdePkg not ArmPkg (which implies splitting<br>
the patch into a mini series with one MdePkg and one ArmPkg patch).<br>
<br>
take care,<br>
  Gerd<br>
<br>
</blockquote></div></div></div>


<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>


Groups.io Links:<p>


  
    You receive all messages sent to this group.
  
  


<p>
<a target="_blank" href="https://edk2.groups.io/g/devel/message/106214">View/Reply Online (#106214)</a> |


  

|

  <a target="_blank" href="https://groups.io/mt/99631663/1813853">Mute This Topic</a>


| <a href="https://edk2.groups.io/g/devel/post">New Topic</a>

<br>




<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>