]> git.baikalelectronics.ru Git - kernel.git/commitdiff
riscv: reject invalid syscalls below -1
authorDavid Abdurachmanov <david.abdurachmanov@gmail.com>
Wed, 18 Dec 2019 08:47:56 +0000 (10:47 +0200)
committerPaul Walmsley <paul.walmsley@sifive.com>
Sat, 28 Dec 2019 05:50:57 +0000 (21:50 -0800)
Running "stress-ng --enosys 4 -t 20 -v" showed a large number of kernel oops
with "Unable to handle kernel paging request at virtual address" message. This
happens when enosys stressor starts testing random non-valid syscalls.

I forgot to redirect any syscall below -1 to sys_ni_syscall.

With the patch kernel oops messages are gone while running stress-ng enosys
stressor.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
Fixes: f13529dcecc9 ("riscv: add support for SECCOMP and SECCOMP_FILTER")
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
arch/riscv/kernel/entry.S

index a1349ca6466961d8eef510a9d4de9391c0f7c5d1..e163b7b64c86cdac7111a53cc641e41a85fc00bb 100644 (file)
@@ -246,6 +246,7 @@ check_syscall_nr:
         */
        li t1, -1
        beq a7, t1, ret_from_syscall_rejected
+       blt a7, t1, 1f
        /* Call syscall */
        la s0, sys_call_table
        slli t0, a7, RISCV_LGPTR