Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752883AbbDBJAp (ORCPT ); Thu, 2 Apr 2015 05:00:45 -0400 Received: from [119.145.14.66] ([119.145.14.66]:10774 "EHLO szxga03-in.huawei.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751306AbbDBJAl (ORCPT ); Thu, 2 Apr 2015 05:00:41 -0400 Message-ID: <551D0507.5050107@huawei.com> Date: Thu, 2 Apr 2015 16:59:51 +0800 From: Wang Nan User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim CC: Li Zefan , "linux-kernel@vger.kernel.org" Subject: [BUG] perf report: segfault when annotate kernel module. Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.69.129] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.551D0514.008E,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 54582f1a430eb57d612ece8a644422aa Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2885 Lines: 76 Hi folks, I hit a segfault when try to analysis a perf.data generated in an aarch 64 board. I tried execute perf report on x86 and arm64, both of them hit similar segfault: $ perf report -i ./buggy/perf.data --objdump=/path/to/aarch64-oe-linux-objdump --kallsyms /path/to/kallsyms perf: Segmentation fault -------- backtrace -------- /home/user/perf[0x503478] /lib64/libc.so.6(+0x3545f)[0x7f5e6944b45f] /home/user/perf[0x499b56] /home/user/perf(dso__load_kallsyms+0x13c)[0x49b56c] /home/user/perf(dso__load+0x72e)[0x49c21e] /home/user/perf(map__load+0x6e)[0x4ae9ee] /home/user/perf(thread__find_addr_map+0x24c)[0x47deec] /home/user/perf(perf_event__preprocess_sample+0x88)[0x47e238] /home/user/perf[0x43ad02] /home/user/perf[0x4b55bc] /home/user/perf(ordered_events__flush+0x1a9)[0x4b58c9] /home/user/perf(perf_session__process_events+0x407)[0x4b42d7] /home/user/perf(cmd_report+0xf11)[0x43bfc1] /home/user/perf[0x474702] /home/user/perf(main+0x5f5)[0x42de95] /lib64/libc.so.6(__libc_start_main+0xf4)[0x7f5e69437bd4] /home/user/perf[0x42dfc4] I did some debugging and found the problem is raised at dso__load_kcore: static int dso__load_kcore(struct dso *dso, struct map *map, const char *kallsyms_filename) { struct map_groups *kmaps = map__kmap(map)->kmaps; // kmap is NULL here struct machine *machine = kmaps->machine; // segfault. ... } Then I realised that if a struct map is created by machine__new_module with map__new2, the map__kmap(map) is never set. However, if I set map->map_ip = map->unmap_ip = identity__map_ip; kmap = map__kmap(map); kmap->kmaps = &machine->kmaps; in machine__new_module like in __machine__create_kernel_maps, I hit another problem: *** Error in `/home/user/perf': free(): invalid next size (normal): 0x0000000002411a60 *** ======= Backtrace: ========= /lib64/libc.so.6(+0x6eeef)[0x7f2ed502feef] /lib64/libc.so.6(+0x78cae)[0x7f2ed5039cae] /lib64/libc.so.6(+0x79987)[0x7f2ed503a987] /home/user/perf(dso__data_fd+0x456)[0x496be6] /home/user/perf(dso__type+0x1a)[0x4987ea] /home/user/perf(vdso__dso_findnew+0x7d)[0x4d2cbd] /home/user/perf(map__new+0x2c3)[0x4ae7c3] /home/user/perf[0x4a90fa] /home/user/perf(machine__process_mmap2_event+0xc1)[0x4acbf1] /home/user/perf[0x4b1fec] /home/user/perf(perf_session__process_events+0x3bf)[0x4b45ff] /home/user/perf(cmd_report+0xf12)[0x43bfc2] /home/user/perf[0x474703] /home/user/perf(main+0x5f6)[0x42de96] /lib64/libc.so.6(__libc_start_main+0xf5)[0x7f2ed4fe2bd5] /home/user/perf[0x42dfc5] ======= Memory map: ======== ... Does anyone has any idea on it? Thank you! -- 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/