Oliver Wagner
2015-Aug-15 11:03 UTC
[syslinux] [PATCH] EFI booting may hang indefinitely when no keyboard is present
EFI booting may hang indefinitely when no keyboard is present on a machine (or when UEFI has chosen to not init USB due to fast boot). Reproducible at least with "EFI v2.31 by American Megatrends" on an Asrock H81M-ITX board. Reason is the input draining loop near the end in efi/main.c; it calls ReadKeyStroke() as long as EFI_NOT_READY is not returned. On machines without keyboard, EFI_DEVICE_ERROR may be returned instead, causing infinite looping. Positively checking for EFI_SUCCESS keeps the intent while avoiding this behavior. Patch is against 6.03; the issue is still present in 6.04 as per e466d2498604c8eea055a8e98284d65311073b39 Best Regards, Olli --- syslinux-6.03/efi/main.c.orig 2015-08-15 12:31:33.987766223 +0200 +++ syslinux-6.03/efi/main.c 2015-08-15 12:31:44.427993051 +0200 @@ -1324,7 +1324,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EF in = ST->ConIn; do { status = uefi_call_wrapper(in->ReadKeyStroke, 2, in, &key); - } while (status != EFI_NOT_READY); + } while (status == EFI_SUCCESS); if (!setjmp(load_error_buf)) load_env32(NULL);
Ady
2015-Aug-15 12:31 UTC
[syslinux] [PATCH] EFI booting may hang indefinitely when no keyboard is present
> EFI booting may hang indefinitely when no keyboard is present on a > machine (or when UEFI has chosen to not init USB due to fast boot). > Reproducible at least with "EFI v2.31 by American Megatrends" on an > Asrock H81M-ITX board. > > Reason is the input draining loop near the end in efi/main.c; it calls > ReadKeyStroke() as long as EFI_NOT_READY is not returned. On machines > without keyboard, EFI_DEVICE_ERROR may be returned instead, causing > infinite looping. Positively checking for EFI_SUCCESS keeps the intent > while avoiding this behavior. > > Patch is against 6.03; the issue is still present in 6.04 as per > e466d2498604c8eea055a8e98284d65311073b39 > > Best Regards, > OlliThank you for sharing patch. I assume this patch was tested on systems with no keyboard connected. I wonder whether it was (also) tested on systems that do have a keyboard connected. Among such systems, we could mention different types of connections (not just USB), and even those with a KVM switch (not to be confused with Kernel-based Virtual Machine). In addition to being able to boot Syslinux in all those systems, I also wonder whether this patch could affect any of the special keys and their related directives' behavior (and if so, hopefully for good?). I am referring mainly to: http://www.syslinux.org/wiki/index.php/Directives/special_keys TIA, Ady.
Oliver Wagner
2015-Aug-15 16:35 UTC
[syslinux] [PATCH] EFI booting may hang indefinitely when no keyboard is present
On 15.08.2015 14:31, Ady via Syslinux wrote:> > Thank you for sharing patch. > > I assume this patch was tested on systems with no keyboard connected. > > I wonder whether it was (also) tested on systems that do have a > keyboard connected. Among such systems, we could mention different > types of connections (not just USB), and even those with a KVM switch > (not to be confused with Kernel-based Virtual Machine).The patch was tested with and without keyboard. Please note that it doesn't touch any of the actual input handling; it solely modifies the input-discarding-loop immediately before jumping into the kernel. Best Regards, Olli
Gene Cumm
2015-Sep-02 18:32 UTC
[syslinux] [PATCH] EFI booting may hang indefinitely when no keyboard is present
On Sat, Aug 15, 2015 at 7:03 AM, Oliver Wagner via Syslinux <syslinux at zytor.com> wrote:> EFI booting may hang indefinitely when no keyboard is present on a machine > (or when UEFI has chosen to not init USB due to fast boot). Reproducible at > least with "EFI v2.31 by American Megatrends" on an Asrock H81M-ITX board. > > Reason is the input draining loop near the end in efi/main.c; it calls > ReadKeyStroke() as long as EFI_NOT_READY is not returned. On machines > without keyboard, EFI_DEVICE_ERROR may be returned instead, causing infinite > looping. Positively checking for EFI_SUCCESS keeps the intent while avoiding > this behavior. > > Patch is against 6.03; the issue is still present in 6.04 as per > e466d2498604c8eea055a8e98284d65311073b39 > > Best Regards, > Olli > > --- syslinux-6.03/efi/main.c.orig 2015-08-15 12:31:33.987766223 +0200 > +++ syslinux-6.03/efi/main.c 2015-08-15 12:31:44.427993051 +0200 > @@ -1324,7 +1324,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EF > in = ST->ConIn; > do { > status = uefi_call_wrapper(in->ReadKeyStroke, 2, in, &key); > - } while (status != EFI_NOT_READY); > + } while (status == EFI_SUCCESS); > > if (!setjmp(load_error_buf)) > load_env32(NULL);Applied. Thanks! -- -Gene