Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2261963imm; Thu, 23 Aug 2018 17:51:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZWXkLKuREGPubVLEMYMl4CPfcLB0jzxfuoXhZ5UcwBtWCSVdLhpRocg/dHvnbXh+ussHa2 X-Received: by 2002:a63:a619:: with SMTP id t25-v6mr5850275pge.288.1535071870024; Thu, 23 Aug 2018 17:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535071869; cv=none; d=google.com; s=arc-20160816; b=NWnlHU+VB8sdEmAgxM+VT/784fEz9kHv+L8NDQegNAbVzoBEHwsyxiv+J9nBTkhM9u jrdyZi+NUczgAVBG+W7bIbEZvUnUlg1gyYibHeROq4mY3dRdyVZ/p3eQ4SE826VG54rX hcNoeCDHZLw5MziwS/3+tBZ1HjuvKh3MNvdgVd4dQL69O84Xuo3ZML0Z18FYnQiJLyYi 8I6qoqinE71dzQBXXdXzZa0OSxIZfPUBOQV1o36GgYdNukwQMpirpFQqD4WYUF1/JNOe 9a667GSsfuDXlKKFZUXRH2D27+tF/CPbbftpCy+CO+MbzlYMdgbD/pVCpi3lXBv4y6yV H+vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=JDjOai0nngTziyc0VLahFzlJO/tsNkpfdsHV67u6wPc=; b=VzddvRjNT0BOdHGToE3bvdATdlvQvmnNtGD2zW/ozwamT/o4TVPIh7Xhlt+vyguUX9 UiesuELHQg5mK93qoItsUgjNLgAjqPEq6tAcsSeHfaE2+ssgt6N48ZLHzK1MjA6FJ4/J 3ycAP4q4dcnZd/UlShDHpzp1W7n5xv2OhK7KzyRK+pMobYqKCgMaIynG/eFxtjuFOiXF b+6GALNHO9R54UPCvr5kwZKmkvEQE9HbzXgDc/KDlS/5p6Up9cI7jzv+2jYkCanAmvdH ZSOs8vcqb4Zha0vya/RSdfk6N63smrB/wNCRl0NnABuPra2CUBgqwUaorTWnV54oBswd /B3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u24-v6si5316178plq.210.2018.08.23.17.50.40; Thu, 23 Aug 2018 17:51:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726303AbeHXEVC (ORCPT + 99 others); Fri, 24 Aug 2018 00:21:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:36328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725951AbeHXEVC (ORCPT ); Fri, 24 Aug 2018 00:21:02 -0400 Received: from vmware.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 21A7921557; Fri, 24 Aug 2018 00:48:51 +0000 (UTC) Date: Thu, 23 Aug 2018 20:48:49 -0400 From: Steven Rostedt To: Pavel Tikhomirov Cc: Ingo Molnar , Al Viro , linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: Fix event filters and triggers to handle negative numbers Message-ID: <20180823204849.3b4aede3@vmware.local.home> In-Reply-To: <20180823102534.7642-1-ptikhomirov@virtuozzo.com> References: <20180823102534.7642-1-ptikhomirov@virtuozzo.com> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Aug 2018 13:25:34 +0300 Pavel Tikhomirov 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@snorch sys_exit_read]# echo "ret == -1" > filter > bash: echo: write error: Invalid argument > [root@snorch 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 > --- > 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++;