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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,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 995F6C43381 for ; Thu, 28 Feb 2019 16:05:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6831C218C3 for ; Thu, 28 Feb 2019 16:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551369950; bh=79CVAXaCT5ykATNBoO+rgDRRbQTD1tXlrEyJUvvyVVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QrwFxMRbwtfp0epudyMeIOClMnsaASL5pWjrH5HuwPWTXVEx92EOP7paveLFRPtgH ZLaJK1m2lIwN/4IhVTX2V59RU4c+9CIPiZy+m+4OYiYkPru3Yju5lPqOrAMEu+G5fK c4XSKwiLHhYVcs1JE5/KfCp8xqoiYmZbwL2NjW7o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732009AbfB1QFs (ORCPT ); Thu, 28 Feb 2019 11:05:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:51106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727880AbfB1QFs (ORCPT ); Thu, 28 Feb 2019 11:05:48 -0500 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 799702184A; Thu, 28 Feb 2019 16:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551369947; bh=79CVAXaCT5ykATNBoO+rgDRRbQTD1tXlrEyJUvvyVVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sYDc2tl5yA2fKYTEHg4N6KoFxIW7shIwhZVJFHe/ce4wcwUlL3na4QNe2SrBL4m+c Y+THHJtHyxH3eTNzyLHnyFs4dmdBBSXxl4PDriGW81Vg9yDGRp7DaZeiiDNaRkjB5Z ss3ArPL7T9tYq0GPq/2sL6b4sI/wxMBYJo2pdiAI= From: Masami Hiramatsu To: Steven Rostedt , Linus Torvalds , Shuah Khan 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 , Peter Zijlstra , Joel Fernandes , yhs@fb.com Subject: [PATCH v5 6/6] selftests/ftrace: Add user-memory access syntax testcase Date: Fri, 1 Mar 2019 01:05:23 +0900 Message-Id: <155136992362.2968.10825848432240513284.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <155136974478.2968.3105123100519786079.stgit@devbox> References: <155136974478.2968.3105123100519786079.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 user-memory access syntax testcase which checks new user-memory access syntax and ustring type. Signed-off-by: Masami Hiramatsu --- .../ftrace/test.d/kprobe/kprobe_args_user.tc | 31 ++++++++++++++++++++ 1 file changed, 31 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..996da9d1eec5 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc @@ -0,0 +1,31 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe event user-memory access + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +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