Like on all other architectures, check for the availability of
h-extensions in the driver to early prevent damage, if h-extensions are
not available.

Signed-off-by: Ralf Ramsauer <[email protected]>
---
 driver/main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/driver/main.c b/driver/main.c
index d13afeb6..ef1c2a90 100644
--- a/driver/main.c
+++ b/driver/main.c
@@ -444,6 +444,13 @@ static int jailhouse_cmd_enable(struct jailhouse_system 
__user *arg)
                }
        }
 #endif
+#ifdef CONFIG_RISCV
+       if (!riscv_isa_extension_available(NULL, h)) {
+               pr_err("jailhouse: hypervisor extension not available\n");
+               err = -ENODEV;
+               goto error_put_module;
+       }
+#endif
 
        /* Load hypervisor image */
        err = request_firmware(&hypervisor, fw_name, jailhouse_dev);
-- 
2.36.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20220627132905.4338-2-ralf.ramsauer%40oth-regensburg.de.

Reply via email to