Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1221947imm; Tue, 5 Jun 2018 10:55:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKBqEL6kB76sd/o1sUcsWJC0uPpHR+S7sf7Y8XOQGjfFQzx9KPqTsisy0JpxjjDnVjaA024 X-Received: by 2002:a17:902:14cb:: with SMTP id y11-v6mr26838149plg.229.1528221339325; Tue, 05 Jun 2018 10:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528221339; cv=none; d=google.com; s=arc-20160816; b=Ne7GO9wvIsKnwCgZoZ3El3AkAH9Znz2uroGJZdCSUdXXhvuwONV/8MLitDOLCA6/j2 eGezXVIdaICa2yEZ9oBkyN7+FBNkEoU1jvWvGpLIz2UWH50S047wCaPWCv/SeiTq05c8 8ami4TWBYmVghVDUQs0ojx1I+ifSFmR/BrkcRNdOXeJ3zhFfq4QVuC81u0soS+kegSyN 9HojLZyP4HAxqMsXu/EMSVCn8vYbgtnFAnozSByj3EmaMRbYGv1aoSrvmebPpfBmDwy2 4aLyPpIy7zXRcIKwwkAT2kWMW165BB+JTVsm8FX0RZblKjEeVGu8xRreLiyjaR0dxSFP jNYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=BaX+N1dbLfMRqdmOJygDsoY3OaUiMQxZ3kCFjRMFN04=; b=R9RIKhv/t0mYo41QJcURIPxMhiI1/4q4ojy/H2F65nFnqFnaWQror/B2b2IllluP7K MRzSbdAMiwal78lyYs9T1S9CVo3QBD/IEert65cf3LBbE467nO9hscyLdK+em4cvt39B wV4a1Fh5vnbMmikqupd/29jGxOmbijuXTTSvJTSU0UqPyH6PcbA5JLazSM2G1AY5G9pF hL/6cl5pRjlAB1r9n14V3/+7ZDjfvM/xB5lF+/Hj/8Bhktwomlf/pEJ+7hsPMikMVk9X EykqnQ1S2ARX1SNzN3IKFzRc9Jls3x2CJfRL4H0YW5UgJUocu9TFO5KA19jYqdfP1hpn 46mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ksGTwsbg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u191-v6si23940368pgd.667.2018.06.05.10.55.25; Tue, 05 Jun 2018 10:55:39 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ksGTwsbg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753038AbeFERwm (ORCPT + 99 others); Tue, 5 Jun 2018 13:52:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:46656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752995AbeFERwi (ORCPT ); Tue, 5 Jun 2018 13:52:38 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (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 3B73A20874; Tue, 5 Jun 2018 17:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528221158; bh=N+V5s/mE/mf3AfAAdvMFu3W1aNRUdNXLGu/A21vUm9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ksGTwsbgIkSZyZFW7YQjkW0Vqu0J04fQZKh+U8DMU8CBOGUo97PqmzGAjVKMa54/B ciFmVaezrfXeF0uySugNiCYmAu1/2WS/bG3rr5E5BZXTeJfo90eYNfUMVNqX/hEGLV 2Zbo1XheWhYV+P8nRS7AeyqVTbu9MtxsyZmhDeNo= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 40/46] perf map: Consider PTI entry trampolines in rip_2objdump() Date: Tue, 5 Jun 2018 14:50:24 -0300 Message-Id: <20180605175030.32549-41-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180605175030.32549-1-acme@kernel.org> References: <20180605175030.32549-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adrian Hunter perf tools uses map__rip_2objdump() to calculate objdump virtual addresses. map__rip_2objdump() needs to be amended to deal with PTI entry trampolines. Signed-off-by: Adrian Hunter Reported-by: Arnaldo Carvalho de Melo Tested-by: Arnaldo Carvalho de Melo Cc: Jiri Olsa Link: http://lkml.kernel.org/r/1528183800-21577-1-git-send-email-adrian.hunter@intel.com [ split from a larger patch ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/map.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 92abc8e248c5..89ac5b5dc218 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -449,6 +449,20 @@ int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix, */ u64 map__rip_2objdump(struct map *map, u64 rip) { + struct kmap *kmap = __map__kmap(map); + + /* + * vmlinux does not have program headers for PTI entry trampolines and + * kcore may not either. However the trampoline object code is on the + * main kernel map, so just use that instead. + */ + if (kmap && is_entry_trampoline(kmap->name) && kmap->kmaps && kmap->kmaps->machine) { + struct map *kernel_map = machine__kernel_map(kmap->kmaps->machine); + + if (kernel_map) + map = kernel_map; + } + if (!map->dso->adjust_symbols) return rip; -- 2.14.3