hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/riscv/kernel/signal.c
....@@ -16,6 +16,7 @@
1616 #include <asm/vdso.h>
1717 #include <asm/switch_to.h>
1818 #include <asm/csr.h>
19
+#include <asm/cacheflush.h>
1920
2021 extern u32 __user_rt_sigreturn[2];
2122
....@@ -178,6 +179,7 @@
178179 {
179180 struct rt_sigframe __user *frame;
180181 long err = 0;
182
+ unsigned long __maybe_unused addr;
181183
182184 frame = get_sigframe(ksig, regs, sizeof(*frame));
183185 if (!access_ok(frame, sizeof(*frame)))
....@@ -206,7 +208,12 @@
206208 if (copy_to_user(&frame->sigreturn_code, __user_rt_sigreturn,
207209 sizeof(frame->sigreturn_code)))
208210 return -EFAULT;
209
- regs->ra = (unsigned long)&frame->sigreturn_code;
211
+
212
+ addr = (unsigned long)&frame->sigreturn_code;
213
+ /* Make sure the two instructions are pushed to icache. */
214
+ flush_icache_range(addr, addr + sizeof(frame->sigreturn_code));
215
+
216
+ regs->ra = addr;
210217 #endif /* CONFIG_MMU */
211218
212219 /*