Received: by 10.213.65.68 with SMTP id h4csp337915imn; Sat, 17 Mar 2018 05:53:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELtFBL5HYZs4C6HbCSaDz5YmB5woyQKmaG9CYOVFyEW4bw2yeFBStOd/gME++Ovf9csFATPh X-Received: by 10.99.97.203 with SMTP id v194mr4262393pgb.373.1521291209182; Sat, 17 Mar 2018 05:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521291209; cv=none; d=google.com; s=arc-20160816; b=QKoTZDlEyLZoYAjwv1FmFqDTMoaNatSU04aEaOLrXWynoUveQiHBCUIrKRzad83LZp mcxP3j0tgvTYK8/o/QsArDQBhnTNPhp8PnUkVJAoCvJ1PxJ/TW3ziviCNO8xM1tNfLYb UYp2xt1FpsRWwqOuTrYU+H8aekHIGcvCa6Zd0Q/Ve37jPGwpV+bfEKAD8uIsk8etl5R9 j9djdO+s0ZEP3qSPnj1x0qyB5SZBhau10FL3EycjlcPABEZK1sYW40pHivcU0TriKsLe cEBMy+HFsGlQ48nszMvjQ/sy1FFxcjvI5L1BYdPlISyUAaMe03ZTsiOXuovXuWL6vqAQ bapg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dmarc-filter:arc-authentication-results; bh=IjER91/ziVZNGxiqyE9AIgi48bpBn1BGWI1ZeYySogo=; b=ogUUj4aTp0drM0+ihw227vt974cZjFF2UYKklmfAdJy4PAajMLhkz48z7H+H/x/p3v ggR21t6ZtGy28jTLlOxYvi+oKFsjiobTp7rhn7YRSsHVh9REFIrrysFCIFVaw25Xwlhi juhFvWjlsIaeKRv7GW9h5VJR/h5Ib//tnfYACdhiy5mLRU09fgCR1BrlFzMPOIMgtBcW 4QSM4cKzrio/zhR4MfHGPn4s7kNoTMJQVikE/69/qsgxRjV0k4PTBIkekcEmfnD7MzkJ 4YqJQlPgOLAT1LTfNQIPK/fpj0cMoOrNlesv5J/ixt6/2FQgtprH4B7ViFez9dlKpaQT 0lIw== 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 e4si2034013pgp.431.2018.03.17.05.53.14; Sat, 17 Mar 2018 05:53:29 -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 S1753323AbeCQMuz (ORCPT + 99 others); Sat, 17 Mar 2018 08:50:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:52382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752340AbeCQMux (ORCPT ); Sat, 17 Mar 2018 08:50:53 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 7997121720; Sat, 17 Mar 2018 12:50:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7997121720 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: Steven Rostedt , linux-kernel@vger.kernel.org Cc: mhiramat@kernel.org, Ingo Molnar , Namhyung Kim , Tom Zanussi , Arnaldo Carvalho de Melo , linux-trace-users@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah@kernel.org, Ravi Bangoria Subject: [PATCH v6 17/21] selftests: ftrace: Add a testcase for symbol type Date: Sat, 17 Mar 2018 21:50:11 +0900 Message-Id: <152129101139.31874.4310293141969492860.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <152129024033.31874.15800253385376959274.stgit@devbox> References: <152129024033.31874.15800253385376959274.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a testcase for symbol type with kprobe event. This tests good/bad syntax combinations and also the traced data. If the kernel doesn't support symbol type, it skips the test as UNSUPPORTED. Signed-off-by: Masami Hiramatsu --- Changes in v3: - Use IP/PC register to test the symbol type --- .../ftrace/test.d/kprobe/kprobe_args_symbol.tc | 77 ++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc new file mode 100644 index 000000000000..20a8664a838b --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc @@ -0,0 +1,77 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe event argument symbol type + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +grep -qe "type:.* symbol" README || exit_unsupported # version issue + +echo 0 > events/enable +echo > kprobe_events + +PROBEFUNC="vfs_read" +GOODREG= +BADREG= +REG= +GOODSYM="_sdata" +if ! grep -qw ${GOODSYM} /proc/kallsyms ; then + GOODSYM=$PROBEFUNC +fi + +case `uname -m` in +x86_64|i[3456]86) + GOODREG=%ax + BADREG=%ex + REG=%ip +;; +aarch64) + GOODREG=%x0 + BADREG=%ax + REG=%pc +;; +arm*) + GOODREG=%r0 + BADREG=%ax + REG=%pc +;; +*) + echo "Please implement other architecture here" + exit_untested +esac + +test_goodarg() # Good-args +{ + while [ "$1" ]; do + echo "p ${PROBEFUNC} $1" > kprobe_events + shift 1 + done; +} + +test_badarg() # Bad-args +{ + while [ "$1" ]; do + ! echo "p ${PROBEFUNC} $1" > kprobe_events + shift 1 + done; +} + +echo > kprobe_events + +: "Symbol type" +test_goodarg "${GOODREG}:symbol" "@${GOODSYM}:symbol" "@${GOODSYM}+10:symbol" \ + "\$stack0:symbol" "+0(\$stack):symbol" +test_badarg "\$comm:symbol" + +: "Retval with symbol type" +echo "r ${PROBEFUNC} \$retval:symbol" > kprobe_events + +echo > kprobe_events + +: "Test get symbol" +echo "p:testprobe create_trace_kprobe ${REG}:symbol" > kprobe_events +echo 1 > events/kprobes/testprobe/enable +! echo test >> kprobe_events +tail -n 1 trace | grep -q "arg1=create_trace_kprobe" + +echo 0 > events/enable +echo > kprobe_events