Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757628AbbFQSyU (ORCPT ); Wed, 17 Jun 2015 14:54:20 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:35329 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753711AbbFQSyO (ORCPT ); Wed, 17 Jun 2015 14:54:14 -0400 MIME-Version: 1.0 In-Reply-To: <20150616143401.GA2548@redhat.com> References: <20150616143401.GA2548@redhat.com> Date: Wed, 17 Jun 2015 11:54:12 -0700 Message-ID: Subject: Re: [BUG] perf report: fails to symbolize when vaddr is non zero for shared objects From: Stephane Eranian To: Arnaldo Carvalho de Melo Cc: LKML , Jiri Olsa , Namhyung Kim , David Ahern , Peter Zijlstra , "mingo@elte.hu" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1620 Lines: 40 On Tue, Jun 16, 2015 at 7:34 AM, Arnaldo Carvalho de Melo wrote: > Em Tue, Jun 16, 2015 at 12:03:01AM -0700, Stephane Eranian escreveu: >> Hi, >> >> It has been brought to my attention that on systems where the text >> of shared libs is not loaded with a zero virtual address, perf report >> fails to symbolize >> correctly samples. This is true of older versions of perf and also the latest >> in tip.git. >> >> I looked at symbol-elf.c and I did not see a place where the vaddr was taken >> into account from the program headers in the case of ET_DYN. I see it for >> ET_EXE, though. >> >> $ readelf -e lib.so >> Type: DYN (Shared object file) >> .... >> Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align >> LOAD 0x000000 0x0000d000 0x0000d000 0x73657c 0x73657c R E 0x1000 >> >> If you get samples in the shared lib, they will be off, possibly >> attributed to the wrong >> functions. >> >> Could this be fixed quickly? > > You tell me, do you have a patch to propose? :-) > Well, need to make sure I understand the code flow in dso__load_sym() and callers. You have elf_read_maps() which seems to be reading the phdr but, it would need to be called systematically for ET_DYN. I will experiment with this. Worst case, we need to add another function to read the phdr and use the p_vaddr. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/