Skip to content

Commit

Permalink
arch: arm: userspace: fix syscall ID validation
Browse files Browse the repository at this point in the history
We need an unsigned comparison when evaluating whether
the supplied syscall ID is lower than the syscall ID limit.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
  • Loading branch information
ioannisg authored and nashif committed Mar 24, 2020
1 parent 83bd7d3 commit 6da1361
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/arm/core/swap_helper.S
Expand Up @@ -411,7 +411,10 @@ _do_syscall:
/* validate syscall limit */
ldr ip, =K_SYSCALL_LIMIT
cmp r6, ip
blt valid_syscall_id
/* The supplied syscall_id must be lower than the limit
* (Requires unsigned integer comparison)
*/
blo valid_syscall_id

/* bad syscall id. Set arg1 to bad id and set call_id to SYSCALL_BAD */
str r6, [r0, #0]
Expand Down

0 comments on commit 6da1361

Please sign in to comment.