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/
Unified · Split
| @@ -342,10 +342,6 @@ static int parse_trace_event(char *arg, struct fetch_insn *code, · 341 unmodified lines | ||
| 342 | 342 | ret = parse_trace_event_arg(arg, code, ctx); |
| 343 | 343 | if (!ret) |
| 344 | 344 | return 0; |
| 345 | − if (strcmp(arg, "comm") == 0 || strcmp(arg, "COMM") == 0) { | |
| 346 | − code->op = FETCH_OP_COMM; | |
| 347 | − return 0; | |
| 348 | − } | |
| 349 | 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 | 1064 | int len; |
| 1069 | 1065 | |
| 1070 | 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 | 1073 | goto inval; |
| 1074 | + } | |
| 1073 | 1075 | return 0; |
| 1074 | 1076 | } |
| 1075 | 1077 | |