From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1D73C04A6B for ; Wed, 8 May 2019 13:32:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73A21204FD for ; Wed, 8 May 2019 13:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557322377; bh=Q2wrxlPrXLcFkDHNhcUzdjdBeRuKkQt34AEOPrdQUDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=atT0MuesK8Lv2t9Eek2Y0Rq7vQhjwcn08DiIxuegdr1U3hNr5AhfJyt3cYvA2ONk2 OW8D3RbT/EIi5JBZZny3pJQtBC8v+M7OLCu3p95in9PXRGwBx2kxU5LISm6RvWr6E9 NiX3nHyyjjEgztHgOCE/kb1+7mjlPxPR/VYxiCzo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727912AbfEHNc4 (ORCPT ); Wed, 8 May 2019 09:32:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:51444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725778AbfEHNcz (ORCPT ); Wed, 8 May 2019 09:32:55 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9899A21530; Wed, 8 May 2019 13:32:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557322375; bh=Q2wrxlPrXLcFkDHNhcUzdjdBeRuKkQt34AEOPrdQUDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jr+c3X9rASgpI35Qdpxy67TymBhuzxVhPo1ifFKaEqs9bpCvtsqHxuYeHgnErbt/c 0sS7w3Vo37OUWuLbwcY0G6S8EB2lXldUGH4y6pGzf+B2+/n+qojJv/7I2PxwEFZeQh 6oiX61moHUSUE3FkizcWLsno6c4brT0qarwBasZM= From: Masami Hiramatsu To: Steven Rostedt , Linus Torvalds , Shuah Khan , Arnaldo Carvalho de Melo , Peter Zijlstra Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Ingo Molnar , Andrew Morton , Changbin Du , Jann Horn , Kees Cook , Andy Lutomirski , Alexei Starovoitov , Nadav Amit , Joel Fernandes , yhs@fb.com Subject: [PATCH v7 5/6] selftests/ftrace: Add user-memory access syntax testcase Date: Wed, 8 May 2019 22:32:49 +0900 Message-Id: <155732236945.12756.14753216541571057263.stgit@devnote2> X-Mailer: git-send-email 2.17.1 In-Reply-To: <155732230159.12756.15040196512285621636.stgit@devnote2> References: <155732230159.12756.15040196512285621636.stgit@devnote2> 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 user-memory access syntax testcase which checks new user-memory access syntax and ustring type. Signed-off-by: Masami Hiramatsu --- Changes in v6: - Add $argN availability check --- .../ftrace/test.d/kprobe/kprobe_args_user.tc | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc new file mode 100644 index 000000000000..0f60087583d8 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc @@ -0,0 +1,32 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe event user-memory access + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +grep -q '\$arg' README || exit_unresolved # depends on arch +grep -A10 "fetcharg:" README | grep -q 'ustring' || exit_unsupported +grep -A10 "fetcharg:" README | grep -q '\[u\]' || exit_unsupported + +:;: "user-memory access syntax and ustring working on user memory";: +echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \ + > kprobe_events + +grep myevent kprobe_events | \ + grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string' +echo 1 > events/kprobes/myevent/enable +echo > /dev/null +echo 0 > events/kprobes/myevent/enable + +grep myevent trace | grep -q 'path="/dev/null" path2="/dev/null"' + +:;: "user-memory access syntax and ustring not working with kernel memory";: +echo 'p:myevent vfs_symlink path=+0($arg3):ustring path2=+u0($arg3):string' \ + > kprobe_events +echo 1 > events/kprobes/myevent/enable +ln -s foo $TMPDIR/bar +echo 0 > events/kprobes/myevent/enable + +grep myevent trace | grep -q 'path=(fault) path2=(fault)' + +exit 0