From patchwork Mon Mar 4 03:41:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 209374 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1200880dyc; Sun, 3 Mar 2024 19:41:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXqduQYvRtTmaW+2fbPoPeTcpXivFTVpn1XFGnGaNRC+6pa1/OS7uCzDmsZWBruE8Qn2aeM4JqocljtzRl/yT6U3uN5vw== X-Google-Smtp-Source: AGHT+IEdM7+/QVCRvpDcq/A77an6j8mQN4zh+hZVq1cRwLZj/2t1jbE5XlDXxFoh0XvFzGsmIYL3 X-Received: by 2002:a50:d60f:0:b0:567:824:e36c with SMTP id x15-20020a50d60f000000b005670824e36cmr3814606edi.14.1709523719588; Sun, 03 Mar 2024 19:41:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709523719; cv=pass; d=google.com; s=arc-20160816; b=HBXLHkvTzB0WwxRAmfc9azPC6GSOBfAewSH7+hPzqAWbuBVItUPSkmF2SqwsR4U2Ln 1TkYbmLWn5d+YGx+bMPDNqi7ptRGOxYVk4MzVrtXwTe4CKe5ON0FEycwmJcHvdppbRQh G/diOpIQJqJPhZUIy6Xhbw1MC8KUyaQCVvxqxyh1mOAfHJT3dNVTTepYQLfFT8qh2LFp yxjhrcsX1UkwEaxdCMiwWYpH9jjCZlb9N4tJnegTb8GLoL+/eySNwcIzkWpl7MepC1rF E3jmyr02BBDHYFVdYWvWFt1ytRGjTzYqvAvjYEJGOXgBl1fSsbLKmF3laGlPQRNK76MH Rh1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=FqGcgvCug/b37eIUszXIySScYCy7NP+ElgOoZyfJWG0=; fh=+uEoxECwu+GZPXA+yzsV/ZJCsf7WyFzcH+9RxOmv8OU=; b=lbxnBK/y1k1ZLFiUGt0m0L0Ja/EAHFQN0VGZU/sLB096jZm+AhbzpryVXpJUtN84j2 j865Gmpn1DC+pkW6qzMSYpHGjcR5XDm37R5vnVk4Dg7vq/7ckbtu/D3wPnjfw95cTyW7 QVZVwlg5aR5DEGVg5XcS7d27D72nr9MHtt6G7Up2ioseWj8i772zBgolP7Z5i7PCurDQ hdFmAfFLpOO3C9nVm3dw5D5o2fzWUDZpl46yAm4BmHUCmX/FLwix+TWatCjLQtH4UHmg fp8Q2HWwsW2w5sZWJXWS0voQg9jKvJMAGglrtmzvzYzKRrzF8GZlmsoff4acLbzzUhDH Lc5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iJI13pja; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90025-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90025-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id di4-20020a056402318400b005671c547bddsi1234189edb.525.2024.03.03.19.41.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 19:41:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90025-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iJI13pja; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90025-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90025-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 24AF61F2134F for ; Mon, 4 Mar 2024 03:41:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14F7BC148; Mon, 4 Mar 2024 03:41:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iJI13pja" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74D2DBA3F; Mon, 4 Mar 2024 03:41:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709523670; cv=none; b=PfXluefsJOsibcSfcNqzqxehoGQVjgKHd/oUhtE5Ut5L71bitjj9jMryRkNYMNZp0udDngtEaq9VZXZBImnE6jQIcL9KBUkjimBvwAIb12bdTg9GSnIERCsEzsjzQ5D8SVjfXThmavuQvBm3MUJ+RM+a23y2hfqpgkk+TerxzOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709523670; c=relaxed/simple; bh=1MG502dBW5ZFZkOGMGA4VMms5Lg9q3jfUg4fYOgVv58=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=m7KuUJSXElrSPbd0lVx+cU2c1neS+3rfJx9+Ozr7Z9RDthWnb0RjJZv4P7mFRG7cyn280OTIhfQ42UsvpSkVuIJJxOWedYTPFIsEocIvkzwD/cn8FRMHGvKfzJ7h7SY9q7xprU4lmWqr7Wj2VKkxLqWP50x7v7CnNOxPxxgtspc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iJI13pja; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89E4AC433C7; Mon, 4 Mar 2024 03:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709523670; bh=1MG502dBW5ZFZkOGMGA4VMms5Lg9q3jfUg4fYOgVv58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJI13pjan5FUMoibjtrvdcfTljbNLUhUSCrCjdf1lCfCbaUlq5bQEiMGiDZrqMVWV DFxLtGGzL/8Ac9mb8ylzh0LSA7PibAd/NLXOKdqVmi/3lJQ2l6OFNe1CzfGVYv1dN4 mhnCCqliAYJ+OFf8nN56ep4EizxlRnRAuflG+Xav4XDFCOFxCBTV+VaxB6sJTCL95G 1+QjQQunf+LXndKMQjSnntPki9KeE812L8eljM7E2rQNLWdpMwhy7O93jbldc0YSt5 TNdOJyf39ojdGAV58dnVI8zBfEzAj9ZU5MaQmTNpJp12ILXyqDbC9VTcT+tDYrFcfl oAuOjE2lHw7eA== From: "Masami Hiramatsu (Google)" To: Steven Rostedt , Jiri Olsa Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mhiramat@kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 7/8] selftests/ftrace: Add test cases for entry args at function exit Date: Mon, 4 Mar 2024 12:41:05 +0900 Message-Id: <170952366504.229804.11605173085475141091.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <170952359657.229804.14867636035660590574.stgit@devnote2> References: <170952359657.229804.14867636035660590574.stgit@devnote2> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792565543643560020 X-GMAIL-MSGID: 1792565543643560020 From: Masami Hiramatsu (Google) Add kretprobe and function exit probe test cases for checking whether those can access entry arguments at function exit correctly. Signed-off-by: Masami Hiramatsu (Google) --- .../ftrace/test.d/dynevent/fprobe_entry_arg.tc | 18 ++++++++++++++++++ .../ftrace/test.d/kprobe/kretprobe_entry_arg.tc | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/fprobe_entry_arg.tc create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_entry_arg.tc diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_entry_arg.tc b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_entry_arg.tc new file mode 100644 index 000000000000..d183b8a8ecf8 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_entry_arg.tc @@ -0,0 +1,18 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Function return probe entry argument access +# requires: dynamic_events 'f[:[/][]] ':README 'kernel return probes support:':README + +echo 'f:tests/myevent1 vfs_open arg=$arg1' >> dynamic_events +echo 'f:tests/myevent2 vfs_open%return arg=$arg1' >> dynamic_events + +echo 1 > events/tests/enable + +echo > trace +cat trace > /dev/null + +function streq() { + test $1 = $2 +} + +streq `grep -A 1 -m 1 myevent1 trace | sed -r 's/^.*(arg=.*)/\1/' ` diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_entry_arg.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_entry_arg.tc new file mode 100644 index 000000000000..53b82f36a1d0 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_entry_arg.tc @@ -0,0 +1,18 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kretprobe entry argument access +# requires: kprobe_events 'kernel return probes support:':README + +echo 'p:myevent1 vfs_open arg=$arg1' >> kprobe_events +echo 'r:myevent2 vfs_open arg=$arg1' >> kprobe_events + +echo 1 > events/kprobes/enable + +echo > trace +cat trace > /dev/null + +function streq() { + test $1 = $2 +} + +streq `grep -A 1 -m 1 myevent1 trace | sed -r 's/^.*(arg=.*)/\1/' `