[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180823204849.3b4aede3@vmware.local.home>
Date: Thu, 23 Aug 2018 20:48:49 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Pavel Tikhomirov <ptikhomirov@...tuozzo.com>
Cc: Ingo Molnar <mingo@...hat.com>, Al Viro <viro@...IV.linux.org.uk>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tracing: Fix event filters and triggers to handle
negative numbers
On Thu, 23 Aug 2018 13:25:34 +0300
Pavel Tikhomirov <ptikhomirov@...tuozzo.com> wrote:
> Then tracing syscall exit event it is extremely useful to filter exit
> codes equal to some negative value, to react only to required errors.
> But negative numbers does not work:
>
> [root@...rch sys_exit_read]# echo "ret == -1" > filter
> bash: echo: write error: Invalid argument
> [root@...rch sys_exit_read]# cat filter
> ret == -1
> ^
> parse_error: Invalid value (did you forget quotes)?
Thanks for the patch. I'll apply it and then start testing it!
-- Steve
>
> Similar thing happens when setting triggers.
>
> These is a regression in v4.17 introduced by the commit mentioned below,
> testing without these commit shows no problem with negative numbers.
>
> Fixes: 80765597bc58 ("tracing: Rewrite filter logic to be simpler and faster")
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@...tuozzo.com>
> ---
> kernel/trace/trace_events_filter.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index 84a65173b1e9..2ba449292561 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c
> @@ -1299,7 +1299,7 @@ static int parse_pred(const char *str, void *data,
> /* go past the last quote */
> i++;
>
> - } else if (isdigit(str[i])) {
> + } else if (isdigit(str[i]) || str[i] == '-') {
>
> /* Make sure the field is not a string */
> if (is_string_field(field)) {
> @@ -1312,6 +1312,9 @@ static int parse_pred(const char *str, void *data,
> goto err_free;
> }
>
> + if (str[i] == '-')
> + i++;
> +
> /* We allow 0xDEADBEEF */
> while (isalnum(str[i]))
> i++;
Powered by blists - more mailing lists