From f3a1270f85762363ed87cafadd4396e24924e1f2 Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Thu, 27 Jun 2019 13:51:06 +0200 Subject: [PATCH] arch: arm: userspace: correct inline comment for bad syscalls We need to correct the inline comment in swap_helper.S, which is suggesting that system call attempts with invalid syscall IDs (i.e. above the limit) do not force the CPU to elevate privileges. This is in fact not true, since the execution flow moves into valid syscall ID handling. In other words, all we do for system calls with invalid ID numbers is to treat them as valid syscalls with the K_SYSCALL_BAD ID value. We fix the inline documentation to reflect the actual execution flow. Signed-off-by: Ioannis Glaropoulos --- arch/arm/core/swap_helper.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/core/swap_helper.S b/arch/arm/core/swap_helper.S index 8ec52a4b813..52549a710e5 100644 --- a/arch/arm/core/swap_helper.S +++ b/arch/arm/core/swap_helper.S @@ -451,7 +451,7 @@ _do_syscall: ldr r1, =z_arm_do_syscall str r1, [r0, #24] /* overwrite the PC to point to z_arm_do_syscall */ - /* validate syscall limit, only set priv mode if valid */ + /* validate syscall limit */ ldr ip, =K_SYSCALL_LIMIT cmp r6, ip blt valid_syscall_id @@ -460,6 +460,8 @@ _do_syscall: str r6, [r0, #0] ldr r6, =K_SYSCALL_BAD + /* Bad syscalls treated as valid syscalls with ID K_SYSCALL_BAD. */ + valid_syscall_id: push {r0, r1} ldr r0, =_kernel