Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1803575imm; Thu, 23 Aug 2018 09:01:19 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwbJcmRlSeGEsyjK4URXCkPMjhF3tcBws5cmdlVc4w2fQBDVj3r76qyt74NKTwql6+SQiw6 X-Received: by 2002:a63:190e:: with SMTP id z14-v6mr20202575pgl.302.1535040079101; Thu, 23 Aug 2018 09:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535040079; cv=none; d=google.com; s=arc-20160816; b=vHTwoh4vPqOeks4JPivWy09xgKhBa4AjFHf/H3CwqZb8hsJP76d09uVDgOTw7+NTlq oVEnRYet94pIVdfgAWUbp+PUfHTDEKc4atkPkNpMwIJoX7QswWpqXA783ZdbZZJc6S1f NSKDHRPWIKT/9BCG6xHNLrrpUMAGgp1MfBaua2OQifJe3mPRpJnZnob4a5xFzvCvYvz8 uacYf4MF7YEFmDfi+F2feFci3PkaNcS8yFbkGcp8ylnNPu+M9x1RjcrBtKPzohYCqmXA LK2tCZGkihYM1429vxTZ9cA+Iw+E01xy2Ac0JDAhh5t0vT9Yfzxp4NBA0LpgBE+bwB4d El2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=ybxUWa84wHBoyd+O/UM1ZW7q2fKYFypTjY2n8DtjlBw=; b=EMLoukHPwmXw0UMfyuvVqyT9bIu5d9PjDL3Wi0U+ld1dCovO4ELiiaXvWHCR/snXka UA+HQ3fnerDCSXgoj+h1QCiFF6YzJKLDaZDG6wQM8cYu0MjrZ4SZE877vRb2UVxWGENG VRllx5n0AeFdAz/HaUKt+7XeFk9vKATLZIRA5aNZnneCK2YhMRQZcOORAIUxQDzmqIc2 jZM+4ad/5vtpYfUj3akXYqUhFf1+JdVgN8JTIqom8xkh2B1e27zy9QCCx4hNNsA/o1x+ pRJX7PyqKdDfDNipTvNbNoqyhhfsTOp68JHp+5WoahRrCFm9oi2Jet979HQiSEQBpMdR nTHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=gJvqjzYH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x195-v6si5348106pfd.124.2018.08.23.09.01.03; Thu, 23 Aug 2018 09:01:19 -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; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=gJvqjzYH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729400AbeHWNzB (ORCPT + 99 others); Thu, 23 Aug 2018 09:55:01 -0400 Received: from mail-eopbgr10094.outbound.protection.outlook.com ([40.107.1.94]:19727 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726500AbeHWNzB (ORCPT ); Thu, 23 Aug 2018 09:55:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ybxUWa84wHBoyd+O/UM1ZW7q2fKYFypTjY2n8DtjlBw=; b=gJvqjzYHRFu1J5apeW72vP4tVJ9+IOGSxC0/5hD+ULdtad/mDtD38wYipZeSUtSYPiHCopKTmglaFUScQanCHVu3xIXHKwcAV2TypP9HxeWBMk980QLOkd6AhJX+20VoKqgzTt17aPVKsNirEbl5B9C5WYGBILboe4g5CPy1KI8= Received: from snorch.sw.ru (185.231.240.5) by DB3PR08MB0188.eurprd08.prod.outlook.com (2a01:111:e400:504d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.13; Thu, 23 Aug 2018 10:25:52 +0000 From: Pavel Tikhomirov To: Steven Rostedt Cc: Ingo Molnar , Al Viro , linux-kernel@vger.kernel.org, Pavel Tikhomirov Subject: [PATCH] tracing: Fix event filters and triggers to handle negative numbers Date: Thu, 23 Aug 2018 13:25:34 +0300 Message-Id: <20180823102534.7642-1-ptikhomirov@virtuozzo.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: AM0PR02CA0006.eurprd02.prod.outlook.com (2603:10a6:208:3e::19) To DB3PR08MB0188.eurprd08.prod.outlook.com (2a01:111:e400:504d::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 19625d18-351d-4381-3bce-08d608e2cddb X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB3PR08MB0188; X-Microsoft-Exchange-Diagnostics: 1;DB3PR08MB0188;3:m2fxBOvLR1wDKshb353QTamh4wzYao21ZPexhuYz/UKMWs3I4tg7W1fzEmzdmkJpETKu5cEtJ1EosWdKol7sbayDTPKtOGdqOGyp3d15Gch9TxTq/4eqr0lCXgWM2sXtf+0LvzHCZWRAG7sNbe49l2MFlSdVFyIHAP6zfLWNBwRzGdjoopVuoda2FGbfJ5FvaKEkjYKOHzLQH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6wN3IdzPKLrqdRXqWcPbsUX/8kUBMQfa+3MkTize+nHZKrnvJZPyRhaM+ZoVqMYwZjUFbMHJM4UcFOfH8bbXcrF1HbAbaTXa6ZQ+L/Qh9cJpNU4EsZNGp537geN3E25oFffpWGCo79DmNxlVtSpXUvP0+ZEEaQQ0B;4:6M3rFdlDuRxVB02eUTG/gINKPx0hH1+fXh3UZnEOzBwtSSaE8EkQmWGc57cV+smLq18h9Kr5G2JVOWxsBQMFb6sha9R2ooalNulcS3rQUpw51CeQhtkZGcWHpDc5//zJ575lgEshUlCVqhblrAAG1ZTb2HO9BSTT9bIPBgpDGdrohRUvAjFggpKfURDssrdBT9iDvI6izsVvJ7LOy4BZiFiiWB4fgIfmte1sLeE1b7iinhfz/aoJzaPxHfl4x3PtGW7Q0HsurB+4hu5MX4ZkFw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(823301075)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699016);SRVR:DB3PR08MB0188;BCL:0;PCL:0;RULEID:;SRVR:DB3PR08MB0188; X-Forefront-PRVS: 0773BB46AC X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(346002)(376002)(39840400004)(366004)(136003)(199004)(189003)(186003)(16526019)(386003)(2906002)(36756003)(6506007)(26005)(14444005)(316002)(6666003)(6916009)(6346003)(16586007)(1857600001)(54906003)(86362001)(476003)(3846002)(486006)(2616005)(6116002)(956004)(1076002)(8676002)(105586002)(97736004)(47776003)(50466002)(69596002)(48376002)(6486002)(51416003)(52116002)(5660300001)(107886003)(81166006)(66066001)(81156014)(4326008)(53936002)(68736007)(53416004)(478600001)(7736002)(25786009)(106356001)(8936002)(6512007)(50226002)(305945005);DIR:OUT;SFP:1102;SCL:1;SRVR:DB3PR08MB0188;H:snorch.sw.ru;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ptikhomirov@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DB3PR08MB0188;23:U1GW4Ne+G6QatyC1ewBxNd84coA2PCtbmvwz58HRA?= =?us-ascii?Q?1NkCcWAq6e44eWXKm7JTCzVydwAZ1Gc627V95Qx8tL41gDeIGqvzMzBJ4hR+?= =?us-ascii?Q?A1DO0diOHIZzK7Q7T+9zQci7nsTWtaWSTtRAq4Y6yyVh+H7bISYtiJKgfFY4?= =?us-ascii?Q?VHA84/m7FdHNUz7rTSrWk7zcjNF8ciHm7Kvp5u1i7Yo2ZOVpHSBTvDS6dZxo?= =?us-ascii?Q?pZftwP2Uve+SgadJg4lMDWnFZ64ywAZPTg3Mf8/lAOotRH++AvYk4DkffN/o?= =?us-ascii?Q?0AKD9PCfRW/+4/nxilT12qWT3N1JO0AYOGqpu1YapySDdre0ZZm8UC5RROOd?= =?us-ascii?Q?fCn7ehBJ/OkPIf2N6kIeoHDLwHcP7GPoR4CRjcSvO1YX0MbCOAQ4kwIYZFlI?= =?us-ascii?Q?E+qjsMi10Ffs4oy0WeYrtBZNxtw0FVU7T/igBqcxuWWncCYc1BdjdL7Po7pN?= =?us-ascii?Q?GIza3BU4SiI7MlX8rGPqLrU3kuorhyPmWlZIQByRcUD5reTB7lo5xppAzCN2?= =?us-ascii?Q?VpazuWeVVrTtlrrPlVF1Y+kEiXNOsl3r/zJSjdkLzn9oWI94mf7957Fx5c6l?= =?us-ascii?Q?cU65O92qIi9/g9CEvLk5BNtA7wG1zxazcDI0stTZkrlPglGLdVqvMUquROqG?= =?us-ascii?Q?r66tv4em4SThy0m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B3PR08MB0188;20:8hdAU3y0KAE4ktOvbwYUCX4djTqykDXMvTI7/5wMZIxmKkSDsTlHw0Xfu1Twba8hNzp6n2vC3u5kRjtKG0eVCdEzviYxzXuDr+me5ASvo2DwrHdjTjG8ohPYW6daTsko8s5L1guJY04UlquoE8LfVwpoEfixHQ42nkfKwBeWkCA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2018 10:25:52.3737 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19625d18-351d-4381-3bce-08d608e2cddb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR08MB0188 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)? 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++; -- 2.17.1