From patchwork Tue Aug 9 16:01:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 73565 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp557195qga; Tue, 9 Aug 2016 09:02:14 -0700 (PDT) X-Received: by 10.98.94.6 with SMTP id s6mr154894512pfb.31.1470758534020; Tue, 09 Aug 2016 09:02:14 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hb9si43222985pac.193.2016.08.09.09.02.13; Tue, 09 Aug 2016 09:02:14 -0700 (PDT) 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 S1752824AbcHIQB5 (ORCPT + 27 others); Tue, 9 Aug 2016 12:01:57 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:37008 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752395AbcHIQBx (ORCPT ); Tue, 9 Aug 2016 12:01:53 -0400 Received: from 191-247-233-20.3g.claro.net.br ([191.247.233.20] helo=jouet.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.85_2 #1 (Red Hat Linux)) id 1bX9TS-0002cE-55; Tue, 09 Aug 2016 16:01:50 +0000 Received: by jouet.infradead.org (Postfix, from userid 1000) id 9D8C0142B71; Tue, 9 Aug 2016 13:01:43 -0300 (BRT) From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Masami Hiramatsu , Alexei Starovoitov , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH 03/11] perf probe: Adjust map->reloc offset when finding kernel symbol from map Date: Tue, 9 Aug 2016 13:01:26 -0300 Message-Id: <1470758494-32127-4-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470758494-32127-1-git-send-email-acme@kernel.org> References: <1470758494-32127-1-git-send-email-acme@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masami Hiramatsu Adjust map->reloc offset for the unmapped address when finding alternative symbol address from map, because KASLR can relocate the kernel symbol address. The same adjustment has been done when finding appropriate kernel symbol address from map which was introduced by commit f90acac75713 ("perf probe: Find given address from offline dwarf") Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Masami Hiramatsu Cc: Alexei Starovoitov Cc: Wang Nan Link: http://lkml.kernel.org/r/20160806192948.e366f3fbc4b194de600f8326@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 953dc1ab2ed7..d5ccb656fd81 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -385,7 +385,7 @@ static int find_alternative_probe_point(struct debuginfo *dinfo, if (uprobes) address = sym->start; else - address = map->unmap_ip(map, sym->start); + address = map->unmap_ip(map, sym->start) - map->reloc; break; } if (!address) {