Skip to content

Commit 51a7691

Browse files
committed
Merge tag 'probes-fixes-v6.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull probes fixes from Masami Hiramatsu: - tracing/kprobes: Fix kernel-doc warnings for the variable length arguments - tracing/kprobes: Fix to count the symbols in modules even if the module name is not specified so that user can probe the symbols in the modules without module name * tag 'probes-fixes-v6.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing/kprobes: Fix symbol counting logic by looking at modules as well tracing/kprobes: Fix the description of variable length arguments
2 parents bd80d2e + 926fe78 commit 51a7691

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

kernel/trace/trace_kprobe.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -714,14 +714,30 @@ static int count_symbols(void *data, unsigned long unused)
714714
return 0;
715715
}
716716

717+
struct sym_count_ctx {
718+
unsigned int count;
719+
const char *name;
720+
};
721+
722+
static int count_mod_symbols(void *data, const char *name, unsigned long unused)
723+
{
724+
struct sym_count_ctx *ctx = data;
725+
726+
if (strcmp(name, ctx->name) == 0)
727+
ctx->count++;
728+
729+
return 0;
730+
}
731+
717732
static unsigned int number_of_same_symbols(char *func_name)
718733
{
719-
unsigned int count;
734+
struct sym_count_ctx ctx = { .count = 0, .name = func_name };
735+
736+
kallsyms_on_each_match_symbol(count_symbols, func_name, &ctx.count);
720737

721-
count = 0;
722-
kallsyms_on_each_match_symbol(count_symbols, func_name, &count);
738+
module_kallsyms_on_each_symbol(NULL, count_mod_symbols, &ctx);
723739

724-
return count;
740+
return ctx.count;
725741
}
726742

727743
static int __trace_kprobe_create(int argc, const char *argv[])
@@ -1007,7 +1023,7 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);
10071023
* @name: The name of the kprobe event
10081024
* @loc: The location of the kprobe event
10091025
* @kretprobe: Is this a return probe?
1010-
* @args: Variable number of arg (pairs), one pair for each field
1026+
* @...: Variable number of arg (pairs), one pair for each field
10111027
*
10121028
* NOTE: Users normally won't want to call this function directly, but
10131029
* rather use the kprobe_event_gen_cmd_start() wrapper, which automatically
@@ -1080,7 +1096,7 @@ EXPORT_SYMBOL_GPL(__kprobe_event_gen_cmd_start);
10801096
/**
10811097
* __kprobe_event_add_fields - Add probe fields to a kprobe command from arg list
10821098
* @cmd: A pointer to the dynevent_cmd struct representing the new event
1083-
* @args: Variable number of arg (pairs), one pair for each field
1099+
* @...: Variable number of arg (pairs), one pair for each field
10841100
*
10851101
* NOTE: Users normally won't want to call this function directly, but
10861102
* rather use the kprobe_event_add_fields() wrapper, which

0 commit comments

Comments
 (0)