Commit 26edad06 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'probes-fixes-v6.14-rc4' of...

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

Pull probe events fixes from Masami Hiramatsu:

 - probe-events: Remove unused MAX_ARG_BUF_LEN macro - it is not used

 - fprobe-events: Log error for exceeding the number of entry args.

   Since the max number of entry args is limited, it should be checked
   and rejected when the parser detects it.

 - tprobe-events: Reject invalid tracepoint name

   If a user specifies an invalid tracepoint name (e.g. including '/')
   then the new event is not defined correctly in the eventfs.

 - tprobe-events: Fix a memory leak when tprobe defined with $retval

   There is a memory leak if tprobe is defined with $retval.

* tag 'probes-fixes-v6.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing: probe-events: Remove unused MAX_ARG_BUF_LEN macro
  tracing: fprobe-events: Log error for exceeding the number of entry args
  tracing: tprobe-events: Reject invalid tracepoint name
  tracing: tprobe-events: Fix a memory leak when tprobe with $retval
parents 7eb17214 fd5ba383
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1049,6 +1049,19 @@ static int parse_symbol_and_return(int argc, const char *argv[],
	if (*is_return)
		return 0;

	if (is_tracepoint) {
		tmp = *symbol;
		while (*tmp && (isalnum(*tmp) || *tmp == '_'))
			tmp++;
		if (*tmp) {
			/* find a wrong character. */
			trace_probe_log_err(tmp - *symbol, BAD_TP_NAME);
			kfree(*symbol);
			*symbol = NULL;
			return -EINVAL;
		}
	}

	/* If there is $retval, this should be a return fprobe. */
	for (i = 2; i < argc; i++) {
		tmp = strstr(argv[i], "$retval");
@@ -1056,6 +1069,8 @@ static int parse_symbol_and_return(int argc, const char *argv[],
			if (is_tracepoint) {
				trace_probe_log_set_index(i);
				trace_probe_log_err(tmp - argv[i], RETVAL_ON_PROBE);
				kfree(*symbol);
				*symbol = NULL;
				return -EINVAL;
			}
			*is_return = true;
@@ -1215,6 +1230,11 @@ static int trace_fprobe_create_internal(int argc, const char *argv[],
	if (is_return && tf->tp.entry_arg) {
		tf->fp.entry_handler = trace_fprobe_entry_handler;
		tf->fp.entry_data_size = traceprobe_get_entry_data_size(&tf->tp);
		if (ALIGN(tf->fp.entry_data_size, sizeof(long)) > MAX_FPROBE_DATA_SIZE) {
			trace_probe_log_set_index(2);
			trace_probe_log_err(0, TOO_MANY_EARGS);
			return -E2BIG;
		}
	}

	ret = traceprobe_set_print_fmt(&tf->tp,
+3 −2
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@
#define MAX_BTF_ARGS_LEN	128
#define MAX_DENTRY_ARGS_LEN	256
#define MAX_STRING_SIZE		PATH_MAX
#define MAX_ARG_BUF_LEN		(MAX_TRACE_ARGS * MAX_ARG_NAME_LEN)

/* Reserved field names */
#define FIELD_STRING_IP		"__probe_ip"
@@ -481,6 +480,7 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
	C(NON_UNIQ_SYMBOL,	"The symbol is not unique"),		\
	C(BAD_RETPROBE,		"Retprobe address must be an function entry"), \
	C(NO_TRACEPOINT,	"Tracepoint is not found"),		\
	C(BAD_TP_NAME,		"Invalid character in tracepoint name"),\
	C(BAD_ADDR_SUFFIX,	"Invalid probed address suffix"), \
	C(NO_GROUP_NAME,	"Group name is not specified"),		\
	C(GROUP_TOO_LONG,	"Group name is too long"),		\
@@ -544,7 +544,8 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
	C(NO_BTF_FIELD,		"This field is not found."),	\
	C(BAD_BTF_TID,		"Failed to get BTF type info."),\
	C(BAD_TYPE4STR,		"This type does not fit for string."),\
	C(NEED_STRING_TYPE,	"$comm and immediate-string only accepts string type"),
	C(NEED_STRING_TYPE,	"$comm and immediate-string only accepts string type"),\
	C(TOO_MANY_EARGS,	"Too many entry arguments specified"),

#undef C
#define C(a, b)		TP_ERR_##a