diff --git a/arch/arm64/kvm/pkvm.c b/arch/arm64/kvm/pkvm.c index 10b899483d43..08ce8d77fe3d 100644 --- a/arch/arm64/kvm/pkvm.c +++ b/arch/arm64/kvm/pkvm.c @@ -4,6 +4,8 @@ * Author: Quentin Perret */ +#include +#include #include #include #include @@ -627,6 +629,7 @@ static int __init __pkvm_request_early_module(char *module_name, "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL }; + static bool proc; char **argv; int idx = 0; @@ -658,6 +661,15 @@ static int __init __pkvm_request_early_module(char *module_name, /* Even with CONFIG_STATIC_USERMODEHELPER we really want this path */ info->path = modprobe_path; + if (!proc) { + wait_for_initramfs(); + if (init_mount("proc", "/proc", "proc", + MS_SILENT | MS_NOEXEC | MS_NOSUID, NULL)) + pr_warn("Couldn't mount /proc, pKVM module parameters will be ignored\n"); + + proc = true; + } + return call_usermodehelper_exec(info, UMH_WAIT_PROC | UMH_KILLABLE); err: kfree(argv); @@ -686,11 +698,7 @@ int __init pkvm_load_early_modules(void) { char *token, *buf = early_pkvm_modules; char *module_path = CONFIG_PKVM_MODULE_PATH; - int err = init_mount("proc", "/proc", "proc", - MS_SILENT | MS_NOEXEC | MS_NOSUID, NULL); - - if (err) - return err; + int err; while (true) { token = strsep(&buf, ",");