Re: [RFC][PATCH] tracing/x86: Save CR2 before tracing irqsoff on error_entry
From: Steven Rostedt
Date: Thu Mar 21 2019 - 16:35:55 EST
On Thu, 21 Mar 2019 20:00:19 +0000
Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
> I'm afraid that I've not got the original context of this thread, but
> I'm going to guess that something is resulting in a #PF before %cr2
> before it gets saved on the #PF path, and using a PVOP causes things to
> explode?
Actually it had nothing to do with PVOPs. It was tracing that caused
it. We added tracepoints to irqs off and on (with a config enabled),
and there's an option to allow taking user stack traces at any
tracepoint. The tracing of irqs off happened at the start of the page
fault entry, and by tracing the userspace stack (which can also fault)
we corrupted the cr2 for the original page fault.
The work now is to store that cr2 early on, but that requires doing it
in assembly, and that's where PVOPs makes the solution hard.
-- Steve
>
> If it helps in the short term, Xen will trap and emulate a mov from cr2
> instruction correctly. Performance will surely suck, but it might be an
> option if we need to rethink how this information is made available to
> guests.
>
> Thanks,
>
> ~Andrew