public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Marvin Häuser" <mhaeuser@posteo.de>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	 Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Sami Mujawar <sami.mujawar@arm.com>,
	 Vitaly Cheptsov <vit9696@protonmail.com>
Subject: Re: [edk2-devel] [PATCH 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN()
Date: Wed, 19 Apr 2023 20:03:16 +0200	[thread overview]
Message-ID: <CAMj1kXEGJBd8kn9_gDa4tpXG3RWQL_GKN0QDR10FL4pguSWuOQ@mail.gmail.com> (raw)
In-Reply-To: <696924B3-EF5B-4799-AAD9-E090C97D9AA9@posteo.de>

On Wed, 19 Apr 2023 at 19:45, Marvin Häuser <mhaeuser@posteo.de> wrote:
>
>
> On 19. Apr 2023, at 19:40, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Wed, 19 Apr 2023 at 19:14, Marvin Häuser <mhaeuser@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"

  reply	other threads:[~2023-04-19 18:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 18:09 [PATCH 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN() Marvin Häuser
2023-04-17 18:09 ` [PATCH 2/2] ArmPkg/ArmMmuLib: Fix ArmReplaceLiveTranslationEntry() alignment Marvin Häuser
2023-04-17 19:53   ` Leif Lindholm
2023-04-17 19:52 ` [PATCH 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN() Leif Lindholm
2023-04-17 21:18   ` Ard Biesheuvel
2023-04-18  6:40     ` Marvin Häuser
2023-04-18  8:10       ` Ard Biesheuvel
2023-04-18  8:18         ` Marvin Häuser
2023-04-18  8:59           ` Ard Biesheuvel
2023-04-19 17:13           ` Marvin Häuser
2023-04-19 17:40             ` [edk2-devel] " Ard Biesheuvel
2023-04-19 17:45               ` Marvin Häuser
2023-04-19 18:03                 ` Ard Biesheuvel [this message]
2023-04-19 18:25                   ` Marvin Häuser
2023-04-19 18:26                     ` Ard Biesheuvel
2023-04-19 18:31                       ` Marvin Häuser
2023-04-19 19:48                         ` Ard Biesheuvel
2023-04-19 20:10                           ` Marvin Häuser
2023-04-19 21:42                             ` Marvin Häuser
2023-04-19 21:55                             ` Ard Biesheuvel
2023-04-19 22:15                               ` Marvin Häuser
2023-04-19 22:27                               ` Pedro Falcato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMj1kXEGJBd8kn9_gDa4tpXG3RWQL_GKN0QDR10FL4pguSWuOQ@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox