grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v9 02/11] Unify GUID types


From: Ard Biesheuvel
Subject: Re: [PATCH v9 02/11] Unify GUID types
Date: Thu, 31 Aug 2023 11:32:05 +0200

On Wed, 30 Aug 2023 at 21:07, Vladimir 'phcoder' Serbinenko
<phcoder@gmail.com> wrote:
>
>
>
> Le mer. 30 août 2023, 16:38, Daniel Kiper <dkiper@net-space.pl> a écrit :
>>
>> On Wed, Aug 30, 2023 at 04:23:36PM +0200, Ard Biesheuvel wrote:
>> > On Wed, 30 Aug 2023 at 16:18, Daniel Kiper <dkiper@net-space.pl> wrote:
>> > >
>> > > On Fri, Aug 25, 2023 at 05:50:58AM -0700, Oliver Steffen wrote:
>> > > > Quoting Vladimir 'phcoder' Serbinenko (2023-08-15 18:14:11)
>> > >
>> > > [...]
>> > >
>> > > > I am not sure what the best way forward is now, but we at least have 
>> > > > the
>> > > > patches from Vladimir (thanks!).
>> > > >
>> > > > Pedro, Adrian, could you - if you get a chance - try them with a 4 byte
>> > > > alignment too?
>> > >
>> > > Yes, that would be perfect. If Itanium works then I suggest to align
>> > > GUIDs to 4 bytes. This alignment is used in the kernel for more than
>> > > 4 years and it looks nobody complains...
>> > >
>> > > Pedro, Adrian, could you change GUIDs alignment in Vladimir's patches to
>> > > 4 and test them on Itanium?
>> > >
>> >
>> > Note that itanium is a 64-bit architecture, whereas the potential
>> > alignment/padding issue I raised only occurs on 32-bit systems.
>>
>> Yeah, I know. But IIRC your Linux kernel patch aligns GUIDs to 4 bytes
>> even on Itanium. So, how does it work on 64-bit architecture and nobody
>> complained for more than 4 years... Hmmm...
>
>
> Unaligned access causes an exception. In GRUB it leads to unhandled 
> exception. Linux catches exception and emulates unaligned access. It's 
> typical for RISC platforms

No it does not, at least not in the general case.

Every Linux arch except IA-64 supports booting via the EFI stub, which
is Linux kernel code that executes in the context of the EFI boot
services. Any unaligned accesses occurring in this phase will be
handled by the system firmware in the exact same way as an unaligned
access caused by a misaligned GUID provided by GRUB. This is why the
Linux EFI code needed to be fixed.

IA-64 deviates in this regard because it predates the introduction of
the EFI stub, and the only EFI calls that occur from Linux are runtime
services calls. Any unaligned traps occurring in that context will
indeed be fixed up by the kernel, and this explains why neither the
original unaligned GUIDs nor the 4-byte aligned ones Linux has been
using for the past four years ever created any problems on IA-64



reply via email to

[Prev in Thread] Current Thread [Next in Thread]