History

tracing/probes: Make the $ prefix mandatory for comm access

Since $comm or $COMM are not event field but special fetcharg variables to access current->comm, It should not be accessed without '$' prefix even with typecast. Link: https://lore.kernel.org/all/178231209724.732967.12049805699091810641.stgit@devnote2/

Masami Hiramatsu (Google) committed 4 months ago

Commit a3692991 parent 367c49d1 file · +7 −5Browse files

Unified · Split

kernel/trace/trace_probe.c+7−5
@@ -342,10 +342,6 @@ static int parse_trace_event(char *arg, struct fetch_insn *code, · 341 unmodified lines
342 ret = parse_trace_event_arg(arg, code, ctx);342 ret = parse_trace_event_arg(arg, code, ctx);
343 if (!ret)343 if (!ret)
344 return 0;344 return 0;
345 if (strcmp(arg, "comm") == 0 || strcmp(arg, "COMM") == 0) {
346 code->op = FETCH_OP_COMM;
347 return 0;
348 }
349 return -EINVAL;345 return -EINVAL;
350}346}
351 347
@@ -1068,8 +1064,14 @@ static int parse_probe_vars(char *orig_arg, const struct fetch_type *t, · 716 unmodified lines
1068 int len;1064 int len;
1069 1065
1070 if (ctx->flags & TPARG_FL_TEVENT) {1066 if (ctx->flags & TPARG_FL_TEVENT) {
1071 if (parse_trace_event(arg, code, ctx) < 0)1067 if (parse_trace_event(arg, code, ctx) < 0) {
1068 /* 'comm' should be checked after field parsing. */
1069 if (strcmp(arg, "comm") == 0 || strcmp(arg, "COMM") == 0) {
1070 code->op = FETCH_OP_COMM;
1071 return 0;
1072 }
1072 goto inval;1073 goto inval;
1074 }
1073 return 0;1075 return 0;
1074 }1076 }
1075 1077