score: fix off-by-one index into syscall table
PATCH 1/1 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.
--- arch/score/kernel/entry.S | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/score/kernel/entry.S +1 -1
@@ -408,7 +408,7 @@ ENTRY(handle_sys) sw r9, [r0, PT_EPC] cmpi.c r27, __NR_syscalls # check syscall number - bgtu illegal_syscall + bgeu illegal_syscall slli r8, r27, 2 # get syscall routine la r11, sys_call_table
Cc'ed [email protected]
ping
Quoted 32 lines · Dan Rosenberg
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, sincesys_call_tableis 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.---
arch/score/kernel/entry.S | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)arch/score/kernel/entry.S +0
-0@@ -408,7 +408,7 @@ ENTRY(handle_sys)sw r9, [r0,
PT_EPC]cmpi.c r27,
__NR_syscalls# check syscall number
- bgtu illegal_syscall
+ bgeu illegal_syscallslli r8, r27, 2 # get syscall routine la r11,
sys_call_table
Quoted 3 lines · Eugene Teo
Cc'ed [email protected]
ping
Liqin's work email bounced. I'm not sure if he is working on these anymore. If not, the MAINTAINERS file needs to be updated.
Quoted 33 lines · Dan Rosenberg
Quoted 32 lines
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, sincesys_call_tableis 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.---
arch/score/kernel/entry.S | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)arch/score/kernel/entry.S +0
-0@@ -408,7 +408,7 @@ ENTRY(handle_sys)sw r9, [r0,
PT_EPC]cmpi.c r27,
__NR_syscalls# check syscall number
- bgtu illegal_syscall
+ bgeu illegal_syscallslli r8, r27, 2 # get syscall routine la r11,
sys_call_table
Dear all,
I will look the issue and update the informaion of MAINTAINERS. Best,
Lennox
2012/1/10 Eugene Teo <[email protected]>
Quoted 42 lines · Eugene Teo
Quoted 3 lines
Cc'ed [email protected]
ping
Liqin's work email bounced. I'm not sure if he is working on these anymore. If not, the
MAINTAINERSfile needs to be updated.Quoted 33 lines · Dan Rosenberg
Quoted 32 lines
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, sincesys_call_tableis 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.---
arch/score/kernel/entry.S | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)arch/score/kernel/entry.S +0
-0@@ -408,7 +408,7 @@ ENTRY(handle_sys)sw r9, [r0,
PT_EPC]cmpi.c r27,
__NR_syscalls# check syscall number
- bgtu illegal_syscall
+ bgeu illegal_syscallslli r8, r27, 2 # get syscall routine la r11,
sys_call_table