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 fc547ac9..51be11e2 100644
--- a/driver/main.c
+++ b/driver/main.c
@@ -448,6 +448,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.40.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/20230519204033.643200-22-ralf.ramsauer%40oth-regensburg.de.

Reply via email to