[edk2-devel] [PATCH 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN()

Ard Biesheuvel ardb at kernel.org
Tue Apr 18 08:10:54 UTC 2023


On Tue, 18 Apr 2023 at 08:40, Marvin Häuser <mhaeuser at posteo.de> wrote:
>
>
> > On 17. Apr 2023, at 23:18, Ard Biesheuvel <ardb at kernel.org> wrote:
> >
> > Agree with all of this.
> >
> > And thanks for tracking this down - must not have been fun :-)
>
> No worries - it wasn’t. :) It was mere luck Vitaly discovered early it was an issue that triggered based on the binary layout rather than a bug in the mapping code itself…
>
> Speaking of not fun to track down, I initially wanted to add ASSERTs (yes, runtime :( ) to check the alignment guarantee is actually met. Leif basically declined any form of regression-testing at runtime. Do you happen to have a simple(!) idea for how it could be checked at build-time? (It’s less about “which commands do I run?” and more about integration with the build process / BaseTools, cross-OS compatibility, etc.)
>


I think we should just add another align to the code:

.align xx
func:

< code >

.align xx
.org func + xx

That way, if the code straddles a xx-aligned boundary, the .org will
move backwards and force an error.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103150): https://edk2.groups.io/g/devel/message/103150
Mute This Topic: https://groups.io/mt/98325898/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