Linux 4.14.275
Greg Kroah-Hartman
maintainerI'm announcing the release of the 4.14.275 kernel.
All users of the 4.14 kernel series must upgrade.
The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.14.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Documentation/arm64/silicon-errata.txt | 1 Makefile | 2 arch/arm/include/asm/kvm_host.h | 6 arch/arm64/Kconfig | 24 ++ arch/arm64/include/asm/assembler.h | 34 ++ arch/arm64/include/asm/cpu.h | 1 arch/arm64/include/asm/cpucaps.h | 4 arch/arm64/include/asm/cpufeature.h | 39 +++ arch/arm64/include/asm/cputype.h | 20 + arch/arm64/include/asm/fixmap.h | 6 arch/arm64/include/asm/kvm_host.h | 5 arch/arm64/include/asm/kvm_mmu.h | 2 arch/arm64/include/asm/mmu.h | 8 arch/arm64/include/asm/sections.h | 6 arch/arm64/include/asm/sysreg.h | 5 arch/arm64/include/asm/vectors.h | 74 ++++++ arch/arm64/kernel/bpi.S | 55 ++++ arch/arm64/kernel/cpu_errata.c | 395 ++++++++++++++++++++++++++++++++- arch/arm64/kernel/cpufeature.c | 21 + arch/arm64/kernel/cpuinfo.c | 1 arch/arm64/kernel/entry.S | 196 +++++++++++++--- arch/arm64/kernel/vmlinux.lds.S | 2 arch/arm64/kvm/hyp/hyp-entry.S | 4 arch/arm64/kvm/hyp/switch.c | 9 arch/arm64/mm/mmu.c | 11 drivers/clocksource/arm_arch_timer.c | 15 + include/linux/arm-smccc.h | 7 virt/kvm/arm/psci.c | 12 + 28 files changed, 908 insertions(+), 57 deletions(-)
Anshuman Khandual (1):
arm64: Add Cortex-X2 CPU part definition
Arnd Bergmann (1):
arm64: arch_timer: avoid unused function warning
Greg Kroah-Hartman (1):
Linux 4.14.275
James Morse (19):
arm64: entry.S: Add ventry overflow sanity checks
arm64: entry: Make the trampoline cleanup optional
arm64: entry: Free up another register on kpti's tramp_exit path
arm64: entry: Move the trampoline data page before the text page
arm64: entry: Allow tramp_alias to access symbols after the 4K boundary
arm64: entry: Don't assume tramp_vectors is the start of the vectors
arm64: entry: Move trampoline macros out of ifdef'd section
arm64: entry: Make the kpti trampoline's kpti sequence optional
arm64: entry: Allow the trampoline text to occupy multiple pages
arm64: entry: Add non-kpti __bp_harden_el1_vectors for mitigations
arm64: entry: Add vectors that have the bhb mitigation sequences
arm64: entry: Add macro for reading symbol addresses from the trampoline
arm64: Add percpu vectors for EL1
arm64: proton-pack: Report Spectre-BHB vulnerabilities as part of Spectre-v2
KVM: arm64: Add templates for BHB mitigation sequences
arm64: Mitigate spectre style branch history side channels
KVM: arm64: Allow SMCCC_ARCH_WORKAROUND_3 to be discovered and migrated
arm64: add ID_AA64ISAR2_EL1 sys register
arm64: Use the clearbhb instruction in mitigations
Marc Zyngier (4):
arm64: arch_timer: Add workaround for ARM erratum 1188873
arm64: Add silicon-errata.txt entry for ARM erratum 1188873
arm64: Make ARM64_ERRATUM_1188873 depend on COMPAT
arm64: Add part number for Neoverse N1
Rob Herring (1):
arm64: Add part number for Arm Cortex-A77
Suzuki K Poulose (1):
arm64: Add Neoverse-N2, Cortex-A710 CPU part definition
Greg Kroah-Hartman
maintainerDocumentation/arm64/silicon-errata.txt +1 -0
@@ -56,6 +56,7 @@ stable kernels. | ARM | Cortex-A72 | #853709 | N/A | | ARM | Cortex-A73 | #858921 | ARM64_ERRATUM_858921 | | ARM | Cortex-A55 | #1024718 | ARM64_ERRATUM_1024718 | +| ARM | Cortex-A76 | #1188873 | ARM64_ERRATUM_1188873 | | ARM | MMU-500 | #841119,#826419 | N/A | | | | | | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 |
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 14 -SUBLEVEL = 274 +SUBLEVEL = 275 EXTRAVERSION = NAME = Petit Gorille
arch/arm/include/asm/kvm_host.h +6 -0
@@ -26,6 +26,7 @@#include <asm/kvm_asm.h> #include <asm/kvm_mmio.h> #include <asm/fpstate.h> +#include <asm/spectre.h> #include <kvm/arm_arch_timer.h> #define __KVM_HAVE_ARCH_INTC_INITIALIZED
@@ -324,4 +325,9 @@ static inline int kvm_arm_have_ssbd(void) return KVM_SSBD_UNKNOWN; } +static inline int kvm_arm_get_spectre_bhb_state (void ) +{ +/* 32bit guests don't need firmware for this */ +return SPECTRE_VULNERABLE ;/* aka SMCCC_RET_NOT_SUPPORTED */ +}#endif /* __ARM_KVM_HOST_H__ */
arch/arm64/Kconfig +24 -0
@@ -458,6 +458,20 @@ config ARM64_ERRATUM_1024718 If unsure, say Y. +config ARM64_ERRATUM_1188873 + bool "Cortex-A76: MRC read following MRRC read of specific Generic Timer in AArch32 might give incorrect result" + default y + depends on COMPAT + select ARM_ARCH_TIMER_OOL_WORKAROUND + help + This option adds work arounds for ARM Cortex-A76 erratum 1188873 + + Affected Cortex-A76 cores (r0p0, r1p0, r2p0) could cause + register corruption when accessing the timer registers from + AArch32 userspace. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y
@@ -858,6 +872,16 @@ config ARM64_SSBD If unsure, say Y. +config MITIGATE_SPECTRE_BRANCH_HISTORY + bool "Mitigate Spectre style attacks against branch history" if EXPERT + default y + depends on HARDEN_BRANCH_PREDICTOR || !KVM + help + Speculation attacks against some high-performance processors can + make use of branch history to influence future speculation. + When taking an exception from user-space, a sequence of branches + or a firmware call overwrites the branch history. + menuconfig ARMV8_DEPRECATED bool "Emulate deprecated/obsolete ARMv8 instructions" depends on COMPAT
arch/arm64/include/asm/assembler.h +34 -0
@@ -103,6 +103,13 @@ hint #20 .endm +/* +* Clear Branch History instruction +*/ + .macro clearbhb + hint #22 + .endm +/* * Sanitise a 64-bit bounded index wrt speculation, returning zero if out * of bounds.
@@ -549,4 +556,31 @@ alternative_endif .Ldone\@: .endm + .macro __mitigate_spectre_bhb_loop tmp +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY +alternative_cb spectre_bhb_patch_loop_iter + mov \tmp, #32 // Patched to correct the immediate +alternative_cb_end +.Lspectre_bhb_loop\@: + b . + 4 + subs \tmp, \tmp, #1 + b.ne .Lspectre_bhb_loop\@ + dsb nsh + isb +#endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ + .endm + + /* Save/restores x0-x3 to the stack */ + .macro __mitigate_spectre_bhb_fw +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY + stp x0, x1, [sp, #-16]! + stp x2, x3, [sp, #-16]! + mov w0, #ARM_SMCCC_ARCH_WORKAROUND_3 +alternative_cb arm64_update_smccc_conduit + nop // Patched to SMC/HVC #0 +alternative_cb_end + ldp x2, x3, [sp], #16 + ldp x0, x1, [sp], #16 +#endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ + .endm #endif /* __ASM_ASSEMBLER_H */
arch/arm64/include/asm/cpu.h +1 -0
@@ -36,6 +36,7 @@ struct cpuinfo_arm64 {u64 reg_id_aa64dfr1;u64 reg_id_aa64isar0;u64 reg_id_aa64isar1; +u64 reg_id_aa64isar2;u64 reg_id_aa64mmfr0;u64 reg_id_aa64mmfr1;u64 reg_id_aa64mmfr2;
arch/arm64/include/asm/cpucaps.h +3 -1
@@ -45,7 +45,9 @@#define ARM64_SSBD 25#define ARM64_MISMATCHED_CACHE_TYPE 26#define ARM64_SSBS 27 +#define ARM64_WORKAROUND_1188873 28 +#define ARM64_SPECTRE_BHB 29 -#define ARM64_NCAPS 28 +#define ARM64_NCAPS 30#endif /* __ASM_CPUCAPS_H */
arch/arm64/include/asm/cpufeature.h +39 -0
@@ -456,6 +456,34 @@ static inline bool cpu_supports_mixed_endian_el0(void)return id_aa64mmfr0_mixed_endian_el0 (read_cpuid (ID_AA64MMFR0_EL1 )); } +static inline bool supports_csv2p3 (int scope) +{ +u64 pfr0; +u8 csv2_val; + +if (scope ==SCOPE_LOCAL_CPU ) + pfr0 =read_sysreg_s (SYS_ID_AA64PFR0_EL1 ); +else + pfr0 =read_sanitised_ftr_reg (SYS_ID_AA64PFR0_EL1 ); + + csv2_val =cpuid_feature_extract_unsigned_field (pfr0, +ID_AA64PFR0_CSV2_SHIFT ); +return csv2_val ==3 ; +} + +static inline bool supports_clearbhb (int scope) +{ +u64 isar2; + +if (scope ==SCOPE_LOCAL_CPU ) + isar2 =read_sysreg_s (SYS_ID_AA64ISAR2_EL1 ); +else + isar2 =read_sanitised_ftr_reg (SYS_ID_AA64ISAR2_EL1 ); + +return cpuid_feature_extract_unsigned_field (isar2, +ID_AA64ISAR2_CLEARBHB_SHIFT ); +} +static inline bool system_supports_32bit_el0 (void ) {return cpus_have_const_cap (ARM64_HAS_32BIT_EL0 );
@@ -495,6 +523,17 @@ static inline int arm64_get_ssbd_state(void)void arm64_set_ssbd_mitigation (bool state); +/* Watch out, ordering is important here. */ +enum mitigation_state { +SPECTRE_UNAFFECTED , +SPECTRE_MITIGATED , +SPECTRE_VULNERABLE , +}; + +enum mitigation_state arm64_get_spectre_bhb_state (void ); +bool is_spectre_bhb_affected (const struct arm64_cpu_capabilities *entry,int scope); +u8 spectre_bhb_loop_affected (int scope); +void spectre_bhb_enable_mitigation (const struct arm64_cpu_capabilities *__unused);#endif /* __ASSEMBLY__ */ #endif
arch/arm64/include/asm/cputype.h +20 -0
@@ -87,6 +87,16 @@#define ARM_CPU_PART_CORTEX_A75 0xD0A#define ARM_CPU_PART_CORTEX_A35 0xD04#define ARM_CPU_PART_CORTEX_A55 0xD05 +#define ARM_CPU_PART_CORTEX_A76 0xD0B +#define ARM_CPU_PART_NEOVERSE_N1 0xD0C +#define ARM_CPU_PART_CORTEX_A77 0xD0D +#define ARM_CPU_PART_NEOVERSE_V1 0xD40 +#define ARM_CPU_PART_CORTEX_A78 0xD41 +#define ARM_CPU_PART_CORTEX_X1 0xD44 +#define ARM_CPU_PART_CORTEX_A710 0xD47 +#define ARM_CPU_PART_CORTEX_X2 0xD48 +#define ARM_CPU_PART_NEOVERSE_N2 0xD49 +#define ARM_CPU_PART_CORTEX_A78C 0xD4B#define APM_CPU_PART_POTENZA 0x000
@@ -112,6 +122,16 @@#define MIDR_CORTEX_A75 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A75)#define MIDR_CORTEX_A35 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A35)#define MIDR_CORTEX_A55 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A55) +#define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76) +#define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1) +#define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77) +#define MIDR_NEOVERSE_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V1) +#define MIDR_CORTEX_A78 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78) +#define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1) +#define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) +#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2) +#define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2) +#define MIDR_CORTEX_A78C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78C)#define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)#define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)#define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)
arch/arm64/include/asm/fixmap.h +4 -2
@@ -59,9 +59,11 @@ enum fixed_addresses {#endif /* CONFIG_ACPI_APEI_GHES */ #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 +FIX_ENTRY_TRAMP_TEXT3 , +FIX_ENTRY_TRAMP_TEXT2 , +FIX_ENTRY_TRAMP_TEXT1 ,FIX_ENTRY_TRAMP_DATA , -FIX_ENTRY_TRAMP_TEXT , -#define TRAMP_VALIAS (__fix_to_virt(FIX_ENTRY_TRAMP_TEXT)) +#define TRAMP_VALIAS (__fix_to_virt(FIX_ENTRY_TRAMP_TEXT1))#endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */ __end_of_permanent_fixed_addresses,
arch/arm64/include/asm/kvm_host.h +5 -0
@@ -450,4 +450,9 @@ static inline int kvm_arm_have_ssbd(void) } } +static inline enum mitigation_state kvm_arm_get_spectre_bhb_state (void ) +{ +return arm64_get_spectre_bhb_state (); +} +#endif /* __ARM64_KVM_HOST_H__ */
arch/arm64/include/asm/kvm_mmu.h +1 -1
@@ -358,7 +358,7 @@ static inline void *kvm_get_hyp_vector(void)struct bp_hardening_data *data =arm64_get_bp_hardening_data ();void *vect =kvm_ksym_ref (__kvm_hyp_vector); -if (data->fn) { +if (data->template_start) { vect = __bp_harden_hyp_vecs_start + data->hyp_vectors_slot *SZ_2K ;
arch/arm64/include/asm/mmu.h +7 -1
@@ -35,7 +35,7 @@ typedef struct {*/ #define ASID (mm) ((mm)->context.id.counter & 0xffff) -static inline bool arm64_kernel_unmapped_at_el0 (void ) +static __always_inline bool arm64_kernel_unmapped_at_el0(void) {return IS_ENABLED (CONFIG_UNMAP_KERNEL_AT_EL0 ) &&cpus_have_const_cap (ARM64_UNMAP_KERNEL_AT_EL0 );
@@ -46,6 +46,12 @@ typedef void (*bp_hardening_cb_t)(void);struct bp_hardening_data {int hyp_vectors_slot;bp_hardening_cb_t fn; + +/* +* template_start is only used by the BHB mitigation to identify the +* hyp_vectors_slot sequence. +*/ +const char *template_start; };#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
arch/arm64/include/asm/sections.h +6 -0
@@ -28,5 +28,11 @@ extern char __initdata_begin[], __initdata_end[];extern char __inittext_begin[], __inittext_end[];extern char __irqentry_text_start[], __irqentry_text_end[];extern char __mmuoff_data_start[], __mmuoff_data_end[]; +extern char __entry_tramp_text_start[], __entry_tramp_text_end[]; + +static inline size_t entry_tramp_text_size (void ) +{ +return __entry_tramp_text_end - __entry_tramp_text_start; +}#endif /* __ASM_SECTIONS_H */
arch/arm64/include/asm/sysreg.h +5 -0
@@ -157,6 +157,7 @@#define SYS_ID_AA64ISAR0_EL1 sys_reg(3, 0, 0, 6, 0)#define SYS_ID_AA64ISAR1_EL1 sys_reg(3, 0, 0, 6, 1) +#define SYS_ID_AA64ISAR2_EL1 sys_reg(3, 0, 0, 6, 2)#define SYS_ID_AA64MMFR0_EL1 sys_reg(3, 0, 0, 7, 0)#define SYS_ID_AA64MMFR1_EL1 sys_reg(3, 0, 0, 7, 1)
@@ -403,6 +404,9 @@#define ID_AA64ISAR1_JSCVT_SHIFT 12#define ID_AA64ISAR1_DPB_SHIFT 0 +/* id_aa64isar2 */ +#define ID_AA64ISAR2_CLEARBHB_SHIFT 28 +/* id_aa64pfr0 */ #define ID_AA64PFR0_CSV3_SHIFT 60#define ID_AA64PFR0_CSV2_SHIFT 56
@@ -448,6 +452,7 @@#define ID_AA64MMFR0_TGRAN16_SUPPORTED 0x1/* id_aa64mmfr1 */ +#define ID_AA64MMFR1_ECBHB_SHIFT 60#define ID_AA64MMFR1_PAN_SHIFT 20#define ID_AA64MMFR1_LOR_SHIFT 16#define ID_AA64MMFR1_HPD_SHIFT 12
arch/arm64/include/asm/vectors.h new file +74 -0
74 lines not on this page · raw message
arch/arm64/kernel/bpi.S +55 -0
58 lines not on this page · raw message
arch/arm64/kernel/cpu_errata.c +390 -5
443 lines not on this page · raw message
arch/arm64/kernel/cpufeature.c +21 -0
@@ -20,11 +20,13 @@#include <linux/bsearch.h> #include <linux/cpumask.h> +#include <linux/percpu.h> #include <linux/sort.h> #include <linux/stop_machine.h> #include <linux/types.h> #include <linux/mm.h> #include <linux/cpu.h> +#include <asm/cpu.h> #include <asm/cpufeature.h> #include <asm/cpu_ops.h>
@@ -32,6 +34,7 @@#include <asm/processor.h> #include <asm/sysreg.h> #include <asm/traps.h> +#include <asm/vectors.h> #include <asm/virt.h> unsigned long elf_hwcap__read_mostly ;
@@ -50,6 +53,8 @@ unsigned int compat_elf_hwcap2 __read_mostly;DECLARE_BITMAP (cpu_hwcaps,ARM64_NCAPS );EXPORT_SYMBOL (cpu_hwcaps); +DEFINE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector) = vectors; +static int dump_cpu_hwcaps (struct notifier_block *self,unsigned long v,void *p) {/* file-wide pr_fmt adds "CPU features: " prefix */
@@ -129,6 +134,11 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = { ARM64_FTR_END, }; +static const struct arm64_ftr_bits ftr_id_aa64isar2[] = { +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_HIGHER_SAFE ,ID_AA64ISAR2_CLEARBHB_SHIFT ,4 ,0 ), +ARM64_FTR_END , +}; +static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_CSV3_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_CSV2_SHIFT ,4 ,0 ),
@@ -356,6 +366,7 @@ static const struct __ftr_reg_entry {/* Op1 = 0, CRn = 0, CRm = 6 */ ARM64_FTR_REG (SYS_ID_AA64ISAR0_EL1 , ftr_id_aa64isar0),ARM64_FTR_REG (SYS_ID_AA64ISAR1_EL1 , ftr_id_aa64isar1), +ARM64_FTR_REG (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2),/* Op1 = 0, CRn = 0, CRm = 7 */ ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0),
@@ -501,6 +512,7 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)init_cpu_ftr_reg (SYS_ID_AA64DFR1_EL1 , info->reg_id_aa64dfr1);init_cpu_ftr_reg (SYS_ID_AA64ISAR0_EL1 , info->reg_id_aa64isar0);init_cpu_ftr_reg (SYS_ID_AA64ISAR1_EL1 , info->reg_id_aa64isar1); +init_cpu_ftr_reg (SYS_ID_AA64ISAR2_EL1 , info->reg_id_aa64isar2);init_cpu_ftr_reg (SYS_ID_AA64MMFR0_EL1 , info->reg_id_aa64mmfr0);init_cpu_ftr_reg (SYS_ID_AA64MMFR1_EL1 , info->reg_id_aa64mmfr1);init_cpu_ftr_reg (SYS_ID_AA64MMFR2_EL1 , info->reg_id_aa64mmfr2);
@@ -612,6 +624,8 @@ void update_cpu_features(int cpu, info->reg_id_aa64isar0, boot->reg_id_aa64isar0); taint |=check_update_ftr_reg (SYS_ID_AA64ISAR1_EL1 , cpu, info->reg_id_aa64isar1, boot->reg_id_aa64isar1); + taint |=check_update_ftr_reg (SYS_ID_AA64ISAR2_EL1 , cpu, + info->reg_id_aa64isar2, boot->reg_id_aa64isar2);/* * Differing PARange support is fine as long as all peripherals and
@@ -732,6 +746,7 @@ static u64 __read_sysreg_by_encoding(u32 sys_id)read_sysreg_case (SYS_ID_AA64MMFR2_EL1 );read_sysreg_case (SYS_ID_AA64ISAR0_EL1 );read_sysreg_case (SYS_ID_AA64ISAR1_EL1 ); +read_sysreg_case (SYS_ID_AA64ISAR2_EL1 );read_sysreg_case (SYS_CNTFRQ_EL0 );read_sysreg_case (SYS_CTR_EL0 );
@@ -892,6 +907,12 @@ kpti_install_ng_mappings(const struct arm64_cpu_capabilities *__unused)static bool kpti_applied = false;int cpu =smp_processor_id (); +if (__this_cpu_read (this_cpu_vector) == vectors) { +const char *v =arm64_get_bp_hardening_vector (EL1_VECTOR_KPTI ); + +__this_cpu_write (this_cpu_vector, v); + } +if (kpti_applied)return ;
arch/arm64/kernel/cpuinfo.c +1 -0
@@ -333,6 +333,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info) info->reg_id_aa64dfr1 =read_cpuid (ID_AA64DFR1_EL1 ); info->reg_id_aa64isar0 =read_cpuid (ID_AA64ISAR0_EL1 ); info->reg_id_aa64isar1 =read_cpuid (ID_AA64ISAR1_EL1 ); + info->reg_id_aa64isar2 =read_cpuid (ID_AA64ISAR2_EL1 ); info->reg_id_aa64mmfr0 =read_cpuid (ID_AA64MMFR0_EL1 ); info->reg_id_aa64mmfr1 =read_cpuid (ID_AA64MMFR1_EL1 ); info->reg_id_aa64mmfr2 =read_cpuid (ID_AA64MMFR2_EL1 );
arch/arm64/kernel/entry.S +156 -40
284 lines not on this page · raw message
arch/arm64/kernel/vmlinux.lds.S +1 -1
@@ -258,7 +258,7 @@ ASSERT(__hibernate_exit_text_end - (__hibernate_exit_text_start & ~(SZ_4K - 1)) <= SZ_4K, "Hibernate exit text too big or misaligned") #endif #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 -ASSERT((__entry_tramp_text_end - __entry_tramp_text_start) == PAGE_SIZE, +ASSERT((__entry_tramp_text_end - __entry_tramp_text_start) <= 3*PAGE_SIZE, "Entry trampoline text too big") #endif /*
arch/arm64/kvm/hyp/hyp-entry.S +4 -0
@@ -135,6 +135,10 @@ el1_hvc_guest: /* ARM_SMCCC_ARCH_WORKAROUND_2 handling */ eor w1, w1, #(ARM_SMCCC_ARCH_WORKAROUND_1 ^ \ ARM_SMCCC_ARCH_WORKAROUND_2) + cbz w1, wa_epilogue + + eor w1, w1, #(ARM_SMCCC_ARCH_WORKAROUND_2 ^ \ + ARM_SMCCC_ARCH_WORKAROUND_3) cbnz w1, el1_trap #ifdef CONFIG_ARM64_SSBD
arch/arm64/kvm/hyp/switch.c +7 -2
@@ -27,6 +27,7 @@#include <asm/kvm_emulate.h> #include <asm/kvm_hyp.h> #include <asm/fpsimd.h> +#include <asm/vectors.h> extern struct exception_table_entry __start___kvm_ex_table;extern struct exception_table_entry __stop___kvm_ex_table;
@@ -110,17 +111,21 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu) static void __hyp_text __deactivate_traps_vhe(void) { -extern char vectors[];/* kernel exception vectors */ +const char *host_vectors = vectors;u64 mdcr_el2 =read_sysreg (mdcr_el2); mdcr_el2 &=MDCR_EL2_HPMN_MASK |MDCR_EL2_E2PB_MASK <<MDCR_EL2_E2PB_SHIFT |MDCR_EL2_TPMS ; +write_sysreg (mdcr_el2, mdcr_el2);write_sysreg (HCR_HOST_VHE_FLAGS , hcr_el2);write_sysreg (CPACR_EL1_FPEN , cpacr_el1); -write_sysreg (vectors, vbar_el1); + +if (!arm64_kernel_unmapped_at_el0 ()) + host_vectors =__this_cpu_read (this_cpu_vector); +write_sysreg (host_vectors, vbar_el1); } static void __hyp_text __deactivate_traps_nvhe(void)
arch/arm64/mm/mmu.c +8 -3
@@ -532,6 +532,7 @@ early_param("rodata", parse_rodata);#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 static int __init map_entry_trampoline (void ) { +int i;extern char __entry_tramp_text_start[];pgprot_t prot = rodata_enabled ?PAGE_KERNEL_ROX :PAGE_KERNEL_EXEC ;
@@ -542,11 +543,15 @@ static int __init map_entry_trampoline(void)/* 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 ); +__create_pgd_mapping (tramp_pg_dir, pa_start,TRAMP_VALIAS , +entry_tramp_text_size (), prot, pgd_pgtable_alloc, +0 );/* Map both the text and data into the kernel page table */ -__set_fixmap (FIX_ENTRY_TRAMP_TEXT , pa_start, prot); +for (i =0 ; i <DIV_ROUND_UP (entry_tramp_text_size (),PAGE_SIZE ); i++) +__set_fixmap (FIX_ENTRY_TRAMP_TEXT1 - i, + pa_start + i *PAGE_SIZE , prot); +if (IS_ENABLED (CONFIG_RANDOMIZE_BASE )) {extern char __entry_tramp_data_start[];
drivers/clocksource/arm_arch_timer.c +15 -0
@@ -298,6 +298,13 @@ static u64 notrace arm64_858921_read_cntvct_el0(void) }#endif +#ifdef CONFIG_ARM64_ERRATUM_1188873 +static u64 notrace arm64_1188873_read_cntvct_el0(void) +{ +return read_sysreg (cntvct_el0); +} +#endif +#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround);
@@ -381,6 +388,14 @@ static const struct arch_timer_erratum_workaround ool_workarounds[] = { .read_cntvct_el0 = arm64_858921_read_cntvct_el0, },#endif +#ifdef CONFIG_ARM64_ERRATUM_1188873 + { + .match_type = ate_match_local_cap_id, + .id = (void *)ARM64_WORKAROUND_1188873, + .desc = "ARM erratum 1188873", + .read_cntvct_el0 = arm64_1188873_read_cntvct_el0, + }, +#endif }; typedef bool (*ate_match_fn_t)(const struct arch_timer_erratum_workaround *,
include/linux/arm-smccc.h +7 -0
@@ -85,6 +85,13 @@ ARM_SMCCC_SMC_32, \ 0, 0x7fff) +#define ARM_SMCCC_ARCH_WORKAROUND_3 \ + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ + ARM_SMCCC_SMC_32, \ + 0, 0x3fff) + +#define SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED 1 +#ifndef __ASSEMBLY__#include <linux/linkage.h>
virt/kvm/arm/psci.c +12 -0
@@ -433,6 +433,18 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)break ; }break ; +case ARM_SMCCC_ARCH_WORKAROUND_3 : +switch (kvm_arm_get_spectre_bhb_state ()) { +case SPECTRE_VULNERABLE : +break ; +case SPECTRE_MITIGATED : + val =SMCCC_RET_SUCCESS ; +break ; +case SPECTRE_UNAFFECTED : + val =SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED ; +break ; + } +break ; }break ;default :