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.web11.3270.1681805469983936856 for ; Tue, 18 Apr 2023 01:11:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NgWkiLWr; 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 4D9CE62E5F for ; Tue, 18 Apr 2023 08:11:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32CD8C4339E for ; Tue, 18 Apr 2023 08:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681805468; bh=URH3f+mdl0PErEedef0Yawt5g6MuGf5DpuYPkYEtm5w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NgWkiLWr9DTDO5SRAuGSeGGnRWzFI5yuyzNk2dyG25V5A8/e6ttvcNga167ylhtsS 3kWxEhbeUYfw5BSlXszVP/FTMD5WkcLOBfkDL1tnzk/kXEaErScyfKPGBoSAJOc+mg 9D3ZxWhuTzAcl021PvXNg+r5DU5uR6q9qY2Wer3qCX1ka1CVRkGmYri9/j2b6UfCk/ NS1wABaBMd8kO2QSo/xmKD5w7o0H8PTkdhHez3q5ydI8tbr/nM0bWlnGyr/SBSSERD fB2Vf733YhBsUc+TiY7enAR077RZ8t/pkYqNyDu7eLQMcTClQaS5EfoaRiQzsqHdUY 6slpBoibJgaMg== Received: by mail-lj1-f177.google.com with SMTP id a29so30140087ljq.0 for ; Tue, 18 Apr 2023 01:11:08 -0700 (PDT) X-Gm-Message-State: AAQBX9cWdUKSIp6VRfOLStZ0KNhDa2ak5qMO4kCvv9QvfJzxZdNDguO3 0LuV1azWi1uidfepWuV0mHW39Q3KviTpEXGhBGE= X-Google-Smtp-Source: AKy350Zq9w+c+87LRUlM863do0uZHytnGMzj740yjbVACxHmA72f63edxTN7dQJPzAJfNWEOr153946ZiwvgPuBgT6M= X-Received: by 2002:a2e:b17c:0:b0:295:a8e6:6b15 with SMTP id a28-20020a2eb17c000000b00295a8e66b15mr484743ljm.4.1681805466221; Tue, 18 Apr 2023 01:11:06 -0700 (PDT) MIME-Version: 1.0 References: <46CED01C-BEA6-49F3-9634-051DC63D248C@posteo.de> In-Reply-To: <46CED01C-BEA6-49F3-9634-051DC63D248C@posteo.de> From: "Ard Biesheuvel" Date: Tue, 18 Apr 2023 10:10:54 +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 , devel@edk2.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 08:40, Marvin H=C3=A4user wrote= : > > > > 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 ear= ly 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 basic= ally declined any form of regression-testing at runtime. Do you happen to h= ave 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 about i= ntegration 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.