The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/4] KVM: x86: Document and enforce APIC base memory hole
@ 2026-07-06  9:20 Tim Wiederhake
  2026-07-06  9:20 ` [PATCH 1/4] KVM: x86: Document that KVM_CREATE_IRQCHIP must precede vcpu creation Tim Wiederhake
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Tim Wiederhake @ 2026-07-06  9:20 UTC (permalink / raw)
  To: Borislav Petkov, Dave Hansen, H. Peter Anvin, Ingo Molnar,
	Jonathan Corbet, kvm, linux-doc, linux-kernel, Paolo Bonzini,
	Sean Christopherson, Shuah Khan, Thomas Gleixner, x86
  Cc: Tim Wiederhake

When an in-kernel irqchip is enabled on x86, KVM installs a private
memory slot at the default APIC base address (0xfee00000) during vcpu
creation.  If user space has already mapped a memory region covering
that address, vcpu creation fails with -EEXIST.  The same happens in
reverse: mapping memory over the APIC base after vcpu creation also
fails with -EEXIST.

None of this is documented, and the error is reported far from where
the actual conflict is introduced.  A VMM developer hitting this has
to trace through KVM internals to understand what went wrong.

This series documents the two undocumented constraints (irqchip before
vcpu, APIC base memory hole) and adds early checks so the error is
reported at the ioctl that actually violates the constraint.

Patches 1-2 are documentation only.  Patches 3-4 add early validation
that turns a confusing -EEXIST at vcpu creation into an explicit error
at the point where the conflict is introduced.

Tested with a reproducer that exercises all six orderings of
{irqchip, memory, vcpu} creation against both overlapping and
non-overlapping memory regions.

Tim Wiederhake (4):
  KVM: x86: Document that KVM_CREATE_IRQCHIP must precede vcpu creation
  KVM: x86: Document APIC base address constraint for in-kernel irqchip
  KVM: x86: Reject KVM_CREATE_IRQCHIP if APIC base is already mapped
  KVM: x86: Reject user memory regions covering the APIC base

 Documentation/virt/kvm/api.rst |  8 +++++++-
 arch/x86/kvm/x86.c             | 11 +++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-07-06 23:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06  9:20 [PATCH 0/4] KVM: x86: Document and enforce APIC base memory hole Tim Wiederhake
2026-07-06  9:20 ` [PATCH 1/4] KVM: x86: Document that KVM_CREATE_IRQCHIP must precede vcpu creation Tim Wiederhake
2026-07-06 23:22   ` Sean Christopherson
2026-07-06  9:20 ` [PATCH 2/4] KVM: x86: Document APIC base address constraint for in-kernel irqchip Tim Wiederhake
2026-07-06 23:32   ` Sean Christopherson
2026-07-06  9:20 ` [PATCH 3/4] KVM: x86: Reject KVM_CREATE_IRQCHIP if APIC base is already mapped Tim Wiederhake
2026-07-06  9:20 ` [PATCH 4/4] KVM: x86: Reject user memory regions covering the APIC base Tim Wiederhake
2026-07-06 15:21 ` [syzbot ci] Re: KVM: x86: Document and enforce APIC base memory hole syzbot ci
2026-07-06 22:26 ` [PATCH 0/4] " Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox