From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.3974.1681808375371377687 for ; Tue, 18 Apr 2023 01:59:35 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GYE9LKRt; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D677E60F87 for ; Tue, 18 Apr 2023 08:59:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46FE3C433D2 for ; Tue, 18 Apr 2023 08:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681808374; bh=RvM9qyuBonuR3LHDXIpkot+vTxi5EJOvGBhL7wlMBNY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GYE9LKRtpytnuZxvgOl5r0rdj6+5HWbAcf5AMZ+3Cl58uYRJJx6z8RiTbDqfx7bG/ 63UGNSLLIG9tNZ34i4GcVvlgbM/BacXMcK05HtUqL0adNBElxVxxZOGbZlMHySbciD /RytQIZ0UfRnEl+9f3XXmXuxwGzPrMLyWP7q7KBGvFsTGCyCsKx8Gcc+gX3yziUrkC 3IHvuLLrXsPANiqmtwOt90FAkoqw51Xan27rVWPg4YybtGihQcI39oHY5IbMw99EYU JxhD2H2/cdQkMC9AHC1D6SVneqLusITiXOhrAV0ntj0vTdJZxocbk5gWdjrH4SLj5z 1YFrqghqogfVw== Received: by mail-lj1-f175.google.com with SMTP id c3so6148307ljf.7 for ; Tue, 18 Apr 2023 01:59:34 -0700 (PDT) X-Gm-Message-State: AAQBX9dMM/NRe4CFUKczzMT3ut6n4J7f9XFCXRuGm5ul0nZ3IHMhtnQD kHtS4+uxxQ1iFTYxU7s8pvjOEc/u+DkoADyeCAI= X-Google-Smtp-Source: AKy350YoMCtPl/EcXqCjNTwMkItKAtDHLaryuMgNhsUlinzsgmvFGzNMO1ODUciqljLTJDnEWEROzqvwR49nmLbZjxc= X-Received: by 2002:a2e:9f4e:0:b0:2a8:2122:102f with SMTP id v14-20020a2e9f4e000000b002a82122102fmr474995ljk.49.1681808372347; Tue, 18 Apr 2023 01:59:32 -0700 (PDT) MIME-Version: 1.0 References: <46CED01C-BEA6-49F3-9634-051DC63D248C@posteo.de> In-Reply-To: From: "Ard Biesheuvel" Date: Tue, 18 Apr 2023 10:59:20 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN() To: =?UTF-8?Q?Marvin_H=C3=A4user?= Cc: Leif Lindholm , edk2-devel-groups-io , Ard Biesheuvel , Sami Mujawar , Vitaly Cheptsov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 18 Apr 2023 at 10:18, Marvin H=C3=A4user wrote= : > > > > > On 18. Apr 2023, at 10:10, Ard Biesheuvel wrote: > > > > On Tue, 18 Apr 2023 at 08:40, Marvin H=C3=A4user w= rote: > >> > >> > >>> On 17. Apr 2023, at 23:18, Ard Biesheuvel wrote: > >>> > >>> Agree with all of this. > >>> > >>> And thanks for tracking this down - must not have been fun :-) > >> > >> No worries - it wasn=E2=80=99t. :) 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=E2=80=A6 > >> > >> Speaking of not fun to track down, I initially wanted to add ASSERTs (= yes, runtime :( ) to check the alignment guarantee is actually met. Leif ba= sically declined any form of regression-testing at runtime. Do you happen t= o have a simple(!) idea for how it could be checked at build-time? (It=E2= =80=99s less about =E2=80=9Cwhich commands do I run?=E2=80=9D and more abou= t integration with the build process / BaseTools, cross-OS compatibility, e= tc.) > >> > > > > > > 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. > > Wow, that's pretty fucking smart... I didn't even know that directive was= a thing. I will try to toy with it soon. Do you want it as a separate seri= es, separate commit in the current series, or squashed into the fix? I think it makes sense to just fold this into the second patch.