[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00ceab91-c86e-be17-0ac9-e4a45d8e7b25@suse.com>
Date: Wed, 13 May 2020 09:11:39 +0200
From: Jürgen Groß <jgross@...e.com>
To: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>
Cc: x86@...nel.org, "Paul E. McKenney" <paulmck@...nel.org>,
Andy Lutomirski <luto@...nel.org>,
Alexandre Chartre <alexandre.chartre@...cle.com>,
Frederic Weisbecker <frederic@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Joel Fernandes <joel@...lfernandes.org>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Brian Gerst <brgerst@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Will Deacon <will@...nel.org>,
Tom Lendacky <thomas.lendacky@....com>,
Wei Liu <wei.liu@...nel.org>,
Michael Kelley <mikelley@...rosoft.com>,
Jason Chen CJ <jason.cj.chen@...el.com>,
Zhao Yakui <yakui.zhao@...el.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>
Subject: Re: [patch V5 01/38] x86/kvm/svm: Use uninstrumented wrmsrl() to
restore GS
On 12.05.20 23:01, Thomas Gleixner wrote:
> On guest exit MSR_GS_BASE contains whatever the guest wrote to it and the
> first action after returning from the ASM code is to set it to the host
> kernel value. This uses wrmsrl() which is interesting at least.
>
> wrmsrl() is either using native_write_msr() or the paravirt variant. The
> XEN_PV code is uninteresting as nested SVM in a XEN_PV guest does not work.
>
> But native_write_msr() can be placed out of line by the compiler especially
> when paravirtualization is enabled in the kernel configuration. The
> function is marked notrace, but still can be probed if
> CONFIG_KPROBE_EVENTS_ON_NOTRACE is enabled.
>
> That would be a fatal problem as kprobe events use per-CPU variables which
> are GS based and would be accessed with the guest GS. Depending on the GS
> value this would either explode in colorful ways or lead to completely
> undebugable data corruption.
>
> Aside of that native_write_msr() contains a tracepoint which objtool
> complains about as it is invoked from the noinstr section.
>
> As this cannot run inside a XEN_PV guest there is no point in using
> wrmsrl(). Use native_wrmsrl() instead which is just a plain native WRMSR
> without tracing or anything else attached.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Cc: Paolo Bonzini <pbonzini@...hat.com>
> Cc: Tom Lendacky <thomas.lendacky@....com>
> Cc: Juergen Gross <jgross@...e.com>
Acked-by: Juergen Gross <jgross@...e.com>
Juergen
Powered by blists - more mailing lists