mirror of
https://github.com/torvalds/linux.git
synced 2026-11-23 23:11:40 +00:00
tracnig: Add proper error message for glob use with "within" filter
If a user were to use a glob expression with the "within" filter, it
currently just fails with an errno return but does not update the
error_log to tell the user why it failed. Update it to use the parsing
error log to tell the user why it failed.
# echo 'within ~ "*_read"' > events/kmem/kmem_cache_alloc/filter
-bash: echo: write error: Invalid argument
# cat error_log
[ 4676.606481] event filter parse error: error: 'within' filter cannot take glob expressions
Command: within ~ "*_read"
^
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Steven Rostedt <[email protected]>
This commit is contained in:
@@ -118,6 +118,7 @@ struct filter_pred {
|
||||
C(IP_FIELD_ONLY, "Only 'ip' field is supported for function trace"), \
|
||||
C(INVALID_VALUE, "Invalid value (did you forget quotes)?"), \
|
||||
C(NO_FUNCTION, "Function not found"), \
|
||||
C(GLOB_WITHIN, "'within' filter cannot take glob expressions"), \
|
||||
C(ERRNO, "Error"), \
|
||||
C(NO_FILTER, "No filter found")
|
||||
|
||||
@@ -2027,8 +2028,10 @@ static int parse_pred(const char *str, void *data,
|
||||
} else if (field->filter_type == FILTER_WITHIN) {
|
||||
unsigned long func;
|
||||
|
||||
if (op == OP_GLOB)
|
||||
if (op == OP_GLOB) {
|
||||
parse_error(pe, FILT_ERR_GLOB_WITHIN, pos + i);
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
pred->fn_num = FILTER_PRED_FN_WITHIN;
|
||||
func = kallsyms_lookup_name(pred->regex->pattern);
|
||||
|
||||
Reference in New Issue
Block a user