Probes fixes for v6.14-rc4:
- probe-events: Some issues are fixed. . probe-events: Remove unused MAX_ARG_BUF_LEN macro. MAX_ARG_BUF_LEN is not used so remove it. . 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 User can specify 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. -----BEGIN PGP SIGNATURE----- iQFPBAABCgA5FiEEh7BulGwFlgAOi5DV2/sHvwUrPxsFAmfFKkcbHG1hc2FtaS5o aXJhbWF0c3VAZ21haWwuY29tAAoJENv7B78FKz8b/F4H/10qmUSsec9+IbQseg0E MSRxAhJQ+xOcLfGsWhblW2zirkw9o4PghZYwBodkastu4Wgq2M5ASKd6KqUY2o7D CX+tCoXf80SDLEVd2go5m72Ml40rrGDEgLvS5YcEa4Iqr5nPZrvCJ7rl2tlqupQH W2ttOTkX9H28phAFDCsdl5ZJUCJRxlFc6fYG0yZYHsFdRub9J2LPiMTMwIlu56YS 8HH3NxS+wxlKK2I4VfD8mFsOnrNh7MFDLOOwNMlKWvm2wSPbPmVho+eXLAc5xyTO d+vUpkp4Dp9WWCLuNdO/sqY0IKngO2sM++WbtL/YPP8YijqsrImep4PCR8/fvlN6 Urs= =dyZm -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
26edad06d5
2 changed files with 23 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue