Message ID | 20240616170553.2832-3-jszhang@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | riscv: convert bottom half of exception handling to C | expand |
On Mon, Jun 17, 2024 at 3:21 AM Jisheng Zhang <jszhang@kernel.org> wrote: > > Inspired by[1], "modifying the return address of to point to > ret_from_exception will corrupt the RAS", so modify the code > to remove the code of modifying ra. > > Link: https://lore.kernel.org/linux-riscv/20240607061335.2197383-1-cyrilbur@tenstorrent.com/ [1] > Signed-off-by: Jisheng Zhang <jszhang@kernel.org> I've run this and it is the same idea that Anton used in the previous patch Reviewed-by: Cyril Bur <cyrilbur@tenstorrent.com> > --- > arch/riscv/kernel/entry.S | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S > index c933460ed3e9..81dec627a8d4 100644 > --- a/arch/riscv/kernel/entry.S > +++ b/arch/riscv/kernel/entry.S > @@ -235,8 +235,8 @@ SYM_CODE_START(ret_from_fork) > jalr s0 > 1: > move a0, sp /* pt_regs */ > - la ra, ret_from_exception > - tail syscall_exit_to_user_mode > + call syscall_exit_to_user_mode > + j ret_from_exception > SYM_CODE_END(ret_from_fork) > > #ifdef CONFIG_IRQ_STACKS > -- > 2.43.0 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S index c933460ed3e9..81dec627a8d4 100644 --- a/arch/riscv/kernel/entry.S +++ b/arch/riscv/kernel/entry.S @@ -235,8 +235,8 @@ SYM_CODE_START(ret_from_fork) jalr s0 1: move a0, sp /* pt_regs */ - la ra, ret_from_exception - tail syscall_exit_to_user_mode + call syscall_exit_to_user_mode + j ret_from_exception SYM_CODE_END(ret_from_fork) #ifdef CONFIG_IRQ_STACKS
Inspired by[1], "modifying the return address of to point to ret_from_exception will corrupt the RAS", so modify the code to remove the code of modifying ra. Link: https://lore.kernel.org/linux-riscv/20240607061335.2197383-1-cyrilbur@tenstorrent.com/ [1] Signed-off-by: Jisheng Zhang <jszhang@kernel.org> --- arch/riscv/kernel/entry.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)