Received: by 10.223.176.46 with SMTP id f43csp1675948wra; Wed, 24 Jan 2018 21:29:42 -0800 (PST) X-Google-Smtp-Source: AH8x227126Bh+vWHD0YSp8NlMGeM5StIPbi6Y8uzxEFtI866tnil55nklys46R7AWOE7Ix3xayjm X-Received: by 2002:a17:902:4083:: with SMTP id c3-v6mr7749384pld.90.1516858182650; Wed, 24 Jan 2018 21:29:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516858182; cv=none; d=google.com; s=arc-20160816; b=m6AyQTq5QzEHeoh3++5K6X8igPIPznXjnyzK1VF7kUq4qn6wrWrpBhv9u5biWfDsoR +LJF4pHMIJSHE8RUacttGhxtBmGRFt+kKAHOktfNVrZAIWL2T3ZdH1Sp/VGv3r9P4fOE +zAPzFMYM10pWL8DOWd6vW+Fq8E2ndg/tW+YAvQhZIp82GszyQDrJgvwqKrfUO9cwNDh h0cfG06ayDxzMG/jsmluc0JTP6X9hPxO3Rz7sfXOjw7yfCOX0FH6B+pZI9HNpAHnvBof 2IDGkWa77DgODwh1pSJ5L4PQL+CUb1WKhnWZltplQoQo8IdaVgbj20hdaVywZYB1g7K6 RjrA== 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:dmarc-filter:arc-authentication-results; bh=a4NA8mCyE9ONUvoAJKI3IKWCeHHhGmaX95EVZnFq5I8=; b=1FCR9hqalNMNJg4UaGlOlShw4UY2tWgaMlUPEPwkn6roOI+4oon2miXWpiqdfVnLAP 8ESZkLkLXp6azwSCHMAK374PBia2lsORqddnhgknNeQaNvmHCmUzyNCnFnsx4owF/wMg 14ouqKn0/DufuEPLtqrwLl/VGHtfTnkHHsIX3ZHc98VL9R/oLKtd6DoPTWdtwZYBvGDl RbrcKvb9StyEBI3aCtFDKa56rg9EHSwyEk1fe4S1UiR4C2U7jo1dItHpHPPNgrMuDu6M dJdBLEoxy02xFkVdPTQFnWCJ7Ei6P4jDiEm1IrkIXVxVYTJMd9VKFHSZBjjaF5FJskfs bihQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20si1094282pgc.682.2018.01.24.21.29.28; Wed, 24 Jan 2018 21:29:42 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751218AbeAYF17 (ORCPT + 99 others); Thu, 25 Jan 2018 00:27:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:41936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751154AbeAYF15 (ORCPT ); Thu, 25 Jan 2018 00:27:57 -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 0CFBF20856; Thu, 25 Jan 2018 05:27:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CFBF20856 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Masami Hiramatsu , Ananth N Mavinakayanahalli , Anil S Keshavamurthy , "David S . Miller" , Jon Medhurst , Will Deacon , Arnd Bergmann , David Howells , Heiko Carstens , "Tobin C . Harding" , Linus Torvalds Subject: [PATCH 2/8] kprobes: Show address of kprobes if kallsyms does Date: Thu, 25 Jan 2018 14:27:33 +0900 Message-Id: <151685805305.3099.10341850491509023684.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <151685799071.3099.10383062804474021403.stgit@devbox> References: <151685799071.3099.10383062804474021403.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 Show probed address in debugfs kprobe list file as same as kallsyms does. This information is used for checking kprobes are placed in the expected address. So it should be able to compared with address in kallsyms. Signed-off-by: Masami Hiramatsu --- kernel/kprobes.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index cb15991ba676..a5f13e379ae1 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -2281,6 +2281,7 @@ static void report_probe(struct seq_file *pi, struct kprobe *p, const char *sym, int offset, char *modname, struct kprobe *pp) { char *kprobe_type; + void *addr = p->addr; if (p->pre_handler == pre_handler_kretprobe) kprobe_type = "r"; @@ -2289,13 +2290,16 @@ static void report_probe(struct seq_file *pi, struct kprobe *p, else kprobe_type = "k"; + if (!kallsyms_show_value()) + addr = NULL; + if (sym) - seq_printf(pi, "%p %s %s+0x%x %s ", - p->addr, kprobe_type, sym, offset, + seq_printf(pi, "%px %s %s+0x%x %s ", + addr, kprobe_type, sym, offset, (modname ? modname : " ")); - else - seq_printf(pi, "%p %s %p ", - p->addr, kprobe_type, p->addr); + else /* try to use %pS */ + seq_printf(pi, "%px %s %pS ", + addr, kprobe_type, p->addr); if (!pp) pp = p;