aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDan Rosenberg <drosenberg@vsecurity.com>2012-01-20 17:34:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-23 11:38:49 -0500
commitc25a785d6647984505fa165b5cd84cfc9a95970b (patch)
treed1386aae3bc4a649ba1594908c7c32bf97ddcdd0 /arch
parent9f9f1acd713d69fae2af286fbeedc6c8963411c6 (diff)
score: fix off-by-one index into syscall table
If the provided system call number is equal to __NR_syscalls, the current check will pass and a function pointer just after the system call table may be called, since sys_call_table is an array with total size __NR_syscalls. Whether or not this is a security bug depends on what the compiler puts immediately after the system call table. It's likely that this won't do anything bad because there is an additional NULL check on the syscall entry, but if there happens to be a non-NULL value immediately after the system call table, this may result in local privilege escalation. Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com> Cc: <stable@vger.kernel.org> Cc: Chen Liqin <liqin.chen@sunplusct.com> Cc: Lennox Wu <lennox.wu@gmail.com> Cc: Eugene Teo <eugeneteo@kernel.sg> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/score/kernel/entry.S2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/score/kernel/entry.S b/arch/score/kernel/entry.S
index 577abba3fac6..83bb96079c43 100644
--- a/arch/score/kernel/entry.S
+++ b/arch/score/kernel/entry.S
@@ -408,7 +408,7 @@ ENTRY(handle_sys)
408 sw r9, [r0, PT_EPC] 408 sw r9, [r0, PT_EPC]
409 409
410 cmpi.c r27, __NR_syscalls # check syscall number 410 cmpi.c r27, __NR_syscalls # check syscall number
411 bgtu illegal_syscall 411 bgeu illegal_syscall
412 412
413 slli r8, r27, 2 # get syscall routine 413 slli r8, r27, 2 # get syscall routine
414 la r11, sys_call_table 414 la r11, sys_call_table