Re: [PATCH 0/7] efi/libstub: Avoid UTF-16 conversion busywork

From: Vincent Mailhol

Date: Sun Sep 06 2026 - 18:15:08 EST


On 06/09/2026 at 15:08, Ard Biesheuvel wrote:
> The EFI libstub performs some redundant conversions between UTF-16 and
> UTF-8 and back again, which includes dealing with surrogate pairs, which
> UEFI implementations themselves simply ignore.
>
> So drop all the homegrown code, and use the existing UCS-2 (== UTF-16
> without surrogate pairs) library code where conversion to UTF-8 is
> actually needed (the kernel command line).
>
> The remaining handling involves the EFI console, which supports wide
> characters natively, so just use those directly.
>
> Cc: Vincent Mailhol <mailhol@xxxxxxxxxx>
> Cc: x86@xxxxxxxxxx

With the panic() dependency now resolved, this compiles and run well.
I rebased my BLI series on top of it and could confirm the good
behaviour of efi_snprintf(). I just sent a v3 of my BLI patch.

Link: https://lore.kernel.org/linux-efi/20260906-efi_stub_bli-v3-1-e7dc0d6b8fcd@xxxxxxxxxx/


That said, sashiko has a few findings which looks relevant to me:

Link: https://sashiko.dev/#/patchset/20260906130817.1151961-9-ardb%40kernel.org

with the two most concerning findings being the correct handling of
ucs2_as_utf8()'s options argument when it is NULL and the correct
NUL-termination of the kernel cmdline.

I didn't try to reproduce those issues, but the report looked legit to
me.


Yours sincerely,
Vincent Mailhol