Commit 3ca112b7 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'probes-fixes-v6.7-rc1' of...

Merge tag 'probes-fixes-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull probes fixes from Masami Hiramatsu:

 - Documentation update: Add a note about argument and return value
   fetching is the best effort because it depends on the type.

 - objpool: Fix to make internal global variables static in
   test_objpool.c.

 - kprobes: Unify kprobes_exceptions_nofify() prototypes. There are the
   same prototypes in asm/kprobes.h for some architectures, but some of
   them are missing the prototype and it causes a warning. So move the
   prototype into linux/kprobes.h.

 - tracing: Fix to check the tracepoint event and return event at
   parsing stage. The tracepoint event doesn't support %return but if
   $retval exists, it will be converted to %return silently. This finds
   that case and rejects it.

 - tracing: Fix the order of the descriptions about the parameters of
   __kprobe_event_gen_cmd_start() to be consistent with the argument
   list of the function.

* tag 'probes-fixes-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing/kprobes: Fix the order of argument descriptions
  tracing: fprobe-event: Fix to check tracepoint event and return
  kprobes: unify kprobes_exceptions_nofify() prototypes
  lib: test_objpool: make global variables static
  Documentation: tracing: Add a note about argument and retval access
parents 18553507 f032c53b
...@@ -59,8 +59,12 @@ Synopsis of fprobe-events ...@@ -59,8 +59,12 @@ Synopsis of fprobe-events
and bitfield are supported. and bitfield are supported.
(\*1) This is available only when BTF is enabled. (\*1) This is available only when BTF is enabled.
(\*2) only for the probe on function entry (offs == 0). (\*2) only for the probe on function entry (offs == 0). Note, this argument access
(\*3) only for return probe. is best effort, because depending on the argument type, it may be passed on
the stack. But this only support the arguments via registers.
(\*3) only for return probe. Note that this is also best effort. Depending on the
return value type, it might be passed via a pair of registers. But this only
accesses one register.
(\*4) this is useful for fetching a field of data structures. (\*4) this is useful for fetching a field of data structures.
(\*5) "u" means user-space dereference. (\*5) "u" means user-space dereference.
......
...@@ -61,8 +61,12 @@ Synopsis of kprobe_events ...@@ -61,8 +61,12 @@ Synopsis of kprobe_events
(x8/x16/x32/x64), "char", "string", "ustring", "symbol", "symstr" (x8/x16/x32/x64), "char", "string", "ustring", "symbol", "symstr"
and bitfield are supported. and bitfield are supported.
(\*1) only for the probe on function entry (offs == 0). (\*1) only for the probe on function entry (offs == 0). Note, this argument access
(\*2) only for return probe. is best effort, because depending on the argument type, it may be passed on
the stack. But this only support the arguments via registers.
(\*2) only for return probe. Note that this is also best effort. Depending on the
return value type, it might be passed via a pair of registers. But this only
accesses one register.
(\*3) this is useful for fetching a field of data structures. (\*3) this is useful for fetching a field of data structures.
(\*4) "u" means user-space dereference. See :ref:`user_mem_access`. (\*4) "u" means user-space dereference. See :ref:`user_mem_access`.
......
...@@ -32,9 +32,6 @@ struct kprobe; ...@@ -32,9 +32,6 @@ struct kprobe;
void arch_remove_kprobe(struct kprobe *p); void arch_remove_kprobe(struct kprobe *p);
int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
struct prev_kprobe { struct prev_kprobe {
struct kprobe *kp; struct kprobe *kp;
unsigned long status; unsigned long status;
......
...@@ -40,8 +40,6 @@ struct kprobe_ctlblk { ...@@ -40,8 +40,6 @@ struct kprobe_ctlblk {
void arch_remove_kprobe(struct kprobe *); void arch_remove_kprobe(struct kprobe *);
int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr); int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
/* optinsn template addresses */ /* optinsn template addresses */
extern __visible kprobe_opcode_t optprobe_template_entry[]; extern __visible kprobe_opcode_t optprobe_template_entry[];
......
...@@ -37,8 +37,6 @@ struct kprobe_ctlblk { ...@@ -37,8 +37,6 @@ struct kprobe_ctlblk {
void arch_remove_kprobe(struct kprobe *); void arch_remove_kprobe(struct kprobe *);
int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr); int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
void __kretprobe_trampoline(void); void __kretprobe_trampoline(void);
void __kprobes *trampoline_probe_handler(struct pt_regs *regs); void __kprobes *trampoline_probe_handler(struct pt_regs *regs);
......
...@@ -71,8 +71,6 @@ struct kprobe_ctlblk { ...@@ -71,8 +71,6 @@ struct kprobe_ctlblk {
struct prev_kprobe prev_kprobe; struct prev_kprobe prev_kprobe;
}; };
extern int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
#endif /* CONFIG_KPROBES */ #endif /* CONFIG_KPROBES */
#endif /* _ASM_KPROBES_H */ #endif /* _ASM_KPROBES_H */
...@@ -84,8 +84,6 @@ struct arch_optimized_insn { ...@@ -84,8 +84,6 @@ struct arch_optimized_insn {
kprobe_opcode_t *insn; kprobe_opcode_t *insn;
}; };
extern int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
extern int kprobe_handler(struct pt_regs *regs); extern int kprobe_handler(struct pt_regs *regs);
extern int kprobe_post_handler(struct pt_regs *regs); extern int kprobe_post_handler(struct pt_regs *regs);
......
...@@ -73,8 +73,6 @@ struct kprobe_ctlblk { ...@@ -73,8 +73,6 @@ struct kprobe_ctlblk {
void arch_remove_kprobe(struct kprobe *p); void arch_remove_kprobe(struct kprobe *p);
int kprobe_fault_handler(struct pt_regs *regs, int trapnr); int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
#define flush_insn_slot(p) do { } while (0) #define flush_insn_slot(p) do { } while (0)
......
...@@ -46,8 +46,6 @@ struct kprobe_ctlblk { ...@@ -46,8 +46,6 @@ struct kprobe_ctlblk {
}; };
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
extern int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
extern int kprobe_handle_illslot(unsigned long pc); extern int kprobe_handle_illslot(unsigned long pc);
#else #else
......
...@@ -47,8 +47,6 @@ struct kprobe_ctlblk { ...@@ -47,8 +47,6 @@ struct kprobe_ctlblk {
struct prev_kprobe prev_kprobe; struct prev_kprobe prev_kprobe;
}; };
int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
int kprobe_fault_handler(struct pt_regs *regs, int trapnr); int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
asmlinkage void __kprobes kprobe_trap(unsigned long trap_level, asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
struct pt_regs *regs); struct pt_regs *regs);
......
...@@ -113,8 +113,6 @@ struct kprobe_ctlblk { ...@@ -113,8 +113,6 @@ struct kprobe_ctlblk {
}; };
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
extern int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
extern int kprobe_int3_handler(struct pt_regs *regs); extern int kprobe_int3_handler(struct pt_regs *regs);
#else #else
......
...@@ -445,6 +445,10 @@ int kprobe_get_kallsym(unsigned int symnum, unsigned long *value, char *type, ...@@ -445,6 +445,10 @@ int kprobe_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
int arch_kprobe_get_kallsym(unsigned int *symnum, unsigned long *value, int arch_kprobe_get_kallsym(unsigned int *symnum, unsigned long *value,
char *type, char *sym); char *type, char *sym);
int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
#else /* !CONFIG_KPROBES: */ #else /* !CONFIG_KPROBES: */
static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
......
...@@ -927,11 +927,12 @@ static int parse_symbol_and_return(int argc, const char *argv[], ...@@ -927,11 +927,12 @@ static int parse_symbol_and_return(int argc, const char *argv[],
for (i = 2; i < argc; i++) { for (i = 2; i < argc; i++) {
tmp = strstr(argv[i], "$retval"); tmp = strstr(argv[i], "$retval");
if (tmp && !isalnum(tmp[7]) && tmp[7] != '_') { if (tmp && !isalnum(tmp[7]) && tmp[7] != '_') {
if (is_tracepoint) {
trace_probe_log_set_index(i);
trace_probe_log_err(tmp - argv[i], RETVAL_ON_PROBE);
return -EINVAL;
}
*is_return = true; *is_return = true;
/*
* NOTE: Don't check is_tracepoint here, because it will
* be checked when the argument is parsed.
*/
break; break;
} }
} }
......
...@@ -1020,9 +1020,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init); ...@@ -1020,9 +1020,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);
/** /**
* __kprobe_event_gen_cmd_start - Generate a kprobe event command from arg list * __kprobe_event_gen_cmd_start - Generate a kprobe event command from arg list
* @cmd: A pointer to the dynevent_cmd struct representing the new event * @cmd: A pointer to the dynevent_cmd struct representing the new event
* @kretprobe: Is this a return probe?
* @name: The name of the kprobe event * @name: The name of the kprobe event
* @loc: The location of the kprobe event * @loc: The location of the kprobe event
* @kretprobe: Is this a return probe?
* @...: Variable number of arg (pairs), one pair for each field * @...: Variable number of arg (pairs), one pair for each field
* *
* NOTE: Users normally won't want to call this function directly, but * NOTE: Users normally won't want to call this function directly, but
......
...@@ -311,7 +311,7 @@ static void ot_fini_sync(struct ot_context *sop) ...@@ -311,7 +311,7 @@ static void ot_fini_sync(struct ot_context *sop)
ot_kfree(sop->test, sop, sizeof(*sop)); ot_kfree(sop->test, sop, sizeof(*sop));
} }
struct { static struct {
struct ot_context * (*init)(struct ot_test *oc); struct ot_context * (*init)(struct ot_test *oc);
void (*fini)(struct ot_context *sop); void (*fini)(struct ot_context *sop);
} g_ot_sync_ops[] = { } g_ot_sync_ops[] = {
...@@ -475,7 +475,7 @@ static struct ot_context *ot_init_async_m0(struct ot_test *test) ...@@ -475,7 +475,7 @@ static struct ot_context *ot_init_async_m0(struct ot_test *test)
return sop; return sop;
} }
struct { static struct {
struct ot_context * (*init)(struct ot_test *oc); struct ot_context * (*init)(struct ot_test *oc);
void (*fini)(struct ot_context *sop); void (*fini)(struct ot_context *sop);
} g_ot_async_ops[] = { } g_ot_async_ops[] = {
...@@ -632,7 +632,7 @@ static int ot_start_async(struct ot_test *test) ...@@ -632,7 +632,7 @@ static int ot_start_async(struct ot_test *test)
#define NODE_COMPACT sizeof(struct ot_node) #define NODE_COMPACT sizeof(struct ot_node)
#define NODE_VMALLOC (512) #define NODE_VMALLOC (512)
struct ot_test g_testcases[] = { static struct ot_test g_testcases[] = {
/* sync & normal */ /* sync & normal */
{0, 0, NODE_COMPACT, 1000, 0, 1, 0, 0, "sync: percpu objpool"}, {0, 0, NODE_COMPACT, 1000, 0, 1, 0, 0, "sync: percpu objpool"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment