From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751454AbcETRnZ (ORCPT ); Fri, 20 May 2016 13:43:25 -0400 Received: from terminus.zytor.com ([198.137.202.10]:33088 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbcETRnU (ORCPT ); Fri, 20 May 2016 13:43:20 -0400 Date: Fri, 20 May 2016 10:42:43 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: dsahern@gmail.com, milian.wolff@kdab.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, adrian.hunter@intel.com, tglx@linutronix.de, namhyung@kernel.org, jolsa@kernel.org, acme@redhat.com, hpa@zytor.com, mingo@kernel.org Reply-To: hpa@zytor.com, mingo@kernel.org, jolsa@kernel.org, namhyung@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, milian.wolff@kdab.com, adrian.hunter@intel.com, wangnan0@huawei.com, tglx@linutronix.de, dsahern@gmail.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf machine: Do not bail out if not managing to read ref reloc symbol Git-Commit-ID: 45e90056904b12d8dd74e0d2ea6dfd5e4394104d X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 45e90056904b12d8dd74e0d2ea6dfd5e4394104d Gitweb: http://git.kernel.org/tip/45e90056904b12d8dd74e0d2ea6dfd5e4394104d Author: Arnaldo Carvalho de Melo AuthorDate: Tue, 17 May 2016 11:52:26 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 20 May 2016 11:43:54 -0300 perf machine: Do not bail out if not managing to read ref reloc symbol This means the user can't access /proc/kallsyms, for instance, because /proc/sys/kernel/kptr_restrict is set to 1. Instead leave the ref_reloc_sym as NULL and code using it will cope. This allows 'perf trace' to work on such systems for !root, the only issue would be when trying to resolve kernel symbols, which happens, for instance, in some libtracevent plugins. A warning for that case will be provided in the next patch in this series. Noticed in Ubuntu 16.04, that comes with kptr_restrict=1. Reported-by: Milian Wolff Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-knpu3z4iyp2dxpdfm798fac4@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/machine.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 7ba9fad..b277984 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1135,10 +1135,10 @@ int machine__create_kernel_maps(struct machine *machine) { struct dso *kernel = machine__get_kernel(machine); const char *name; - u64 addr = machine__get_running_kernel_start(machine, &name); + u64 addr; int ret; - if (!addr || kernel == NULL) + if (kernel == NULL) return -1; ret = __machine__create_kernel_maps(machine, kernel); @@ -1160,8 +1160,9 @@ int machine__create_kernel_maps(struct machine *machine) */ map_groups__fixup_end(&machine->kmaps); - if (maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, name, - addr)) { + addr = machine__get_running_kernel_start(machine, &name); + if (!addr) { + } else if (maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, name, addr)) { machine__destroy_kernel_maps(machine); return -1; }