[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1725622408.git.legion@kernel.org>
Date: Fri, 6 Sep 2024 13:49:58 +0200
From: Alexey Gladkov <legion@...nel.org>
To: linux-kernel@...r.kernel.org,
linux-coco@...ts.linux.dev
Cc: "Alexey Gladkov (Intel)" <legion@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Yuan Yao <yuan.yao@...el.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Yuntao Wang <ytcoode@...il.com>,
Kai Huang <kai.huang@...el.com>,
Baoquan He <bhe@...hat.com>,
Oleg Nesterov <oleg@...hat.com>,
cho@...rosoft.com,
decui@...rosoft.com,
John.Starks@...rosoft.com
Subject: [PATCH v6 0/6] x86/tdx: Allow MMIO instructions from userspace
From: "Alexey Gladkov (Intel)" <legion@...nel.org>
Currently, MMIO inside the TDX guest is allowed from kernel space and access
from userspace is denied. This becomes a problem when working with virtual
devices in userspace.
In TDX guest MMIO instructions are emulated in #VE. The kernel code uses special
helpers to access MMIO memory to limit the number of instructions which are
used.
This patchset makes MMIO accessible from userspace. To do this additional checks
were added to ensure that the emulated instruction will not be compromised.
v6:
- Reorder patches and change commit messages.
v5:
- Improve commit messages and comments in commits as suggested by Kirill A. Shutemov.
- To emulate MOVS, instead of storing the entire address, started using a flag.
v4:
- Move patches to avoid crossing the page boundary to separate patchset. They
address separate issue.
- Check the address only in user context and in case of nested exceptions.
- Fix the check that the address does not point to private memory.
v3:
- Add patches to avoid crossing the page boundary when the instruction is read
and decoded in the TDX, SEV, UMIP.
- Forbid accessing userspace addresses from kernel space. The exception to this
is when emulating MOVS instructions.
- Fix address validation during MOVS emulation.
v2:
- Split into separate patches AMD helpers extraction and MOVS implementation
code for intel as suggested by Thomas Gleixner.
- Fix coding style issues.
Alexey Gladkov (Intel) (6):
x86/tdx: Fix "in-kernel MMIO" check
x86/tdx: Split MMIO read and write operations
x86/tdx: Add validation of userspace MMIO instructions
x86/tdx: Allow MMIO from userspace
x86/tdx: Move MMIO helpers to common library
x86/tdx: Implement MOVS for MMIO
arch/x86/coco/sev/core.c | 139 ++-----------
arch/x86/coco/tdx/tdx.c | 338 ++++++++++++++++++++++++++-----
arch/x86/include/asm/io.h | 3 +
arch/x86/include/asm/processor.h | 3 +
arch/x86/lib/iomem.c | 115 +++++++++++
5 files changed, 429 insertions(+), 169 deletions(-)
--
2.46.0
Powered by blists - more mailing lists