Skip to content
Permalink
Browse files

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 <Ioannis.Glaropoulos@nordicsemi.no>
  • Loading branch information...
ioannisg authored and nashif committed Jun 27, 2019
1 parent 5d423b8 commit f3a1270f85762363ed87cafadd4396e24924e1f2
Showing with 3 additions and 1 deletion.
  1. +3 −1 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

0 comments on commit f3a1270

Please sign in to comment.
You can’t perform that action at this time.