[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC v1 0/7] x86/hvm: Start unifying VMEXIT and emulated paths


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Date: Mon, 18 May 2026 14:13:57 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u8rRp+XT6d1dIZLxltye5ArmuW4P4fmwGrddNG+ri2Y=; b=mEThNuDqI6C4y1F9VTlFi1YAkj9AOLR/jkPjOVJdE/fCfH0FYaczlzQeewchE7IMkXjjDHe2cPZbjdVnDjmnnmXe3HXwLK4cluS7PcWfp9Ic9qD/N6ZCmYuEHGaZAstNIy00ut/o+mLkBGja5oO9nUsZuwsdhJP872q8P2v92mhYk68/OJQ2kVyOaeqvmNRtteD7r/OB22KwX2FQX/1kG5fpmBw4ThJ/5TRzyyz65baevj3wkWq4a7URa7q4C4aZExVogF5i9oIXv73waJ853Zp83j7uy9GKuEfIsnWdS4cU4hm9X9FCIfqzyla8WtEC2G8JHNYsOTYGE8njQg3F1g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q9eK/fhw6v7L/F3pP5ohKLYFBcy8OLMueS6LmjqlWItaUnSUME8dce+dNzjj3pfmmtNhmVPcRVCcsS10L4NNTefVgJVE3V256H9kvlS9sYkriOxfcwgzxsBQGwUCYE6fFPSzLSDtadWhWC26pei4WGM8TWaeCsBRze9TuTcVdzJoIJxYFq84WwsoElgKDILiL7qrghTSTqjaap8dDfTh0nCVT+aTGuIHe5pEvmOs6qdx5qDL70ZbiGxkEjesVttm1V1mAavTygJFUfZLP38szk/cXlwFmoF9Sq7nbdhee8jAt58ZZaN7HzYo6Aa0WAXapvBqGwT4EX+vagGjBXCTlQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>
  • Delivery-date: Mon, 18 May 2026 13:14:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi,

There are differences in instruction execution when coming from a VMEXIT
vs a fully emulated path. This can result in subtle bugs, e.g. injecting
#GP with trap rather than fault semantics. When using nested virt, these
bugs may become security issues if it allows L2 to attack L1 (because
L0 has done something unexpected).

To fix this, we plan to unify the VMEXIT (fast) path and emulated
instruction paths with everything going through the emulator but the
fast path short-circuiting some parts. This patch series adds the basic
infrastructure and converts two SVM VMEXITs: halt and read/write CR

The other motivation to do this work is to arrange it so that there is only
a single place where Xen needs to consider whether an instruction/event
is something that L1 cares about.

This is very much an RFC at this point so I'm mainly looking for
feedback on the overall approach.

Thanks,
Ross

Ross Lagerwall (7):
  x86/hvm: Move description into hvm_emulate_ctxt
  x86/hvm: Introduce hvm_emulate_one_ctxt
  x86/emul: Separate out instruction completion
  x86/hvm: Support a fast path during emulation
  x86/hvm: Move INSTR_* constants to hvm.h
  x86/svm: Use the emulator path for VMEXIT_HLT
  x86/svm: Use the emulator path for VMEXIT_CR*

 xen/arch/x86/hvm/emulate.c             | 180 +++++++++++++++++++------
 xen/arch/x86/hvm/hvm.c                 |   2 +-
 xen/arch/x86/hvm/io.c                  |  19 ++-
 xen/arch/x86/hvm/ioreq.c               |   2 +-
 xen/arch/x86/hvm/svm/emulate.c         |   6 +-
 xen/arch/x86/hvm/svm/svm.c             |  52 +++----
 xen/arch/x86/hvm/svm/svm.h             |  30 +----
 xen/arch/x86/hvm/vmx/realmode.c        |   2 +-
 xen/arch/x86/include/asm/hvm/emulate.h |  13 ++
 xen/arch/x86/include/asm/hvm/hvm.h     |  31 +++++
 xen/arch/x86/x86_emulate/x86_emulate.c |  48 ++++---
 xen/arch/x86/x86_emulate/x86_emulate.h |   3 +
 12 files changed, 252 insertions(+), 136 deletions(-)

-- 
2.53.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.