[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1724248680.git.legion@kernel.org>
Date: Wed, 21 Aug 2024 16:24:32 +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 v4 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.
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: Split MMIO read and write operations
x86/tdx: Add validation of userspace MMIO instructions
x86/tdx: Allow MMIO from userspace
x86/tdx: Add a restriction on access to MMIO address
x86/tdx: Move MMIO helpers to common library
x86/tdx: Implement movs for MMIO
arch/x86/coco/sev/core.c | 135 ++----------
arch/x86/coco/tdx/tdx.c | 340 ++++++++++++++++++++++++++-----
arch/x86/include/asm/io.h | 3 +
arch/x86/include/asm/processor.h | 4 +
arch/x86/lib/iomem.c | 125 ++++++++++++
5 files changed, 434 insertions(+), 173 deletions(-)
--
2.45.2
Powered by blists - more mailing lists