Re: [PATCH v17 02/13] perf/x86, KVM: Prevent host debug register leak into guest OS on NMI

From: Peter Zijlstra

Date: Thu Sep 24 2026 - 05:22:40 EST


On Wed, Sep 23, 2026 at 07:33:15AM -0700, Sean Christopherson wrote:
> On Wed, Sep 23, 2026, Peter Zijlstra wrote:
> > On Tue, Sep 22, 2026 at 01:25:07PM +0900, Masami Hiramatsu (Google) wrote:
> > > From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
> > >
> > > When KVM enters a guest OS, host hardware breakpoints are disabled
> > > before running the guest. However, an NMI can occur while executing
> > > in guest mode or during guest transition, where
> > > arch_install_hw_breakpoint() can be invoked from NMI context.
> >
> > How? AFAICT perf doesn't do that. arch_install_hw_breakpoint() is called
> > through pmu::add() which is strictly IPI context.
>
> I assume it's:
>
> kgdb_nmi_handler()
> |
> -> kgdb_nmicallin()
> |
> -> kgdb_cpu_enter()
> |
> -> arch_kgdb_ops.correct_hw_break()
> |
> -> kgdb_correct_hw_break()
> |
> -> arch_install_hw_breakpoint()

So I would *love* to delete KGDB support for x86. Is anybody actually
using this turd?