From: Vince Weaver <vincent.weaver@maine.edu>
To: Vince Weaver <vincent.weaver@maine.edu>
Cc: Steven Rostedt <rostedt@goodmis.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>
Subject: Re: perf_fuzzer compiled for x32 causes reboot
Date: Thu, 27 Feb 2014 17:06:36 -0500 (EST) [thread overview]
Message-ID: <alpine.DEB.2.10.1402271621000.2571@vincent-weaver-1.um.maine.edu> (raw)
In-Reply-To: <alpine.DEB.2.10.1402261003390.18730@vincent-weaver-1.um.maine.edu>
I spent some more time on this.
I managed to get a trace that exhibited the bug practically right
away, but still unable to generate a reproducible trace :(
So instead I'm adding WARN's and trace_printks to see what I can find out.
Here's a summary of what I think is happneing. Please let me know if I'm
wildly wrong in analyzing this.
Userspace accesses the perf
ring-buffer-user-page of an event for the first time (in this trace
it's a SW_CPU_CLOCK event).
This triggers a page_fault to bring in the page.
This triggers a TRACEPOINT event (task/task_newtask) which
has PERF_SAMPLE_IP|PERF_SAMPLE_TID|PERF_SAMPLE_TIME|PERF_SAMPLE_CALLCHAIN|PERF_SAMPLE_ID|PERF_SAMPLE_CPU|PERF_SAMPLE_PERIOD|PERF_SAMPLE_STREAM_ID|PERF_SAMPLE_WEIGHT|PERF_SAMPLE_DATA_SRC|PERF_SAMPLE_TRANSACTION;
and exclude_callchain_kernel=1, triggering a perf_callchain().
Here is a dump of the stack right after we enter perf_callchain()
vince@core2:~$ [ 202.320444] ------------[ cut here ]------------
[ 202.324001] WARNING: CPU: 1 PID: 2873 at kernel/events/callchain.c:168 perf_callchain+0x67/0x211()
hermal_sys ehci_pci ehci_hcd sg sd_mod usbcore usb_common
[ 202.324001] CPU: 1 PID: 2873 Comm: perf_fuzzer Not tainted 3.14.0-rc3+ #24
[ 202.324001] Hardware name: AOpen DE7000/nMCP7ALPx-DE R1.06 Oct.19.2012, BIOS 080015 10/19/2012
[ 202.324001] 00000000000000a8 ffff880119ec1b48 ffffffff81531dc1 00000000000000a8
[ 202.324001] 0000000000000000 ffff880119ec1b88 ffffffff81040ce4 ffff880119ec1b88
[ 202.324001] ffffffff810d416f ffff880119ec1e38 ffff8800cba67800 0000000000000000
[ 202.324001] Call Trace:
[ 202.324001] [<ffffffff81531dc1>] dump_stack+0x49/0x60
[ 202.324001] [<ffffffff81040ce4>] warn_slowpath_common+0x81/0x9b
[ 202.324001] [<ffffffff810d416f>] ? perf_callchain+0x67/0x211
[ 202.324001] [<ffffffff81040d18>] warn_slowpath_null+0x1a/0x1c
[ 202.324001] [<ffffffff810d416f>] perf_callchain+0x67/0x211
[ 202.324001] [<ffffffff8106b0ab>] ? local_clock+0x1b/0x24
[ 202.324001] [<ffffffff810d0872>] perf_prepare_sample+0x7b/0x304
[ 202.324001] [<ffffffff810d1079>] __perf_event_overflow+0x156/0x1c1
[ 202.324001] [<ffffffff810f4613>] ? free_pgtables+0xa7/0xc9
[ 202.324001] [<ffffffff810d125e>] perf_swevent_overflow+0x41/0x5b
[ 202.324001] [<ffffffff810d12ea>] perf_swevent_event+0x72/0x74
[ 202.324001] [<ffffffff810d1478>] perf_tp_event+0xea/0x1ef
[ 202.324001] [<ffffffff8103515a>] ? perf_trace_x86_exceptions+0x4c/0xba
[ 202.324001] [<ffffffff810351b6>] perf_trace_x86_exceptions+0xa8/0xba
[ 202.324001] [<ffffffff8103515a>] ? perf_trace_x86_exceptions+0x4c/0xba
[ 202.324001] [<ffffffff81538439>] trace_do_page_fault+0x48/0x99
[ 202.324001] [<ffffffff815354b2>] trace_page_fault+0x22/0x30
[ 202.324001] ---[ end trace 31ccd31b4e82cb42 ]---
This triggers a kernel pagefault because the BP register is not valid and
copy_from_user_nmi() tries to copy the user stack area from there.
This *should* be OK? And it maybe looks like it works, but then
copy_user_handle_tail()
causes another page fault again at the invaid BP register.
But then the code continues to
perf_output_begin()
237.265689: page_fault_kernel: address=0x17a0 ip=copy_user_handle_tail error_code=0x0
237.265689: function: __do_page_fault
237.265689: function: bad_area_nosemaphore
237.265690: function: __bad_area_nosemaphore
237.265690: function: no_context
237.265690: function: fixup_exception
237.265690: function: search_exception_tables
237.265690: function: search_extable
237.265691: function: perf_output_begin
237.265692: bprint: perf_output_begin: VMW: event type 2 config 2a st: 2c3e7
how are we back in __do_page_fault again here?
237.265692: function: __do_page_fault
237.265692: function: down_read_trylock
237.265692: function: _cond_resched
237.265693: function: find_vma
237.265693: function: bad_area
237.265693: function: up_read
237.265693: function: __bad_area_nosemaphore
237.265694: function: is_prefetch
237.265694: function: convert_ip_to_linear
237.265695: function: unhandled_signal
237.265695: function: __printk_ratelimit
237.265695: function: _raw_spin_trylock
237.265695: function: _raw_spin_unlock_irqrestore
237.265696: function: printk
237.265696: function: vprintk_emit
[ 202.877004] perf_fuzzer[2873]: segfault at 17a0 ip 00000000004017fd sp 00000000ffd19d10 error 6 in perf_fuzzer[400000+d1000]
Vince
next prev parent reply other threads:[~2014-02-27 22:04 UTC|newest]
Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 20:25 perf_fuzzer causes reboot Vince Weaver
2014-02-21 22:13 ` perf_fuzzer compiled for x32 " Vince Weaver
2014-02-21 22:34 ` Vince Weaver
2014-02-22 4:50 ` Vince Weaver
2014-02-22 5:03 ` H. Peter Anvin
2014-02-22 6:26 ` H. Peter Anvin
2014-02-23 5:18 ` Vince Weaver
2014-02-23 5:24 ` H. Peter Anvin
2014-02-23 6:07 ` H. Peter Anvin
2014-02-23 14:05 ` Vince Weaver
2014-02-24 3:02 ` Vince Weaver
2014-02-24 5:22 ` H. Peter Anvin
2014-02-24 15:35 ` Vince Weaver
2014-02-24 16:34 ` Vince Weaver
2014-02-24 16:47 ` H. Peter Anvin
2014-02-24 17:10 ` Vince Weaver
2014-02-24 17:25 ` Peter Zijlstra
2014-02-24 17:32 ` Vince Weaver
2014-02-24 17:40 ` H. Peter Anvin
2014-02-24 18:00 ` Vince Weaver
2014-02-24 18:07 ` Vince Weaver
2014-02-24 18:34 ` H. Peter Anvin
2014-02-24 19:13 ` Steven Rostedt
2014-02-24 19:15 ` H. Peter Anvin
2014-02-24 19:30 ` Peter Zijlstra
2014-02-24 19:32 ` Steven Rostedt
2014-02-25 3:49 ` H. Peter Anvin
2014-02-25 14:07 ` Vince Weaver
2014-02-25 14:34 ` H. Peter Anvin
2014-02-25 14:43 ` Steven Rostedt
2014-02-25 15:33 ` Vince Weaver
2014-02-26 15:06 ` Vince Weaver
2014-02-27 22:06 ` Vince Weaver [this message]
2014-02-27 22:31 ` Steven Rostedt
2014-02-27 22:52 ` H. Peter Anvin
2014-02-27 23:30 ` Steven Rostedt
2014-02-27 23:46 ` H. Peter Anvin
2014-02-28 1:00 ` Vince Weaver
2014-02-28 20:34 ` Paul E. McKenney
2014-02-28 20:47 ` Steven Rostedt
2014-02-28 20:54 ` Peter Zijlstra
2014-02-28 21:17 ` Paul E. McKenney
2014-02-28 21:27 ` Peter Zijlstra
2014-02-28 21:51 ` Paul E. McKenney
2014-02-28 21:55 ` Peter Zijlstra
2014-02-28 22:05 ` Steven Rostedt
2014-02-28 22:23 ` Paul E. McKenney
2014-02-28 1:34 ` Vince Weaver
2014-02-28 2:17 ` H. Peter Anvin
2014-02-28 2:57 ` Steven Rostedt
2014-02-28 11:11 ` Peter Zijlstra
2014-02-28 13:37 ` Steven Rostedt
2014-02-28 14:15 ` Vince Weaver
2014-02-28 14:23 ` Steven Rostedt
2014-02-28 15:07 ` Vince Weaver
2014-02-28 15:13 ` H. Peter Anvin
2014-02-28 15:40 ` Peter Zijlstra
2014-02-28 16:15 ` H. Peter Anvin
2014-02-28 16:29 ` Steven Rostedt
2014-02-28 19:33 ` [PATCH] x86: Rename copy_from_user_nmi() to copy_from_user_trace() Steven Rostedt
2014-02-28 20:46 ` Peter Zijlstra
2014-02-28 20:51 ` Steven Rostedt
2014-02-28 20:58 ` Peter Zijlstra
2014-02-28 21:01 ` Steven Rostedt
2014-02-28 21:17 ` Peter Zijlstra
2014-02-28 20:56 ` perf_fuzzer compiled for x32 causes reboot Peter Zijlstra
2014-02-28 21:06 ` Steven Rostedt
2014-03-01 9:16 ` Ingo Molnar
2014-03-01 9:50 ` Borislav Petkov
2014-03-01 16:50 ` H. Peter Anvin
2014-03-04 23:05 ` Borislav Petkov
2014-03-03 9:16 ` Peter Zijlstra
2014-02-28 20:55 ` Peter Zijlstra
2014-02-28 15:20 ` Steven Rostedt
2014-02-28 15:30 ` Steven Rostedt
2014-02-28 20:38 ` H. Peter Anvin
2014-02-28 20:46 ` Steven Rostedt
2014-02-28 21:18 ` Vince Weaver
2014-02-28 21:30 ` Steven Rostedt
2014-02-28 23:34 ` Vince Weaver
2014-03-01 0:43 ` H. Peter Anvin
2014-03-01 3:36 ` Steven Rostedt
2014-03-01 16:24 ` Andi Kleen
2014-03-02 15:34 ` Vince Weaver
2014-03-02 16:02 ` Vince Weaver
2014-02-28 9:39 ` Peter Zijlstra
2014-02-24 17:40 ` Peter Zijlstra
2014-02-24 17:41 ` Vince Weaver
2014-02-24 17:42 ` H. Peter Anvin
2014-02-24 17:52 ` H. Peter Anvin
2014-02-28 15:33 [PATCH] x86 trace: Fix page fault tracing bug Jiri Olsa
2014-02-28 15:47 ` Peter Zijlstra
2014-02-28 16:05 ` [PATCHv2] " Jiri Olsa
2014-02-28 16:11 ` H. Peter Anvin
2014-02-28 16:23 ` Steven Rostedt
2014-02-28 16:15 ` Steven Rostedt
2014-03-05 0:03 ` [tip:x86/urgent] x86, trace: Fix CR2 corruption when tracing page faults tip-bot for Jiri Olsa
2014-03-05 11:14 ` Peter Zijlstra
2014-03-05 12:20 ` Steven Rostedt
2014-03-05 12:25 ` Peter Zijlstra
2014-03-05 12:33 ` Steven Rostedt
2014-03-05 12:54 ` Peter Zijlstra
2014-03-05 13:02 ` Peter Zijlstra
2014-03-05 13:07 ` Peter Zijlstra
2014-03-05 12:36 ` Peter Zijlstra
2014-03-05 13:00 ` Steven Rostedt
2014-03-05 13:08 ` Peter Zijlstra
2014-03-05 21:37 ` H. Peter Anvin
2014-03-06 8:40 ` Peter Zijlstra
2014-03-06 11:02 ` Steven Rostedt
2014-03-06 14:53 ` [PATCH] x86: Further robustify CR2 handling vs tracing Peter Zijlstra
2014-03-07 23:07 ` [tip:x86/urgent] x86, trace: " tip-bot for Peter Zijlstra
2014-02-28 15:47 ` [PATCH] x86 trace: Fix page fault tracing bug Jiri Olsa
2014-02-28 16:00 ` Steven Rostedt
2014-02-28 16:01 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.10.1402271621000.2571@vincent-weaver-1.um.maine.edu \
--to=vincent.weaver@maine.edu \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).