summaryrefslogtreecommitdiff
path: root/arch/nios2
diff options
context:
space:
mode:
authorAndreas Oetken <andreas.oetken@siemens.com>2021-02-19 09:41:03 +0300
committerLey Foon Tan <ley.foon.tan@intel.com>2021-02-19 10:02:08 +0300
commit9abcfcb20320e8f693e89d86573b58e6289931cb (patch)
treead794fe45d0c5ce36849ccf39c46565e2548dcca /arch/nios2
parentc26958cb5a0d9053d1358258827638773f3d36ed (diff)
downloadlinux-9abcfcb20320e8f693e89d86573b58e6289931cb.tar.xz
nios2: fixed broken sys_clone syscall
The tls pointer must be pushed on the stack prior to calling nios2_clone as it is the 5th function argument. Prior handling of the tls pointer was done inside former called function copy_thread_tls using the r8 register from the current_pt_regs directly. This was a bad design and resulted in the current bug introduced in 04bd52fb. Fixes: 04bd52fb ("nios2: enable HAVE_COPY_THREAD_TLS, switch to kernel_clone_args") Signed-off-by: Andreas Oetken <andreas.oetken@siemens.com> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com> Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Diffstat (limited to 'arch/nios2')
-rw-r--r--arch/nios2/kernel/entry.S3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
index da8442450e46..0794cd7803df 100644
--- a/arch/nios2/kernel/entry.S
+++ b/arch/nios2/kernel/entry.S
@@ -389,7 +389,10 @@ ENTRY(ret_from_interrupt)
*/
ENTRY(sys_clone)
SAVE_SWITCH_STACK
+ subi sp, sp, 4 /* make space for tls pointer */
+ stw r8, 0(sp) /* pass tls pointer (r8) via stack (5th argument) */
call nios2_clone
+ addi sp, sp, 4
RESTORE_SWITCH_STACK
ret