From 6b197e58f60021c7a9ce920548928776062084ed Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Wed, 12 Feb 2020 22:29:08 +0000 Subject: [PATCH] efiloader: don't execute hooks when setting currdev/loaddev We still need to set the hooks to prevent improper manipulations thereafter at the loader prompt, but as it is we're actively preventing loaddev from being set correctly in some circumstances (ZFS in particular) and doing more work than needed with currdev -- that hook in particular validates it as a correct device, which we can assume isn't needed in this context. Reviewed by: imp, sigsys@gmail.com Submitted/Diagnosed by: sigsys@gmail.com Differential Revision: https://reviews.freebsd.org/D23390 --- stand/efi/loader/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 4f736b9f30ec..700ad6bec5a4 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -180,8 +180,17 @@ static void set_currdev(const char *devname) { - env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset); + /* + * Don't execute hooks here; we may need to try setting these more than + * once here if we're probing for the ZFS pool we're supposed to boot. + * The currdev hook is intended to just validate user input anyways, + * while the loaddev hook makes it immutable once we've determined what + * the proper currdev is. + */ + env_setenv("currdev", EV_VOLATILE | EV_NOHOOK, devname, efi_setcurrdev, + env_nounset); + env_setenv("loaddev", EV_VOLATILE | EV_NOHOOK, devname, env_noset, + env_nounset); } static void