[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240214113516.2307-1-petrtesarik@huaweicloud.com>
Date: Wed, 14 Feb 2024 12:35:08 +0100
From: Petr Tesarik <petrtesarik@...weicloud.com>
To: Jonathan Corbet <corbet@....net>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Oleg Nesterov <oleg@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Xin Li <xin3.li@...el.com>,
Arnd Bergmann <arnd@...db.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Rick Edgecombe <rick.p.edgecombe@...el.com>,
Kees Cook <keescook@...omium.org>,
"Masami Hiramatsu (Google)" <mhiramat@...nel.org>,
Pengfei Xu <pengfei.xu@...el.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Ze Gao <zegao2021@...il.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Kai Huang <kai.huang@...el.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Brian Gerst <brgerst@...il.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Joerg Roedel <jroedel@...e.de>,
"Mike Rapoport (IBM)" <rppt@...nel.org>,
Tina Zhang <tina.zhang@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
linux-doc@...r.kernel.org (open list:DOCUMENTATION),
linux-kernel@...r.kernel.org (open list)
Cc: Roberto Sassu <roberto.sassu@...weicloud.com>,
petr@...arici.cz,
Petr Tesarik <petr.tesarik1@...wei-partners.com>
Subject: [PATCH v1 0/8] x86_64 SandBox Mode arch hooks
From: Petr Tesarik <petr.tesarik1@...wei-partners.com>
This patch series implements x86_64 arch hooks for the generic SandBox
Mode infrastructure.
SandBox Mode on x86_64 is implemented as follows:
* The target function runs with CPL 3 (same as user mode) within its
own virtual address space.
* Interrupt entry/exit paths are modified to let the interrupt handlers
always run with kernel CR3 and restore sandbox CR3 when returning to
sandbox mode.
* To avoid undesirable user mode processing (FPU state, signals, etc.),
the value of pt_regs->cs is temporarily adjusted to make it look like
coming from kernel mode.
* On a CPU fault, execution stops immediately, returning -EFAULT to
the caller.
Petr Tesarik (8):
sbm: x86: page table arch hooks
sbm: x86: execute target function on sandbox mode stack
sbm: x86: map system data structures into the sandbox
sbm: x86: allocate and map an exception stack
sbm: x86: handle sandbox mode faults
sbm: x86: switch to sandbox mode pages in arch_sbm_exec()
sbm: documentation of the x86-64 SandBox Mode implementation
sbm: x86: lazy TLB flushing
Documentation/security/sandbox-mode.rst | 25 ++
arch/x86/Kconfig | 1 +
arch/x86/entry/entry_64.S | 123 ++++++
arch/x86/include/asm/page_64_types.h | 1 +
arch/x86/include/asm/ptrace.h | 21 +
arch/x86/include/asm/sbm.h | 83 ++++
arch/x86/include/asm/segment.h | 7 +
arch/x86/include/asm/thread_info.h | 3 +
arch/x86/kernel/Makefile | 2 +
arch/x86/kernel/asm-offsets.c | 10 +
arch/x86/kernel/sbm/Makefile | 16 +
arch/x86/kernel/sbm/call_64.S | 95 +++++
arch/x86/kernel/sbm/core.c | 499 ++++++++++++++++++++++++
arch/x86/kernel/traps.c | 14 +-
arch/x86/mm/fault.c | 6 +
15 files changed, 905 insertions(+), 1 deletion(-)
create mode 100644 arch/x86/include/asm/sbm.h
create mode 100644 arch/x86/kernel/sbm/Makefile
create mode 100644 arch/x86/kernel/sbm/call_64.S
create mode 100644 arch/x86/kernel/sbm/core.c
--
2.34.1
Powered by blists - more mailing lists