Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1609878lqg; Sun, 3 Mar 2024 19:41:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU8JNGFh7aMoCAb5ncrMWah+pVQHK7065tI/7qzn8EH0/KEPU9tFR0ZW6p8T4tXLYhP09xLZOWT0zRjbQBb8XvNKZ71aIa4Qrtwlu9fBQ== X-Google-Smtp-Source: AGHT+IFaktOyX9YX7K3UoqYktEtbBrliZ3v0AnKZbPSFtctZeHnLod+NYfnJWNTeI+aLvz9hXw/L X-Received: by 2002:a05:6214:908:b0:690:68a:a141 with SMTP id dj8-20020a056214090800b00690068aa141mr12378442qvb.24.1709523711666; Sun, 03 Mar 2024 19:41:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709523711; cv=pass; d=google.com; s=arc-20160816; b=BhBJrQAy+23WtUANlssyHsyigBRa2gbIWUa7D24wRI+T1A3WvfdFgZ3Zw90+YDOxHq S7WjLVwI2rcodroHeZS2uFfcknA3WsPmNINUR90SZB3ZuOvcfpdk8HKDvZU7ib+jDfKJ JVJb/tFXMA9+jzaAkCUen10n9lAaL2bafrM1uQn2vFWDNOsvEJYBhmd8ZFBdyeJUhDHD ITmVqhbiu3u8xzhkRORHNt821H0p5ZJ7QMWz3C1Nz7X+uc0miu+czWzE0Opfeqp7qLN+ rWjEUDSLiqzfcNrBkGkCerxfdWJRBTp3G6LLCWHKXWnxd7fvcShR4i3Eld58v8FRQT5y 3WQg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90025-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j5-20020a05621419c500b0068fcc76644bsi8978101qvc.99.2024.03.03.19.41.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 19:41:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90025-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90025-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 52E1D1C20A93 for ; Mon, 4 Mar 2024 03:41:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 546E68F61; Mon, 4 Mar 2024 03:41:11 +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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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/' `