[PATCH] riscv: vector: Mark riscv_v_context_nesting_start/end as noinstr

hu.shengming@zte.com.cn posted 1 patch 2 months, 1 week ago
arch/riscv/kernel/kernel_mode_vector.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] riscv: vector: Mark riscv_v_context_nesting_start/end as noinstr
Posted by hu.shengming@zte.com.cn 2 months, 1 week ago
From: Luo Haiyang <luo.haiyang@zte.com.cn>

The functions riscv_v_context_nesting_start() and
riscv_v_context_nesting_end() are invoked in exception handling paths.
Allowing kprobes, function tracing on these functions could lead to
recursive exceptions or crashes.

Signed-off-by: Luo Haiyang <luo.haiyang@zte.com.cn>
Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
---
 arch/riscv/kernel/kernel_mode_vector.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/kernel_mode_vector.c b/arch/riscv/kernel/kernel_mode_vector.c
index 99972a48e86b..1b2b9e4574b8 100644
--- a/arch/riscv/kernel/kernel_mode_vector.c
+++ b/arch/riscv/kernel/kernel_mode_vector.c
@@ -152,7 +152,7 @@ static int riscv_v_start_kernel_context(bool *is_nested)
 }
 
 /* low-level V context handling code, called with irq disabled */
-asmlinkage void riscv_v_context_nesting_start(struct pt_regs *regs)
+asmlinkage void noinstr riscv_v_context_nesting_start(struct pt_regs *regs)
 {
 	int depth;
 
@@ -166,7 +166,7 @@ asmlinkage void riscv_v_context_nesting_start(struct pt_regs *regs)
 	riscv_v_ctx_depth_inc();
 }
 
-asmlinkage void riscv_v_context_nesting_end(struct pt_regs *regs)
+asmlinkage void noinstr riscv_v_context_nesting_end(struct pt_regs *regs)
 {
 	struct __riscv_v_ext_state *vstate = &current->thread.kernel_vstate;
 	u32 depth;
-- 
2.25.1