Skip to contentSkip to conversation

parisc: fix a bug when syscall number of tracee is __NR_Linux_syscalls

PATCH In review Dmitry V. Levin 3 participants 4 messages Apr 27, 2016 PA-RISC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parisc: fix a bug when syscall number of tracee is __NR_Linux_syscalls

Do not load one entry beyond the end of the syscall table when the syscall number of a traced process equals to __NR_Linux_syscalls. Similar bug with regular processes was fixed by commit 3bb457af4fa8 ("[PARISC] Fix bug when syscall nr is __NR_Linux_syscalls").

This bug was found by strace test suite.

---
 arch/parisc/kernel/syscall.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/syscall.S +1 -1
index c976ebf..57b4836 100644
@@ -344,7 +344,7 @@ tracesys_next:
 #endif
 
 	cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */
-	comiclr,>>=	__NR_Linux_syscalls, %r20, %r0
+	comiclr,>>	__NR_Linux_syscalls, %r20, %r0
 	b,n	.Ltracesys_nosys
 
 	LDREGX  %r20(%r19), %r19
Signature · 1 line
ldv
#1 lore raw
Quoted 18 lines · Dmitry V. Levin

Do not load one entry beyond the end of the syscall table when the syscall number of a traced process equals to __NR_Linux_syscalls. Similar bug with regular processes was fixed by commit 3bb457af4fa8 ("[PARISC] Fix bug when syscall nr is __NR_Linux_syscalls").

This bug was found by strace test suite.

---
 arch/parisc/kernel/syscall.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/syscall.S +0 -0
index c976ebf..57b4836 100644

arch/parisc/kernel/syscall.S tracesys_next: · line 350

Quoted 8 lines
arch/parisc/kernel/syscall.S +1 -1
@@ -344,7 +344,7 @@ tracesys_next:
 #endif
 
 	cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */
-	comiclr,>>=	__NR_Linux_syscalls, %r20, %r0
+	comiclr,>>	__NR_Linux_syscalls, %r20, %r0
 	b,n	.Ltracesys_nosys
 
 	LDREGX  %r20(%r19), %r19

i've deployd your fix to hake, so feel free to give the tests another run to try and crash the box :).
-mike

#2 lore raw
Quoted 26 lines · Mike Frysinger
Quoted 25 lines · Dmitry V. Levin

Do not load one entry beyond the end of the syscall table when the syscall number of a traced process equals to __NR_Linux_syscalls. Similar bug with regular processes was fixed by commit 3bb457af4fa8 ("[PARISC] Fix bug when syscall nr is __NR_Linux_syscalls").

This bug was found by strace test suite.

---
 arch/parisc/kernel/syscall.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/syscall.S +1 -1
index c976ebf..57b4836 100644
@@ -344,7 +344,7 @@ tracesys_next:
 #endif
 
 	cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */
-	comiclr,>>=	__NR_Linux_syscalls, %r20, %r0
+	comiclr,>>	__NR_Linux_syscalls, %r20, %r0
 	b,n	.Ltracesys_nosys
 
Quoted 4 lines

arch/parisc/kernel/syscall.S tracesys_next: · line 350

Quoted 1 line
arch/parisc/kernel/syscall.S +0 -0
 	LDREGX  %r20(%r19), %r19

i've deployd your fix to hake, so feel free to give the tests another run to try and crash the box :).

With this fix the box no longer crashes.

Signature · 1 line
ldv
maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Dmitry V. Levin
Quoted 9 lines · Dmitry V. Levin

Do not load one entry beyond the end of the syscall table when the syscall number of a traced process equals to __NR_Linux_syscalls. Similar bug with regular processes was fixed by commit 3bb457af4fa8 ("[PARISC] Fix bug when syscall nr is __NR_Linux_syscalls").

This bug was found by strace test suite.

Thanks!

Helge

Quoted 18 lines
---
 arch/parisc/kernel/syscall.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/syscall.S +1 -1
index c976ebf..57b4836 100644
@@ -344,7 +344,7 @@ tracesys_next:
 #endif
 
 	cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */
-	comiclr,>>=	__NR_Linux_syscalls, %r20, %r0
+	comiclr,>>	__NR_Linux_syscalls, %r20, %r0
 	b,n	.Ltracesys_nosys
 
 	LDREGX  %r20(%r19), %r19