From patchwork Mon Jan 22 07:40:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 189937 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2417031dyb; Sun, 21 Jan 2024 23:39:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfuZ8bGF7IGql6YYrrxGOtRHjFLWnkwjtjpDGUrwoRtQn956cvXGxJtSArNvVpHIsNmmxo X-Received: by 2002:a05:6358:9386:b0:173:203:c5c1 with SMTP id h6-20020a056358938600b001730203c5c1mr1457329rwb.62.1705909178633; Sun, 21 Jan 2024 23:39:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705909178; cv=pass; d=google.com; s=arc-20160816; b=VGlyaNmFxaG2T2RORMz0sXJltXxqfCX2un+qRJ1Z6RXcMGUu/L5QFd1xE4wj7DQc3E nqbypajupw14+QB7H0jCpxUpSvoZ/aAsVyXTUmsq+12045XuNN9i7SEhkk1Gvm8iS5Ue gr0M2TMHsAGGYChulnqVHM4nJHpJle9eWHUQ7R7rpflY0UHcTNViLtgFYtqnE9wnnEXq TwGoSvBXstoWYgrGybYZj4rmcTcjVcXhGUJuSNnrAQRhrEx7WEUip0KfYy7Wwp+jV9mo bkExXJ4ebvLHCz+lopjeBYfjt4XRf6mImpOD/bmqNz8XEPYGsZfnntZOdomBsqh42gTM dAHQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=m8LjomVwrXT4T62mIm13eH431OWptUKNTv39dGu0u2Y=; fh=Us/DORbzHj5XmgnBeJW+VlCBdo2pSXKHAejHonylCvY=; b=c1oJcYZBeZ/YGTvjHnBjRY6j2+GkeDyvM0OKA01BsekkwewDVQTHaBw1BHCMVKGZlP kUOZM1h88Z2GlHUCJuO12JtBtfkNPnHqBNryh0OVJGDA15GK28gJfKvK5Fx2/5S8rHhh ukuj8M6e6T9hGhYIB7Bql9erq70c75bp5Uo5j6Ukpp4haJWBM/6P2Jj/skbxYIYZxuCP hR674KTK+J+zp95+J20+c10/T/V/LowPIn2CSxT4ybwAU/TBbnZl6uWfaW/jAukxqN4b f92Cd0XknmSFQ7chdmVgPgL+CmGSNZ4UoUbHrllFN35V8vWVxO05oszGid8gdXAgJLm+ Jp+g== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-32438-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32438-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id fb18-20020a056a002d9200b006dbce4a61e0si3925363pfb.387.2024.01.21.23.39.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 23:39:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32438-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-32438-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32438-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 46ED6B233AF for ; Mon, 22 Jan 2024 07:39:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E8A818AF1; Mon, 22 Jan 2024 07:38:43 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 9BBDE17BD1; Mon, 22 Jan 2024 07:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909121; cv=none; b=mrnDj/orcNUxuyXyEcY1m91zBs2Q93Z0nHXeQqo+J4FsGUTfTe8YgJLhMwynnrT5Uyx/C+JhOiRpOv7Q7ge1Yrc4/ZbLhSYAdt8qfdWy1m3Bp9Z5n+MfggCBKxLzxk5Gd2apwqCOBJ200WCUzSIM4nruFdr8byQCwVHtawfXZng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909121; c=relaxed/simple; bh=R+0EqFIiGaBBpGCVcH0I4eW51HMRsop2Clw0T8UHkPY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G0dyfKuvKCnr8dr6e/eaJFAbxPO9sNiFgwdSLykWVsbBalLpbtJ/WYDr92oIGk50VfdKqHnDQSWlULQUkYlXi2pLb06Px1mYmLUItYwXUbIhmriVG4omiu4wPHi4/tdULIbhCaPRwVoLGRkevluTieVXqhvELKaEqnNloVCcgSA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TJMRY6CBkz1FJcT; Mon, 22 Jan 2024 15:34:17 +0800 (CST) Received: from canpemm500010.china.huawei.com (unknown [7.192.105.118]) by mail.maildlp.com (Postfix) with ESMTPS id 24FAD1A0173; Mon, 22 Jan 2024 15:38:22 +0800 (CST) Received: from huawei.com (10.175.127.227) by canpemm500010.china.huawei.com (7.192.105.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 22 Jan 2024 15:37:39 +0800 From: Ye Bin To: , , , CC: , Subject: [PATCH v2 3/7] tracing/probes: support '%pd' type for print struct dentry's name Date: Mon, 22 Jan 2024 15:40:11 +0800 Message-ID: <20240122074015.4042575-4-yebin10@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240122074015.4042575-1-yebin10@huawei.com> References: <20240122074015.4042575-1-yebin10@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500010.china.huawei.com (7.192.105.118) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788775422772254861 X-GMAIL-MSGID: 1788775422772254861 Similar to '%pd' for printk, use '%pd' for print struct dentry's name. Signed-off-by: Ye Bin --- kernel/trace/trace_kprobe.c | 6 ++++++ kernel/trace/trace_probe.h | 1 + 2 files changed, 7 insertions(+) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index c4c6e0e0068b..00b74530fbad 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -779,6 +779,7 @@ static int __trace_kprobe_create(int argc, const char *argv[]) char buf[MAX_EVENT_NAME_LEN]; char gbuf[MAX_EVENT_NAME_LEN]; char abuf[MAX_BTF_ARGS_LEN]; + char dbuf[MAX_DENTRY_ARGS_LEN]; struct traceprobe_parse_context ctx = { .flags = TPARG_FL_KERNEL }; switch (argv[0][0]) { @@ -930,6 +931,11 @@ static int __trace_kprobe_create(int argc, const char *argv[]) argv = new_argv; } + ret = traceprobe_expand_dentry_args(argc, argv, dbuf, + MAX_DENTRY_ARGS_LEN); + if (ret) + goto out; + /* setup a probe */ tk = alloc_trace_kprobe(group, event, addr, symbol, offset, maxactive, argc, is_return); diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 553371a4e0b1..d9c053824975 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -34,6 +34,7 @@ #define MAX_ARRAY_LEN 64 #define MAX_ARG_NAME_LEN 32 #define MAX_BTF_ARGS_LEN 128 +#define MAX_DENTRY_ARGS_LEN 256 #define MAX_STRING_SIZE PATH_MAX #define MAX_ARG_BUF_LEN (MAX_TRACE_ARGS * MAX_ARG_NAME_LEN)