From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/4] RFC: split text and linear mappings using tagged pointers
Date: Mon, 23 Mar 2015 16:36:52 +0100 [thread overview]
Message-ID: <1427125016-3873-1-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20150317164353.GN23340@leverpostej>
This implements a split mapping of the kernel Image using the AArch64
tagged pointers feature. The kernel text is emitted with bit 56 cleared,
which can be used by the virt to phys translation to choose one translation
regime or another.
The purpose is to allow PHYS_OFFSET to start at an arbitrary offset below
the kernel image, so that memory below the kernel Image can be used, allowing
the Image to be loaded anywhere in physical memory.
This series moves the kernel text right below PAGE_OFFSET, next to the modules
area. PHYS_OFFSET is chosen to be a suitable aligned boundary somewhere below
the kernel Image (1 GB or 512 MB depending on chosen page size).
Output from a QEMU/EFI boot:
System RAM:
memory[0x0] [0x00000040000000-0x000000bfffffff], 0x80000000 bytes flags: 0x0
Kernel image:
reserved[0x0] [0x0000005f680000-0x0000005fe68fff], 0x7e9000 bytes flags: 0x0
Virtual kernel memory layout:
vmalloc : 0xffffff8000000000 - 0xffffffbdbfff0000 ( 246 GB)
vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000 ( 8 GB maximum)
0xffffffbdc1000000 - 0xffffffbdc3000000 ( 32 MB actual)
fixed : 0xffffffbff69fd000 - 0xffffffbff6c00000 ( 2060 KB)
PCI I/O : 0xffffffbff6e00000 - 0xffffffbff7e00000 ( 16 MB)
modules : 0xffffffbff8000000 - 0xffffffbffc000000 ( 64 MB)
memory : 0xffffffc000000000 - 0xffffffc080000000 ( 2048 MB)
.init : 0xfeffffbffc783000 - 0xfeffffbffc7c6000 ( 268 KB)
.text : 0xfeffffbffc080000 - 0xfeffffbffc782344 ( 7177 KB)
.data : 0xfeffffbffc7ca000 - 0xfeffffbffc830c00 ( 411 KB)
Note that this time, no relocations were harmed in the making of these
patches. With added relocation support, it should be possible to move
the combined modules and kernel text anywhere in the vmalloc area (for
kaslr)
There are probably some places where the cleared bit 56 in the virtual
address may cause trouble. Known problem is the module loader, but there
are surely others.
Ard Biesheuvel (4):
arm64: use tagged pointers to distinguish kernel text from the linear
mapping
arm64: fixmap: move translation tables to dedicated region
arm64: move kernel text below PAGE_OFFSET
arm64: align PHYS_OFFSET to block size
arch/arm64/include/asm/linkage.h | 2 ++
arch/arm64/include/asm/memory.h | 27 +++++++++++++++++--
arch/arm64/include/asm/pgtable-hwdef.h | 1 +
arch/arm64/kernel/head.S | 48 +++++++++++++++++++++++++---------
arch/arm64/kernel/vmlinux.lds.S | 19 +++++++++-----
arch/arm64/mm/mmu.c | 21 +++++++++------
arch/arm64/mm/proc.S | 3 ++-
7 files changed, 91 insertions(+), 30 deletions(-)
--
1.8.3.2
next prev parent reply other threads:[~2015-03-23 15:36 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-16 15:23 [RFC PATCH 0/3] arm64: relocatable kernel proof of concept Ard Biesheuvel
2015-03-16 15:23 ` [RFC PATCH 1/3] arm64: head.S: replace early literals with constant immediates Ard Biesheuvel
2015-03-16 17:14 ` Mark Rutland
2015-03-17 7:01 ` Ard Biesheuvel
2015-03-16 15:23 ` [RFC PATCH 2/3] arm64: add support for relocatable kernel Ard Biesheuvel
2015-03-16 15:23 ` [RFC PATCH 3/3] arm64/efi: use relocated kernel Ard Biesheuvel
2015-03-16 16:09 ` [RFC PATCH 0/3] arm64: relocatable kernel proof of concept Mark Rutland
2015-03-16 16:45 ` Ard Biesheuvel
2015-03-16 17:33 ` Mark Rutland
2015-03-16 17:43 ` Ard Biesheuvel
2015-03-17 16:20 ` Mark Rutland
2015-03-16 23:19 ` Kees Cook
2015-03-17 7:38 ` Ard Biesheuvel
2015-03-17 16:35 ` Mark Rutland
2015-03-17 16:40 ` Ard Biesheuvel
2015-03-17 16:43 ` Mark Rutland
2015-03-23 15:36 ` Ard Biesheuvel [this message]
2015-03-23 15:36 ` [PATCH 1/4] arm64: use tagged pointers to distinguish kernel text from the linear mapping Ard Biesheuvel
2015-03-25 14:04 ` Catalin Marinas
2015-03-26 1:27 ` Mark Rutland
2015-03-23 15:36 ` [PATCH 2/4] arm64: fixmap: move translation tables to dedicated region Ard Biesheuvel
2015-03-26 1:28 ` Mark Rutland
2015-03-26 6:20 ` Ard Biesheuvel
2015-03-30 14:34 ` Mark Rutland
2015-03-23 15:36 ` [PATCH 3/4] arm64: move kernel text below PAGE_OFFSET Ard Biesheuvel
2015-03-25 14:10 ` Catalin Marinas
2015-03-23 15:36 ` [PATCH 4/4] arm64: align PHYS_OFFSET to block size Ard Biesheuvel
2015-03-25 14:14 ` Catalin Marinas
2015-03-26 6:23 ` Ard Biesheuvel
2015-03-25 14:59 ` Catalin Marinas
2015-03-26 6:22 ` Ard Biesheuvel
2015-03-27 13:16 ` Ard Biesheuvel
2015-03-30 13:49 ` Catalin Marinas
2015-03-30 14:00 ` Ard Biesheuvel
2015-03-30 14:55 ` Mark Rutland
2015-03-30 15:00 ` Catalin Marinas
2015-03-30 18:08 ` Ard Biesheuvel
2015-03-31 14:49 ` Catalin Marinas
2015-03-31 16:19 ` Catalin Marinas
2015-03-31 16:46 ` Catalin Marinas
2015-03-26 1:26 ` [PATCH 0/4] RFC: split text and linear mappings using tagged pointers Mark Rutland
2015-03-26 6:09 ` Ard Biesheuvel
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=1427125016-3873-1-git-send-email-ard.biesheuvel@linaro.org \
--to=ard.biesheuvel@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).