From: Evgeniy Baskov <baskov@ispras.ru>
To: Borislav Petkov <bp@alien8.de>
Cc: Evgeniy Baskov <baskov@ispras.ru>,
Dave Hansen <dave.hansen@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Alexey Khoroshilov <khoroshilov@ispras.ru>
Subject: [RFC PATCH 0/8] x86_64: Harden compressed kernel, part 1
Date: Mon, 1 Aug 2022 19:38:57 +0300 [thread overview]
Message-ID: <cover.1659369873.git.baskov@ispras.ru> (raw)
This is the first half of changes aimed to increase security of early
boot code of compressed kernel for x86_64 by enforcing memory protection
on page table level.
It applies memory protection to the compressed kernel code executing
outside EFI environment and makes all identity mappings explicit
to reduce probability of hiding erroneous memory accesses.
Second half makes kernel more compliant PE image and enforces memory
protection for EFISTUB code, thus completing W^X support for compressed
kernel.
I'll send second half for review later.
Evgeniy Baskov (8):
x86/boot: Align vmlinuz sections on page size
x86/build: Remove RWX sections and align on 4KB
x86/boot: Set cr0 to known state in trampoline
x86/boot: Increase boot page table size
x86/boot: Support 4KB pages for identity mapping
x86/boot: Setup memory protection for bzImage code
x86/boot: Map memory explicitly
x86/boot: Remove mapping from page fault handler
arch/x86/boot/compressed/acpi.c | 21 ++-
arch/x86/boot/compressed/efi.c | 19 ++-
arch/x86/boot/compressed/head_64.S | 7 +-
arch/x86/boot/compressed/ident_map_64.c | 128 ++++++++++------
arch/x86/boot/compressed/kaslr.c | 4 +
arch/x86/boot/compressed/misc.c | 52 ++++++-
arch/x86/boot/compressed/misc.h | 16 +-
arch/x86/boot/compressed/pgtable.h | 20 ---
arch/x86/boot/compressed/pgtable_64.c | 2 +-
arch/x86/boot/compressed/sev.c | 6 +-
arch/x86/boot/compressed/vmlinux.lds.S | 6 +
arch/x86/include/asm/boot.h | 26 ++--
arch/x86/include/asm/init.h | 1 +
arch/x86/include/asm/shared/pgtable.h | 29 ++++
arch/x86/kernel/vmlinux.lds.S | 15 +-
arch/x86/mm/ident_map.c | 186 ++++++++++++++++++++----
16 files changed, 403 insertions(+), 135 deletions(-)
delete mode 100644 arch/x86/boot/compressed/pgtable.h
create mode 100644 arch/x86/include/asm/shared/pgtable.h
--
2.35.1
next reply other threads:[~2022-08-01 16:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 16:38 Evgeniy Baskov [this message]
2022-08-01 16:38 ` [PATCH 1/8] x86/boot: Align vmlinuz sections on page size Evgeniy Baskov
2022-08-01 16:38 ` [PATCH 2/8] x86/build: Remove RWX sections and align on 4KB Evgeniy Baskov
2022-08-01 16:39 ` [PATCH 3/8] x86/boot: Set cr0 to known state in trampoline Evgeniy Baskov
2022-08-01 16:39 ` [PATCH 4/8] x86/boot: Increase boot page table size Evgeniy Baskov
2022-08-01 16:39 ` [PATCH 5/8] x86/boot: Support 4KB pages for identity mapping Evgeniy Baskov
2022-08-01 16:39 ` [PATCH 6/8] x86/boot: Setup memory protection for bzImage code Evgeniy Baskov
2022-08-01 16:39 ` [PATCH 7/8] x86/boot: Map memory explicitly Evgeniy Baskov
2022-08-01 16:39 ` [PATCH 8/8] x86/boot: Remove mapping from page fault handler Evgeniy Baskov
2022-08-01 16:48 ` [RFC PATCH 0/8] x86_64: Harden compressed kernel, part 1 Dave Hansen
2022-08-02 0:25 ` Evgeniy Baskov
2022-08-02 2:41 ` Dave Hansen
2022-08-02 23:45 ` Evgeniy Baskov
2022-08-03 14:05 ` Dave Hansen
2022-08-04 10:41 ` Evgeniy Baskov
2022-08-04 11:22 ` Greg KH
2022-08-04 14:26 ` Evgeniy Baskov
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.1659369873.git.baskov@ispras.ru \
--to=baskov@ispras.ru \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=khoroshilov@ispras.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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