nios2: page fault et.al. are *not* restartable syscalls...
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 8 Aug 2022 15:06:04 +0000 (16:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:09:29 +0000 (11:09 +0200)
commit 8535c239ac674f7ead0f2652932d35c52c4123b2 upstream.

make sure that ->orig_r2 is negative for everything except
the syscalls.

Fixes: 82ed08dd1b0e ("nios2: Exception handling")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/nios2/include/asm/entry.h
arch/nios2/kernel/entry.S

index cf37f55efbc228def6770597ca7f3ad643975a3d..bafb7b2ca59fcb32a410cffd1666eb1c5e06d6bb 100644 (file)
@@ -50,7 +50,8 @@
        stw     r13, PT_R13(sp)
        stw     r14, PT_R14(sp)
        stw     r15, PT_R15(sp)
-       stw     r2, PT_ORIG_R2(sp)
+       movi    r24, -1
+       stw     r24, PT_ORIG_R2(sp)
        stw     r7, PT_ORIG_R7(sp)
 
        stw     ra, PT_RA(sp)
index 1e515ccd698e38f4a437b43ee6a97eb8c2aed987..668f928db7873b1c433fdb0d264136de1dc2422b 100644 (file)
@@ -185,6 +185,7 @@ ENTRY(handle_system_call)
        ldw     r5, PT_R5(sp)
 
 local_restart:
+       stw     r2, PT_ORIG_R2(sp)
        /* Check that the requested system call is within limits */
        movui   r1, __NR_syscalls
        bgeu    r2, r1, ret_invsyscall
@@ -336,9 +337,6 @@ external_interrupt:
        /* skip if no interrupt is pending */
        beq     r12, r0, ret_from_interrupt
 
-       movi    r24, -1
-       stw     r24, PT_ORIG_R2(sp)
-
        /*
         * Process an external hardware interrupt.
         */