From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAA29C43381 for ; Tue, 26 Mar 2019 06:37:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB4602075E for ; Tue, 26 Mar 2019 06:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553582231; bh=qZuOzc+Uo+MO/KOT4Cn+NEhp8o6oQ3oLyEx2AcN4tpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=swnneyKPaiXNsFemgVqjjpI0FMMPctxV8JxSPq/1yeplrL3soUdQdR4toflB9qyWm zWLP7ByBrP4lXCdy6P7MlaEMBm/+ZeuEW8zK08Cm/yewYAri860Z+FH5n2/5kzP0PA EFeFNqFk9myAcCC44HoFkZEiGN5oBQtqATc6t7JM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732339AbfCZGhK (ORCPT ); Tue, 26 Mar 2019 02:37:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:50174 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732318AbfCZGhG (ORCPT ); Tue, 26 Mar 2019 02:37:06 -0400 Received: from localhost (unknown [104.132.152.111]) (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 F32C920863; Tue, 26 Mar 2019 06:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553582225; bh=qZuOzc+Uo+MO/KOT4Cn+NEhp8o6oQ3oLyEx2AcN4tpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wSyyZNqsUvblhfdlLDIcwtUvR0ZrRJreDLIPuBe+6xfL7IC2HtL8PIT3+/4px/05r BH7PyggZq4jFsEa8Rz1PeErUh0LEiuldtlm2S2lJ7TNMlzYpm7CAY9oaIAR6spEeHn q15EbGQBTdBOj0JXt71RETemFvx6qwpjuOjOcu34= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Joseph Qi , Masami Hiramatsu , Alexander Shishkin , Andy Lutomirski , Jiufei Xue , Peter Zijlstra , Xu Yu , Arnaldo Carvalho de Melo Subject: [PATCH 4.19 19/45] perf probe: Fix getting the kernel map Date: Tue, 26 Mar 2019 15:30:02 +0900 Message-Id: <20190326042703.705217559@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190326042702.565683325@linuxfoundation.org> References: <20190326042702.565683325@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adrian Hunter commit eaeffeb9838a7c0dec981d258666bfcc0fa6a947 upstream. Since commit 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines"), perf tools has been creating more than one kernel map, however 'perf probe' assumed there could be only one. Fix by using machine__kernel_map() to get the main kernel map. Signed-off-by: Adrian Hunter Tested-by: Joseph Qi Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Andy Lutomirski Cc: Greg Kroah-Hartman Cc: Jiufei Xue Cc: Peter Zijlstra Cc: stable@vger.kernel.org Cc: Xu Yu Fixes: 4d99e4136580 ("perf machine: Workaround missing maps for x86 PTI entry trampolines") Fixes: d83212d5dd67 ("kallsyms, x86: Export addresses of PTI entry trampolines") Link: http://lkml.kernel.org/r/2ed432de-e904-85d2-5c36-5897ddc5b23b@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/probe-event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -157,8 +157,10 @@ static struct map *kernel_get_module_map if (module && strchr(module, '/')) return dso__new_map(module); - if (!module) - module = "kernel"; + if (!module) { + pos = machine__kernel_map(host_machine); + return map__get(pos); + } for (pos = maps__first(maps); pos; pos = map__next(pos)) { /* short_name is "[module]" */