2016-04-27 02:02:11

by Dmitry V. Levin

[permalink] [raw]
Subject: [PATCH] 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.

Cc: [email protected]
Signed-off-by: Dmitry V. Levin <[email protected]>
---
arch/parisc/kernel/syscall.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index c976ebf..57b4836 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -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
--
ldv


2016-04-27 02:45:14

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH] parisc: fix a bug when syscall number of tracee is __NR_Linux_syscalls

On 27 Apr 2016 04:56, Dmitry V. Levin wrote:
> 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.
>
> Cc: [email protected]
> Signed-off-by: Dmitry V. Levin <[email protected]>
> ---
> arch/parisc/kernel/syscall.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
> index c976ebf..57b4836 100644
> --- a/arch/parisc/kernel/syscall.S
> +++ b/arch/parisc/kernel/syscall.S
> @@ -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


Attachments:
(No filename) (1.09 kB)
signature.asc (819.00 B)
Digital signature
Download all attachments

2016-04-27 03:28:31

by Dmitry V. Levin

[permalink] [raw]
Subject: Re: [PATCH] parisc: fix a bug when syscall number of tracee is __NR_Linux_syscalls

On Tue, Apr 26, 2016 at 10:45:11PM -0400, Mike Frysinger wrote:
> On 27 Apr 2016 04:56, Dmitry V. Levin wrote:
> > 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.
> >
> > Cc: [email protected]
> > Signed-off-by: Dmitry V. Levin <[email protected]>
> > ---
> > arch/parisc/kernel/syscall.S | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
> > index c976ebf..57b4836 100644
> > --- a/arch/parisc/kernel/syscall.S
> > +++ b/arch/parisc/kernel/syscall.S
> > @@ -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 :).

With this fix the box no longer crashes.


--
ldv


Attachments:
(No filename) (1.25 kB)
(No filename) (819.00 B)
Download all attachments

2016-04-27 19:23:44

by Helge Deller

[permalink] [raw]
Subject: Re: [PATCH] parisc: fix a bug when syscall number of tracee is __NR_Linux_syscalls

On 27.04.2016 03:56, Dmitry V. Levin wrote:
> 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.
>
> Cc: [email protected]
> Signed-off-by: Dmitry V. Levin <[email protected]>

Acked-by: Helge Deller <[email protected]>

Thanks!

Helge

> ---
> arch/parisc/kernel/syscall.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
> index c976ebf..57b4836 100644
> --- a/arch/parisc/kernel/syscall.S
> +++ b/arch/parisc/kernel/syscall.S
> @@ -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
>