All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Paolo Bonzini <pbonzini@redhat.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,
	 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: Thu, 7 May 2026 07:08:02 -0700	[thread overview]
Message-ID: <afycwi4KT6xrQhMX@google.com> (raw)
In-Reply-To: <e03f092dfbb7d391a6bf2797ba01e122ba080bcd.camel@infradead.org>

On Thu, May 07, 2026, 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.

Hmm, but KVM unconditionally intercepts task switches.  Is this effectively working
around a bug in task_switch_interception()?

> 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 ++++++++++++++++++
>  4 files changed, 437 insertions(+)
>  create mode 100644 tools/testing/selftests/kvm/x86/int1_ept_test.c

int1_host_page_fault_test?  I definitely dont' want to call it "ept" since it's
valid for both Intel (EPT) and AMD (NPT), but int1_tdp_test isn't accurate either
since the test is also valid for shadow paging (at least, as written).

  reply	other threads:[~2026-05-07 14:08 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 [this message]
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
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=afycwi4KT6xrQhMX@google.com \
    --to=seanjc@google.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=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.