From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752858AbaB1QQW (ORCPT ); Fri, 28 Feb 2014 11:16:22 -0500 Received: from terminus.zytor.com ([198.137.202.10]:44150 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752557AbaB1QQV (ORCPT ); Fri, 28 Feb 2014 11:16:21 -0500 Message-ID: <5310B60F.30806@zytor.com> Date: Fri, 28 Feb 2014 08:15:11 -0800 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Peter Zijlstra CC: Vince Weaver , Steven Rostedt , Linux Kernel , Ingo Molnar Subject: Re: perf_fuzzer compiled for x32 causes reboot References: <20140227173150.4e5ed747@gandalf.local.home> <530FC1C6.5040209@zytor.com> <20140227215726.7018c861@gandalf.local.home> <20140228092341.12a40f7c@gandalf.local.home> <1c583986-74f8-4829-883b-390dc49ddabb@email.android.com> <20140228154026.GH9987@twins.programming.kicks-ass.net> In-Reply-To: <20140228154026.GH9987@twins.programming.kicks-ass.net> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/28/2014 07:40 AM, Peter Zijlstra wrote: > On Fri, Feb 28, 2014 at 07:13:06AM -0800, H. Peter Anvin wrote: >> If I'm reading this right we end up going from the page fault >> tracepoint to copy_from_user_nmi() without going through NMI, and the >> cr2 corruption is obvious. I guess the assumption that only the NMI >> path needed to save cr2 is flawed? > > It was never assumed it would only go through NMI, but that it would be > NMI safe -- and as it turns out, it is that. > > What I did assume was that any other callsites would be safe, seeing how > they'd already be running in 'normal' contexts. > > I had not considered people putting tracepoints _that_ early in the > exception paths. > > Note that there's more tracepoints there than the one mentioned. > Well, I was talking about the assumption spelled out in the comment above copy_from_user_nmi() which pretty much states "cr2 is safe because cr2 is saved/restored in the NMI wrappers." -hpa