hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/arch/nds32/kernel/ftrace.c
....@@ -7,7 +7,6 @@
77 #ifndef CONFIG_DYNAMIC_FTRACE
88 extern void (*ftrace_trace_function)(unsigned long, unsigned long,
99 struct ftrace_ops*, struct pt_regs*);
10
-extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
1110 extern void ftrace_graph_caller(void);
1211
1312 noinline void __naked ftrace_stub(unsigned long ip, unsigned long parent_ip,
....@@ -90,18 +89,6 @@
9089 return 0;
9190 }
9291
93
-int ftrace_arch_code_modify_prepare(void)
94
-{
95
- set_all_modules_text_rw();
96
- return 0;
97
-}
98
-
99
-int ftrace_arch_code_modify_post_process(void)
100
-{
101
- set_all_modules_text_ro();
102
- return 0;
103
-}
104
-
10592 static unsigned long gen_sethi_insn(unsigned long addr)
10693 {
10794 unsigned long opcode = 0x46000000;
....@@ -144,13 +131,14 @@
144131 unsigned long orig_insn[3];
145132
146133 if (validate) {
147
- if (probe_kernel_read(orig_insn, (void *)pc, MCOUNT_INSN_SIZE))
134
+ if (copy_from_kernel_nofault(orig_insn, (void *)pc,
135
+ MCOUNT_INSN_SIZE))
148136 return -EFAULT;
149137 if (memcmp(orig_insn, old_insn, MCOUNT_INSN_SIZE))
150138 return -EINVAL;
151139 }
152140
153
- if (probe_kernel_write((void *)pc, new_insn, MCOUNT_INSN_SIZE))
141
+ if (copy_to_kernel_nofault((void *)pc, new_insn, MCOUNT_INSN_SIZE))
154142 return -EPERM;
155143
156144 return 0;