On Wed, 19 Apr 2023 at 19:45, Marvin Häuser <mhaeu...@posteo.de> wrote:
>
>
> On 19. Apr 2023, at 19:40, Ard Biesheuvel <a...@kernel.org> wrote:
>
> On Wed, 19 Apr 2023 at 19:14, Marvin Häuser <mhaeu...@posteo.de> wrote:
>
>
> Hi all,
>
> While testing Ard's suggestion for V3, I noticed I got a broken FD where 
> ArmReplaceLiveTranslationEntry() is misaligned, but does not cross a 4 KB 
> boundary.
>
>
> Which platform are you building?
>
>
> ArmVirtPkg / AARCH64 / DEBUG / GCC5 (GCC 12.2.0).
>
>
> To not just hide the issue via this patch, can someone please try to explain 
> the exact requirements this function has (the comments read like 0x200 was 
> just the lowest value to guarantee staying within a page)? Why would it be 
> broken if misaligned, but not crossing a page?
>
>
> 0x200 is a log2 upper bound for the size of the function, so it's just
> the smallest value that fits that requirement, determined manually
> iirc
>
> And the only reason we have this is that we can cheaply decide whether
> or not unmapping a page will unmap this function or not, but we could
> actually just use the address and size to decide this.
>
> In any case, if the FD is constructed in a way that violates the
> alignment, there is something wrong with the build tools you are
> using.
>
>
> The tools are stock edk2, the only changes made are those in the latest 
> commit of the linked branch.
>
>
> Is there any chance the FD is somehow misaligned in memory, thus shifting the 
> function across a page in the process? Or is the FD mapped to a fixed address 
> like with x86? Is code after ArmReplaceLiveTranslationEntry() crossing page 
> boundaries the actual issue (and is implicitly fixed by aligning it)?
>
>
> If you are building ArmVirtQemu.dsc, the FD is mapped at address 0x0
> and the FV is mapped at 0x1000
>
>
> Then the function simply is not crossing a page boundary... which means the 
> patch did fix a valid bug, but it wasn't what actually caused the corruption. 
> Any help is appreciated. :)
>

Your branch seems to be missing 16e0969ef775b898ac700f3261d76030b8ab9ef0

"ArmVirtPkg/ArmVirtQemu: Use PEI flavor of ArmMmuLib for all PEIMs"


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103235): https://edk2.groups.io/g/devel/message/103235
Mute This Topic: https://groups.io/mt/98325898/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to