From: <gregkh@linuxfoundation.org>
To: mark.rutland@arm.com, alex.shi@linaro.org, ghackmann@google.com,
gregkh@linuxfoundation.org, labbott@redhat.com,
shankerd@codeaurora.org, will.deacon@arm.com
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "arm64: mm: Map entry trampoline into trampoline and kernel page tables" has been added to the 4.9-stable tree
Date: Thu, 05 Apr 2018 21:42:33 +0200 [thread overview]
Message-ID: <152295735389109@kroah.com> (raw)
In-Reply-To: <20180403110923.43575-10-mark.rutland@arm.com>
This is a note to let you know that I've just added the patch titled
arm64: mm: Map entry trampoline into trampoline and kernel page tables
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm64-mm-map-entry-trampoline-into-trampoline-and-kernel-page-tables.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From foo@baz Thu Apr 5 21:39:27 CEST 2018
From: Mark Rutland <mark.rutland@arm.com>
Date: Tue, 3 Apr 2018 12:09:05 +0100
Subject: arm64: mm: Map entry trampoline into trampoline and kernel page tables
To: stable@vger.kernel.org
Cc: mark.brown@linaro.org, ard.biesheuvel@linaro.org, marc.zyngier@arm.com, will.deacon@arm.com
Message-ID: <20180403110923.43575-10-mark.rutland@arm.com>
From: Will Deacon <will.deacon@arm.com>
commit 51a0048beb44 upstream.
The exception entry trampoline needs to be mapped at the same virtual
address in both the trampoline page table (which maps nothing else)
and also the kernel page table, so that we can swizzle TTBR1_EL1 on
exceptions from and return to EL0.
This patch maps the trampoline at a fixed virtual address in the fixmap
area of the kernel virtual address space, which allows the kernel proper
to be randomized with respect to the trampoline when KASLR is enabled.
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Laura Abbott <labbott@redhat.com>
Tested-by: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Alex Shi <alex.shi@linaro.org>
Signed-off-by: Mark Rutland <mark.rutland@arm.com> [v4.9 backport]
Tested-by: Will Deacon <will.deacon@arm.com>
Tested-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/include/asm/fixmap.h | 5 +++++
arch/arm64/include/asm/pgtable.h | 1 +
arch/arm64/kernel/asm-offsets.c | 6 +++++-
arch/arm64/mm/mmu.c | 23 +++++++++++++++++++++++
4 files changed, 34 insertions(+), 1 deletion(-)
--- a/arch/arm64/include/asm/fixmap.h
+++ b/arch/arm64/include/asm/fixmap.h
@@ -51,6 +51,11 @@ enum fixed_addresses {
FIX_EARLYCON_MEM_BASE,
FIX_TEXT_POKE0,
+
+#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
+ FIX_ENTRY_TRAMP_TEXT,
+#define TRAMP_VALIAS (__fix_to_virt(FIX_ENTRY_TRAMP_TEXT))
+#endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */
__end_of_permanent_fixed_addresses,
/*
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -692,6 +692,7 @@ static inline void pmdp_set_wrprotect(st
extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
extern pgd_t idmap_pg_dir[PTRS_PER_PGD];
+extern pgd_t tramp_pg_dir[PTRS_PER_PGD];
/*
* Encode and decode a swap entry:
--- a/arch/arm64/kernel/asm-offsets.c
+++ b/arch/arm64/kernel/asm-offsets.c
@@ -24,6 +24,7 @@
#include <linux/kvm_host.h>
#include <linux/suspend.h>
#include <asm/cpufeature.h>
+#include <asm/fixmap.h>
#include <asm/thread_info.h>
#include <asm/memory.h>
#include <asm/smp_plat.h>
@@ -144,11 +145,14 @@ int main(void)
DEFINE(ARM_SMCCC_RES_X2_OFFS, offsetof(struct arm_smccc_res, a2));
DEFINE(ARM_SMCCC_QUIRK_ID_OFFS, offsetof(struct arm_smccc_quirk, id));
DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS, offsetof(struct arm_smccc_quirk, state));
-
BLANK();
DEFINE(HIBERN_PBE_ORIG, offsetof(struct pbe, orig_address));
DEFINE(HIBERN_PBE_ADDR, offsetof(struct pbe, address));
DEFINE(HIBERN_PBE_NEXT, offsetof(struct pbe, next));
DEFINE(ARM64_FTR_SYSVAL, offsetof(struct arm64_ftr_reg, sys_val));
+ BLANK();
+#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
+ DEFINE(TRAMP_VALIAS, TRAMP_VALIAS);
+#endif
return 0;
}
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -419,6 +419,29 @@ static void __init map_kernel_segment(pg
vm_area_add_early(vma);
}
+#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
+static int __init map_entry_trampoline(void)
+{
+ extern char __entry_tramp_text_start[];
+
+ pgprot_t prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
+ phys_addr_t pa_start = __pa_symbol(__entry_tramp_text_start);
+
+ /* The trampoline is always mapped and can therefore be global */
+ pgprot_val(prot) &= ~PTE_NG;
+
+ /* Map only the text into the trampoline page table */
+ memset(tramp_pg_dir, 0, PGD_SIZE);
+ __create_pgd_mapping(tramp_pg_dir, pa_start, TRAMP_VALIAS, PAGE_SIZE,
+ prot, pgd_pgtable_alloc, 0);
+
+ /* ...as well as the kernel page table */
+ __set_fixmap(FIX_ENTRY_TRAMP_TEXT, pa_start, prot);
+ return 0;
+}
+core_initcall(map_entry_trampoline);
+#endif
+
/*
* Create fine-grained mappings for the kernel.
*/
Patches currently in stable-queue which might be from mark.rutland@arm.com are
queue-4.9/arm64-mm-add-arm64_kernel_unmapped_at_el0-helper.patch
queue-4.9/arm64-entry-reword-comment-about-post_ttbr_update_workaround.patch
queue-4.9/arm64-kaslr-put-kernel-vectors-address-in-separate-data-page.patch
queue-4.9/arm64-turn-on-kpti-only-on-cpus-that-need-it.patch
queue-4.9/arm64-force-kpti-to-be-disabled-on-cavium-thunderx.patch
queue-4.9/arm64-mm-allocate-asids-in-pairs.patch
queue-4.9/arm64-tls-avoid-unconditional-zeroing-of-tpidrro_el0-for-native-tasks.patch
queue-4.9/arm64-use-ret-instruction-for-exiting-the-trampoline.patch
queue-4.9/arm64-entry-explicitly-pass-exception-level-to-kernel_ventry-macro.patch
queue-4.9/arm64-kpti-make-use-of-ng-dependent-on-arm64_kernel_unmapped_at_el0.patch
queue-4.9/arm64-mm-use-non-global-mappings-for-kernel-space.patch
queue-4.9/arm64-capabilities-handle-duplicate-entries-for-a-capability.patch
queue-4.9/arm64-entry-hook-up-entry-trampoline-to-exception-vectors.patch
queue-4.9/arm64-mm-invalidate-both-kernel-and-user-asids-when-performing-tlbi.patch
queue-4.9/arm64-mm-map-entry-trampoline-into-trampoline-and-kernel-page-tables.patch
queue-4.9/module-extend-rodata-off-boot-cmdline-parameter-to-module-mappings.patch
queue-4.9/arm64-kconfig-reword-unmap_kernel_at_el0-kconfig-entry.patch
queue-4.9/arm64-mm-move-asid-from-ttbr0-to-ttbr1.patch
queue-4.9/arm64-allow-checking-of-a-cpu-local-erratum.patch
queue-4.9/arm64-take-into-account-id_aa64pfr0_el1.csv3.patch
queue-4.9/arm64-kconfig-add-config_unmap_kernel_at_el0.patch
queue-4.9/arm64-idmap-use-awx-flags-for-.idmap.text-.pushsection-directives.patch
queue-4.9/arm64-factor-out-entry-stack-manipulation.patch
queue-4.9/arm64-entry-add-exception-trampoline-page-for-exceptions-from-el0.patch
queue-4.9/arm64-kpti-add-enable-callback-to-remap-swapper-using-ng-mappings.patch
queue-4.9/arm64-entry-add-fake-cpu-feature-for-unmapping-the-kernel-at-el0.patch
queue-4.9/arm64-cputype-add-midr-values-for-cavium-thunderx2-cpus.patch
next prev parent reply other threads:[~2018-04-05 19:43 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-03 11:08 [PATCH v4.9.y 00/27] arm64 meltdown patches Mark Rutland
2018-04-03 11:08 ` [PATCH v4.9.y 01/27] arm64: mm: Use non-global mappings for kernel space Mark Rutland
2018-04-05 19:42 ` Patch "arm64: mm: Use non-global mappings for kernel space" has been added to the 4.9-stable tree gregkh
2018-04-03 11:08 ` [PATCH v4.9.y 02/27] arm64: mm: Move ASID from TTBR0 to TTBR1 Mark Rutland
2018-04-05 19:42 ` Patch "arm64: mm: Move ASID from TTBR0 to TTBR1" has been added to the 4.9-stable tree gregkh
2018-04-03 11:08 ` [PATCH v4.9.y 03/27] arm64: mm: Allocate ASIDs in pairs Mark Rutland
2018-04-05 19:42 ` Patch "arm64: mm: Allocate ASIDs in pairs" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 04/27] arm64: mm: Add arm64_kernel_unmapped_at_el0 helper Mark Rutland
2018-04-05 19:42 ` Patch "arm64: mm: Add arm64_kernel_unmapped_at_el0 helper" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 05/27] arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI Mark Rutland
2018-04-05 19:42 ` Patch "arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 06/27] arm64: factor out entry stack manipulation Mark Rutland
2018-04-05 19:42 ` Patch "arm64: factor out entry stack manipulation" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 07/27] module: extend 'rodata=off' boot cmdline parameter to module mappings Mark Rutland
2018-04-05 19:42 ` Patch "module: extend 'rodata=off' boot cmdline parameter to module mappings" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 08/27] arm64: entry: Add exception trampoline page for exceptions from EL0 Mark Rutland
2018-04-05 19:42 ` Patch "arm64: entry: Add exception trampoline page for exceptions from EL0" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 09/27] arm64: mm: Map entry trampoline into trampoline and kernel page tables Mark Rutland
2018-04-03 11:15 ` Mark Rutland
2018-04-05 19:33 ` Greg KH
2018-04-05 19:42 ` gregkh [this message]
2018-04-03 11:09 ` [PATCH v4.9.y 10/27] arm64: entry: Explicitly pass exception level to kernel_ventry macro Mark Rutland
2018-04-05 19:42 ` Patch "arm64: entry: Explicitly pass exception level to kernel_ventry macro" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 11/27] arm64: entry: Hook up entry trampoline to exception vectors Mark Rutland
2018-04-05 19:42 ` Patch "arm64: entry: Hook up entry trampoline to exception vectors" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 12/27] arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks Mark Rutland
2018-04-05 19:42 ` Patch "arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 13/27] arm64: entry: Add fake CPU feature for unmapping the kernel at EL0 Mark Rutland
2018-04-05 19:42 ` Patch "arm64: entry: Add fake CPU feature for unmapping the kernel at EL0" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 14/27] arm64: kaslr: Put kernel vectors address in separate data page Mark Rutland
2018-04-05 19:42 ` Patch "arm64: kaslr: Put kernel vectors address in separate data page" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 15/27] arm64: use RET instruction for exiting the trampoline Mark Rutland
2018-04-05 19:42 ` Patch "arm64: use RET instruction for exiting the trampoline" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 16/27] arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0 Mark Rutland
2018-04-05 19:42 ` Patch "arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 17/27] arm64: Kconfig: Reword UNMAP_KERNEL_AT_EL0 kconfig entry Mark Rutland
2018-04-05 19:42 ` Patch "arm64: Kconfig: Reword UNMAP_KERNEL_AT_EL0 kconfig entry" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 18/27] arm64: Take into account ID_AA64PFR0_EL1.CSV3 Mark Rutland
2018-04-05 19:42 ` Patch "arm64: Take into account ID_AA64PFR0_EL1.CSV3" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 19/27] arm64: Allow checking of a CPU-local erratum Mark Rutland
2018-04-05 19:42 ` Patch "arm64: Allow checking of a CPU-local erratum" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 20/27] arm64: capabilities: Handle duplicate entries for a capability Mark Rutland
2018-04-05 19:42 ` Patch "arm64: capabilities: Handle duplicate entries for a capability" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 21/27] arm64: cputype: Add MIDR values for Cavium ThunderX2 CPUs Mark Rutland
2018-04-05 19:42 ` Patch "arm64: cputype: Add MIDR values for Cavium ThunderX2 CPUs" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 22/27] arm64: Turn on KPTI only on CPUs that need it Mark Rutland
2018-04-05 19:42 ` Patch "arm64: Turn on KPTI only on CPUs that need it" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 23/27] arm64: kpti: Make use of nG dependent on arm64_kernel_unmapped_at_el0() Mark Rutland
2018-04-05 19:42 ` Patch "arm64: kpti: Make use of nG dependent on arm64_kernel_unmapped_at_el0()" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 24/27] arm64: kpti: Add ->enable callback to remap swapper using nG mappings Mark Rutland
2018-04-05 19:42 ` Patch "arm64: kpti: Add ->enable callback to remap swapper using nG mappings" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 25/27] arm64: Force KPTI to be disabled on Cavium ThunderX Mark Rutland
2018-04-05 19:42 ` Patch "arm64: Force KPTI to be disabled on Cavium ThunderX" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 26/27] arm64: entry: Reword comment about post_ttbr_update_workaround Mark Rutland
2018-04-05 19:42 ` Patch "arm64: entry: Reword comment about post_ttbr_update_workaround" has been added to the 4.9-stable tree gregkh
2018-04-03 11:09 ` [PATCH v4.9.y 27/27] arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives Mark Rutland
2018-04-05 19:42 ` Patch "arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives" has been added to the 4.9-stable tree gregkh
2018-04-04 15:07 ` [PATCH v4.9.y 00/27] arm64 meltdown patches Greg KH
2018-04-05 10:04 ` Will Deacon
2018-04-05 10:15 ` Mark Rutland
2018-04-05 11:46 ` Will Deacon
2018-04-05 17:34 ` Greg Hackmann
2018-04-05 19:15 ` Greg KH
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=152295735389109@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=alex.shi@linaro.org \
--cc=ghackmann@google.com \
--cc=labbott@redhat.com \
--cc=mark.rutland@arm.com \
--cc=shankerd@codeaurora.org \
--cc=stable-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=will.deacon@arm.com \
/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).