History

tracing: probeevent: Fix to make the type of $comm string

Fix to make the type of $comm "string". If we set the other type to $comm argument, it shows meaningless value or wrong data. Currently probe events allow us to set string array type (e.g. ":string[2]"), or other digit types like x8 on $comm. But since clearly $comm is just a string data, it should not be fetched by other types including array. Link: http://lkml.kernel.org/r/155723736241.9149.14582064184468574539.stgit@devnote2

Masami Hiramatsu committed 7 years ago

Commit 3dd1f7f1 parent 489fe001 file · +7 −6Browse files

Unified · Split

kernel/trace/trace_probe.c+7−6
@@ -533,13 +533,14 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size, · 532 unmodified lines
533533 }
534534 }
535535 }
536− /*
537− * The default type of $comm should be "string", and it can't be
538− * dereferenced.
539− */
540− if (!t && strcmp(arg, "$comm") == 0)
536+
537+ /* Since $comm can not be dereferred, we can find $comm by strcmp */
538+ if (strcmp(arg, "$comm") == 0) {
539+ /* The type of $comm must be "string", and not an array. */
540+ if (parg->count || (t && strcmp(t, "string")))
541+ return -EINVAL;
541542 parg->type = find_fetch_type("string");
542− else
543+ } else
543544 parg->type = find_fetch_type(t);
544545 if (!parg->type) {
545546 trace_probe_log_err(offset + (t ? (t - arg) : 0), BAD_TYPE);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t