Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Sean Christopherson <seanjc@google.com>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Shuah Khan <shuah@kernel.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	"Saenz Julienne, Nicolas" <nsaenz@amazon.es>,
	Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Subject: Re: [PATCH] KVM: SVM: Always intercept ICEBP, add INT1 selftests
Date: Tue, 12 May 2026 23:10:20 +0200	[thread overview]
Message-ID: <9b76002a-dbd4-4f8f-8279-96ea0ff3966a@redhat.com> (raw)
In-Reply-To: <e03f092dfbb7d391a6bf2797ba01e122ba080bcd.camel@infradead.org>

On 5/7/26 13:22, David Woodhouse wrote:
> From: David Woodhouse <dwmw@amazon.co.uk>
> 
> ICEBP (INT1, opcode 0xF1) generates a #DB that is architecturally a
> trap, but on SVM it was not always intercepted. Unconditionally
> intercept ICEBP on SVM to match VMX behaviour and ensure correct
> event delivery semantics.
> 
> Add two selftests exercising ICEBP:
> 
>   - int1_ept_test: verifies that ICEBP works correctly when the
>     exception stack page is not present (EPT/NPT fault during #DB
>     delivery). The IST stack is evicted via MADV_DONTNEED before
>     executing INT1.
> 
>   - int1_task_gate_test: verifies ICEBP delivery through a 32-bit
>     task gate, exercising the legacy task-switch path for #DB.
> 
> Tested on Intel Sapphire Rapids and AMD Genoa. Without the SVM fix,
> int1_task_gate_test fails on AMD with EIP pointing at ICEBP instead
> of after it. With the fix, both tests pass on both platforms.
> 
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
>   arch/x86/kvm/svm/svm.c                        |  21 ++
>   tools/testing/selftests/kvm/Makefile.kvm      |   2 +
>   .../testing/selftests/kvm/x86/int1_ept_test.c | 116 +++++++
>   .../selftests/kvm/x86/int1_task_gate_test.c   | 298 ++++++++++++++++++

y u no like kvm-unit-tests?  For the task gate test it's much simpler, 
as all the infrastructure for 32-bit IDT and GDT is already there, and 
there is no real KVM corner case being tested.

See 
https://lore.kernel.org/r/20260512210847.3039048-1-pbonzini@redhat.com/ 
for a conversion, which is about 1/6th of the size of int1_task_gate_test.c.

Paolo



  parent reply	other threads:[~2026-05-12 21:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 11:22 [PATCH] KVM: SVM: Always intercept ICEBP, add INT1 selftests David Woodhouse
2026-05-07 14:08 ` Sean Christopherson
2026-05-07 14:21   ` Andrew Cooper
2026-05-07 15:16     ` Sean Christopherson
2026-05-07 15:57       ` Sean Christopherson
2026-05-12 21:10 ` Paolo Bonzini [this message]
2026-05-12 21:33   ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9b76002a-dbd4-4f8f-8279-96ea0ff3966a@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=mingo@redhat.com \
    --cc=nsaenz@amazon.es \
    --cc=seanjc@google.com \
    --cc=shuah@kernel.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox