Skip to content

Commit 3ca112b

Browse files
committed
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
2 parents 1855350 + f032c53 commit 3ca112b

File tree

15 files changed

+25
-31
lines changed

15 files changed

+25
-31
lines changed

Documentation/trace/fprobetrace.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ Synopsis of fprobe-events
5959
and bitfield are supported.
6060

6161
(\*1) This is available only when BTF is enabled.
62-
(\*2) only for the probe on function entry (offs == 0).
63-
(\*3) only for return probe.
62+
(\*2) only for the probe on function entry (offs == 0). Note, this argument access
63+
is best effort, because depending on the argument type, it may be passed on
64+
the stack. But this only support the arguments via registers.
65+
(\*3) only for return probe. Note that this is also best effort. Depending on the
66+
return value type, it might be passed via a pair of registers. But this only
67+
accesses one register.
6468
(\*4) this is useful for fetching a field of data structures.
6569
(\*5) "u" means user-space dereference.
6670

Documentation/trace/kprobetrace.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ Synopsis of kprobe_events
6161
(x8/x16/x32/x64), "char", "string", "ustring", "symbol", "symstr"
6262
and bitfield are supported.
6363

64-
(\*1) only for the probe on function entry (offs == 0).
65-
(\*2) only for return probe.
64+
(\*1) only for the probe on function entry (offs == 0). Note, this argument access
65+
is best effort, because depending on the argument type, it may be passed on
66+
the stack. But this only support the arguments via registers.
67+
(\*2) only for return probe. Note that this is also best effort. Depending on the
68+
return value type, it might be passed via a pair of registers. But this only
69+
accesses one register.
6670
(\*3) this is useful for fetching a field of data structures.
6771
(\*4) "u" means user-space dereference. See :ref:`user_mem_access`.
6872

arch/arc/include/asm/kprobes.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ struct kprobe;
3232

3333
void arch_remove_kprobe(struct kprobe *p);
3434

35-
int kprobe_exceptions_notify(struct notifier_block *self,
36-
unsigned long val, void *data);
37-
3835
struct prev_kprobe {
3936
struct kprobe *kp;
4037
unsigned long status;

arch/arm/include/asm/kprobes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ struct kprobe_ctlblk {
4040

4141
void arch_remove_kprobe(struct kprobe *);
4242
int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
43-
int kprobe_exceptions_notify(struct notifier_block *self,
44-
unsigned long val, void *data);
4543

4644
/* optinsn template addresses */
4745
extern __visible kprobe_opcode_t optprobe_template_entry[];

arch/arm64/include/asm/kprobes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ struct kprobe_ctlblk {
3737

3838
void arch_remove_kprobe(struct kprobe *);
3939
int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
40-
int kprobe_exceptions_notify(struct notifier_block *self,
41-
unsigned long val, void *data);
4240
void __kretprobe_trampoline(void);
4341
void __kprobes *trampoline_probe_handler(struct pt_regs *regs);
4442

arch/mips/include/asm/kprobes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ struct kprobe_ctlblk {
7171
struct prev_kprobe prev_kprobe;
7272
};
7373

74-
extern int kprobe_exceptions_notify(struct notifier_block *self,
75-
unsigned long val, void *data);
7674

7775
#endif /* CONFIG_KPROBES */
7876
#endif /* _ASM_KPROBES_H */

arch/powerpc/include/asm/kprobes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ struct arch_optimized_insn {
8484
kprobe_opcode_t *insn;
8585
};
8686

87-
extern int kprobe_exceptions_notify(struct notifier_block *self,
88-
unsigned long val, void *data);
8987
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
9088
extern int kprobe_handler(struct pt_regs *regs);
9189
extern int kprobe_post_handler(struct pt_regs *regs);

arch/s390/include/asm/kprobes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ struct kprobe_ctlblk {
7373
void arch_remove_kprobe(struct kprobe *p);
7474

7575
int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
76-
int kprobe_exceptions_notify(struct notifier_block *self,
77-
unsigned long val, void *data);
7876

7977
#define flush_insn_slot(p) do { } while (0)
8078

arch/sh/include/asm/kprobes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ struct kprobe_ctlblk {
4646
};
4747

4848
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
49-
extern int kprobe_exceptions_notify(struct notifier_block *self,
50-
unsigned long val, void *data);
5149
extern int kprobe_handle_illslot(unsigned long pc);
5250
#else
5351

arch/sparc/include/asm/kprobes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ struct kprobe_ctlblk {
4747
struct prev_kprobe prev_kprobe;
4848
};
4949

50-
int kprobe_exceptions_notify(struct notifier_block *self,
51-
unsigned long val, void *data);
5250
int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
5351
asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
5452
struct pt_regs *regs);

arch/x86/include/asm/kprobes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ struct kprobe_ctlblk {
113113
};
114114

115115
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
116-
extern int kprobe_exceptions_notify(struct notifier_block *self,
117-
unsigned long val, void *data);
118116
extern int kprobe_int3_handler(struct pt_regs *regs);
119117

120118
#else

include/linux/kprobes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,10 @@ int kprobe_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
445445

446446
int arch_kprobe_get_kallsym(unsigned int *symnum, unsigned long *value,
447447
char *type, char *sym);
448+
449+
int kprobe_exceptions_notify(struct notifier_block *self,
450+
unsigned long val, void *data);
451+
448452
#else /* !CONFIG_KPROBES: */
449453

450454
static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)

kernel/trace/trace_fprobe.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -927,11 +927,12 @@ static int parse_symbol_and_return(int argc, const char *argv[],
927927
for (i = 2; i < argc; i++) {
928928
tmp = strstr(argv[i], "$retval");
929929
if (tmp && !isalnum(tmp[7]) && tmp[7] != '_') {
930+
if (is_tracepoint) {
931+
trace_probe_log_set_index(i);
932+
trace_probe_log_err(tmp - argv[i], RETVAL_ON_PROBE);
933+
return -EINVAL;
934+
}
930935
*is_return = true;
931-
/*
932-
* NOTE: Don't check is_tracepoint here, because it will
933-
* be checked when the argument is parsed.
934-
*/
935936
break;
936937
}
937938
}

kernel/trace/trace_kprobe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,9 +1020,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);
10201020
/**
10211021
* __kprobe_event_gen_cmd_start - Generate a kprobe event command from arg list
10221022
* @cmd: A pointer to the dynevent_cmd struct representing the new event
1023+
* @kretprobe: Is this a return probe?
10231024
* @name: The name of the kprobe event
10241025
* @loc: The location of the kprobe event
1025-
* @kretprobe: Is this a return probe?
10261026
* @...: Variable number of arg (pairs), one pair for each field
10271027
*
10281028
* NOTE: Users normally won't want to call this function directly, but

lib/test_objpool.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static void ot_fini_sync(struct ot_context *sop)
311311
ot_kfree(sop->test, sop, sizeof(*sop));
312312
}
313313

314-
struct {
314+
static struct {
315315
struct ot_context * (*init)(struct ot_test *oc);
316316
void (*fini)(struct ot_context *sop);
317317
} g_ot_sync_ops[] = {
@@ -475,7 +475,7 @@ static struct ot_context *ot_init_async_m0(struct ot_test *test)
475475
return sop;
476476
}
477477

478-
struct {
478+
static struct {
479479
struct ot_context * (*init)(struct ot_test *oc);
480480
void (*fini)(struct ot_context *sop);
481481
} g_ot_async_ops[] = {
@@ -632,7 +632,7 @@ static int ot_start_async(struct ot_test *test)
632632
#define NODE_COMPACT sizeof(struct ot_node)
633633
#define NODE_VMALLOC (512)
634634

635-
struct ot_test g_testcases[] = {
635+
static struct ot_test g_testcases[] = {
636636

637637
/* sync & normal */
638638
{0, 0, NODE_COMPACT, 1000, 0, 1, 0, 0, "sync: percpu objpool"},

0 commit comments

Comments
 (0)