From b35300fc67cc050ce3f709a88a4437153d85e0ee Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 17 Feb 2025 13:11:28 +0000 Subject: [efi] Increase download timeout for autoexec.ipxe In almost all cases, the download timeout for autoexec.ipxe is irrelevant: the operation will either succeed or fail relatively quickly (e.g. due to a nonexistent file). The overall download timeout exists only to ensure that an unattended or headless system will not wait indefinitely in the case of a degenerate network response (e.g. an HTTP server that returns an endless trickle of data using chunked transfer encoding without ever reaching the end of the file). The current download timeout is too short if PeerDist content encoding is enabled, since the overall download will abort before the first peer discovery attempt has completed, and without allowing sufficient time for an origin server range request. The single timeout value is currently used for both the download timeout and the sync timeout. The latter timeout exists only to allow network communication to be gracefully quiesced before removing the temporary MNP network device, and may safely be shortened without affecting functionality. Fix by increasing the download timeout from two seconds to 30 seconds, and defining a separate one-second timeout for the sync operation. Reported-by: Michael Niehaus Signed-off-by: Michael Brown --- src/interface/efi/efi_autoexec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/interface/efi/efi_autoexec.c b/src/interface/efi/efi_autoexec.c index 44b8b645b..73ba5df33 100644 --- a/src/interface/efi/efi_autoexec.c +++ b/src/interface/efi/efi_autoexec.c @@ -43,7 +43,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); */ /** Timeout for autoexec script downloads */ -#define EFI_AUTOEXEC_TIMEOUT ( 2 * TICKS_PER_SEC ) +#define EFI_AUTOEXEC_TIMEOUT ( 30 * TICKS_PER_SEC ) + +/** Timeout for autoexec pending operation completion */ +#define EFI_AUTOEXEC_SYNC_TIMEOUT ( 1 * TICKS_PER_SEC ) /** Autoexec script image name */ #define EFI_AUTOEXEC_NAME "autoexec.ipxe" @@ -136,7 +139,7 @@ static int efi_autoexec_network ( EFI_HANDLE handle, struct image **image ) { } /* Ensure network exchanges have completed */ - sync ( EFI_AUTOEXEC_TIMEOUT ); + sync ( EFI_AUTOEXEC_SYNC_TIMEOUT ); err_open: err_cwuri: -- cgit