@@ -40,35 +40,35 @@ struct trace_kprobe {
4040 (sizeof(struct probe_arg) * (n)))
4141
4242
43- static __kprobes bool trace_kprobe_is_return (struct trace_kprobe * tk )
43+ static nokprobe_inline bool trace_kprobe_is_return (struct trace_kprobe * tk )
4444{
4545 return tk -> rp .handler != NULL ;
4646}
4747
48- static __kprobes const char * trace_kprobe_symbol (struct trace_kprobe * tk )
48+ static nokprobe_inline const char * trace_kprobe_symbol (struct trace_kprobe * tk )
4949{
5050 return tk -> symbol ? tk -> symbol : "unknown" ;
5151}
5252
53- static __kprobes unsigned long trace_kprobe_offset (struct trace_kprobe * tk )
53+ static nokprobe_inline unsigned long trace_kprobe_offset (struct trace_kprobe * tk )
5454{
5555 return tk -> rp .kp .offset ;
5656}
5757
58- static __kprobes bool trace_kprobe_has_gone (struct trace_kprobe * tk )
58+ static nokprobe_inline bool trace_kprobe_has_gone (struct trace_kprobe * tk )
5959{
6060 return !!(kprobe_gone (& tk -> rp .kp ));
6161}
6262
63- static __kprobes bool trace_kprobe_within_module (struct trace_kprobe * tk ,
63+ static nokprobe_inline bool trace_kprobe_within_module (struct trace_kprobe * tk ,
6464 struct module * mod )
6565{
6666 int len = strlen (mod -> name );
6767 const char * name = trace_kprobe_symbol (tk );
6868 return strncmp (mod -> name , name , len ) == 0 && name [len ] == ':' ;
6969}
7070
71- static __kprobes bool trace_kprobe_is_on_module (struct trace_kprobe * tk )
71+ static nokprobe_inline bool trace_kprobe_is_on_module (struct trace_kprobe * tk )
7272{
7373 return !!strchr (trace_kprobe_symbol (tk ), ':' );
7474}
@@ -132,34 +132,38 @@ struct symbol_cache *alloc_symbol_cache(const char *sym, long offset)
132132 * Kprobes-specific fetch functions
133133 */
134134#define DEFINE_FETCH_stack (type ) \
135- static __kprobes void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs,\
135+ static void FETCH_FUNC_NAME(stack, type)(struct pt_regs *regs, \
136136 void *offset, void *dest) \
137137{ \
138138 *(type *)dest = (type)regs_get_kernel_stack_nth(regs, \
139139 (unsigned int)((unsigned long)offset)); \
140- }
140+ } \
141+ NOKPROBE_SYMBOL(FETCH_FUNC_NAME(stack, type));
142+
141143DEFINE_BASIC_FETCH_FUNCS (stack )
142144/* No string on the stack entry */
143145#define fetch_stack_string NULL
144146#define fetch_stack_string_size NULL
145147
146148#define DEFINE_FETCH_memory (type ) \
147- static __kprobes void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs,\
149+ static void FETCH_FUNC_NAME(memory, type)(struct pt_regs *regs, \
148150 void *addr, void *dest) \
149151{ \
150152 type retval; \
151153 if (probe_kernel_address(addr, retval)) \
152154 *(type *)dest = 0; \
153155 else \
154156 *(type *)dest = retval; \
155- }
157+ } \
158+ NOKPROBE_SYMBOL(FETCH_FUNC_NAME(memory, type));
159+
156160DEFINE_BASIC_FETCH_FUNCS (memory )
157161/*
158162 * Fetch a null-terminated string. Caller MUST set *(u32 *)dest with max
159163 * length and relative data location.
160164 */
161- static __kprobes void FETCH_FUNC_NAME (memory , string )(struct pt_regs * regs ,
162- void * addr , void * dest )
165+ static void FETCH_FUNC_NAME (memory , string )(struct pt_regs * regs ,
166+ void * addr , void * dest )
163167{
164168 long ret ;
165169 int maxlen = get_rloc_len (* (u32 * )dest );
@@ -193,10 +197,11 @@ static __kprobes void FETCH_FUNC_NAME(memory, string)(struct pt_regs *regs,
193197 get_rloc_offs (* (u32 * )dest ));
194198 }
195199}
200+ NOKPROBE_SYMBOL (FETCH_FUNC_NAME (memory , string ));
196201
197202/* Return the length of string -- including null terminal byte */
198- static __kprobes void FETCH_FUNC_NAME (memory , string_size )(struct pt_regs * regs ,
199- void * addr , void * dest )
203+ static void FETCH_FUNC_NAME (memory , string_size )(struct pt_regs * regs ,
204+ void * addr , void * dest )
200205{
201206 mm_segment_t old_fs ;
202207 int ret , len = 0 ;
@@ -219,17 +224,19 @@ static __kprobes void FETCH_FUNC_NAME(memory, string_size)(struct pt_regs *regs,
219224 else
220225 * (u32 * )dest = len ;
221226}
227+ NOKPROBE_SYMBOL (FETCH_FUNC_NAME (memory , string_size ));
222228
223229#define DEFINE_FETCH_symbol (type ) \
224- __kprobes void FETCH_FUNC_NAME(symbol, type)(struct pt_regs *regs, \
225- void *data, void *dest) \
230+ void FETCH_FUNC_NAME(symbol, type)(struct pt_regs *regs, void *data, void *dest)\
226231{ \
227232 struct symbol_cache *sc = data; \
228233 if (sc->addr) \
229234 fetch_memory_##type(regs, (void *)sc->addr, dest); \
230235 else \
231236 *(type *)dest = 0; \
232- }
237+ } \
238+ NOKPROBE_SYMBOL(FETCH_FUNC_NAME(symbol, type));
239+
233240DEFINE_BASIC_FETCH_FUNCS (symbol )
234241DEFINE_FETCH_symbol (string )
235242DEFINE_FETCH_symbol (string_size )
@@ -907,7 +914,7 @@ static const struct file_operations kprobe_profile_ops = {
907914};
908915
909916/* Kprobe handler */
910- static __kprobes void
917+ static nokprobe_inline void
911918__kprobe_trace_func (struct trace_kprobe * tk , struct pt_regs * regs ,
912919 struct ftrace_event_file * ftrace_file )
913920{
@@ -943,17 +950,18 @@ __kprobe_trace_func(struct trace_kprobe *tk, struct pt_regs *regs,
943950 entry , irq_flags , pc , regs );
944951}
945952
946- static __kprobes void
953+ static void
947954kprobe_trace_func (struct trace_kprobe * tk , struct pt_regs * regs )
948955{
949956 struct event_file_link * link ;
950957
951958 list_for_each_entry_rcu (link , & tk -> tp .files , list )
952959 __kprobe_trace_func (tk , regs , link -> file );
953960}
961+ NOKPROBE_SYMBOL (kprobe_trace_func );
954962
955963/* Kretprobe handler */
956- static __kprobes void
964+ static nokprobe_inline void
957965__kretprobe_trace_func (struct trace_kprobe * tk , struct kretprobe_instance * ri ,
958966 struct pt_regs * regs ,
959967 struct ftrace_event_file * ftrace_file )
@@ -991,7 +999,7 @@ __kretprobe_trace_func(struct trace_kprobe *tk, struct kretprobe_instance *ri,
991999 entry , irq_flags , pc , regs );
9921000}
9931001
994- static __kprobes void
1002+ static void
9951003kretprobe_trace_func (struct trace_kprobe * tk , struct kretprobe_instance * ri ,
9961004 struct pt_regs * regs )
9971005{
@@ -1000,6 +1008,7 @@ kretprobe_trace_func(struct trace_kprobe *tk, struct kretprobe_instance *ri,
10001008 list_for_each_entry_rcu (link , & tk -> tp .files , list )
10011009 __kretprobe_trace_func (tk , ri , regs , link -> file );
10021010}
1011+ NOKPROBE_SYMBOL (kretprobe_trace_func );
10031012
10041013/* Event entry printers */
10051014static enum print_line_t
@@ -1131,7 +1140,7 @@ static int kretprobe_event_define_fields(struct ftrace_event_call *event_call)
11311140#ifdef CONFIG_PERF_EVENTS
11321141
11331142/* Kprobe profile handler */
1134- static __kprobes void
1143+ static void
11351144kprobe_perf_func (struct trace_kprobe * tk , struct pt_regs * regs )
11361145{
11371146 struct ftrace_event_call * call = & tk -> tp .call ;
@@ -1158,9 +1167,10 @@ kprobe_perf_func(struct trace_kprobe *tk, struct pt_regs *regs)
11581167 store_trace_args (sizeof (* entry ), & tk -> tp , regs , (u8 * )& entry [1 ], dsize );
11591168 perf_trace_buf_submit (entry , size , rctx , 0 , 1 , regs , head , NULL );
11601169}
1170+ NOKPROBE_SYMBOL (kprobe_perf_func );
11611171
11621172/* Kretprobe profile handler */
1163- static __kprobes void
1173+ static void
11641174kretprobe_perf_func (struct trace_kprobe * tk , struct kretprobe_instance * ri ,
11651175 struct pt_regs * regs )
11661176{
@@ -1188,6 +1198,7 @@ kretprobe_perf_func(struct trace_kprobe *tk, struct kretprobe_instance *ri,
11881198 store_trace_args (sizeof (* entry ), & tk -> tp , regs , (u8 * )& entry [1 ], dsize );
11891199 perf_trace_buf_submit (entry , size , rctx , 0 , 1 , regs , head , NULL );
11901200}
1201+ NOKPROBE_SYMBOL (kretprobe_perf_func );
11911202#endif /* CONFIG_PERF_EVENTS */
11921203
11931204/*
@@ -1223,8 +1234,7 @@ static int kprobe_register(struct ftrace_event_call *event,
12231234 return 0 ;
12241235}
12251236
1226- static __kprobes
1227- int kprobe_dispatcher (struct kprobe * kp , struct pt_regs * regs )
1237+ static int kprobe_dispatcher (struct kprobe * kp , struct pt_regs * regs )
12281238{
12291239 struct trace_kprobe * tk = container_of (kp , struct trace_kprobe , rp .kp );
12301240
@@ -1238,9 +1248,10 @@ int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs)
12381248#endif
12391249 return 0 ; /* We don't tweek kernel, so just return 0 */
12401250}
1251+ NOKPROBE_SYMBOL (kprobe_dispatcher );
12411252
1242- static __kprobes
1243- int kretprobe_dispatcher (struct kretprobe_instance * ri , struct pt_regs * regs )
1253+ static int
1254+ kretprobe_dispatcher (struct kretprobe_instance * ri , struct pt_regs * regs )
12441255{
12451256 struct trace_kprobe * tk = container_of (ri -> rp , struct trace_kprobe , rp );
12461257
@@ -1254,6 +1265,7 @@ int kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs)
12541265#endif
12551266 return 0 ; /* We don't tweek kernel, so just return 0 */
12561267}
1268+ NOKPROBE_SYMBOL (kretprobe_dispatcher );
12571269
12581270static struct trace_event_functions kretprobe_funcs = {
12591271 .trace = print_kretprobe_event
0 commit comments