diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2018-07-03 22:55:19 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2018-07-03 22:55:19 -0400 |
commit | 5c36a96b758250d11a62e8397854df17dfb0369f (patch) | |
tree | b962780ed2494488f65c414c3b92a52c326a586a | |
parent | d04f2d0641bf6b96dda95e48a1beaf338a3386db (diff) | |
download | longterm-queue-4.12-5c36a96b758250d11a62e8397854df17dfb0369f.tar.gz |
arm64: drop sw-pan patches n/a for 4.12
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | queue/arm64-SW-PAN-Point-saved-ttbr0-at-the-zero-page-when.patch | 92 | ||||
-rw-r--r-- | queue/arm64-SW-PAN-Update-saved-ttbr0-value-on-enter_lazy_.patch | 73 | ||||
-rw-r--r-- | queue/series | 2 |
3 files changed, 0 insertions, 167 deletions
diff --git a/queue/arm64-SW-PAN-Point-saved-ttbr0-at-the-zero-page-when.patch b/queue/arm64-SW-PAN-Point-saved-ttbr0-at-the-zero-page-when.patch deleted file mode 100644 index 7e79aeb..0000000 --- a/queue/arm64-SW-PAN-Point-saved-ttbr0-at-the-zero-page-when.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 0adbdfde8cfc9415aeed2a4955d2d17b3bd9bf13 Mon Sep 17 00:00:00 2001 -From: Will Deacon <will.deacon@arm.com> -Date: Wed, 6 Dec 2017 10:42:10 +0000 -Subject: [PATCH] arm64: SW PAN: Point saved ttbr0 at the zero page when - switching to init_mm - -commit 0adbdfde8cfc9415aeed2a4955d2d17b3bd9bf13 upstream. - -update_saved_ttbr0 mandates that mm->pgd is not swapper, since swapper -contains kernel mappings and should never be installed into ttbr0. However, -this means that callers must avoid passing the init_mm to update_saved_ttbr0 -which in turn can cause the saved ttbr0 value to be out-of-date in the context -of the idle thread. For example, EFI runtime services may leave the saved ttbr0 -pointing at the EFI page table, and kernel threads may end up with stale -references to freed page tables. - -This patch changes update_saved_ttbr0 so that the init_mm points the saved -ttbr0 value to the empty zero page, which always exists and never contains -valid translations. EFI and switch can then call into update_saved_ttbr0 -unconditionally. - -Cc: Mark Rutland <mark.rutland@arm.com> -Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> -Cc: Vinayak Menon <vinmenon@codeaurora.org> -Cc: <stable@vger.kernel.org> -Fixes: 39bc88e5e38e9b21 ("arm64: Disable TTBR0_EL1 during normal kernel execution") -Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> -Reviewed-by: Mark Rutland <mark.rutland@arm.com> -Reported-by: Vinayak Menon <vinmenon@codeaurora.org> -Signed-off-by: Will Deacon <will.deacon@arm.com> - -diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h -index 650344d01124..c4cd5081d78b 100644 ---- a/arch/arm64/include/asm/efi.h -+++ b/arch/arm64/include/asm/efi.h -@@ -132,11 +132,9 @@ static inline void efi_set_pgd(struct mm_struct *mm) - * Defer the switch to the current thread's TTBR0_EL1 - * until uaccess_enable(). Restore the current - * thread's saved ttbr0 corresponding to its active_mm -- * (if different from init_mm). - */ - cpu_set_reserved_ttbr0(); -- if (current->active_mm != &init_mm) -- update_saved_ttbr0(current, current->active_mm); -+ update_saved_ttbr0(current, current->active_mm); - } - } - } -diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h -index 3257895a9b5e..f7773f90546e 100644 ---- a/arch/arm64/include/asm/mmu_context.h -+++ b/arch/arm64/include/asm/mmu_context.h -@@ -174,11 +174,17 @@ enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) - static inline void update_saved_ttbr0(struct task_struct *tsk, - struct mm_struct *mm) - { -- if (system_uses_ttbr0_pan()) { -- BUG_ON(mm->pgd == swapper_pg_dir); -- task_thread_info(tsk)->ttbr0 = -- virt_to_phys(mm->pgd) | ASID(mm) << 48; -- } -+ u64 ttbr; -+ -+ if (!system_uses_ttbr0_pan()) -+ return; -+ -+ if (mm == &init_mm) -+ ttbr = __pa_symbol(empty_zero_page); -+ else -+ ttbr = virt_to_phys(mm->pgd) | ASID(mm) << 48; -+ -+ task_thread_info(tsk)->ttbr0 = ttbr; - } - #else - static inline void update_saved_ttbr0(struct task_struct *tsk, -@@ -214,11 +220,9 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, - * Update the saved TTBR0_EL1 of the scheduled-in task as the previous - * value may have not been initialised yet (activate_mm caller) or the - * ASID has changed since the last run (following the context switch -- * of another thread of the same process). Avoid setting the reserved -- * TTBR0_EL1 to swapper_pg_dir (init_mm; e.g. via idle_task_exit). -+ * of another thread of the same process). - */ -- if (next != &init_mm) -- update_saved_ttbr0(tsk, next); -+ update_saved_ttbr0(tsk, next); - } - - #define deactivate_mm(tsk,mm) do { } while (0) --- -2.15.0 - diff --git a/queue/arm64-SW-PAN-Update-saved-ttbr0-value-on-enter_lazy_.patch b/queue/arm64-SW-PAN-Update-saved-ttbr0-value-on-enter_lazy_.patch deleted file mode 100644 index c124f30..0000000 --- a/queue/arm64-SW-PAN-Update-saved-ttbr0-value-on-enter_lazy_.patch +++ /dev/null @@ -1,73 +0,0 @@ -From d96cc49bff5a7735576cc6f6f111f875d101cec8 Mon Sep 17 00:00:00 2001 -From: Will Deacon <will.deacon@arm.com> -Date: Wed, 6 Dec 2017 10:51:12 +0000 -Subject: [PATCH] arm64: SW PAN: Update saved ttbr0 value on enter_lazy_tlb - -commit d96cc49bff5a7735576cc6f6f111f875d101cec8 upstream. - -enter_lazy_tlb is called when a kernel thread rides on the back of -another mm, due to a context switch or an explicit call to unuse_mm -where a call to switch_mm is elided. - -In these cases, it's important to keep the saved ttbr value up to date -with the active mm, otherwise we can end up with a stale value which -points to a potentially freed page table. - -This patch implements enter_lazy_tlb for arm64, so that the saved ttbr0 -is kept up-to-date with the active mm for kernel threads. - -Cc: Mark Rutland <mark.rutland@arm.com> -Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> -Cc: Vinayak Menon <vinmenon@codeaurora.org> -Cc: <stable@vger.kernel.org> -Fixes: 39bc88e5e38e9b21 ("arm64: Disable TTBR0_EL1 during normal kernel execution") -Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> -Reviewed-by: Mark Rutland <mark.rutland@arm.com> -Reported-by: Vinayak Menon <vinmenon@codeaurora.org> -Signed-off-by: Will Deacon <will.deacon@arm.com> - -diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h -index f7773f90546e..9d155fa9a507 100644 ---- a/arch/arm64/include/asm/mmu_context.h -+++ b/arch/arm64/include/asm/mmu_context.h -@@ -156,20 +156,6 @@ void check_and_switch_context(struct mm_struct *mm, unsigned int cpu); - - #define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.id, 0); 0; }) - --/* -- * This is called when "tsk" is about to enter lazy TLB mode. -- * -- * mm: describes the currently active mm context -- * tsk: task which is entering lazy tlb -- * cpu: cpu number which is entering lazy tlb -- * -- * tsk->mm will be NULL -- */ --static inline void --enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) --{ --} -- - #ifdef CONFIG_ARM64_SW_TTBR0_PAN - static inline void update_saved_ttbr0(struct task_struct *tsk, - struct mm_struct *mm) -@@ -193,6 +179,16 @@ static inline void update_saved_ttbr0(struct task_struct *tsk, - } - #endif - -+static inline void -+enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) -+{ -+ /* -+ * We don't actually care about the ttbr0 mapping, so point it at the -+ * zero page. -+ */ -+ update_saved_ttbr0(tsk, &init_mm); -+} -+ - static inline void __switch_mm(struct mm_struct *next) - { - unsigned int cpu = smp_processor_id(); --- -2.15.0 - diff --git a/queue/series b/queue/series index 90436ba..c1147c9 100644 --- a/queue/series +++ b/queue/series @@ -51,8 +51,6 @@ kdb-Fix-handling-of-kallsyms_symbol_next-return-valu.patch drm-bridge-analogix-dp-Fix-runtime-PM-state-in-get_m.patch drm-exynos-gem-Drop-NONCONTIG-flag-for-buffers-alloc.patch media-dvb-i2c-transfers-over-usb-cannot-be-done-from.patch -arm64-SW-PAN-Point-saved-ttbr0-at-the-zero-page-when.patch -arm64-SW-PAN-Update-saved-ttbr0-value-on-enter_lazy_.patch Revert-ARM-dts-imx53-add-srtc-node.patch bus-arm-cci-Fix-use-of-smp_processor_id-in-preemptib.patch bus-arm-ccn-Check-memory-allocation-failure.patch |