linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Support userspace hypercalls for TDX
@ 2024-07-26 18:57 Tim Merrifield
  2024-07-26 18:58 ` [PATCH v2 1/2] Add prctl to allow userlevel TDX hypercalls Tim Merrifield
  2024-07-26 18:58 ` [PATCH v2 2/2] x86/vmware: VMware support for TDX userspace hypercalls Tim Merrifield
  0 siblings, 2 replies; 6+ messages in thread
From: Tim Merrifield @ 2024-07-26 18:57 UTC (permalink / raw)
  To: Kirill A . Shutemov, Dave Hansen, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H . Peter Anvin, Xin Li, Tim Merrifield,
	Ard Biesheuvel, Kai Huang, Kevin Loughlin, Thomas Zimmermann,
	Rick Edgecombe, Kees Cook, Mike Rapoport, Brian Gerst, linux-coco,
	linux-kernel, Ajay Kaher, Alexey Makhalov,
	Broadcom internal kernel review list, virtualization, alex.james,
	doug.covelli, jeffrey.sheldon, kevin.christopher,
	aravind-as.srinivasan, ravindra.kumar

Hypercall instructions like VMCALL and VMMCALL are not restricted to CPL 0.
This allows userspace software like open-vm-tools to communicate directly
with the VMM.

For TDX VMs, this communication may violate the security model. Today,
VMCALLs are not forwarded to the host VMM, which breaks open-vm-tools
and any other userspace software that uses VMCALL.

But if userspace is aware of the risks and has been hardened to
address any known violations of the security model, then it seems
reasonable to allow hypercalls from this process to proceed.

This patchset introduces a new x86 process control flag to address this
concern. By setting the MM_CONTEXT_COCO_USER_HCALL flag, the process opts
in to user-level hypercalls. When TDX is enabled, the VMCALL will #VE and
control will be transferred to a hypervisor-specific hypercall handler
(similar to how things work today for SEV with
sev_es_hcall_prepare/sev_es_hcall_finish). The flag has no effect on
non-TDX VMs. Other confidential computing technologies could use this flag
to provide limited access to user-level hypercalls.

v1->v2 changes:
- Updated coverletter to get to the point a little faster.
- Patch 1: Changed to use a per-process flag rather than a per-thread
flag, based on feedback from Kirill Shutemov. I believe this also addresses
the issue of inheritance raised by Dave Hansen.
- Patch 1: Refactored the logic in tdx.c to be made more clear. Also,
tdx_hcall now returns an error code. Both suggested by Kirill.
- Patch 2: We now zero tdx_module_args to prevent data leakage to the VMM,
pointed out by Kirill.

Tim Merrifield (2):
  Add prctl to allow userlevel TDX hypercalls
  x86/vmware: VMware support for TDX userspace hypercalls

 arch/x86/coco/tdx/tdx.c           | 23 ++++++++++++++
 arch/x86/include/asm/mmu.h        |  2 ++
 arch/x86/include/asm/x86_init.h   |  1 +
 arch/x86/include/uapi/asm/prctl.h |  3 ++
 arch/x86/kernel/cpu/vmware.c      | 51 ++++++++++++++++++++++++-------
 arch/x86/kernel/process.c         | 22 +++++++++++++
 6 files changed, 91 insertions(+), 11 deletions(-)

-- 
2.40.1


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

end of thread, other threads:[~2024-08-02 12:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26 18:57 [PATCH v2 0/2] Support userspace hypercalls for TDX Tim Merrifield
2024-07-26 18:58 ` [PATCH v2 1/2] Add prctl to allow userlevel TDX hypercalls Tim Merrifield
2024-07-27  7:13   ` kernel test robot
2024-07-27  7:24   ` kernel test robot
2024-08-02 12:47   ` Kirill A . Shutemov
2024-07-26 18:58 ` [PATCH v2 2/2] x86/vmware: VMware support for TDX userspace hypercalls Tim Merrifield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).