From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757006AbaAJP3l (ORCPT ); Fri, 10 Jan 2014 10:29:41 -0500 Received: from g4t0016.houston.hp.com ([15.201.24.19]:13204 "EHLO g4t0016.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751871AbaAJP3i (ORCPT ); Fri, 10 Jan 2014 10:29:38 -0500 Message-ID: <52D011C9.7000209@hp.com> Date: Fri, 10 Jan 2014 10:29:13 -0500 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Peter Zijlstra CC: Ingo Molnar , Arnaldo Carvalho de Melo , Linux Kernel Mailing List , Aswin Chandramouleeswaran , Scott J Norton Subject: SIGSEGV when using "perf record -g" with 3.13-rc* kernel Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter, I recently encountered a strange problem using 3.13-rc* kernel that did not happen in a 3.12 kernel. When I ran the high_systime benchmark of the AIM7 test suite, I saw the following errors: Child terminated by signal #11 core dumped Child terminated by signal #11 Child process called exit(), status = 139 core dumped Child terminated by signal #11 This only happened when I monitored the running of the benchmark using "perf record -g". There was no problem if callchain was not enabled. Adding debug code to the kernel showed the following stack trace: Call Trace: [] dump_stack+0x49/0x62 [] warn_slowpath_common+0x8c/0xc0 [] warn_slowpath_null+0x1a/0x20 [] force_sig_info+0x131/0x140 [] force_sig_info_fault+0x5f/0x70 [] ? search_exception_tables+0x2a/0x50 [] ? fixup_exception+0x1d/0x70 [] no_context+0x159/0x1f0 [] __bad_area_nosemaphore+0x12d/0x230 [] ? __bad_area_nosemaphore+0x12d/0x230 [] bad_area_nosemaphore+0x13/0x20 [] __do_page_fault+0x362/0x480 [] ? __do_page_fault+0x362/0x480 [] do_page_fault+0xe/0x10 [] page_fault+0x22/0x30 [] ? bad_to_user+0x5e/0x66b [] copy_from_user_nmi+0x76/0x90 [] perf_callchain_user+0xd0/0x360 [] perf_callchain+0x1af/0x1f0 [] perf_prepare_sample+0x2f3/0x3a0 [] __perf_event_overflow+0x10f/0x220 [] perf_event_overflow+0x14/0x20 [] intel_pmu_handle_irq+0x1de/0x3c0 [] ? emulate_vsyscall+0x144/0x390 [] perf_event_nmi_handler+0x34/0x60 [] nmi_handle+0x8a/0x170 [] default_do_nmi+0x68/0x210 [] do_nmi+0x90/0xe0 [] end_repeat_nmi+0x1e/0x2e [] ? emulate_vsyscall+0x144/0x390 [] ? emulate_vsyscall+0x144/0x390 [] ? emulate_vsyscall+0x144/0x390 <> [] __bad_area_nosemaphore+0x21d/0x230 [] bad_area_nosemaphore+0x13/0x20 [] __do_page_fault+0x362/0x480 [] ? vm_mmap_pgoff+0xbc/0xe0 [] do_page_fault+0xe/0x10 [] page_fault+0x22/0x30 ---[ end trace 037bf09d279751ec ]--- So this is a double page faults. Looking at relevant changes in 3.13 kernel, I spotted the following one patch that modified the perf_callchain_user() function shown up in the stack trace above: perf: Fix arch_perf_out_copy_user default @@ -2041,7 +2041,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs) frame.return_address = 0; bytes = copy_from_user_nmi(&frame, fp, sizeof(frame)); - if (bytes != sizeof(frame)) + if (bytes != 0) break; if (!valid_user_frame(fp, sizeof(frame))) I wondered if it was the cause of the SIGSEGV. Please let me know your thought on that. -Longman