ANDROID: KVM: arm64: wait_for_initramfs for pKVM module loading procfs

Of course, the initramfs needs to be ready before procfs can be
mounted... in the initramfs. While at it, only mount if a pKVM module
must be loaded and only print a warning in case of failure.

Bug: 357781595
Bug: 301483379
Bug: 331152809
Change-Id: Ie56bd26d4575f69cb1f06ba6317a098649f6da44
Reported-by: Mankyum Kim <mankyum.kim@samsung-slsi.corp-partner.google.com>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
Vincent Donnefort
2024-04-04 09:51:05 +01:00
parent 009433c762
commit 2330c625c8
+14
View File
@@ -5,6 +5,7 @@
*/
#include <linux/init.h>
#include <linux/initrd.h>
#include <linux/interval_tree_generic.h>
#include <linux/io.h>
#include <linux/iommu.h>
@@ -30,6 +31,9 @@
#include <kvm/device.h>
#include <linux/init_syscalls.h>
#include <uapi/linux/mount.h>
#include "hyp_constants.h"
#include "hyp_trace.h"
@@ -870,6 +874,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;
@@ -901,6 +906,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);