Reject every SMC requests except for the emulated PSCI services. This is
required because we have generally no idea about what services are
behind an interface, and even the calling convention is undefined.
Better fail loudly and then resolve the valid cases on a per-platform
basis.

This obsoletes the smc stub in exception.S, so remove it.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
---
 hypervisor/arch/arm/exception.S | 6 ------
 hypervisor/arch/arm/traps.c     | 8 ++++----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/hypervisor/arch/arm/exception.S b/hypervisor/arch/arm/exception.S
index 4ae57c7..90c580f 100644
--- a/hypervisor/arch/arm/exception.S
+++ b/hypervisor/arch/arm/exception.S
@@ -79,9 +79,3 @@ vmreturn:
 hvc:
        hvc     #0
        bx      lr
-
-       .arch_extension sec
-       .globl smc
-smc:
-       smc     #0
-       bx      lr
diff --git a/hypervisor/arch/arm/traps.c b/hypervisor/arch/arm/traps.c
index 4b2cd21..0b522e2 100644
--- a/hypervisor/arch/arm/traps.c
+++ b/hypervisor/arch/arm/traps.c
@@ -249,10 +249,10 @@ static int arch_handle_smc(struct trap_context *ctx)
 {
        unsigned long *regs = ctx->regs;
 
-       if (IS_PSCI_32(regs[0]) || IS_PSCI_UBOOT(regs[0]))
-               regs[0] = psci_dispatch(ctx);
-       else
-               regs[0] = smc(regs[0], regs[1], regs[2], regs[3]);
+       if (!IS_PSCI_32(regs[0]) && !IS_PSCI_UBOOT(regs[0]))
+               return TRAP_FORBIDDEN;
+
+       regs[0] = psci_dispatch(ctx);
 
        arch_skip_instruction(ctx);
 
-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate 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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to