From: Tim Merrifield <tim.merrifield@broadcom.com>
To: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
Xin Li <xin3.li@intel.com>,
Tim Merrifield <tim.merrifield@broadcom.com>,
Ard Biesheuvel <ardb@kernel.org>, Kai Huang <kai.huang@intel.com>,
Kevin Loughlin <kevinloughlin@google.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Kees Cook <kees@kernel.org>, Mike Rapoport <rppt@kernel.org>,
Brian Gerst <brgerst@gmail.com>,
linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org,
Ajay Kaher <ajay.kaher@broadcom.com>,
Alexey Makhalov <alexey.makhalov@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
virtualization@lists.linux.dev, alex.james@broadcom.com,
doug.covelli@broadcom.com, jeffrey.sheldon@broadcom.com,
kevin.christopher@broadcom.com,
aravind-as.srinivasan@broadcom.com, ravindra.kumar@broadcom.com
Subject: [PATCH v2 0/2] Support userspace hypercalls for TDX
Date: Fri, 26 Jul 2024 18:57:59 +0000 [thread overview]
Message-ID: <cover.1722019360.git.tim.merrifield@broadcom.com> (raw)
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
next reply other threads:[~2024-07-26 18:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 18:57 Tim Merrifield [this message]
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
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=cover.1722019360.git.tim.merrifield@broadcom.com \
--to=tim.merrifield@broadcom.com \
--cc=ajay.kaher@broadcom.com \
--cc=alex.james@broadcom.com \
--cc=alexey.makhalov@broadcom.com \
--cc=aravind-as.srinivasan@broadcom.com \
--cc=ardb@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=doug.covelli@broadcom.com \
--cc=hpa@zytor.com \
--cc=jeffrey.sheldon@broadcom.com \
--cc=kai.huang@intel.com \
--cc=kees@kernel.org \
--cc=kevin.christopher@broadcom.com \
--cc=kevinloughlin@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=ravindra.kumar@broadcom.com \
--cc=rick.p.edgecombe@intel.com \
--cc=rppt@kernel.org \
--cc=tglx@linutronix.de \
--cc=tzimmermann@suse.de \
--cc=virtualization@lists.linux.dev \
--cc=x86@kernel.org \
--cc=xin3.li@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).