On 10.01.23 17:48, Ralf Ramsauer wrote:
> Now that we have architecture information, we can check it. Just like we
> do it for the magic bytes of the configs.
>
> Signed-off-by: Ralf Ramsauer <[email protected]>
> ---
> driver/cell.c | 4 ++++
> driver/main.c | 4 ++++
> driver/main.h | 8 ++++++++
> 3 files changed, 16 insertions(+)
>
> diff --git a/driver/cell.c b/driver/cell.c
> index ade61edb..f9d7982b 100644
> --- a/driver/cell.c
> +++ b/driver/cell.c
> @@ -186,6 +186,10 @@ int jailhouse_cmd_cell_create(struct
> jailhouse_cell_create __user *arg)
> err = -EINVAL;
> goto kfree_config_out;
> }
> + if (config->architecture != JAILHOUSE_ARCHITECTURE) {
> + pr_err("jailhouse: Architecture mismatch\n");
Maybe clearer: "Configuration architecture mismatch", just like for the
revision below.
> + goto kfree_config_out;
> + }
>
> config->name[JAILHOUSE_CELL_NAME_MAXLEN] = 0;
>
> diff --git a/driver/main.c b/driver/main.c
> index 64e2b9a4..fe119890 100644
> --- a/driver/main.c
> +++ b/driver/main.c
> @@ -396,6 +396,10 @@ static int jailhouse_cmd_enable(struct jailhouse_system
> __user *arg)
> pr_err("jailhouse: Configuration revision mismatch\n");
> return -EINVAL;
> }
> + if (config_header.architecture != JAILHOUSE_ARCHITECTURE) {
> + pr_err("jailhouse: Architecture mismatch\n");
> + return -EINVAL;
> + }
>
> config_header.root_cell.name[JAILHOUSE_CELL_NAME_MAXLEN] = 0;
>
> diff --git a/driver/main.h b/driver/main.h
> index 7c9f661c..9df51aa1 100644
> --- a/driver/main.h
> +++ b/driver/main.h
> @@ -17,6 +17,14 @@
>
> #include "cell.h"
>
> +#ifdef CONFIG_X86
> +#define JAILHOUSE_ARCHITECTURE JAILHOUSE_X86
> +#elif defined(CONFIG_ARM)
> +#define JAILHOUSE_ARCHITECTURE JAILHOUSE_ARM
> +#elif defined(CONFIG_ARM64)
> +#define JAILHOUSE_ARCHITECTURE JAILHOUSE_ARM64
> +#endif
> +
> extern struct mutex jailhouse_lock;
> extern bool jailhouse_enabled;
> extern void *hypervisor_mem;
All the rest looks good to me.
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
--
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/90801fb1-225a-b828-5d94-d2c3a53c46f8%40siemens.com.