From patchwork Mon Feb 26 03:58:53 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: 206228 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1859988dyb; Sun, 25 Feb 2024 20:12:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXdqJc8VeE9JJ99ht2rs2dbjxgMaxQwdIycmU7MbFAQsXQTsFLRlRqkwKy7/1Dp6wYoD83BiGmjWjvCyG2vitJ8KTnZ6w== X-Google-Smtp-Source: AGHT+IGTitSHRfIKY4jZjfXNJtG4inJtzZIsa9Hsn0zkJspZLml4cCUUaTGQ3IgRq+EFaUBbmeZf X-Received: by 2002:a05:6402:5201:b0:565:a5f5:84d0 with SMTP id s1-20020a056402520100b00565a5f584d0mr3432541edd.22.1708920760286; Sun, 25 Feb 2024 20:12:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708920760; cv=pass; d=google.com; s=arc-20160816; b=sWvVUXfDej05mOTadql1H2BIymGAe7WZGHAKoQq4swwm1c4s8Lv4DZ3lr3Ndd4XRwb JoCxdQ7SLXO81G9yIoc5e5WZL0pxQcxLmyyDOfcrvJZXdJUOhxPgVlMaHoUqLyskmXBV OrXQqbjLdDkg4Pk3wasppfWcM+4sLGpVhyHQJLcnnsPvhNMc8AP1W7FUq/JTGG4sgGDw QCw2ZzdkLetdpA5XXad0Qpq6rTda2/+ybY8pjtcGfvms5mhRG3Gjb8XFjNEoxwlVNsFZ bUsSLRYqfUiEKQWQpXtYUuhHDmsjja3gdg1goOQ2amPGpnUjCDhcScvI2K4STZnrZQE5 HjDg== 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=NwXSIpMxMVXcjoaKpUWLu6NstcvJN7DtxHpbHak31hpw8JRhLyw6lAWJEL+tpzm94i YHxVqD0x2cujI9msaIreR4EEMiHp7BEvelvF1TZse7/wTzC0Ql0XQTwcbT7DOEWf+HBo 2FUtMce6vRCS+9s9ZbyJtCS3Wx4r77JvVDAfGTZP+UfUe+qEEGZminfj2j81XbN1MgQH 9kHGjXhqgmVWMEd0V44REjDjJ31TseBnVE39mcCSOucX0DlX1sCf01AI7a7qYhWZsspY VxOQQsUFXeZ06Fm0bK7j8HzjoMqCvpqGM9H5ScHoSh0XQwS8sg6leA4nxro4rba2y3su s0wg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uu4gI0sF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80509-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80509-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 19-20020a508753000000b005646879fe80si1665890edv.225.2024.02.25.20.12.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 20:12:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80509-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=uu4gI0sF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80509-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80509-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 E18151F25FE3 for ; Mon, 26 Feb 2024 04:03:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 033CD1CAB5; Mon, 26 Feb 2024 03:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uu4gI0sF" 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 598DD1CA85; Mon, 26 Feb 2024 03:58:58 +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=1708919938; cv=none; b=Bdjcgrtiho+tPYXtjR7bg1HMVV2f3UM6lbSdWlV16AxIaqdnnUEsj/NyP3NUpsoNag9K05NcjWDT8YQPZl7ggabvY8CmWmt71nw8OtFcpbu8tdsHHY+XjEmsA+mZu4O8v9P2Wg2A57SQd9LdXH25ZQbph5syE5Mby7p8w32Y3LQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708919938; c=relaxed/simple; bh=1MG502dBW5ZFZkOGMGA4VMms5Lg9q3jfUg4fYOgVv58=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=sBH3Gr2p+CKn5x3Fk46zdAbb7nKltnMhE+JoLQuvMsFBDpx5ywOP3uIZ0gGD7cSuRuhNA2Cr37xNHP/FIm+WX+p/I1l3JE21ldcV2V98nPVbKVpM+Pi3AGAzafqKREcQgmLjlTt6QmTzU+ywGtsvQS51NKOa8XaAuq+P75A7yWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uu4gI0sF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C9C8C433F1; Mon, 26 Feb 2024 03:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708919937; bh=1MG502dBW5ZFZkOGMGA4VMms5Lg9q3jfUg4fYOgVv58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uu4gI0sFM0+viQgCOBY+qx/gnkrQrkEJUs2cYPQ95TmIouJXMzORCyEB4U56cnXKC EKkp9JEjPGy9thEmDbrFwTj5X9SmWiMQF/Vzc9DtgNCw58E1pawpFZ1ddg/2mJwQPJ wL1cEsewUSISu4FMsWTc48vr5fEWk5U91Etc/VqfUEiTqBfse5QN+Qlq7mbf4XPPZl bDgrTNRmhC+h4WQ+ZSpyaqkoF/tZcSoXUdBZlwAyGPwwbU2GfUjRGikVAuEKGL50NL KiZi3RDjlwYrCsTi5EEiP2Jjw/u+MudV0nsjS9zjjWYg3c3LHFCd5m1CH/1wvOEeI/ MehYUiCqvIVyQ== 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 v2 6/7] selftests/ftrace: Add test cases for entry args at function exit Date: Mon, 26 Feb 2024 12:58:53 +0900 Message-Id: <170891993315.609861.477644237329143406.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <170891987362.609861.6767830614537418260.stgit@devnote2> References: <170891987362.609861.6767830614537418260.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: 1791933294973127034 X-GMAIL-MSGID: 1791933294973127034 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/' `