summaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/signal.c
diff options
context:
space:
mode:
authorGuo Ren <guoren@linux.alibaba.com>2022-04-05 09:13:12 +0200
committerPalmer Dabbelt <palmer@rivosinc.com>2022-05-18 01:37:21 +0200
commit7383ee05314be58f8f9f018ee0ac53bef3808aea (patch)
treea89a2a6a09629f049a1cfef0aa5a1daca90f401e /arch/riscv/kernel/signal.c
parentriscv: compat: vdso: Add setup additional pages implementation (diff)
downloadlinux-7383ee05314be58f8f9f018ee0ac53bef3808aea.tar.xz
linux-7383ee05314be58f8f9f018ee0ac53bef3808aea.zip
riscv: compat: signal: Add rt_frame implementation
Implement compat_setup_rt_frame for sigcontext save & restore. The main process is the same with signal, but the rv32 pt_regs' size is different from rv64's, so we needs convert them. Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20220405071314.3225832-19-guoren@kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/kernel/signal.c')
-rw-r--r--arch/riscv/kernel/signal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
index 9f4e59f80551..38b05ca6fe66 100644
--- a/arch/riscv/kernel/signal.c
+++ b/arch/riscv/kernel/signal.c
@@ -6,6 +6,7 @@
* Copyright (C) 2012 Regents of the University of California
*/
+#include <linux/compat.h>
#include <linux/signal.h>
#include <linux/uaccess.h>
#include <linux/syscalls.h>
@@ -14,6 +15,7 @@
#include <asm/ucontext.h>
#include <asm/vdso.h>
+#include <asm/signal32.h>
#include <asm/switch_to.h>
#include <asm/csr.h>
@@ -261,7 +263,10 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
rseq_signal_deliver(ksig, regs);
/* Set up the stack frame */
- ret = setup_rt_frame(ksig, oldset, regs);
+ if (is_compat_task())
+ ret = compat_setup_rt_frame(ksig, oldset, regs);
+ else
+ ret = setup_rt_frame(ksig, oldset, regs);
signal_setup_done(ret, ksig, 0);
}