Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4936574ybf; Wed, 4 Mar 2020 13:50:07 -0800 (PST) X-Google-Smtp-Source: ADFU+vvYYDsDDT5Q7qS14cDaglmPRyuf6ANZy4URyHdr8QoDZyzXJ0lFqXqeBAFca22N9QUsntX3 X-Received: by 2002:a9d:75d7:: with SMTP id c23mr2950349otl.73.1583358607246; Wed, 04 Mar 2020 13:50:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583358607; cv=none; d=google.com; s=arc-20160816; b=oNoD8gV3fMYzy+sPN5YE4euEF8zHIeZUQ9KCdPlCDrqNoNpL5mUI0M8f8SpfR0rKJu QChDtyxUz4CwWNNBit4pIAXEaecOGQZEsoKn3SYK/dY3hDIUVdA00HKi6tqJ3mIvbpnf B6qyAz1Loa1RUqaLaGkJyehJyvrsCxTbqSh2mWo0s2nSaHNQzFe7hF/MIk5feIJras4C 6FpUnH2LbPUS+WnUDcs8EjI//9fiWyw30Pyfsbwfpb1oBbToAQb1EJxLJAk5grc9s+jp ni/Ntnd+xgklfYVkGIp1AConTLB893pAD/73KQyYj9smgxztPR9I42mJ1aYJ8D03RB6E 0K/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=D15ynwrrHMGu8Lvf29PfzDkO2Xnj0Kx0WtMUcRAoGUk=; b=El0DncpSo/nVUxryBEXbNUt/0+QbW9YzkUjscwZo2cmRcvHqb1iSJgfUQQtI7lSglo KOYmmWp+A49eYwj90zLOlbfa4dv3FICh0Q0jhGq6WFC6At3HcIX2nHCNcljcjzf1W5ig AmWg81gzcpPIQ0bTj6kdCl5xHd63xEZdOCZl4x6kW9Zw4CAQcuLsskQ6DrvVgrv29fjt /NY1iCNR4egbcW2RviSCG4K56fiB+qqfV3zb8iPOeXJ4DxAwU//+0qq7ndESJ2ZBwgX5 LKG7CRysmAkLbNnekFqwMIvbOD+9PajwQCEyajGQIF78uJjFpFbnhVSFc37T3Bcjnn4L vsIw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si2058671otn.213.2020.03.04.13.49.55; Wed, 04 Mar 2020 13:50:07 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388435AbgCDVtn (ORCPT + 99 others); Wed, 4 Mar 2020 16:49:43 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:44648 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388312AbgCDVtn (ORCPT ); Wed, 4 Mar 2020 16:49:43 -0500 Received: from mail-yw1-f70.google.com ([209.85.161.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j9btd-0000WF-4v for linux-kernel@vger.kernel.org; Wed, 04 Mar 2020 21:49:41 +0000 Received: by mail-yw1-f70.google.com with SMTP id w185so4666445ywa.22 for ; Wed, 04 Mar 2020 13:49:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=D15ynwrrHMGu8Lvf29PfzDkO2Xnj0Kx0WtMUcRAoGUk=; b=qoWQGSSu/tFHv8n1zwRep6M0w8gOzEnTnGgWSITy8RY1i92WhHypPPLqIeE5ehpgJm ikKLO32hhoo6dG7MBS8eg7o9eOVWx8rk5ttTptc4+5aD8XLFlpsx2O4uQkAlde9OsQST FRaLmBW+RErO1VW4i28DXK7mUfXgiXOi86AC6v8erm3nnHWjlKEAoIS0ykauHbX1HSRt im6CC1qJoCCyNS5C89hs+2TVkLGJDZAm532KbO+PnK6TFRmv0j2DLqm11FztAUJYnON/ oWps5hVQFRi6dywVEsjioL+/U1isGBvPNhiX2CTbE3aQKGSm8Uh5ha+5yaT8uurDyVcB U5WA== X-Gm-Message-State: ANhLgQ3JMUgiSAyBYZ65sExLKB2N9h13OzhtDnqMLDpZiM+TQBVYUyTT VBM4x6nzqth12atvf6CYt6VmGLojAgW2ESsBAlxjK1sWKObQnhzvOD+i2g38Y59VDgU6qkOoNIg oGAdjKzX8vZ/+0/szJK8dGSyJJbKfvZ8l1Vg3eTHOGg== X-Received: by 2002:a81:1c0a:: with SMTP id c10mr3094621ywc.142.1583358580153; Wed, 04 Mar 2020 13:49:40 -0800 (PST) X-Received: by 2002:a81:1c0a:: with SMTP id c10mr3094602ywc.142.1583358579744; Wed, 04 Mar 2020 13:49:39 -0800 (PST) Received: from localhost ([2605:a601:af9b:a120:d987:fd11:6482:bff3]) by smtp.gmail.com with ESMTPSA id d2sm5077945ywe.36.2020.03.04.13.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 13:49:38 -0800 (PST) Date: Wed, 4 Mar 2020 15:49:37 -0600 From: Seth Forshee To: Steven Rostedt Cc: Ingo Molnar , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] selftests/ftrace: Use printf instead of echo in kprobe syntax error tests Message-ID: <20200304214937.GA2347@ubuntu-x1> References: <20200304161435.23019-1-seth.forshee@canonical.com> <20200304155004.7dd033a3@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200304155004.7dd033a3@gandalf.local.home> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 04, 2020 at 03:50:04PM -0500, Steven Rostedt wrote: > On Wed, 4 Mar 2020 10:14:35 -0600 > Seth Forshee wrote: > > > --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc > > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc > > @@ -37,7 +37,7 @@ fi > > > > check_error 'p vfs_read ^$none_var' # BAD_VAR > > > > -check_error 'p vfs_read ^%none_reg' # BAD_REG_NAME > > +check_error 'p vfs_read ^%%none_reg' # BAD_REG_NAME > > check_error 'p vfs_read ^@12345678abcde' # BAD_MEM_ADDR > > check_error 'p vfs_read ^@+10' # FILE_ON_KPROBE > > > > @@ -80,7 +80,7 @@ check_error 'p vfs_read arg1=^' # NO_ARG_BODY > > # instruction boundary check is valid on x86 (at this moment) > > case $(uname -m) in > > x86_64|i[3456]86) > > - echo 'p vfs_read' > kprobe_events > > + printf 'p vfs_read' > kprobe_events > > if grep -q FTRACE ../kprobes/list ; then > > check_error 'p ^vfs_read+3' # BAD_INSN_BNDRY (only if function-tracer is enabled) > > fi > > @@ -89,13 +89,13 @@ esac > > > > # multiprobe errors > > if grep -q "Create/append/" README && grep -q "imm-value" README; then > > -echo 'p:kprobes/testevent _do_fork' > kprobe_events > > +printf 'p:kprobes/testevent _do_fork' > kprobe_events > > check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE > > -echo 'p:kprobes/testevent _do_fork abcd=\1' > kprobe_events > > -check_error 'p:kprobes/testevent _do_fork ^bcd=\1' # DIFF_ARG_TYPE > > -check_error 'p:kprobes/testevent _do_fork ^abcd=\1:u8' # DIFF_ARG_TYPE > > -check_error 'p:kprobes/testevent _do_fork ^abcd=\"foo"' # DIFF_ARG_TYPE > > -check_error '^p:kprobes/testevent _do_fork abcd=\1' # SAME_PROBE > > +printf 'p:kprobes/testevent _do_fork abcd=\\1' > kprobe_events > > +check_error 'p:kprobes/testevent _do_fork ^bcd=\\1' # DIFF_ARG_TYPE > > +check_error 'p:kprobes/testevent _do_fork ^abcd=\\1:u8' # DIFF_ARG_TYPE > > +check_error 'p:kprobes/testevent _do_fork ^abcd=\\"foo"'# DIFF_ARG_TYPE > > +check_error '^p:kprobes/testevent _do_fork abcd=\\1' # SAME_PROBE > > fi > > > > exit 0 > > > This change causes my tests to fail: > > ++ echo 'Test command: p vfs_read arg1="abcd' > Test command: p vfs_read arg1="abcd > ++ echo > ++ grep 'trace_kprobe: error:' -A 3 error_log > [61913.240093] trace_kprobe: error: Invalid fetch argument > Command: p vfs_read arg1="abcd > ^ > +++ tail -n 1 error_log > +++ wc -c > ++ N=29 > +++ expr 13 + 21 > ++ test 34 -eq 29 Ah, I did miss a couple of backslashes that need to be escaped there. The test passes for me without it though, so mabye printf behavior is less consistent than I thought. I'll send a v2, hopefully it will work better for you. Seth