Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp805287img; Thu, 28 Feb 2019 08:09:09 -0800 (PST) X-Google-Smtp-Source: APXvYqy99zQybD/hYcNdYYnP90l5NhhBwVn9KTURFYWn3IoI7mbquGcEqCu8dsLCp/JSy5YWA8xe X-Received: by 2002:a17:902:aa06:: with SMTP id be6mr106691plb.57.1551370149654; Thu, 28 Feb 2019 08:09:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551370149; cv=none; d=google.com; s=arc-20160816; b=KcAj2Nof/VqYW+OTZw3EPsT6bEWT7vIbgXggw/8tnDU70xm8ptNrFRE5aIiPnBgBiT DcsteK7QxsfSNgMSKNkxfFGRK4Gj3dp7ZHDOFZEpAbyFxIczrD7l7m/JcA759Z3hODCU it6pc8UevbMG19Aq4keVORJlMtBnDWrD0fYIwkWv63I9pO82mRSL2PEJ6Vu8LOWb/0F6 C2lcjDJfsrPWjTra+TJZI8S12uyTm7c7VQ2QE1b9fVvc8RTp8/+zc3WcwB6AUZdP20dR 3QQM9isrtO9PsehFlMUpJF8E1Y6Vbvw69PlXgJ909GLKTKB68zOommxCHFv4GGo+dwNX hM1g== 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:dkim-signature; bh=Xll0AyQ0mzClobnya1rwPbeeEBzlTPHo9MNemzn/4mg=; b=hravYDruPgc9NgTFbzBC4/e1iu1ihL7Cb7S3l3We3S3K1iLbtuUdTLnjy6pAfJZUPO e+XiJC5N3Ov/WYMwHaPaOkdv55fZ48ZZ8dcxXNQYQDf8orPJrRK8qaBW4XO9xod4SFG0 lUncuryQEEM16L3wDIEO5ZJDVnNciTM+ysWe6h7SgTvrc0fFQla5SsOG+EQUmt93eqNJ zTp+0XhSDm+exfTRo2ZxKhi9hjTqNMwSyW8c1WhW5+6NfCzoCODWNPDP98SN+cHGmDxX dnA26BouXRPB0CxFNdwCzf+Njh7YgwTLWflawXdkDcZjD4VlOJ95pFMhyF2LzkcRkNIP dTXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sYDc2tl5; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z192si17501645pgd.500.2019.02.28.08.08.53; Thu, 28 Feb 2019 08:09:09 -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; dkim=pass header.i=@kernel.org header.s=default header.b=sYDc2tl5; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731905AbfB1QFs (ORCPT + 99 others); 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