5.16.14-rc1 review
Greg Kroah-Hartman
maintainercover 5.16.14-rc1 review
This is the start of the stable review cycle for the 5.16.14 release. There are 37 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Mar 2022 15:58:48 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.14-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.16.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.16.14-rc1
Emmanuel Gil Peyrot <[email protected]>
ARM: fix build error when BPF_SYSCALL is disabled
James Morse <[email protected]>
arm64: proton-pack: Include unprivileged eBPF status in Spectre v2 mitigation reporting
James Morse <[email protected]>
arm64: Use the clearbhb instruction in mitigations
James Morse <[email protected]>
KVM: arm64: Allow SMCCC_ARCH_WORKAROUND_3 to be discovered and migrated
James Morse <[email protected]>
arm64: Mitigate spectre style branch history side channels
James Morse <[email protected]>
arm64: proton-pack: Report Spectre-BHB vulnerabilities as part of Spectre-v2
James Morse <[email protected]>
arm64: Add percpu vectors for EL1
James Morse <[email protected]>
arm64: entry: Add macro for reading symbol addresses from the trampoline
James Morse <[email protected]>
arm64: entry: Add vectors that have the bhb mitigation sequences
James Morse <[email protected]>
arm64: entry: Add non-kpti __bp_harden_el1_vectors for mitigations
James Morse <[email protected]>
arm64: entry: Allow the trampoline text to occupy multiple pages
James Morse <[email protected]>
arm64: entry: Make the kpti trampoline's kpti sequence optional
James Morse <[email protected]>
arm64: entry: Move trampoline macros out of ifdef'd section
James Morse <[email protected]>
arm64: entry: Don't assume tramp_vectors is the start of the vectors
James Morse <[email protected]>
arm64: entry: Allow tramp_alias to access symbols after the 4K boundary
James Morse <[email protected]>
arm64: entry: Move the trampoline data page before the text page
James Morse <[email protected]>
arm64: entry: Free up another register on kpti's tramp_exit path
James Morse <[email protected]>
arm64: entry: Make the trampoline cleanup optional
James Morse <[email protected]>
KVM: arm64: Allow indirect vectors to be used without SPECTRE_V3A
James Morse <[email protected]>
arm64: spectre: Rename spectre_v4_patch_fw_mitigation_conduit
James Morse <[email protected]>
arm64: entry.S: Add ventry overflow sanity checks
Joey Gouly <[email protected]>
arm64: cpufeature: add HWCAP for FEAT_RPRES
Joey Gouly <[email protected]>
arm64: cpufeature: add HWCAP for FEAT_AFP
Joey Gouly <[email protected]>
arm64: add ID_AA64ISAR2_EL1 sys register
Russell King (Oracle) <[email protected]>
ARM: include unprivileged BPF status in Spectre V2 reporting
Russell King (Oracle) <[email protected]>
ARM: Spectre-BHB workaround
Russell King (Oracle) <[email protected]>
ARM: use LOADADDR() to get load address of sections
Russell King (Oracle) <[email protected]>
ARM: early traps initialisation
Russell King (Oracle) <[email protected]>
ARM: report Spectre v2 status through sysfs
Josh Poimboeuf <[email protected]>
x86/speculation: Warn about eIBRS + LFENCE + Unprivileged eBPF + SMT
Josh Poimboeuf <[email protected]>
x86/speculation: Warn about Spectre v2 LFENCE mitigation
Kim Phillips <[email protected]>
x86/speculation: Update link to AMD speculation whitepaper
Kim Phillips <[email protected]>
x86/speculation: Use generic retpoline by default on AMD
Josh Poimboeuf <[email protected]>
x86/speculation: Include unprivileged eBPF status in Spectre v2 mitigation reporting
Peter Zijlstra <[email protected]>
Documentation/hw-vuln: Update spectre doc
Peter Zijlstra <[email protected]>
x86/speculation: Add eIBRS + Retpoline options
Peter Zijlstra (Intel) <[email protected]>
x86/speculation: Rename RETPOLINE_AMD to RETPOLINE_LFENCE
-------------
Diffstat:
Documentation/admin-guide/hw-vuln/spectre.rst | 50 +-- Documentation/admin-guide/kernel-parameters.txt | 8 +- Documentation/arm64/cpu-feature-registers.rst | 17 ++ Documentation/arm64/elf_hwcaps.rst | 8 + Makefile | 4 +- arch/arm/include/asm/assembler.h | 10 + arch/arm/include/asm/spectre.h | 32 ++ arch/arm/include/asm/vmlinux.lds.h | 35 ++- arch/arm/kernel/Makefile | 2 + arch/arm/kernel/entry-armv.S | 79 ++++- arch/arm/kernel/entry-common.S | 24 ++ arch/arm/kernel/spectre.c | 71 +++++ arch/arm/kernel/traps.c | 65 +++- arch/arm/mm/Kconfig | 11 + arch/arm/mm/proc-v7-bugs.c | 207 ++++++++++--- arch/arm64/Kconfig | 9 + arch/arm64/include/asm/assembler.h | 53 ++++ arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/cpufeature.h | 29 ++ arch/arm64/include/asm/cputype.h | 8 + arch/arm64/include/asm/fixmap.h | 6 +- arch/arm64/include/asm/hwcap.h | 2 + arch/arm64/include/asm/insn.h | 1 + arch/arm64/include/asm/kvm_host.h | 5 + arch/arm64/include/asm/sections.h | 5 + arch/arm64/include/asm/spectre.h | 4 + arch/arm64/include/asm/sysreg.h | 18 ++ arch/arm64/include/asm/vectors.h | 73 +++++ arch/arm64/include/uapi/asm/hwcap.h | 2 + arch/arm64/include/uapi/asm/kvm.h | 5 + arch/arm64/kernel/cpu_errata.c | 7 + arch/arm64/kernel/cpufeature.c | 25 ++ arch/arm64/kernel/cpuinfo.c | 3 + arch/arm64/kernel/entry.S | 214 +++++++++---- arch/arm64/kernel/image-vars.h | 4 + arch/arm64/kernel/proton-pack.c | 391 +++++++++++++++++++++++- arch/arm64/kernel/vmlinux.lds.S | 2 +- arch/arm64/kvm/arm.c | 5 +- arch/arm64/kvm/hyp/hyp-entry.S | 9 + arch/arm64/kvm/hyp/nvhe/mm.c | 4 +- arch/arm64/kvm/hyp/vhe/switch.c | 9 +- arch/arm64/kvm/hypercalls.c | 12 + arch/arm64/kvm/psci.c | 18 +- arch/arm64/kvm/sys_regs.c | 2 +- arch/arm64/mm/mmu.c | 12 +- arch/arm64/tools/cpucaps | 1 + arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/include/asm/nospec-branch.h | 16 +- arch/x86/kernel/alternative.c | 8 +- arch/x86/kernel/cpu/bugs.c | 204 ++++++++++--- arch/x86/lib/retpoline.S | 2 +- arch/x86/net/bpf_jit_comp.c | 2 +- include/linux/arm-smccc.h | 5 + include/linux/bpf.h | 12 + kernel/sysctl.c | 7 + tools/arch/x86/include/asm/cpufeatures.h | 2 +- 56 files changed, 1606 insertions(+), 216 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/37 x86/speculation: Rename RETPOLINE_AMD to RETPOLINE_LFENCE
From: "Peter Zijlstra (Intel)" <[email protected]>
commit d45476d9832409371537013ebdd8dc1a7781f97a upstream.
The RETPOLINE_AMD name is unfortunate since it isn't necessarily AMD only, in fact Hygon also uses it. Furthermore it will likely be sufficient for some Intel processors. Therefore rename the thing to RETPOLINE_LFENCE to better describe what it is.
Add the spectre_v2=retpoline,lfence option as an alias to spectre_v2=retpoline,amd to preserve existing setups. However, the output of /sys/devices/system/cpu/vulnerabilities/spectre_v2 will be changed.
[ bp: Fix typos, massage. ]
--- arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/include/asm/nospec-branch.h | 12 ++++++------ arch/x86/kernel/alternative.c | 8 ++++---- arch/x86/kernel/cpu/bugs.c | 29 ++++++++++++++++++----------- arch/x86/lib/retpoline.S | 2 +- arch/x86/net/bpf_jit_comp.c | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 2 +- 7 files changed, 32 insertions(+), 25 deletions(-)
arch/x86/include/asm/cpufeatures.h +1 -1
@@ -204,7 +204,7 @@/* FREE! ( 7*32+10) */ #define X86_FEATURE_PTI ( 7*32+11)/* Kernel Page Table Isolation enabled */ #define X86_FEATURE_RETPOLINE ( 7*32+12)/* "" Generic Retpoline mitigation for Spectre variant 2 */ -#define X86_FEATURE_RETPOLINE_AMD ( 7*32+13)/* "" AMD Retpoline mitigation for Spectre variant 2 */ +#define X86_FEATURE_RETPOLINE_LFENCE ( 7*32+13)/* "" Use LFENCE for Spectre variant 2 */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14)/* Intel Processor Inventory Number */ #define X86_FEATURE_CDP_L2 ( 7*32+15)/* Code and Data Prioritization L2 */ #define X86_FEATURE_MSR_SPEC_CTRL ( 7*32+16)/* "" MSR SPEC_CTRL is implemented */
arch/x86/include/asm/nospec-branch.h +6 -6
@@ -84,7 +84,7 @@#ifdef CONFIG_RETPOLINE ALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), \ __stringify(jmp __x86_indirect_thunk_\reg), X86_FEATURE_RETPOLINE, \ - __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), X86_FEATURE_RETPOLINE_AMD + __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), X86_FEATURE_RETPOLINE_LFENCE#else jmp *%\reg#endif
@@ -94,7 +94,7 @@#ifdef CONFIG_RETPOLINE ALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; call *%\reg), \ __stringify(call __x86_indirect_thunk_\reg), X86_FEATURE_RETPOLINE, \ - __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; call *%\reg), X86_FEATURE_RETPOLINE_AMD + __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; call *%\reg), X86_FEATURE_RETPOLINE_LFENCE#else call *%\reg#endif
@@ -146,7 +146,7 @@ extern retpoline_thunk_t __x86_indirect_ "lfence;\n" \ ANNOTATE_RETPOLINE_SAFE \ "call *%[thunk_target]\n", \ - X86_FEATURE_RETPOLINE_AMD) + X86_FEATURE_RETPOLINE_LFENCE)# define THUNK_TARGET (addr) [thunk_target] "r" (addr)
@@ -176,7 +176,7 @@ extern retpoline_thunk_t __x86_indirect_ "lfence;\n" \ ANNOTATE_RETPOLINE_SAFE \ "call *%[thunk_target]\n", \ - X86_FEATURE_RETPOLINE_AMD) + X86_FEATURE_RETPOLINE_LFENCE)# define THUNK_TARGET (addr) [thunk_target] "rm" (addr)#endif
@@ -188,8 +188,8 @@ extern retpoline_thunk_t __x86_indirect_/* The Spectre V2 mitigation variants */ enum spectre_v2_mitigation {SPECTRE_V2_NONE , -SPECTRE_V2_RETPOLINE_GENERIC , -SPECTRE_V2_RETPOLINE_AMD , +SPECTRE_V2_RETPOLINE , +SPECTRE_V2_LFENCE ,SPECTRE_V2_IBRS_ENHANCED , };
arch/x86/kernel/alternative.c +4 -4
@@ -389,7 +389,7 @@ static int emit_indirect(int op, int reg* * CALL *%\reg * -* It also tries to inline spectre_v2=retpoline,amd when size permits. +* It also tries to inline spectre_v2=retpoline,lfence when size permits. */ static int patch_retpoline (void *addr,struct insn *insn,u8 *bytes) {
@@ -407,7 +407,7 @@ static int patch_retpoline(void *addr, sBUG_ON (reg ==4 );if (cpu_feature_enabled (X86_FEATURE_RETPOLINE ) && - !cpu_feature_enabled (X86_FEATURE_RETPOLINE_AMD )) + !cpu_feature_enabled (X86_FEATURE_RETPOLINE_LFENCE ))return -1 ; op = insn->opcode.bytes[0 ];
@@ -438,9 +438,9 @@ static int patch_retpoline(void *addr, s }/* -* For RETPOLINE_AMD: prepend the indirect CALL/JMP with an LFENCE. +* For RETPOLINE_LFENCE: prepend the indirect CALL/JMP with an LFENCE. */ -if (cpu_feature_enabled (X86_FEATURE_RETPOLINE_AMD )) { +if (cpu_feature_enabled (X86_FEATURE_RETPOLINE_LFENCE )) { bytes[i++] =0x0f ; bytes[i++] =0xae ; bytes[i++] =0xe8 ;/* LFENCE */
arch/x86/kernel/cpu/bugs.c +18 -11
@@ -664,7 +664,7 @@ enum spectre_v2_mitigation_cmd {SPECTRE_V2_CMD_FORCE ,SPECTRE_V2_CMD_RETPOLINE ,SPECTRE_V2_CMD_RETPOLINE_GENERIC , - SPECTRE_V2_CMD_RETPOLINE_AMD, + SPECTRE_V2_CMD_RETPOLINE_LFENCE, }; enum spectre_v2_user_cmd {
@@ -824,8 +824,8 @@ set_mode:static const char *const spectre_v2_strings[] = { [SPECTRE_V2_NONE ] ="Vulnerable" , - [SPECTRE_V2_RETPOLINE_GENERIC ] ="Mitigation: Full generic retpoline" , - [SPECTRE_V2_RETPOLINE_AMD ] ="Mitigation: Full AMD retpoline" , + [SPECTRE_V2_RETPOLINE ] ="Mitigation: Retpolines" , + [SPECTRE_V2_LFENCE ] ="Mitigation: LFENCE" , [SPECTRE_V2_IBRS_ENHANCED ] ="Mitigation: Enhanced IBRS" , };
@@ -837,7 +837,8 @@ static const struct { { "off", SPECTRE_V2_CMD_NONE, false }, { "on", SPECTRE_V2_CMD_FORCE, true }, { "retpoline", SPECTRE_V2_CMD_RETPOLINE, false }, - { "retpoline,amd", SPECTRE_V2_CMD_RETPOLINE_AMD, false }, + { "retpoline,amd", SPECTRE_V2_CMD_RETPOLINE_LFENCE, false }, + { "retpoline,lfence", SPECTRE_V2_CMD_RETPOLINE_LFENCE, false }, { "retpoline,generic", SPECTRE_V2_CMD_RETPOLINE_GENERIC, false }, { "auto", SPECTRE_V2_CMD_AUTO, false }, };
@@ -875,13 +876,19 @@ static enum spectre_v2_mitigation_cmd __ }if ((cmd ==SPECTRE_V2_CMD_RETPOLINE || - cmd ==SPECTRE_V2_CMD_RETPOLINE_AMD || + cmd ==SPECTRE_V2_CMD_RETPOLINE_LFENCE || cmd ==SPECTRE_V2_CMD_RETPOLINE_GENERIC ) && !IS_ENABLED (CONFIG_RETPOLINE )) {pr_err ("%s selected but not compiled in. Switching to AUTO select\n" , mitigation_options[i].option);return SPECTRE_V2_CMD_AUTO ; } +if ((cmd ==SPECTRE_V2_CMD_RETPOLINE_LFENCE ) && + !boot_cpu_has (X86_FEATURE_LFENCE_RDTSC )) { +pr_err ("%s selected, but CPU doesn't have a serializing LFENCE. Switching to AUTO select\n" , mitigation_options[i].option); +return SPECTRE_V2_CMD_AUTO ; + } +spec_v2_print_cond (mitigation_options[i].option, mitigation_options[i].secure);return cmd;
@@ -916,9 +923,9 @@ static void __init spectre_v2_select_mitif (IS_ENABLED (CONFIG_RETPOLINE )) goto retpoline_auto;break ; -case SPECTRE_V2_CMD_RETPOLINE_AMD : +case SPECTRE_V2_CMD_RETPOLINE_LFENCE :if (IS_ENABLED (CONFIG_RETPOLINE )) - goto retpoline_amd; + goto retpoline_lfence;break ;case SPECTRE_V2_CMD_RETPOLINE_GENERIC :if (IS_ENABLED (CONFIG_RETPOLINE ))
@@ -935,17 +942,17 @@ static void __init spectre_v2_select_mit retpoline_auto:if (boot_cpu_data.x86_vendor ==X86_VENDOR_AMD || boot_cpu_data.x86_vendor ==X86_VENDOR_HYGON ) { - retpoline_amd: + retpoline_lfence:if (!boot_cpu_has (X86_FEATURE_LFENCE_RDTSC )) {pr_err ("Spectre mitigation: LFENCE not serializing, switching to generic retpoline\n" ); goto retpoline_generic; } - mode =SPECTRE_V2_RETPOLINE_AMD ; -setup_force_cpu_cap (X86_FEATURE_RETPOLINE_AMD ); + mode =SPECTRE_V2_LFENCE ; +setup_force_cpu_cap (X86_FEATURE_RETPOLINE_LFENCE );setup_force_cpu_cap (X86_FEATURE_RETPOLINE ); }else { retpoline_generic: - mode =SPECTRE_V2_RETPOLINE_GENERIC ; + mode =SPECTRE_V2_RETPOLINE ;setup_force_cpu_cap (X86_FEATURE_RETPOLINE ); }
arch/x86/lib/retpoline.S +1 -1
@@ -34,7 +34,7 @@ SYM_INNER_LABEL(__x86_indirect_thunk_\re ALTERNATIVE_2 __stringify(ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), \ __stringify(RETPOLINE \reg), X86_FEATURE_RETPOLINE, \ - __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), X86_FEATURE_RETPOLINE_AMD + __stringify(lfence; ANNOTATE_RETPOLINE_SAFE; jmp *%\reg), X86_FEATURE_RETPOLINE_LFENCE .endm
arch/x86/net/bpf_jit_comp.c +1 -1
@@ -394,7 +394,7 @@ static void emit_indirect_jump(u8 **pprou8 *prog = *pprog;#ifdef CONFIG_RETPOLINE -if (cpu_feature_enabled (X86_FEATURE_RETPOLINE_AMD )) { +if (cpu_feature_enabled (X86_FEATURE_RETPOLINE_LFENCE )) {EMIT_LFENCE ();EMIT2 (0xFF ,0xE0 + reg); }else if (cpu_feature_enabled (X86_FEATURE_RETPOLINE )) {
tools/arch/x86/include/asm/cpufeatures.h +1 -1
@@ -204,7 +204,7 @@/* FREE! ( 7*32+10) */ #define X86_FEATURE_PTI ( 7*32+11)/* Kernel Page Table Isolation enabled */ #define X86_FEATURE_RETPOLINE ( 7*32+12)/* "" Generic Retpoline mitigation for Spectre variant 2 */ -#define X86_FEATURE_RETPOLINE_AMD ( 7*32+13)/* "" AMD Retpoline mitigation for Spectre variant 2 */ +#define X86_FEATURE_RETPOLINE_LFENCE ( 7*32+13)/* "" Use LFENCEs for Spectre variant 2 */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14)/* Intel Processor Inventory Number */ #define X86_FEATURE_CDP_L2 ( 7*32+15)/* Code and Data Prioritization L2 */ #define X86_FEATURE_MSR_SPEC_CTRL ( 7*32+16)/* "" MSR SPEC_CTRL is implemented */
Greg Kroah-Hartman
maintainerPATCH 2/37 x86/speculation: Add eIBRS + Retpoline options
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 1e19da8522c81bf46b335f84137165741e0d82b7 upstream.
Thanks to the chaps at VUsec it is now clear that eIBRS is not sufficient, therefore allow enabling of retpolines along with eIBRS.
Add spectre_v2=eibrs, spectre_v2=eibrs,lfence and spectre_v2=eibrs,retpoline options to explicitly pick your preferred means of mitigation.
Since there's new mitigations there's also user visible changes in /sys/devices/system/cpu/vulnerabilities/spectre_v2 to reflect these new mitigations.
[ bp: Massage commit message, trim error messages,
do more precise eIBRS mode checking. ]
--- arch/x86/include/asm/nospec-branch.h | 4 - arch/x86/kernel/cpu/bugs.c | 133 +++++++++++++++++++++++++---------- 2 files changed, 99 insertions(+), 38 deletions(-)
arch/x86/include/asm/nospec-branch.h +3 -1
@@ -190,7 +190,9 @@ enum spectre_v2_mitigation {SPECTRE_V2_NONE ,SPECTRE_V2_RETPOLINE ,SPECTRE_V2_LFENCE , - SPECTRE_V2_IBRS_ENHANCED, +SPECTRE_V2_EIBRS , +SPECTRE_V2_EIBRS_RETPOLINE , + SPECTRE_V2_EIBRS_LFENCE, };/* The indirect branch speculation control variants */
arch/x86/kernel/cpu/bugs.c +96 -37
212 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 3/37 Documentation/hw-vuln: Update spectre doc
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 5ad3eb1132453b9795ce5fd4572b1c18b292cca9 upstream.
Update the doc with the new fun.
[ bp: Massage commit message. ]
--- Documentation/admin-guide/hw-vuln/spectre.rst | 44 ++++++++++++++++-------- Documentation/admin-guide/kernel-parameters.txt | 8 +++- 2 files changed, 36 insertions(+), 16 deletions(-)
Documentation/admin-guide/hw-vuln/spectre.rst +30 -14
@@ -131,6 +131,19 @@ steer its indirect branch speculations t speculative execution's side effects left in level 1 cache to infer the victim's data. +Yet another variant 2 attack vector is for the attacker to poison the +Branch History Buffer (BHB) to speculatively steer an indirect branch +to a specific Branch Target Buffer (BTB) entry, even if the entry isn't +associated with the source address of the indirect branch. Specifically, +the BHB might be shared across privilege levels even in the presence of +Enhanced IBRS. + +Currently the only known real-world BHB attack vector is via +unprivileged eBPF. Therefore, it's highly recommended to not enable +unprivileged eBPF, especially when eIBRS is used (without retpolines). +For a full mitigation against BHB attacks, it's recommended to use +retpolines (or eIBRS combined with retpolines). + Attack scenarios ----------------
@@ -364,13 +377,15 @@ The possible values in this file are: - Kernel status: - ==================================== ================================= - 'Not affected' The processor is not vulnerable - 'Vulnerable' Vulnerable, no mitigation - 'Mitigation: Full generic retpoline' Software-focused mitigation - 'Mitigation: Full AMD retpoline' AMD-specific software mitigation - 'Mitigation: Enhanced IBRS' Hardware-focused mitigation - ==================================== ================================= + ======================================== ================================= + 'Not affected' The processor is not vulnerable + 'Mitigation: None' Vulnerable, no mitigation + 'Mitigation: Retpolines' Use Retpoline thunks + 'Mitigation: LFENCE' Use LFENCE instructions + 'Mitigation: Enhanced IBRS' Hardware-focused mitigation + 'Mitigation: Enhanced IBRS + Retpolines' Hardware-focused + Retpolines + 'Mitigation: Enhanced IBRS + LFENCE' Hardware-focused + LFENCE + ======================================== ================================= - Firmware status: Show if Indirect Branch Restricted Speculation (IBRS) is used to protect against Spectre variant 2 attacks when calling firmware (x86 only).
@@ -583,12 +598,13 @@ kernel command line. Specific mitigations can also be selected manually: - retpoline - replace indirect branches - retpoline,generic - google's original retpoline - retpoline,amd - AMD-specific minimal thunk + retpoline auto pick between generic,lfence + retpoline,generic Retpolines + retpoline,lfence LFENCE; indirect branch + retpoline,amd alias for retpoline,lfence + eibrs enhanced IBRS + eibrs,retpoline enhanced IBRS + Retpolines + eibrs,lfence enhanced IBRS + LFENCE Not specifying this option is equivalent to spectre_v2=auto.
@@ -599,7 +615,7 @@ kernel command line. spectre_v2=off. Spectre variant 1 mitigations cannot be disabled. -For spectre_v2_user see :doc:`/admin-guide/kernel-parameters`. +For spectre_v2_user see Documentation/admin-guide/kernel-parameters.txt Mitigation selection guide --------------------------
Documentation/admin-guide/kernel-parameters.txt +6 -2
@@ -5303,8 +5303,12 @@ Specific mitigations can also be selected manually: retpoline - replace indirect branches - retpoline,generic - google's original retpoline - retpoline,amd - AMD-specific minimal thunk + retpoline,generic - Retpolines + retpoline,lfence - LFENCE; indirect branch + retpoline,amd - alias for retpoline,lfence + eibrs - enhanced IBRS + eibrs,retpoline - enhanced IBRS + Retpolines + eibrs,lfence - enhanced IBRS + LFENCE Not specifying this option is equivalent to spectre_v2=auto.
Greg Kroah-Hartman
maintainerPATCH 4/37 x86/speculation: Include unprivileged eBPF status in Spectre v2 mitigation reporting
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
commit 44a3918c8245ab10c6c9719dd12e7a8d291980d8 upstream.
With unprivileged eBPF enabled, eIBRS (without retpoline) is vulnerable to Spectre v2 BHB-based attacks.
When both are enabled, print a warning message and report it in the 'spectre_v2' sysfs vulnerabilities file.
--- arch/x86/kernel/cpu/bugs.c | 35 +++++++++++++++++++++++++++++------ include/linux/bpf.h | 12 ++++++++++++ kernel/sysctl.c | 7 +++++++ 3 files changed, 48 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/bugs.c +29 -6
@@ -16,6 +16,7 @@#include <linux/prctl.h> #include <linux/sched/smt.h> #include <linux/pgtable.h> +#include <linux/bpf.h> #include <asm/spec-ctrl.h> #include <asm/cmdline.h>
@@ -650,6 +651,16 @@ static inline const char *spectre_v2_modstatic inline const char *spectre_v2_module_string (void ) {return "" ; }#endif +#define SPECTRE_V2_EIBRS_EBPF_MSG "WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible via Spectre v2 BHB attacks!\n" + +#ifdef CONFIG_BPF_SYSCALL +void unpriv_ebpf_notify (int new_state) +{ +if (spectre_v2_enabled ==SPECTRE_V2_EIBRS && !new_state) +pr_err (SPECTRE_V2_EIBRS_EBPF_MSG ); +} +#endif +static inline bool match_option (const char *arg,int arglen,const char *opt) {int len =strlen (opt);
@@ -994,6 +1005,9 @@ static void __init spectre_v2_select_mitbreak ; } +if (mode ==SPECTRE_V2_EIBRS &&unprivileged_ebpf_enabled ()) +pr_err (SPECTRE_V2_EIBRS_EBPF_MSG ); +if (spectre_v2_in_eibrs_mode (mode)) {/* Force it so VMEXIT will restore correctly */ x86_spec_ctrl_base |=SPEC_CTRL_IBRS ;
@@ -1780,6 +1794,20 @@ static char *ibpb_state(void)return "" ; } +static ssize_t spectre_v2_show_state (char *buf) +{ +if (spectre_v2_enabled ==SPECTRE_V2_EIBRS &&unprivileged_ebpf_enabled ()) +return sprintf (buf,"Vulnerable: Unprivileged eBPF enabled\n" ); + +return sprintf (buf,"%s%s%s%s%s%s\n" , + spectre_v2_strings[spectre_v2_enabled], +ibpb_state (), +boot_cpu_has (X86_FEATURE_USE_IBRS_FW ) ?", IBRS_FW" :"" , +stibp_state (), +boot_cpu_has (X86_FEATURE_RSB_CTXSW ) ?", RSB filling" :"" , +spectre_v2_module_string ()); +} +static ssize_t srbds_show_state (char *buf) {return sprintf (buf,"%s\n" , srbds_strings[srbds_mitigation]);
@@ -1805,12 +1833,7 @@ static ssize_t cpu_show_common(struct dereturn sprintf (buf,"%s\n" , spectre_v1_strings[spectre_v1_mitigation]);case X86_BUG_SPECTRE_V2 : -return sprintf (buf,"%s%s%s%s%s%s\n" , spectre_v2_strings[spectre_v2_enabled], -ibpb_state (), -boot_cpu_has (X86_FEATURE_USE_IBRS_FW ) ?", IBRS_FW" :"" , -stibp_state (), -boot_cpu_has (X86_FEATURE_RSB_CTXSW ) ?", RSB filling" :"" , -spectre_v2_module_string ()); +return spectre_v2_show_state (buf);case X86_BUG_SPEC_STORE_BYPASS :return sprintf (buf,"%s\n" , ssb_strings[ssb_mode]);
include/linux/bpf.h +12 -0
@@ -1774,6 +1774,12 @@ bool bpf_prog_has_kfunc_call(const strucconst struct btf_func_model *bpf_jit_find_kfunc_model (const struct bpf_prog *prog,const struct bpf_insn *insn); + +static inline bool unprivileged_ebpf_enabled (void ) +{ +return !sysctl_unprivileged_bpf_disabled; +} +#else /* !CONFIG_BPF_SYSCALL */ static inline struct bpf_prog *bpf_prog_get (u32 ufd) {
@@ -1993,6 +1999,12 @@ bpf_jit_find_kfunc_model(const struct bp {return NULL ; } + +static inline bool unprivileged_ebpf_enabled (void ) +{ +return false; +} +#endif /* CONFIG_BPF_SYSCALL */ void __bpf_free_used_btfs(struct bpf_prog_aux *aux,
kernel/sysctl.c +7 -0
@@ -228,6 +228,10 @@ static int bpf_stats_handler(struct ctl_return ret; } +void __weak unpriv_ebpf_notify (int new_state) +{ +} +static int bpf_unpriv_handler (struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -245,6 +249,9 @@ static int bpf_unpriv_handler(struct ctlreturn -EPERM ; *(int *)table->data = unpriv_enable; } + +unpriv_ebpf_notify (unpriv_enable); +return ret; }#endif /* CONFIG_BPF_SYSCALL && CONFIG_SYSCTL */
Greg Kroah-Hartman
maintainerPATCH 5/37 x86/speculation: Use generic retpoline by default on AMD
In reply to Greg Kroah-HartmanFrom: Kim Phillips <[email protected]>
commit 244d00b5dd4755f8df892c86cab35fb2cfd4f14b upstream.
AMD retpoline may be susceptible to speculation. The speculation execution window for an incorrect indirect branch prediction using LFENCE/JMP sequence may potentially be large enough to allow exploitation using Spectre V2.
By default, don't use retpoline,lfence on AMD. Instead, use the generic retpoline.
--- arch/x86/kernel/cpu/bugs.c | 9 --------- 1 file changed, 9 deletions(-)
arch/x86/kernel/cpu/bugs.c +0 -9
@@ -941,15 +941,6 @@ static enum spectre_v2_mitigation __initreturn SPECTRE_V2_NONE ; } -if (boot_cpu_data.x86_vendor ==X86_VENDOR_AMD || - boot_cpu_data.x86_vendor ==X86_VENDOR_HYGON ) { -if (!boot_cpu_has (X86_FEATURE_LFENCE_RDTSC )) { -pr_err ("LFENCE not serializing, switching to generic retpoline\n" ); -return SPECTRE_V2_RETPOLINE ; - } -return SPECTRE_V2_LFENCE ; - } -return SPECTRE_V2_RETPOLINE ; }
Greg Kroah-Hartman
maintainerPATCH 6/37 x86/speculation: Update link to AMD speculation whitepaper
In reply to Greg Kroah-HartmanFrom: Kim Phillips <[email protected]>
commit e9b6013a7ce31535b04b02ba99babefe8a8599fa upstream.
Update the link to the "Software Techniques for Managing Speculation on AMD Processors" whitepaper.
--- Documentation/admin-guide/hw-vuln/spectre.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/admin-guide/hw-vuln/spectre.rst +3 -3
@@ -60,8 +60,8 @@ privileged data touched during the specu Spectre variant 1 attacks take advantage of speculative execution of conditional branches, while Spectre variant 2 attacks use speculative execution of indirect branches to leak privileged memory. -See :ref:`[1] <spec_ref1>` :ref:`[5] <spec_ref5>` :ref:`[7] <spec_ref7>` -:ref:`[10] <spec_ref10>` :ref:`[11] <spec_ref11>`. +See :ref:`[1] <spec_ref1>` :ref:`[5] <spec_ref5>` :ref:`[6] <spec_ref6>` +:ref:`[7] <spec_ref7>` :ref:`[10] <spec_ref10>` :ref:`[11] <spec_ref11>`. Spectre variant 1 (Bounds Check Bypass) ---------------------------------------
@@ -697,7 +697,7 @@ AMD white papers: .. _spec_ref6: -[6] `Software techniques for managing speculation on AMD processors <https://developer.amd.com/wp-content/resources/90343-B_SoftwareTechniquesforManagingSpeculation_WP_7-18Update_FNL.pdf>`_. +[6] `Software techniques for managing speculation on AMD processors <https://developer.amd.com/wp-content/resources/Managing-Speculation-on-AMD-Processors.pdf>`_. ARM white papers:
Greg Kroah-Hartman
maintainerPATCH 7/37 x86/speculation: Warn about Spectre v2 LFENCE mitigation
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
commit eafd987d4a82c7bb5aa12f0e3b4f8f3dea93e678 upstream.
With:
f8a66d608a3e ("x86,bugs: Unconditionally allow spectre_v2=retpoline,amd")
it became possible to enable the LFENCE "retpoline" on Intel. However, Intel doesn't recommend it, as it has some weaknesses compared to retpoline.
Now AMD doesn't recommend it either.
It can still be left available as a cmdline option. It's faster than retpoline but is weaker in certain scenarios -- particularly SMT, but even non-SMT may be vulnerable in some cases.
So just unconditionally warn if the user requests it on the cmdline.
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/bugs.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kernel/cpu/bugs.c +5 -0
@@ -651,6 +651,7 @@ static inline const char *spectre_v2_modstatic inline const char *spectre_v2_module_string (void ) {return "" ; }#endif +#define SPECTRE_V2_LFENCE_MSG "WARNING: LFENCE mitigation is not recommended for this CPU, data leaks possible!\n"#define SPECTRE_V2_EIBRS_EBPF_MSG "WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible via Spectre v2 BHB attacks!\n"#ifdef CONFIG_BPF_SYSCALL
@@ -972,6 +973,7 @@ static void __init spectre_v2_select_mitbreak ;case SPECTRE_V2_CMD_RETPOLINE_LFENCE : +pr_err (SPECTRE_V2_LFENCE_MSG ); mode =SPECTRE_V2_LFENCE ;break ;
@@ -1787,6 +1789,9 @@ static char *ibpb_state(void)static ssize_t spectre_v2_show_state (char *buf) { +if (spectre_v2_enabled ==SPECTRE_V2_LFENCE ) +return sprintf (buf,"Vulnerable: LFENCE\n" ); +if (spectre_v2_enabled ==SPECTRE_V2_EIBRS &&unprivileged_ebpf_enabled ())return sprintf (buf,"Vulnerable: Unprivileged eBPF enabled\n" );
Greg Kroah-Hartman
maintainerPATCH 8/37 x86/speculation: Warn about eIBRS + LFENCE + Unprivileged eBPF + SMT
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
commit 0de05d056afdb00eca8c7bbb0c79a3438daf700c upstream.
The commit
44a3918c8245 ("x86/speculation: Include unprivileged eBPF status in Spectre v2 mitigation reporting")
added a warning for the "eIBRS + unprivileged eBPF" combination, which has been shown to be vulnerable against Spectre v2 BHB-based attacks.
However, there's no warning about the "eIBRS + LFENCE retpoline + unprivileged eBPF" combo. The LFENCE adds more protection by shortening the speculation window after a mispredicted branch. That makes an attack significantly more difficult, even with unprivileged eBPF. So at least for now the logic doesn't warn about that combination.
But if you then add SMT into the mix, the SMT attack angle weakens the effectiveness of the LFENCE considerably.
So extend the "eIBRS + unprivileged eBPF" warning to also include the "eIBRS + LFENCE + unprivileged eBPF + SMT" case.
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/bugs.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/bugs.c +25 -2
@@ -653,12 +653,27 @@ static inline const char *spectre_v2_mod#define SPECTRE_V2_LFENCE_MSG "WARNING: LFENCE mitigation is not recommended for this CPU, data leaks possible!\n"#define SPECTRE_V2_EIBRS_EBPF_MSG "WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible via Spectre v2 BHB attacks!\n" +#define SPECTRE_V2_EIBRS_LFENCE_EBPF_SMT_MSG "WARNING: Unprivileged eBPF is enabled with eIBRS+LFENCE mitigation and SMT, data leaks possible via Spectre v2 BHB attacks!\n"#ifdef CONFIG_BPF_SYSCALL void unpriv_ebpf_notify (int new_state) { -if (spectre_v2_enabled ==SPECTRE_V2_EIBRS && !new_state) +if (new_state) +return ; + +/* Unprivileged eBPF is enabled */ + +switch (spectre_v2_enabled) { +case SPECTRE_V2_EIBRS :pr_err (SPECTRE_V2_EIBRS_EBPF_MSG ); +break ; +case SPECTRE_V2_EIBRS_LFENCE : +if (sched_smt_active ()) +pr_err (SPECTRE_V2_EIBRS_LFENCE_EBPF_SMT_MSG ); +break ; +default : +break ; + } }#endif
@@ -1118,6 +1133,10 @@ void cpu_bugs_smt_update(void) {mutex_lock (&spec_ctrl_mutex); +if (sched_smt_active () &&unprivileged_ebpf_enabled () && + spectre_v2_enabled ==SPECTRE_V2_EIBRS_LFENCE ) +pr_warn_once (SPECTRE_V2_EIBRS_LFENCE_EBPF_SMT_MSG ); +switch (spectre_v2_user_stibp) {case SPECTRE_V2_USER_NONE :break ;
@@ -1793,7 +1812,11 @@ static ssize_t spectre_v2_show_state(chareturn sprintf (buf,"Vulnerable: LFENCE\n" );if (spectre_v2_enabled ==SPECTRE_V2_EIBRS &&unprivileged_ebpf_enabled ()) -return sprintf (buf,"Vulnerable: Unprivileged eBPF enabled\n" ); +return sprintf (buf,"Vulnerable: eIBRS with unprivileged eBPF\n" ); + +if (sched_smt_active () &&unprivileged_ebpf_enabled () && + spectre_v2_enabled ==SPECTRE_V2_EIBRS_LFENCE ) +return sprintf (buf,"Vulnerable: eIBRS+LFENCE with unprivileged eBPF and SMT\n" ); return sprintf(buf, "%s%s%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled],
Greg Kroah-Hartman
maintainerPATCH 9/37 ARM: report Spectre v2 status through sysfs
In reply to Greg Kroah-HartmanFrom: "Russell King (Oracle)" <[email protected]>
commit 9dd78194a3722fa6712192cdd4f7032d45112a9a upstream.
As per other architectures, add support for reporting the Spectre vulnerability status via sysfs CPU.
--- arch/arm/include/asm/spectre.h | 28 ++++++++ arch/arm/kernel/Makefile | 2 arch/arm/kernel/spectre.c | 54 +++++++++++++++ arch/arm/mm/Kconfig | 1 arch/arm/mm/proc-v7-bugs.c | 141 +++++++++++++++++++++++++++++------------ 5 files changed, 187 insertions(+), 39 deletions(-) create mode 100644 arch/arm/include/asm/spectre.h create mode 100644 arch/arm/kernel/spectre.c
arch/arm/include/asm/spectre.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_SPECTRE_H +#define __ASM_SPECTRE_H + +enum { +SPECTRE_UNAFFECTED , +SPECTRE_MITIGATED , +SPECTRE_VULNERABLE , +}; + +enum { + __SPECTRE_V2_METHOD_BPIALL, + __SPECTRE_V2_METHOD_ICIALLU, + __SPECTRE_V2_METHOD_SMC, + __SPECTRE_V2_METHOD_HVC, +}; + +enum { +SPECTRE_V2_METHOD_BPIALL =BIT (__SPECTRE_V2_METHOD_BPIALL), +SPECTRE_V2_METHOD_ICIALLU =BIT (__SPECTRE_V2_METHOD_ICIALLU), +SPECTRE_V2_METHOD_SMC =BIT (__SPECTRE_V2_METHOD_SMC), +SPECTRE_V2_METHOD_HVC =BIT (__SPECTRE_V2_METHOD_HVC), +}; + +void spectre_v2_update_state (unsigned int state,unsigned int methods); + +#endif
arch/arm/kernel/Makefile +2 -0
@@ -106,4 +106,6 @@ endif obj-$(CONFIG_HAVE_ARM_SMCCC) += smccc-call.o +obj-$(CONFIG_GENERIC_CPU_VULNERABILITIES) += spectre.o + extra-y := $(head-y) vmlinux.lds
arch/arm/kernel/spectre.c new file +54 -0
54 lines not on this page · raw message
arch/arm/mm/Kconfig +1 -0
@@ -830,6 +830,7 @@ config CPU_BPREDICT_DISABLE config CPU_SPECTRE bool + select GENERIC_CPU_VULNERABILITIES config HARDEN_BRANCH_PREDICTOR bool "Harden the branch predictor against aliasing attacks" if EXPERT
arch/arm/mm/proc-v7-bugs.c +102 -39
207 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 10/37 ARM: early traps initialisation
In reply to Greg Kroah-HartmanFrom: "Russell King (Oracle)" <[email protected]>
commit 04e91b7324760a377a725e218b5ee783826d30f5 upstream.
Provide a couple of helpers to copy the vectors and stubs, and also to flush the copied vectors and stubs.
--- arch/arm/kernel/traps.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
arch/arm/kernel/traps.c +21 -6
@@ -787,10 +787,22 @@ static inline void __init kuser_init(voi }#endif +#ifndef CONFIG_CPU_V7M +static void copy_from_lma (void *vma,void *lma_start,void *lma_end) +{ +memcpy (vma, lma_start, lma_end - lma_start); +} + +static void flush_vectors (void *vma,size_t offset,size_t size) +{ +unsigned long start = (unsigned long )vma + offset; +unsigned long end = start + size; + +flush_icache_range (start, end); +} +void __init early_trap_init (void *vectors_base) { -#ifndef CONFIG_CPU_V7M -unsigned long vectors = (unsigned long )vectors_base;extern char __stubs_start[], __stubs_end[];extern char __vectors_start[], __vectors_end[];unsigned i;
@@ -811,17 +823,20 @@ void __init early_trap_init(void *vector* into the vector page, mapped at 0xffff0000, and ensure these * are visible to the instruction stream. */ -memcpy ((void *)vectors, __vectors_start, __vectors_end - __vectors_start); -memcpy ((void *)vectors +0x1000 , __stubs_start, __stubs_end - __stubs_start); +copy_from_lma (vectors_base, __vectors_start, __vectors_end); +copy_from_lma (vectors_base +0x1000 , __stubs_start, __stubs_end);kuser_init (vectors_base); -flush_icache_range (vectors, vectors +PAGE_SIZE *2 ); + flush_vectors(vectors_base, 0, PAGE_SIZE * 2); +}#else /* ifndef CONFIG_CPU_V7M */ +void __init early_trap_init (void *vectors_base) +{/* * on V7-M there is no need to copy the vector table to a dedicated * memory area. The address is configurable and so a table in the kernel * image can be used. */ -#endif } +#endif
Greg Kroah-Hartman
maintainerPATCH 11/37 ARM: use LOADADDR() to get load address of sections
In reply to Greg Kroah-HartmanFrom: "Russell King (Oracle)" <[email protected]>
commit 8d9d651ff2270a632e9dc497b142db31e8911315 upstream.
Use the linker's LOADADDR() macro to get the load address of the sections, and provide a macro to set the start and end symbols.
--- arch/arm/include/asm/vmlinux.lds.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
arch/arm/include/asm/vmlinux.lds.h +12 -7
@@ -26,6 +26,11 @@#define ARM_MMU_DISCARD (x) x#endif +/* Set start/end symbol names to the LMA for the section */ +#define ARM_LMA (sym, section) \ + sym##_start = LOADADDR(section); \ + sym##_end = LOADADDR(section) + SIZEOF(section) +#define PROC_INFO \ . = ALIGN(4); \ __proc_info_begin = .; \
@@ -110,19 +115,19 @@* only thing that matters is their relative offsets */ #define ARM_VECTORS \ - __vectors_start = .; \ + __vectors_lma = .; \ .vectors 0xffff0000 : AT(__vectors_start) { \ *(.vectors) \ } \ - . = __vectors_start + SIZEOF(.vectors); \ - __vectors_end = .; \ + ARM_LMA(__vectors, .vectors); \ + . = __vectors_lma + SIZEOF(.vectors); \ \ - __stubs_start = .; \ - .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { \ + __stubs_lma = .; \ + .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { \ *(.stubs) \ } \ - . = __stubs_start + SIZEOF(.stubs); \ - __stubs_end = .; \ + ARM_LMA(__stubs, .stubs); \ + . = __stubs_lma + SIZEOF(.stubs); \ \ PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors));
Greg Kroah-Hartman
maintainerPATCH 12/37 ARM: Spectre-BHB workaround
In reply to Greg Kroah-HartmanFrom: "Russell King (Oracle)" <[email protected]>
comomit b9baf5c8c5c356757f4f9d8180b5e9d234065bc3 upstream.
Workaround the Spectre BHB issues for Cortex-A15, Cortex-A57, Cortex-A72, Cortex-A73 and Cortex-A75. We also include Brahma B15 as well to be safe, which is affected by Spectre V2 in the same ways as Cortex-A15.
--- arch/arm/include/asm/assembler.h | 10 ++++ arch/arm/include/asm/spectre.h | 4 + arch/arm/include/asm/vmlinux.lds.h | 18 +++++++- arch/arm/kernel/entry-armv.S | 79 ++++++++++++++++++++++++++++++++++--- arch/arm/kernel/entry-common.S | 24 +++++++++++ arch/arm/kernel/spectre.c | 4 + arch/arm/kernel/traps.c | 38 +++++++++++++++++ arch/arm/mm/Kconfig | 10 ++++ arch/arm/mm/proc-v7-bugs.c | 76 +++++++++++++++++++++++++++++++++++ 9 files changed, 254 insertions(+), 9 deletions(-)
arch/arm/include/asm/assembler.h +10 -0
@@ -107,6 +107,16 @@ .endm#endif +#if __LINUX_ARM_ARCH__ <7 + .macro dsb, args + mcr p15, 0, r0, c7, c10, 4 + .endm + + .macro isb, args + mcr p15, 0, r0, c7, r5, 4 + .endm +#endif + .macro asm_trace_hardirqs_off, save=1#if defined(CONFIG_TRACE_IRQFLAGS ) .if \save
arch/arm/include/asm/spectre.h +4 -0
@@ -14,6 +14,7 @@ enum { __SPECTRE_V2_METHOD_ICIALLU, __SPECTRE_V2_METHOD_SMC, __SPECTRE_V2_METHOD_HVC, + __SPECTRE_V2_METHOD_LOOP8, }; enum {
@@ -21,8 +22,11 @@ enum {SPECTRE_V2_METHOD_ICIALLU =BIT (__SPECTRE_V2_METHOD_ICIALLU),SPECTRE_V2_METHOD_SMC =BIT (__SPECTRE_V2_METHOD_SMC),SPECTRE_V2_METHOD_HVC =BIT (__SPECTRE_V2_METHOD_HVC), + SPECTRE_V2_METHOD_LOOP8 = BIT(__SPECTRE_V2_METHOD_LOOP8), };void spectre_v2_update_state (unsigned int state,unsigned int methods); +int spectre_bhb_update_vectors (unsigned int method); +#endif
arch/arm/include/asm/vmlinux.lds.h +15 -3
@@ -116,11 +116,23 @@*/ #define ARM_VECTORS \ __vectors_lma = .; \ - .vectors 0xffff0000 : AT(__vectors_start) { \ - *(.vectors) \ + OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { \ + .vectors { \ + *(.vectors) \ + } \ + .vectors.bhb.loop8 { \ + *(.vectors.bhb.loop8) \ + } \ + .vectors.bhb.bpiall { \ + *(.vectors.bhb.bpiall) \ + } \ } \ ARM_LMA(__vectors, .vectors); \ - . = __vectors_lma + SIZEOF(.vectors); \ + ARM_LMA(__vectors_bhb_loop8, .vectors.bhb.loop8); \ + ARM_LMA(__vectors_bhb_bpiall, .vectors.bhb.bpiall); \ + . = __vectors_lma + SIZEOF(.vectors) + \ + SIZEOF(.vectors.bhb.loop8) + \ + SIZEOF(.vectors.bhb.bpiall); \ \ __stubs_lma = .; \ .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { \
arch/arm/kernel/entry-armv.S +73 -6
111 lines not on this page · raw message
arch/arm/kernel/entry-common.S +24 -0
@@ -154,12 +154,36 @@ ENDPROC(ret_from_fork) */ .align 5 +#ifdef CONFIG_HARDEN_BRANCH_HISTORY +ENTRY(vector_bhb_loop8_swi) + sub sp, sp, #PT_REGS_SIZE + stmia sp, {r0 - r12} + mov r8, #8 +1: b 2f +2: subs r8, r8, #1 + bne 1b + dsb + isb + b 3f +ENDPROC(vector_bhb_loop8_swi) + + .align 5 +ENTRY(vector_bhb_bpiall_swi) + sub sp, sp, #PT_REGS_SIZE + stmia sp, {r0 - r12} + mcr p15, 0, r8, c7, c5, 6 @ BPIALL + isb + b 3f +ENDPROC(vector_bhb_bpiall_swi) +#endif + .align 5 ENTRY(vector_swi) #ifdef CONFIG_CPU_V7M v7m_exception_entry #else sub sp, sp, #PT_REGS_SIZE stmia sp, {r0 - r12} @ Calling r0 - r12 +3: ARM( add r8, sp, #S_PC ) ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr THUMB( mov r8, sp )
arch/arm/kernel/spectre.c +4 -0
@@ -45,6 +45,10 @@ ssize_t cpu_show_spectre_v2(struct devic method ="Firmware call" ;break ; +case SPECTRE_V2_METHOD_LOOP8 : + method ="History overwrite" ; +break ; +default : method ="Multiple mitigations" ;break ;
arch/arm/kernel/traps.c +38 -0
@@ -30,6 +30,7 @@#include <linux/atomic.h> #include <asm/cacheflush.h> #include <asm/exception.h> +#include <asm/spectre.h> #include <asm/unistd.h> #include <asm/traps.h> #include <asm/ptrace.h>
@@ -801,6 +802,43 @@ static void flush_vectors(void *vma, sizflush_icache_range (start, end); } +#ifdef CONFIG_HARDEN_BRANCH_HISTORY +int spectre_bhb_update_vectors (unsigned int method) +{ +extern char __vectors_bhb_bpiall_start[], __vectors_bhb_bpiall_end[]; +extern char __vectors_bhb_loop8_start[], __vectors_bhb_loop8_end[]; +void *vec_start, *vec_end; + +if (system_state >=SYSTEM_FREEING_INITMEM ) { +pr_err ("CPU%u: Spectre BHB workaround too late - system vulnerable\n" , +smp_processor_id ()); +return SPECTRE_VULNERABLE ; + } + +switch (method) { +case SPECTRE_V2_METHOD_LOOP8 : + vec_start = __vectors_bhb_loop8_start; + vec_end = __vectors_bhb_loop8_end; +break ; + +case SPECTRE_V2_METHOD_BPIALL : + vec_start = __vectors_bhb_bpiall_start; + vec_end = __vectors_bhb_bpiall_end; +break ; + +default : +pr_err ("CPU%u: unknown Spectre BHB state %d\n" , +smp_processor_id (), method); +return SPECTRE_VULNERABLE ; + } + +copy_from_lma (vectors_page, vec_start, vec_end); +flush_vectors (vectors_page,0 , vec_end - vec_start); + +return SPECTRE_MITIGATED ; +} +#endif +void __init early_trap_init (void *vectors_base) {extern char __stubs_start[], __stubs_end[];
arch/arm/mm/Kconfig +10 -0
@@ -851,6 +851,16 @@ config HARDEN_BRANCH_PREDICTOR If unsure, say Y. +config HARDEN_BRANCH_HISTORY + bool "Harden Spectre style attacks against branch history" if EXPERT + depends on CPU_SPECTRE + default y + help + Speculation attacks against some high-performance processors can + make use of branch history to influence future speculation. When + taking an exception, a sequence of branches overwrites the branch + history, or branch history is invalidated. + config TLS_REG_EMUL bool select NEED_KUSER_HELPERS
arch/arm/mm/proc-v7-bugs.c +76 -0
86 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 13/37 ARM: include unprivileged BPF status in Spectre V2 reporting
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
commit 25875aa71dfefd1959f07e626c4d285b88b27ac2 upstream.
The mitigations for Spectre-BHB are only applied when an exception is taken, but when unprivileged BPF is enabled, userspace can load BPF programs that can be used to exploit the problem.
When unprivileged BPF is enabled, report the vulnerable status via the spectre_v2 sysfs file.
--- arch/arm/kernel/spectre.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/kernel/spectre.c +13 -0
@@ -1,9 +1,19 @@// SPDX-License-Identifier: GPL-2.0-only +#include <linux/bpf.h> #include <linux/cpu.h> #include <linux/device.h> #include <asm/spectre.h> +static bool _unprivileged_ebpf_enabled (void ) +{ +#ifdef CONFIG_BPF_SYSCALL +return !sysctl_unprivileged_bpf_disabled; +#else + return false +#endif +} +ssize_t cpu_show_spectre_v1 (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -31,6 +41,9 @@ ssize_t cpu_show_spectre_v2(struct devicif (spectre_v2_state !=SPECTRE_MITIGATED )return sprintf (buf,"%s\n" ,"Vulnerable" ); +if (_unprivileged_ebpf_enabled ()) +return sprintf (buf,"Vulnerable: Unprivileged eBPF enabled\n" ); +switch (spectre_v2_methods) {case SPECTRE_V2_METHOD_BPIALL : method ="Branch predictor hardening" ;
Greg Kroah-Hartman
maintainerPATCH 14/37 arm64: add ID_AA64ISAR2_EL1 sys register
In reply to Greg Kroah-HartmanFrom: Joey Gouly <[email protected]>
commit 9e45365f1469ef2b934f9d035975dbc9ad352116 upstream.
This is a new ID register, introduced in 8.7.
--- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/sysreg.h | 15 +++++++++++++++ arch/arm64/kernel/cpufeature.c | 9 +++++++++ arch/arm64/kernel/cpuinfo.c | 1 + arch/arm64/kvm/sys_regs.c | 2 +- 5 files changed, 27 insertions(+), 1 deletion(-)
arch/arm64/include/asm/cpu.h +1 -0
@@ -51,6 +51,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/sysreg.h +15 -0
@@ -182,6 +182,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)
@@ -771,6 +772,20 @@#define ID_AA64ISAR1_GPI_NI 0x0#define ID_AA64ISAR1_GPI_IMP_DEF 0x1 +/* id_aa64isar2 */ +#define ID_AA64ISAR2_RPRES_SHIFT 4 +#define ID_AA64ISAR2_WFXT_SHIFT 0 + +#define ID_AA64ISAR2_RPRES_8BIT 0x0 +#define ID_AA64ISAR2_RPRES_12BIT 0x1 +/* +* Value 0x1 has been removed from the architecture, and is +* reserved, but has not yet been removed from the ARM ARM +* as of ARM DDI 0487G.b. +*/ +#define ID_AA64ISAR2_WFXT_NI 0x0 +#define ID_AA64ISAR2_WFXT_SUPPORTED 0x2 +/* id_aa64pfr0 */ #define ID_AA64PFR0_CSV3_SHIFT 60#define ID_AA64PFR0_CSV2_SHIFT 56
arch/arm64/kernel/cpufeature.c +9 -0
@@ -225,6 +225,10 @@ static const struct arm64_ftr_bits ftr_i ARM64_FTR_END, }; +static const struct arm64_ftr_bits ftr_id_aa64isar2[] = { +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 ),
@@ -637,6 +641,7 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG (SYS_ID_AA64ISAR0_EL1 , ftr_id_aa64isar0),ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR1_EL1 , ftr_id_aa64isar1, &id_aa64isar1_override), +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),
@@ -933,6 +938,7 @@ void __init init_cpu_features(struct cpuinit_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);
@@ -1151,6 +1157,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
@@ -1272,6 +1280,7 @@ u64 __read_sysreg_by_encoding(u32 sys_idread_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 );
arch/arm64/kernel/cpuinfo.c +1 -0
@@ -391,6 +391,7 @@ static void __cpuinfo_store_cpu(struct c 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/kvm/sys_regs.c +1 -1
@@ -1525,7 +1525,7 @@ static const struct sys_reg_desc sys_reg/* CRm=6 */ ID_SANITISED (ID_AA64ISAR0_EL1 ),ID_SANITISED (ID_AA64ISAR1_EL1 ), -ID_UNALLOCATED (6 ,2 ), +ID_SANITISED (ID_AA64ISAR2_EL1 ),ID_UNALLOCATED (6 ,3 ),ID_UNALLOCATED (6 ,4 ), ID_UNALLOCATED(6,5),
Greg Kroah-Hartman
maintainerPATCH 15/37 arm64: cpufeature: add HWCAP for FEAT_AFP
In reply to Greg Kroah-HartmanFrom: Joey Gouly <[email protected]>
commit 5c13f042e73200b50573ace63e1a6b94e2917616 upstream.
Add a new HWCAP to detect the Alternate Floating-point Behaviour feature (FEAT_AFP), introduced in Armv8.7.
Also expose this to userspace in the ID_AA64MMFR1_EL1 feature register.
--- Documentation/arm64/cpu-feature-registers.rst | 9 +++++++++ Documentation/arm64/elf_hwcaps.rst | 4 ++++ arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/include/asm/sysreg.h | 1 + arch/arm64/include/uapi/asm/hwcap.h | 1 + arch/arm64/kernel/cpufeature.c | 2 ++ arch/arm64/kernel/cpuinfo.c | 1 + 7 files changed, 19 insertions(+)
Documentation/arm64/cpu-feature-registers.rst +9 -0
@@ -275,6 +275,15 @@ infrastructure: | SVEVer | [3-0] | y | +------------------------------+---------+---------+ + 8) ID_AA64MMFR1_EL1 - Memory model feature register 1 + + +------------------------------+---------+---------+ + | Name | bits | visible | + +------------------------------+---------+---------+ + | AFP | [47-44] | y | + +------------------------------+---------+---------+ + + Appendix I: Example -------------------
Documentation/arm64/elf_hwcaps.rst +4 -0
@@ -251,6 +251,10 @@ HWCAP2_ECV Functionality implied by ID_AA64MMFR0_EL1.ECV == 0b0001. +HWCAP2_AFP + + Functionality implied by ID_AA64MFR1_EL1.AFP == 0b0001. + 4. Unused AT_HWCAP bits -----------------------
arch/arm64/include/asm/hwcap.h +1 -0
@@ -106,6 +106,7 @@#define KERNEL_HWCAP_BTI __khwcap2_feature(BTI)#define KERNEL_HWCAP_MTE __khwcap2_feature(MTE)#define KERNEL_HWCAP_ECV __khwcap2_feature(ECV) +#define KERNEL_HWCAP_AFP __khwcap2_feature(AFP)/* * This yields a mask that user programs can use to figure out what
arch/arm64/include/asm/sysreg.h +1 -0
@@ -904,6 +904,7 @@#endif /* id_aa64mmfr1 */ +#define ID_AA64MMFR1_AFP_SHIFT 44#define ID_AA64MMFR1_ETS_SHIFT 36#define ID_AA64MMFR1_TWED_SHIFT 32#define ID_AA64MMFR1_XNX_SHIFT 28
arch/arm64/include/uapi/asm/hwcap.h +1 -0
@@ -76,5 +76,6 @@#define HWCAP2_BTI (1 << 17)#define HWCAP2_MTE (1 << 18)#define HWCAP2_ECV (1 << 19) +#define HWCAP2_AFP (1 << 20)#endif /* _UAPI__ASM_HWCAP_H */
arch/arm64/kernel/cpufeature.c +2 -0
@@ -329,6 +329,7 @@ static const struct arm64_ftr_bits ftr_i };static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = { +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_AFP_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_ETS_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_TWED_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64MMFR1_XNX_SHIFT ,4 ,0 ),
@@ -2488,6 +2489,7 @@ static const struct arm64_cpu_capabilitiHWCAP_CAP (SYS_ID_AA64PFR1_EL1 ,ID_AA64PFR1_MTE_SHIFT ,FTR_UNSIGNED ,ID_AA64PFR1_MTE ,CAP_HWCAP ,KERNEL_HWCAP_MTE ), #endif /* CONFIG_ARM64_MTE */HWCAP_CAP (SYS_ID_AA64MMFR0_EL1 ,ID_AA64MMFR0_ECV_SHIFT ,FTR_UNSIGNED ,1 ,CAP_HWCAP ,KERNEL_HWCAP_ECV ), + HWCAP_CAP(SYS_ID_AA64MMFR1_EL1, ID_AA64MMFR1_AFP_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_AFP), {}, };
arch/arm64/kernel/cpuinfo.c +1 -0
@@ -95,6 +95,7 @@ static const char *const hwcap_str[] = { [KERNEL_HWCAP_BTI] = "bti", [KERNEL_HWCAP_MTE] = "mte", [KERNEL_HWCAP_ECV] = "ecv", + [KERNEL_HWCAP_AFP] = "afp", };#ifdef CONFIG_COMPAT
Greg Kroah-Hartman
maintainerPATCH 16/37 arm64: cpufeature: add HWCAP for FEAT_RPRES
In reply to Greg Kroah-HartmanFrom: Joey Gouly <[email protected]>
commit 1175011a7d0030d49dc9c10bde36f08f26d0a8ee upstream.
Add a new HWCAP to detect the Increased precision of Reciprocal Estimate and Reciprocal Square Root Estimate feature (FEAT_RPRES), introduced in Armv8.7.
Also expose this to userspace in the ID_AA64ISAR2_EL1 feature register.
--- Documentation/arm64/cpu-feature-registers.rst | 8 ++++++++ Documentation/arm64/elf_hwcaps.rst | 4 ++++ arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/include/uapi/asm/hwcap.h | 1 + arch/arm64/kernel/cpufeature.c | 2 ++ arch/arm64/kernel/cpuinfo.c | 1 + 6 files changed, 17 insertions(+)
Documentation/arm64/cpu-feature-registers.rst +8 -0
@@ -283,6 +283,14 @@ infrastructure: | AFP | [47-44] | y | +------------------------------+---------+---------+ + 9) ID_AA64ISAR2_EL1 - Instruction set attribute register 2 + + +------------------------------+---------+---------+ + | Name | bits | visible | + +------------------------------+---------+---------+ + | RPRES | [7-4] | y | + +------------------------------+---------+---------+ + Appendix I: Example -------------------
Documentation/arm64/elf_hwcaps.rst +4 -0
@@ -255,6 +255,10 @@ HWCAP2_AFP Functionality implied by ID_AA64MFR1_EL1.AFP == 0b0001. +HWCAP2_RPRES + + Functionality implied by ID_AA64ISAR2_EL1.RPRES == 0b0001. + 4. Unused AT_HWCAP bits -----------------------
arch/arm64/include/asm/hwcap.h +1 -0
@@ -107,6 +107,7 @@#define KERNEL_HWCAP_MTE __khwcap2_feature(MTE)#define KERNEL_HWCAP_ECV __khwcap2_feature(ECV)#define KERNEL_HWCAP_AFP __khwcap2_feature(AFP) +#define KERNEL_HWCAP_RPRES __khwcap2_feature(RPRES)/* * This yields a mask that user programs can use to figure out what
arch/arm64/include/uapi/asm/hwcap.h +1 -0
@@ -77,5 +77,6 @@#define HWCAP2_MTE (1 << 18)#define HWCAP2_ECV (1 << 19)#define HWCAP2_AFP (1 << 20) +#define HWCAP2_RPRES (1 << 21)#endif /* _UAPI__ASM_HWCAP_H */
arch/arm64/kernel/cpufeature.c +2 -0
@@ -226,6 +226,7 @@ static const struct arm64_ftr_bits ftr_i };static const struct arm64_ftr_bits ftr_id_aa64isar2[] = { +ARM64_FTR_BITS (FTR_VISIBLE ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR2_RPRES_SHIFT ,4 ,0 ),ARM64_FTR_END , };
@@ -2490,6 +2491,7 @@ static const struct arm64_cpu_capabiliti#endif /* CONFIG_ARM64_MTE */ HWCAP_CAP (SYS_ID_AA64MMFR0_EL1 ,ID_AA64MMFR0_ECV_SHIFT ,FTR_UNSIGNED ,1 ,CAP_HWCAP ,KERNEL_HWCAP_ECV ),HWCAP_CAP (SYS_ID_AA64MMFR1_EL1 ,ID_AA64MMFR1_AFP_SHIFT ,FTR_UNSIGNED ,1 ,CAP_HWCAP ,KERNEL_HWCAP_AFP ), + HWCAP_CAP(SYS_ID_AA64ISAR2_EL1, ID_AA64ISAR2_RPRES_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_RPRES), {}, };
arch/arm64/kernel/cpuinfo.c +1 -0
@@ -96,6 +96,7 @@ static const char *const hwcap_str[] = { [KERNEL_HWCAP_MTE] = "mte", [KERNEL_HWCAP_ECV] = "ecv", [KERNEL_HWCAP_AFP] = "afp", + [KERNEL_HWCAP_RPRES] = "rpres", };#ifdef CONFIG_COMPAT
Greg Kroah-Hartman
maintainerPATCH 17/37 arm64: entry.S: Add ventry overflow sanity checks
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 4330e2c5c04c27bebf89d34e0bc14e6943413067 upstream.
Subsequent patches add even more code to the ventry slots. Ensure kernels that overflow a ventry slot don't get built.
--- arch/arm64/kernel/entry.S | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/kernel/entry.S +3 -0
@@ -37,6 +37,7 @@ .macro kernel_ventry, el:req, ht:req, regsize:req, label:req .align 7 +.Lventry_start\@: #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 .if \el == 0 alternative_if ARM64_UNMAP_KERNEL_AT_EL0
@@ -95,6 +96,7 @@ alternative_else_nop_endif mrs x0, tpidrro_el0 #endif b el\el\ht\()_\regsize\()_\label +.org .Lventry_start\@ + 128 // Did we overflow the ventry slot? .endm .macro tramp_alias, dst, sym
@@ -662,6 +664,7 @@ alternative_else_nop_endif add x30, x30, #(1b - tramp_vectors) isb ret +.org 1b + 128 // Did we overflow the ventry slot? .endm .macro tramp_exit, regsize = 64
Greg Kroah-Hartman
maintainerPATCH 18/37 arm64: spectre: Rename spectre_v4_patch_fw_mitigation_conduit
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 1b33d4860deaecf1d8eec3061b7e7ed7ab0bae8d upstream.
The spectre-v4 sequence includes an SMC from the assembly entry code. spectre_v4_patch_fw_mitigation_conduit is the patching callback that generates an HVC or SMC depending on the SMCCC conduit type.
As this isn't specific to spectre-v4, rename it smccc_patch_fw_mitigation_conduit so it can be re-used.
--- arch/arm64/kernel/entry.S | 2 +- arch/arm64/kernel/proton-pack.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/kernel/entry.S +1 -1
@@ -118,7 +118,7 @@ alternative_cb_end tbnz \tmp2, #TIF_SSBD, .L__asm_ssbd_skip\@ mov w0, #ARM_SMCCC_ARCH_WORKAROUND_2 mov w1, #\state -alternative_cb spectre_v4_patch_fw_mitigation_conduit +alternative_cb smccc_patch_fw_mitigation_conduit nop // Patched to SMC/HVC #0 alternative_cb_end .L__asm_ssbd_skip\@:
arch/arm64/kernel/proton-pack.c +3 -3
@@ -554,9 +554,9 @@ void __init spectre_v4_patch_fw_mitigati* Patch a NOP in the Spectre-v4 mitigation code with an SMC/HVC instruction * to call into firmware to adjust the mitigation state. */ -void __init spectre_v4_patch_fw_mitigation_conduit (struct alt_instr *alt, -__le32 *origptr, -__le32 *updptr,int nr_inst) +void __init smccc_patch_fw_mitigation_conduit (struct alt_instr *alt, +__le32 *origptr, +__le32 *updptr,int nr_inst) {u32 insn;
Greg Kroah-Hartman
maintainerPATCH 19/37 KVM: arm64: Allow indirect vectors to be used without SPECTRE_V3A
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 5bdf3437603d4af87f9c7f424b0c8aeed2420745 upstream.
CPUs vulnerable to Spectre-BHB either need to make an SMC-CC firmware call from the vectors, or run a sequence of branches. This gets added to the hyp vectors. If there is no support for arch-workaround-1 in firmware, the indirect vector will be used.
kvm_init_vector_slots() only initialises the two indirect slots if the platform is vulnerable to Spectre-v3a. pKVM's hyp_map_vectors() only initialises __hyp_bp_vect_base if the platform is vulnerable to Spectre-v3a.
As there are about to more users of the indirect vectors, ensure their entries in hyp_spectre_vector_selector[] are always initialised, and __hyp_bp_vect_base defaults to the regular VA mapping.
The Spectre-v3a check is moved to a helper kvm_system_needs_idmapped_vectors(), and merged with the code that creates the hyp mappings.
--- arch/arm64/include/asm/kvm_host.h | 5 +++++ arch/arm64/kvm/arm.c | 5 +---- arch/arm64/kvm/hyp/nvhe/mm.c | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-)
arch/arm64/include/asm/kvm_host.h +5 -0
@@ -712,6 +712,11 @@ static inline void kvm_init_host_cpu_conctxt_sys_reg (cpu_ctxt,MPIDR_EL1 ) =read_cpuid_mpidr (); } +static inline bool kvm_system_needs_idmapped_vectors (void ) +{ +return cpus_have_const_cap (ARM64_SPECTRE_V3A ); +} +void kvm_arm_vcpu_ptrauth_trap (struct kvm_vcpu *vcpu);static inline void kvm_arch_hardware_unsetup (void ) {}
arch/arm64/kvm/arm.c +1 -4
@@ -1464,10 +1464,7 @@ static int kvm_init_vector_slots(void) base =kern_hyp_va (kvm_ksym_ref (__bp_harden_hyp_vecs));kvm_init_vector_slot (base,HYP_VECTOR_SPECTRE_DIRECT ); -if (!cpus_have_const_cap (ARM64_SPECTRE_V3A )) -return 0 ; - -if (!has_vhe ()) { +if (kvm_system_needs_idmapped_vectors () && !has_vhe ()) { err =create_hyp_exec_mappings (__pa_symbol (__bp_harden_hyp_vecs), __BP_HARDEN_HYP_VECS_SZ, &base);if (err)
arch/arm64/kvm/hyp/nvhe/mm.c +3 -1
@@ -146,8 +146,10 @@ int hyp_map_vectors(void)phys_addr_t phys;void *bp_base; -if (!cpus_have_const_cap (ARM64_SPECTRE_V3A )) +if (!kvm_system_needs_idmapped_vectors ()) { + __hyp_bp_vect_base = __bp_harden_hyp_vecs;return 0 ; + } phys =__hyp_pa (__bp_harden_hyp_vecs); bp_base = (void *)__pkvm_create_private_mapping(phys,
Greg Kroah-Hartman
maintainerPATCH 20/37 arm64: entry: Make the trampoline cleanup optional
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit d739da1694a0eaef0358a42b76904b611539b77b upstream.
Subsequent patches will add additional sets of vectors that use the same tricks as the kpti vectors to reach the full-fat vectors. The full-fat vectors contain some cleanup for kpti that is patched in by alternatives when kpti is in use. Once there are additional vectors, the cleanup will be needed in more cases.
But on big/little systems, the cleanup would be harmful if no trampoline vector were in use. Instead of forcing CPUs that don't need a trampoline vector to use one, make the trampoline cleanup optional.
Entry at the top of the vectors will skip the cleanup. The trampoline vectors can then skip the first instruction, triggering the cleanup to run.
--- arch/arm64/kernel/entry.S | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm64/kernel/entry.S +7 -3
@@ -40,14 +40,18 @@ .Lventry_start\@: #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 .if \el == 0 -alternative_if ARM64_UNMAP_KERNEL_AT_EL0 + /* + * This must be the first instruction of the EL0 vector entries. It is + * skipped by the trampoline vectors, to trigger the cleanup. + */ + b .Lskip_tramp_vectors_cleanup\@ .if \regsize == 64 mrs x30, tpidrro_el0 msr tpidrro_el0, xzr .else mov x30, xzr .endif -alternative_else_nop_endif +.Lskip_tramp_vectors_cleanup\@: .endif #endif
@@ -661,7 +665,7 @@ alternative_if_not ARM64_WORKAROUND_CAVI prfm plil1strm, [x30, #(1b - tramp_vectors)] alternative_else_nop_endif msr vbar_el1, x30 - add x30, x30, #(1b - tramp_vectors) + add x30, x30, #(1b - tramp_vectors + 4) isb ret .org 1b + 128 // Did we overflow the ventry slot?
Greg Kroah-Hartman
maintainerPATCH 21/37 arm64: entry: Free up another register on kptis tramp_exit path
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 03aff3a77a58b5b52a77e00537a42090ad57b80b upstream.
Kpti stashes x30 in far_el1 while it uses x30 for all its work.
Making the vectors a per-cpu data structure will require a second register.
Allow tramp_exit two registers before it unmaps the kernel, by leaving x30 on the stack, and stashing x29 in far_el1.
--- arch/arm64/kernel/entry.S | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
arch/arm64/kernel/entry.S +13 -6
@@ -419,14 +419,16 @@ alternative_else_nop_endif ldp x24, x25, [sp, #16 * 12] ldp x26, x27, [sp, #16 * 13] ldp x28, x29, [sp, #16 * 14] - ldr lr, [sp, #S_LR] - add sp, sp, #PT_REGS_SIZE // restore sp .if \el == 0 -alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0 +alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0 + ldr lr, [sp, #S_LR] + add sp, sp, #PT_REGS_SIZE // restore sp + eret +alternative_else_nop_endif #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 bne 4f - msr far_el1, x30 + msr far_el1, x29 tramp_alias x30, tramp_exit_native br x30 4:
@@ -434,6 +436,9 @@ alternative_insn eret, nop, ARM64_UNMAP_ br x30 #endif .else + ldr lr, [sp, #S_LR] + add sp, sp, #PT_REGS_SIZE // restore sp + /* Ensure any device/NC reads complete */ alternative_insn nop, "dmb sy", ARM64_WORKAROUND_1508412
@@ -674,10 +679,12 @@ alternative_else_nop_endif .macro tramp_exit, regsize = 64 adr x30, tramp_vectors msr vbar_el1, x30 - tramp_unmap_kernel x30 + ldr lr, [sp, #S_LR] + tramp_unmap_kernel x29 .if \regsize == 64 - mrs x30, far_el1 + mrs x29, far_el1 .endif + add sp, sp, #PT_REGS_SIZE // restore sp eret sb .endm
Greg Kroah-Hartman
maintainerPATCH 22/37 arm64: entry: Move the trampoline data page before the text page
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit c091fb6ae059cda563b2a4d93fdbc548ef34e1d6 upstream.
The trampoline code has a data page that holds the address of the vectors, which is unmapped when running in user-space. This ensures that with CONFIG_RANDOMIZE_BASE, the randomised address of the kernel can't be discovered until after the kernel has been mapped.
If the trampoline text page is extended to include multiple sets of vectors, it will be larger than a single page, making it tricky to find the data page without knowing the size of the trampoline text pages, which will vary with PAGE_SIZE.
Move the data page to appear before the text page. This allows the data page to be found without knowing the size of the trampoline text pages. 'tramp_vectors' is used to refer to the beginning of the .entry.tramp.text section, do that explicitly.
--- arch/arm64/include/asm/fixmap.h | 2 +- arch/arm64/kernel/entry.S | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
arch/arm64/include/asm/fixmap.h +1 -1
@@ -62,8 +62,8 @@ enum fixed_addresses {#endif /* CONFIG_ACPI_APEI_GHES */ #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 -FIX_ENTRY_TRAMP_DATA ,FIX_ENTRY_TRAMP_TEXT , +FIX_ENTRY_TRAMP_DATA , #define TRAMP_VALIAS (__fix_to_virt(FIX_ENTRY_TRAMP_TEXT))#endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */ __end_of_permanent_fixed_addresses,
arch/arm64/kernel/entry.S +7 -2
@@ -644,6 +644,11 @@ alternative_else_nop_endif */ .endm + .macro tramp_data_page dst + adr \dst, .entry.tramp.text + sub \dst, \dst, PAGE_SIZE + .endm + .macro tramp_ventry, regsize = 64 .align 7 1:
@@ -660,7 +665,7 @@ alternative_else_nop_endif 2: tramp_map_kernel x30 #ifdef CONFIG_RANDOMIZE_BASE - adr x30, tramp_vectors + PAGE_SIZE + tramp_data_page x30 alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003 ldr x30, [x30] #else
@@ -851,7 +856,7 @@ SYM_CODE_START(__sdei_asm_entry_trampoli 1: str x4, [x1, #(SDEI_EVENT_INTREGS + S_SDEI_TTBR1)] #ifdef CONFIG_RANDOMIZE_BASE - adr x4, tramp_vectors + PAGE_SIZE + tramp_data_page x4 add x4, x4, #:lo12:__sdei_asm_trampoline_next_handler ldr x4, [x4] #else
Greg Kroah-Hartman
maintainerPATCH 23/37 arm64: entry: Allow tramp_alias to access symbols after the 4K boundary
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 6c5bf79b69f911560fbf82214c0971af6e58e682 upstream.
Systems using kpti enter and exit the kernel through a trampoline mapping that is always mapped, even when the kernel is not. tramp_valias is a macro to find the address of a symbol in the trampoline mapping.
Adding extra sets of vectors will expand the size of the entry.tramp.text section to beyond 4K. tramp_valias will be unable to generate addresses for symbols beyond 4K as it uses the 12 bit immediate of the add instruction.
As there are now two registers available when tramp_alias is called, use the extra register to avoid the 4K limit of the 12 bit immediate.
--- arch/arm64/kernel/entry.S | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/arm64/kernel/entry.S +8 -5
@@ -103,9 +103,12 @@ .org .Lventry_start\@ + 128 // Did we overflow the ventry slot? .endm - .macro tramp_alias, dst, sym + .macro tramp_alias, dst, sym, tmp mov_q \dst, TRAMP_VALIAS - add \dst, \dst, #(\sym - .entry.tramp.text) + adr_l \tmp, \sym + add \dst, \dst, \tmp + adr_l \tmp, .entry.tramp.text + sub \dst, \dst, \tmp .endm /*
@@ -429,10 +432,10 @@ alternative_else_nop_endif #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 bne 4f msr far_el1, x29 - tramp_alias x30, tramp_exit_native + tramp_alias x30, tramp_exit_native, x29 br x30 4: - tramp_alias x30, tramp_exit_compat + tramp_alias x30, tramp_exit_compat, x29 br x30 #endif .else
@@ -998,7 +1001,7 @@ alternative_if_not ARM64_UNMAP_KERNEL_AT alternative_else_nop_endif #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 - tramp_alias dst=x5, sym=__sdei_asm_exit_trampoline + tramp_alias dst=x5, sym=__sdei_asm_exit_trampoline, tmp=x3 br x5 #endif SYM_CODE_END(__sdei_asm_handler)
Greg Kroah-Hartman
maintainerPATCH 24/37 arm64: entry: Dont assume tramp_vectors is the start of the vectors
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit ed50da7764535f1e24432ded289974f2bf2b0c5a upstream.
The tramp_ventry macro uses tramp_vectors as the address of the vectors when calculating which ventry in the 'full fat' vectors to branch to.
While there is one set of tramp_vectors, this will be true. Adding multiple sets of vectors will break this assumption.
Move the generation of the vectors to a macro, and pass the start of the vectors as an argument to tramp_ventry.
--- arch/arm64/kernel/entry.S | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
arch/arm64/kernel/entry.S +16 -14
@@ -652,7 +652,7 @@ alternative_else_nop_endif sub \dst, \dst, PAGE_SIZE .endm - .macro tramp_ventry, regsize = 64 + .macro tramp_ventry, vector_start, regsize .align 7 1: .if \regsize == 64
@@ -675,10 +675,10 @@ alternative_insn isb, nop, ARM64_WORKARO ldr x30, =vectors #endif alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM - prfm plil1strm, [x30, #(1b - tramp_vectors)] + prfm plil1strm, [x30, #(1b - \vector_start)] alternative_else_nop_endif msr vbar_el1, x30 - add x30, x30, #(1b - tramp_vectors + 4) + add x30, x30, #(1b - \vector_start + 4) isb ret .org 1b + 128 // Did we overflow the ventry slot?
@@ -697,19 +697,21 @@ alternative_else_nop_endif sb .endm - .align 11 -SYM_CODE_START_NOALIGN(tramp_vectors) + .macro generate_tramp_vector +.Lvector_start\@: .space 0x400 - tramp_ventry - tramp_ventry - tramp_ventry - tramp_ventry - - tramp_ventry 32 - tramp_ventry 32 - tramp_ventry 32 - tramp_ventry 32 + .rept 4 + tramp_ventry .Lvector_start\@, 64 + .endr + .rept 4 + tramp_ventry .Lvector_start\@, 32 + .endr + .endm + + .align 11 +SYM_CODE_START_NOALIGN(tramp_vectors) + generate_tramp_vector SYM_CODE_END(tramp_vectors) SYM_CODE_START(tramp_exit_native)
Greg Kroah-Hartman
maintainerPATCH 25/37 arm64: entry: Move trampoline macros out of ifdefd section
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 13d7a08352a83ef2252aeb464a5e08dfc06b5dfd upstream.
The macros for building the kpti trampoline are all behind CONFIG_UNMAP_KERNEL_AT_EL0, and in a region that outputs to the .entry.tramp.text section.
Move the macros out so they can be used to generate other kinds of trampoline. Only the symbols need to be guarded by CONFIG_UNMAP_KERNEL_AT_EL0 and appear in the .entry.tramp.text section.
--- arch/arm64/kernel/entry.S | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
arch/arm64/kernel/entry.S +5 -6
@@ -608,12 +608,6 @@ SYM_CODE_END(ret_to_user) .popsection // .entry.text -#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 -/* - * Exception vectors trampoline. - */ - .pushsection ".entry.tramp.text", "ax" - // Move from tramp_pg_dir to swapper_pg_dir .macro tramp_map_kernel, tmp mrs \tmp, ttbr1_el1
@@ -709,6 +703,11 @@ alternative_else_nop_endif .endr .endm +#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 +/* + * Exception vectors trampoline. + */ + .pushsection ".entry.tramp.text", "ax" .align 11 SYM_CODE_START_NOALIGN(tramp_vectors) generate_tramp_vector
Greg Kroah-Hartman
maintainerPATCH 26/37 arm64: entry: Make the kpti trampolines kpti sequence optional
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit c47e4d04ba0f1ea17353d85d45f611277507e07a upstream.
Spectre-BHB needs to add sequences to the vectors. Having one global set of vectors is a problem for big/little systems where the sequence is costly on cpus that are not vulnerable.
Making the vectors per-cpu in the style of KVM's bh_harden_hyp_vecs requires the vectors to be generated by macros.
Make the kpti re-mapping of the kernel optional, so the macros can be used without kpti.
--- arch/arm64/kernel/entry.S | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
arch/arm64/kernel/entry.S +12 -6
@@ -646,9 +646,10 @@ alternative_else_nop_endif sub \dst, \dst, PAGE_SIZE .endm - .macro tramp_ventry, vector_start, regsize + .macro tramp_ventry, vector_start, regsize, kpti .align 7 1: + .if \kpti == 1 .if \regsize == 64 msr tpidrro_el0, x30 // Restored in kernel_ventry .endif
@@ -671,9 +672,14 @@ alternative_insn isb, nop, ARM64_WORKARO alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM prfm plil1strm, [x30, #(1b - \vector_start)] alternative_else_nop_endif + msr vbar_el1, x30 - add x30, x30, #(1b - \vector_start + 4) isb + .else + ldr x30, =vectors + .endif // \kpti == 1 + + add x30, x30, #(1b - \vector_start + 4) ret .org 1b + 128 // Did we overflow the ventry slot? .endm
@@ -691,15 +697,15 @@ alternative_else_nop_endif sb .endm - .macro generate_tramp_vector + .macro generate_tramp_vector, kpti .Lvector_start\@: .space 0x400 .rept 4 - tramp_ventry .Lvector_start\@, 64 + tramp_ventry .Lvector_start\@, 64, \kpti .endr .rept 4 - tramp_ventry .Lvector_start\@, 32 + tramp_ventry .Lvector_start\@, 32, \kpti .endr .endm
@@ -710,7 +716,7 @@ alternative_else_nop_endif .pushsection ".entry.tramp.text", "ax" .align 11 SYM_CODE_START_NOALIGN(tramp_vectors) - generate_tramp_vector + generate_tramp_vector kpti=1 SYM_CODE_END(tramp_vectors) SYM_CODE_START(tramp_exit_native)
Greg Kroah-Hartman
maintainerPATCH 27/37 arm64: entry: Allow the trampoline text to occupy multiple pages
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit a9c406e6462ff14956d690de7bbe5131a5677dc9 upstream.
Adding a second set of vectors to .entry.tramp.text will make it larger than a single 4K page.
Allow the trampoline text to occupy up to three pages by adding two more fixmap slots. Previous changes to tramp_valias allowed it to reach beyond a single page.
--- arch/arm64/include/asm/fixmap.h | 6 ++++-- arch/arm64/include/asm/sections.h | 5 +++++ arch/arm64/kernel/entry.S | 2 +- arch/arm64/kernel/vmlinux.lds.S | 2 +- arch/arm64/mm/mmu.c | 12 +++++++++--- 5 files changed, 20 insertions(+), 7 deletions(-)
arch/arm64/include/asm/fixmap.h +4 -2
@@ -62,9 +62,11 @@ enum fixed_addresses {#endif /* CONFIG_ACPI_APEI_GHES */ #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 -FIX_ENTRY_TRAMP_TEXT , +FIX_ENTRY_TRAMP_TEXT3 , +FIX_ENTRY_TRAMP_TEXT2 , +FIX_ENTRY_TRAMP_TEXT1 ,FIX_ENTRY_TRAMP_DATA , -#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/sections.h +5 -0
@@ -23,4 +23,9 @@ extern char __mmuoff_data_start[], __mmuextern char __entry_tramp_text_start[], __entry_tramp_text_end[];extern char __relocate_new_kernel_start[], __relocate_new_kernel_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/kernel/entry.S +1 -1
@@ -642,7 +642,7 @@ alternative_else_nop_endif .endm .macro tramp_data_page dst - adr \dst, .entry.tramp.text + adr_l \dst, .entry.tramp.text sub \dst, \dst, PAGE_SIZE .endm
arch/arm64/kernel/vmlinux.lds.S +1 -1
@@ -341,7 +341,7 @@ ASSERT(__hibernate_exit_text_end - (__hi <= 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 #ifdef CONFIG_KVM
arch/arm64/mm/mmu.c +9 -3
@@ -617,6 +617,8 @@ early_param("rodata", parse_rodata);#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 static int __init map_entry_trampoline (void ) { +int i; +pgprot_t prot = rodata_enabled ?PAGE_KERNEL_ROX :PAGE_KERNEL_EXEC ;phys_addr_t pa_start =__pa_symbol (__entry_tramp_text_start);
@@ -625,11 +627,15 @@ static int __init map_entry_trampoline(v/* 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,NO_BLOCK_MAPPINGS );/* 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[];
Greg Kroah-Hartman
maintainerPATCH 28/37 arm64: entry: Add non-kpti __bp_harden_el1_vectors for mitigations
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit aff65393fa1401e034656e349abd655cfe272de0 upstream.
kpti is an optional feature, for systems not using kpti a set of vectors for the spectre-bhb mitigations is needed.
Add another set of vectors, __bp_harden_el1_vectors, that will be used if a mitigation is needed and kpti is not in use.
The EL1 ventries are repeated verbatim as there is no additional work needed for entry from EL1.
--- arch/arm64/kernel/entry.S | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
arch/arm64/kernel/entry.S +34 -1
@@ -649,10 +649,11 @@ alternative_else_nop_endif .macro tramp_ventry, vector_start, regsize, kpti .align 7 1: - .if \kpti == 1 .if \regsize == 64 msr tpidrro_el0, x30 // Restored in kernel_ventry .endif + + .if \kpti == 1 /* * Defend against branch aliasing attacks by pushing a dummy * entry onto the return stack and using a RET instruction to
@@ -740,6 +741,38 @@ SYM_DATA_END(__entry_tramp_data_start) #endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */ /* + * Exception vectors for spectre mitigations on entry from EL1 when + * kpti is not in use. + */ + .macro generate_el1_vector +.Lvector_start\@: + kernel_ventry 1, t, 64, sync // Synchronous EL1t + kernel_ventry 1, t, 64, irq // IRQ EL1t + kernel_ventry 1, t, 64, fiq // FIQ EL1h + kernel_ventry 1, t, 64, error // Error EL1t + + kernel_ventry 1, h, 64, sync // Synchronous EL1h + kernel_ventry 1, h, 64, irq // IRQ EL1h + kernel_ventry 1, h, 64, fiq // FIQ EL1h + kernel_ventry 1, h, 64, error // Error EL1h + + .rept 4 + tramp_ventry .Lvector_start\@, 64, kpti=0 + .endr + .rept 4 + tramp_ventry .Lvector_start\@, 32, kpti=0 + .endr + .endm + + .pushsection ".entry.text", "ax" + .align 11 +SYM_CODE_START(__bp_harden_el1_vectors) + generate_el1_vector +SYM_CODE_END(__bp_harden_el1_vectors) + .popsection + + +/* * Register switch for AArch64. The callee-saved registers need to be saved * and restored. On entry: * x0 = previous task_struct (must be preserved across the switch)
Greg Kroah-Hartman
maintainerPATCH 29/37 arm64: entry: Add vectors that have the bhb mitigation sequences
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit ba2689234be92024e5635d30fe744f4853ad97db upstream.
Some CPUs affected by Spectre-BHB need a sequence of branches, or a firmware call to be run before any indirect branch. This needs to go in the vectors. No CPU needs both.
While this can be patched in, it would run on all CPUs as there is a single set of vectors. If only one part of a big/little combination is affected, the unaffected CPUs have to run the mitigation too.
Create extra vectors that include the sequence. Subsequent patches will allow affected CPUs to select this set of vectors. Later patches will modify the loop count to match what the CPU requires.
--- arch/arm64/include/asm/assembler.h | 24 ++++++++++++++++ arch/arm64/include/asm/vectors.h | 34 +++++++++++++++++++++++ arch/arm64/kernel/entry.S | 53 ++++++++++++++++++++++++++++++------- arch/arm64/kernel/proton-pack.c | 16 +++++++++++ include/linux/arm-smccc.h | 5 +++ 5 files changed, 123 insertions(+), 9 deletions(-) create mode 100644 arch/arm64/include/asm/vectors.h
arch/arm64/include/asm/assembler.h +24 -0
@@ -840,4 +840,28 @@ alternative_endif #endif /* GNU_PROPERTY_AARCH64_FEATURE_1_DEFAULT */ + .macro __mitigate_spectre_bhb_loop tmp +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY + mov \tmp, #32 +.Lspectre_bhb_loop\@: + b . + 4 + subs \tmp, \tmp, #1 + b.ne .Lspectre_bhb_loop\@ + sb +#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 smccc_patch_fw_mitigation_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/vectors.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2022 ARM Ltd. +*/ +#ifndef __ASM_VECTORS_H +#define __ASM_VECTORS_H + +/* +* Note: the order of this enum corresponds to two arrays in entry.S: +* tramp_vecs and __bp_harden_el1_vectors. By default the canonical +* 'full fat' vectors are used directly. +*/ +enum arm64_bp_harden_el1_vectors { +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY +/* +* Perform the BHB loop mitigation, before branching to the canonical +* vectors. +*/ +EL1_VECTOR_BHB_LOOP , + +/* +* Make the SMC call for firmware mitigation, before branching to the +* canonical vectors. +*/ +EL1_VECTOR_BHB_FW , +#endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ + +/* +* Remap the kernel before branching to the canonical vectors. +*/ +EL1_VECTOR_KPTI , ++}; + +#endif /* __ASM_VECTORS_H */
arch/arm64/kernel/entry.S +44 -9
119 lines not on this page · raw message
arch/arm64/kernel/proton-pack.c +16 -0
@@ -770,3 +770,19 @@ int arch_prctl_spec_ctrl_get(struct taskreturn -ENODEV ; } } + +/* Patched to NOP when enabled */ +void noinstr spectre_bhb_patch_loop_mitigation_enable(struct alt_instr *alt, +__le32 *origptr, +__le32 *updptr,int nr_inst) +{ +BUG_ON (nr_inst !=1 ); +} + +/* Patched to NOP when enabled */ +void noinstr spectre_bhb_patch_fw_mitigation_enabled(struct alt_instr *alt, +__le32 *origptr, +__le32 *updptr,int nr_inst) +{ +BUG_ON (nr_inst !=1 ); +}
include/linux/arm-smccc.h +5 -0
@@ -92,6 +92,11 @@ 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 ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID \ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ ARM_SMCCC_SMC_32, \
Re: [PATCH 5.16 29/37] arm64: entry: Add vectors that have the bhb mitigation sequences
Hi!
Quoted 11 lines
From: James Morse <[email protected]>
commit
ba2689234be92024e5635d30fe744f4853ad97dbupstream.Some CPUs affected by Spectre-BHB need a sequence of branches, or a firmware call to be run before any indirect branch. This needs to go in the vectors. No CPU needs both.
While this can be patched in, it would run on all CPUs as there is a single set of vectors. If only one part of a big/little combination is affected, the unaffected CPUs have to run the mitigation too.
This adds build error. Same problem is in 5.10.
Quoted 3 lines
arch/arm64/include/asm/vectors.h new file +0
-0@@ -0,0 +1,34 @@
...
Quoted 16 lines
arch/arm64/include/asm/vectors.h new file +16
-0+/* +* Note: the order of this enum corresponds to two arrays in entry.S: +* tramp_vecs and __bp_harden_el1_vectors. By default the canonical +* 'full fat' vectors are used directly. +*/ +enum arm64_bp_harden_el1_vectors { +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY +/* +* Perform the BHB loop mitigation, before branching to the canonical +* vectors. +*/ +EL1_VECTOR_BHB_LOOP , + +/* +* Make the SMC call for firmware mitigation, before branching to the +* canonical vectors.
arch/arm64/include/asm/vectors.h line 33
Quoted 10 lines
arch/arm64/include/asm/vectors.h new file +10
-0+*/ + EL1_VECTOR_BHB_FW, +#endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ + +/* +* Remap the kernel before branching to the canonical vectors. +*/ + EL1_VECTOR_KPTI, ++}; +
Note "++". Following patch fixes this up, but it is still a trap for people trying to bisect.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Greg Kroah-Hartman
maintainerRe: [PATCH 5.16 29/37] arm64: entry: Add vectors that have the bhb mitigation sequences
Quoted 42 lines · Pavel Machek
Hi!
Quoted 11 lines
From: James Morse <[email protected]>
commit
ba2689234be92024e5635d30fe744f4853ad97dbupstream.Some CPUs affected by Spectre-BHB need a sequence of branches, or a firmware call to be run before any indirect branch. This needs to go in the vectors. No CPU needs both.
While this can be patched in, it would run on all CPUs as there is a single set of vectors. If only one part of a big/little combination is affected, the unaffected CPUs have to run the mitigation too.
This adds build error. Same problem is in 5.10.
Quoted 3 lines
arch/arm64/include/asm/vectors.h new file +0
-0@@ -0,0 +1,34 @@...
Quoted 22 lines
arch/arm64/include/asm/vectors.h new file +22
-0+/* +* Note: the order of this enum corresponds to two arrays in entry.S: +* tramp_vecs and __bp_harden_el1_vectors. By default the canonical +* 'full fat' vectors are used directly. +*/ +enum arm64_bp_harden_el1_vectors { +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY +/* +* Perform the BHB loop mitigation, before branching to the canonical +* vectors. +*/ +EL1_VECTOR_BHB_LOOP , + +/* +* Make the SMC call for firmware mitigation, before branching to the +* canonical vectors. +*/ +EL1_VECTOR_BHB_FW , +#endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ + +/* +* Remap the kernel before branching to the canonical vectors.
Quoted 8 lines
arch/arm64/include/asm/vectors.h line 33
Quoted 4 lines
arch/arm64/include/asm/vectors.h new file +4
-0+*/ + EL1_VECTOR_KPTI, ++}; +Note "++". Following patch fixes this up, but it is still a trap for people trying to bisect.
Ick, ok, will try to fix up, thanks for finding this.
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 5.16 29/37] arm64: entry: Add vectors that have the bhb mitigation sequences
Quoted 52 lines · Greg Kroah-Hartman
Quoted 42 lines · Pavel Machek
Hi!
Quoted 11 lines
From: James Morse <[email protected]>
commit
ba2689234be92024e5635d30fe744f4853ad97dbupstream.Some CPUs affected by Spectre-BHB need a sequence of branches, or a firmware call to be run before any indirect branch. This needs to go in the vectors. No CPU needs both.
While this can be patched in, it would run on all CPUs as there is a single set of vectors. If only one part of a big/little combination is affected, the unaffected CPUs have to run the mitigation too.
This adds build error. Same problem is in 5.10.
Quoted 3 lines
arch/arm64/include/asm/vectors.h new file +0
-0@@ -0,0 +1,34 @@...
Quoted 22 lines
arch/arm64/include/asm/vectors.h new file +22
-0+/* +* Note: the order of this enum corresponds to two arrays in entry.S: +* tramp_vecs and __bp_harden_el1_vectors. By default the canonical +* 'full fat' vectors are used directly. +*/ +enum arm64_bp_harden_el1_vectors { +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY +/* +* Perform the BHB loop mitigation, before branching to the canonical +* vectors. +*/ +EL1_VECTOR_BHB_LOOP , + +/* +* Make the SMC call for firmware mitigation, before branching to the +* canonical vectors. +*/ +EL1_VECTOR_BHB_FW , +#endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ + +/* +* Remap the kernel before branching to the canonical vectors. Quoted 8 lines
arch/arm64/include/asm/vectors.h line 33
Quoted 4 lines
arch/arm64/include/asm/vectors.h new file +4
-0+*/ + EL1_VECTOR_KPTI, ++}; +Note "++". Following patch fixes this up, but it is still a trap for people trying to bisect.
Quoted 1 line
Ick, ok, will try to fix up, thanks for finding this.
Now fixed up for 5.16.y, 5.15.y, and 5.10.y, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 30/37 arm64: entry: Add macro for reading symbol addresses from the trampoline
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit b28a8eebe81c186fdb1a0078263b30576c8e1f42 upstream.
The trampoline code needs to use the address of symbols in the wider kernel, e.g. vectors. PC-relative addressing wouldn't work as the trampoline code doesn't run at the address the linker expected.
tramp_ventry uses a literal pool, unless CONFIG_RANDOMIZE_BASE is set, in which case it uses the data page as a literal pool because the data page can be unmapped when running in user-space, which is required for CPUs vulnerable to meltdown.
Pull this logic out as a macro, instead of adding a third copy of it.
--- arch/arm64/kernel/entry.S | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-)
arch/arm64/kernel/entry.S +16 -21
@@ -646,6 +646,15 @@ alternative_else_nop_endif sub \dst, \dst, PAGE_SIZE .endm + .macro tramp_data_read_var dst, var +#ifdef CONFIG_RANDOMIZE_BASE + tramp_data_page \dst + add \dst, \dst, #:lo12:__entry_tramp_data_\var + ldr \dst, [\dst] +#else + ldr \dst, =\var +#endif + .endm #define BHB_MITIGATION_NONE 0 #define BHB_MITIGATION_LOOP 1
@@ -676,13 +685,8 @@ alternative_else_nop_endif b . 2: tramp_map_kernel x30 -#ifdef CONFIG_RANDOMIZE_BASE - tramp_data_page x30 alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003 - ldr x30, [x30] -#else - ldr x30, =vectors -#endif + tramp_data_read_var x30, vectors alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM prfm plil1strm, [x30, #(1b - \vector_start)] alternative_else_nop_endif
@@ -765,7 +769,12 @@ SYM_CODE_END(tramp_exit_compat) .pushsection ".rodata", "a" .align PAGE_SHIFT SYM_DATA_START(__entry_tramp_data_start) +__entry_tramp_data_vectors: .quad vectors +#ifdef CONFIG_ARM_SDE_INTERFACE +__entry_tramp_data___sdei_asm_handler: + .quad __sdei_asm_handler +#endif /* CONFIG_ARM_SDE_INTERFACE */ SYM_DATA_END(__entry_tramp_data_start) .popsection // .rodata #endif /* CONFIG_RANDOMIZE_BASE */
@@ -932,14 +941,7 @@ SYM_CODE_START(__sdei_asm_entry_trampoli * Remember whether to unmap the kernel on exit. */ 1: str x4, [x1, #(SDEI_EVENT_INTREGS + S_SDEI_TTBR1)] - -#ifdef CONFIG_RANDOMIZE_BASE - tramp_data_page x4 - add x4, x4, #:lo12:__sdei_asm_trampoline_next_handler - ldr x4, [x4] -#else - ldr x4, =__sdei_asm_handler -#endif + tramp_data_read_var x4, __sdei_asm_handler br x4 SYM_CODE_END(__sdei_asm_entry_trampoline) NOKPROBE(__sdei_asm_entry_trampoline)
@@ -962,13 +964,6 @@ SYM_CODE_END(__sdei_asm_exit_trampoline) NOKPROBE(__sdei_asm_exit_trampoline) .ltorg .popsection // .entry.tramp.text -#ifdef CONFIG_RANDOMIZE_BASE -.pushsection ".rodata", "a" -SYM_DATA_START(__sdei_asm_trampoline_next_handler) - .quad __sdei_asm_handler -SYM_DATA_END(__sdei_asm_trampoline_next_handler) -.popsection // .rodata -#endif /* CONFIG_RANDOMIZE_BASE */ #endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */ /*
Greg Kroah-Hartman
maintainerPATCH 31/37 arm64: Add percpu vectors for EL1
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit bd09128d16fac3c34b80bd6a29088ac632e8ce09 upstream.
The Spectre-BHB workaround adds a firmware call to the vectors. This is needed on some CPUs, but not others. To avoid the unaffected CPU in a big/little pair from making the firmware call, create per cpu vectors.
The per-cpu vectors only apply when returning from EL0.
Systems using KPTI can use the canonical 'full-fat' vectors directly at EL1, the trampoline exit code will switch to this_cpu_vector on exit to EL0. Systems not using KPTI should always use this_cpu_vector.
this_cpu_vector will point at a vector in tramp_vecs or __bp_harden_el1_vectors, depending on whether KPTI is in use.
--- arch/arm64/include/asm/vectors.h | 29 ++++++++++++++++++++++++++++- arch/arm64/kernel/cpufeature.c | 11 +++++++++++ arch/arm64/kernel/entry.S | 12 ++++++------ arch/arm64/kvm/hyp/vhe/switch.c | 9 +++++++-- 4 files changed, 52 insertions(+), 9 deletions(-)
arch/arm64/include/asm/vectors.h +28 -1
@@ -5,6 +5,15 @@#ifndef __ASM_VECTORS_H#define __ASM_VECTORS_H +#include <linux/bug.h> +#include <linux/percpu.h> + +#include <asm/fixmap.h> + +extern char vectors[]; +extern char tramp_vectors[]; +extern char __bp_harden_el1_vectors[]; +/* * Note: the order of this enum corresponds to two arrays in entry.S: * tramp_vecs and __bp_harden_el1_vectors. By default the canonical
@@ -29,6 +38,24 @@ enum arm64_bp_harden_el1_vectors {* Remap the kernel before branching to the canonical vectors. */ EL1_VECTOR_KPTI, -+}; +}; + +/* The vectors to use on return from EL0. e.g. to remap the kernel */ +DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector); + +#ifndef CONFIG_UNMAP_KERNEL_AT_EL0 +#define TRAMP_VALIAS 0 +#endif + +static inline const char * +arm64_get_bp_hardening_vector (enum arm64_bp_harden_el1_vectors slot) +{ +if (arm64_kernel_unmapped_at_el0 ()) +return (char *)TRAMP_VALIAS +SZ_2K * slot; + +WARN_ON_ONCE (slot ==EL1_VECTOR_KPTI ); + +return __bp_harden_el1_vectors +SZ_2K * slot; +}#endif /* __ASM_VECTORS_H */
arch/arm64/kernel/cpufeature.c +11 -0
@@ -73,6 +73,8 @@#include <linux/mm.h> #include <linux/cpu.h> #include <linux/kasan.h> +#include <linux/percpu.h> +#include <asm/cpu.h> #include <asm/cpufeature.h> #include <asm/cpu_ops.h>
@@ -85,6 +87,7 @@#include <asm/smp.h> #include <asm/sysreg.h> #include <asm/traps.h> +#include <asm/vectors.h> #include <asm/virt.h> /* Kernel representation of AT_HWCAP and AT_HWCAP2 */
@@ -110,6 +113,8 @@ DECLARE_BITMAP(boot_capabilities, ARM64_bool arm64_use_ng_mappings = false;EXPORT_SYMBOL (arm64_use_ng_mappings); +DEFINE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector) = vectors; +/* * Permit PER_LINUX32 and execve() of 32-bit binaries even if not all CPUs * support it?
@@ -1590,6 +1595,12 @@ kpti_install_ng_mappings(const struct arint 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); + } +/* * We don't need to rewrite the page-tables if either we've done * it already or we have KASLR enabled and therefore have not
arch/arm64/kernel/entry.S +6 -6
@@ -38,7 +38,6 @@ .macro kernel_ventry, el:req, ht:req, regsize:req, label:req .align 7 .Lventry_start\@: -#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 .if \el == 0 /* * This must be the first instruction of the EL0 vector entries. It is
@@ -53,7 +52,6 @@ .endif .Lskip_tramp_vectors_cleanup\@: .endif -#endif sub sp, sp, #PT_REGS_SIZE #ifdef CONFIG_VMAP_STACK
@@ -712,10 +710,10 @@ alternative_else_nop_endif .endm .macro tramp_exit, regsize = 64 - adr x30, tramp_vectors -#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY - add x30, x30, SZ_4K -#endif + tramp_data_read_var x30, this_cpu_vector + get_this_cpu_offset x29 + ldr x30, [x30, x29] + msr vbar_el1, x30 ldr lr, [sp, #S_LR] tramp_unmap_kernel x29
@@ -775,6 +773,8 @@ __entry_tramp_data_vectors: __entry_tramp_data___sdei_asm_handler: .quad __sdei_asm_handler #endif /* CONFIG_ARM_SDE_INTERFACE */ +__entry_tramp_data_this_cpu_vector: + .quad this_cpu_vector SYM_DATA_END(__entry_tramp_data_start) .popsection // .rodata #endif /* CONFIG_RANDOMIZE_BASE */
arch/arm64/kvm/hyp/vhe/switch.c +7 -2
@@ -10,6 +10,7 @@#include <linux/kvm_host.h> #include <linux/types.h> #include <linux/jump_label.h> +#include <linux/percpu.h> #include <uapi/linux/psci.h> #include <kvm/arm_psci.h>
@@ -25,6 +26,7 @@#include <asm/debug-monitors.h> #include <asm/processor.h> #include <asm/thread_info.h> +#include <asm/vectors.h> /* VHE specific context */ DEFINE_PER_CPU(struct kvm_host_data, kvm_host_data);
@@ -68,7 +70,7 @@ NOKPROBE_SYMBOL(__activate_traps);static void __deactivate_traps (struct kvm_vcpu *vcpu) { -extern char vectors[];/* kernel exception vectors */ +const char *host_vectors = vectors;___deactivate_traps (vcpu);
@@ -82,7 +84,10 @@ static void __deactivate_traps(struct kv asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_SPECULATIVE_AT));write_sysreg (CPACR_EL1_DEFAULT , 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); }NOKPROBE_SYMBOL (__deactivate_traps);
Greg Kroah-Hartman
maintainerPATCH 32/37 arm64: proton-pack: Report Spectre-BHB vulnerabilities as part of Spectre-v2
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit dee435be76f4117410bbd90573a881fd33488f37 upstream.
Speculation attacks against some high-performance processors can make use of branch history to influence future speculation as part of a spectre-v2 attack. This is not mitigated by CSV2, meaning CPUs that previously reported 'Not affected' are now moderately mitigated by CSV2.
Update the value in /sys/devices/system/cpu/vulnerabilities/spectre_v2 to also show the state of the BHB mitigation.
--- arch/arm64/include/asm/spectre.h | 2 ++ arch/arm64/kernel/proton-pack.c | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-)
arch/arm64/include/asm/spectre.h +2 -0
@@ -93,5 +93,7 @@ void spectre_v4_enable_task_mitigation(senum mitigation_state arm64_get_meltdown_state (void ); +enum mitigation_state arm64_get_spectre_bhb_state (void ); +#endif /* __ASSEMBLY__ */ #endif /* __ASM_SPECTRE_H */
arch/arm64/kernel/proton-pack.c +34 -2
@@ -96,14 +96,39 @@ static bool spectre_v2_mitigations_off(vreturn ret; } +static const char *get_bhb_affected_string (enum mitigation_state bhb_state) +{ +switch (bhb_state) { +case SPECTRE_UNAFFECTED : +return "" ; +default : +case SPECTRE_VULNERABLE : +return ", but not BHB" ; +case SPECTRE_MITIGATED : +return ", BHB" ; + } +} +ssize_t cpu_show_spectre_v2 (struct device *dev,struct device_attribute *attr,char *buf) { +enum mitigation_state bhb_state =arm64_get_spectre_bhb_state (); +const char *bhb_str =get_bhb_affected_string (bhb_state); +const char *v2_str ="Branch predictor hardening" ; +switch (spectre_v2_state) {case SPECTRE_UNAFFECTED : -return sprintf (buf,"Not affected\n" ); +if (bhb_state ==SPECTRE_UNAFFECTED ) +return sprintf (buf,"Not affected\n" ); + +/* +* Platforms affected by Spectre-BHB can't report +* "Not affected" for Spectre-v2. +*/ + v2_str ="CSV2" ; + fallthrough;case SPECTRE_MITIGATED : -return sprintf (buf,"Mitigation: Branch predictor hardening\n" ); +return sprintf (buf,"Mitigation: %s%s\n" , v2_str, bhb_str);case SPECTRE_VULNERABLE : fallthrough;default :
@@ -771,6 +796,13 @@ int arch_prctl_spec_ctrl_get(struct task } } +static enum mitigation_state spectre_bhb_state; + +enum mitigation_state arm64_get_spectre_bhb_state (void ) +{ +return spectre_bhb_state; +} +/* Patched to NOP when enabled */ void noinstr spectre_bhb_patch_loop_mitigation_enable(struct alt_instr *alt, __le32 *origptr,
Greg Kroah-Hartman
maintainerPATCH 33/37 arm64: Mitigate spectre style branch history side channels
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 558c303c9734af5a813739cd284879227f7297d2 upstream.
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 or invalidates the branch history.
The sequence of branches is added to the vectors, and should appear before the first indirect branch. For systems using KPTI the sequence is added to the kpti trampoline where it has a free register as the exit from the trampoline is via a 'ret'. For systems not using KPTI, the same register tricks are used to free up a register in the vectors.
For the firmware call, arch-workaround-3 clobbers 4 registers, so there is no choice but to save them to the EL1 stack. This only happens for entry from EL0, so if we take an exception due to the stack access, it will not become re-entrant.
For KVM, the existing branch-predictor-hardening vectors are used. When a spectre version of these vectors is in use, the firmware call is sufficient to mitigate against Spectre-BHB. For the non-spectre versions, the sequence of branches is added to the indirect vector.
--- arch/arm64/Kconfig | 9 + arch/arm64/include/asm/assembler.h | 14 + arch/arm64/include/asm/cpufeature.h | 16 ++ arch/arm64/include/asm/cputype.h | 8 + arch/arm64/include/asm/spectre.h | 4 arch/arm64/include/asm/sysreg.h | 1 arch/arm64/include/asm/vectors.h | 5 arch/arm64/kernel/cpu_errata.c | 7 arch/arm64/kernel/image-vars.h | 3 arch/arm64/kernel/proton-pack.c | 278 ++++++++++++++++++++++++++++++++++++ arch/arm64/kvm/hyp/hyp-entry.S | 8 + arch/arm64/tools/cpucaps | 1 12 files changed, 352 insertions(+), 2 deletions(-)
arch/arm64/Kconfig +9 -0
@@ -1395,6 +1395,15 @@ config UNMAP_KERNEL_AT_EL0 If unsure, say Y. +config MITIGATE_SPECTRE_BRANCH_HISTORY + bool "Mitigate Spectre style attacks against branch history" if EXPERT + default y + 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. + config RODATA_FULL_DEFAULT_ENABLED bool "Apply r/o permissions of VM areas also to their linear aliases" default y
arch/arm64/include/asm/assembler.h +13 -1
@@ -842,7 +842,9 @@ alternative_endif .macro __mitigate_spectre_bhb_loop tmp#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY - mov \tmp, #32 +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
@@ -851,6 +853,16 @@ alternative_endif#endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ .endm + .macro mitigate_spectre_bhb_loop tmp +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY +alternative_cb spectre_bhb_patch_loop_mitigation_enable + b .L_spectre_bhb_loop_done\@ // Patched to NOP +alternative_cb_end + __mitigate_spectre_bhb_loop \tmp +.L_spectre_bhb_loop_done\@: +#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
arch/arm64/include/asm/cpufeature.h +16 -0
@@ -637,6 +637,22 @@ static inline bool cpu_supports_mixed_enreturn 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 ; +} +const struct cpumask *system_32bit_el0_cpumask (void );DECLARE_STATIC_KEY_FALSE (arm64_mismatched_32bit_el0);
arch/arm64/include/asm/cputype.h +8 -0
@@ -73,10 +73,14 @@#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_A510 0xD46#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
@@ -117,10 +121,14 @@#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_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)#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/spectre.h +3 -1
@@ -94,6 +94,8 @@ void spectre_v4_enable_task_mitigation(senum mitigation_state arm64_get_meltdown_state (void );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 /* __ASM_SPECTRE_H */
arch/arm64/include/asm/sysreg.h +1 -0
@@ -904,6 +904,7 @@#endif /* id_aa64mmfr1 */ +#define ID_AA64MMFR1_ECBHB_SHIFT 60#define ID_AA64MMFR1_AFP_SHIFT 44#define ID_AA64MMFR1_ETS_SHIFT 36#define ID_AA64MMFR1_TWED_SHIFT 32
arch/arm64/include/asm/vectors.h +5 -0
@@ -40,6 +40,11 @@ enum arm64_bp_harden_el1_vectors { EL1_VECTOR_KPTI, }; +#ifndef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY +#define EL1_VECTOR_BHB_LOOP -1 +#define EL1_VECTOR_BHB_FW -1 +#endif /* !CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ +/* The vectors to use on return from EL0. e.g. to remap the kernel */ DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
arch/arm64/kernel/cpu_errata.c +7 -0
@@ -502,6 +502,13 @@ const struct arm64_cpu_capabilities arm6 .matches = has_spectre_v4, .cpu_enable = spectre_v4_enable_mitigation, }, + { + .desc = "Spectre-BHB", + .capability = ARM64_SPECTRE_BHB, + .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, + .matches = is_spectre_bhb_affected, + .cpu_enable = spectre_bhb_enable_mitigation, + }, #ifdef CONFIG_ARM64_ERRATUM_1418040 { .desc = "ARM erratum 1418040",
arch/arm64/kernel/image-vars.h +3 -0
@@ -66,6 +66,9 @@ KVM_NVHE_ALIAS(kvm_patch_vector_branch);KVM_NVHE_ALIAS (kvm_update_va_mask);KVM_NVHE_ALIAS (kvm_get_kimage_voffset);KVM_NVHE_ALIAS (kvm_compute_final_ctr_el0); +KVM_NVHE_ALIAS (spectre_bhb_patch_loop_iter); +KVM_NVHE_ALIAS (spectre_bhb_patch_loop_mitigation_enable); +KVM_NVHE_ALIAS (spectre_bhb_patch_wa3);/* Global kernel state accessed by nVHE hyp code. */ KVM_NVHE_ALIAS (kvm_vgic_global_state);
arch/arm64/kernel/proton-pack.c +278 -0
309 lines not on this page · raw message
arch/arm64/kvm/hyp/hyp-entry.S +8 -0
@@ -62,6 +62,10 @@ el1_sync: // Guest trapped into EL2 /* 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 wa_epilogue:
@@ -192,7 +196,10 @@ SYM_CODE_END(__kvm_hyp_vector) sub sp, sp, #(8 * 4) stp x2, x3, [sp, #(8 * 0)] stp x0, x1, [sp, #(8 * 2)] + alternative_cb spectre_bhb_patch_wa3 + /* Patched to mov WA3 when supported */ mov w0, #ARM_SMCCC_ARCH_WORKAROUND_1 + alternative_cb_end smc #0 ldp x2, x3, [sp, #(8 * 0)] add sp, sp, #(8 * 2)
@@ -205,6 +212,7 @@ SYM_CODE_END(__kvm_hyp_vector) spectrev2_smccc_wa1_smc .else stp x0, x1, [sp, #-16]! + mitigate_spectre_bhb_loop x0 .endif .if \indirect != 0 alternative_cb kvm_patch_vector_branch
arch/arm64/tools/cpucaps +1 -0
@@ -44,6 +44,7 @@ MTE_ASYMM SPECTRE_V2 SPECTRE_V3A SPECTRE_V4 +SPECTRE_BHB SSBS SVE UNMAP_KERNEL_AT_EL0
Greg Kroah-Hartman
maintainerPATCH 34/37 KVM: arm64: Allow SMCCC_ARCH_WORKAROUND_3 to be discovered and migrated
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit a5905d6af492ee6a4a2205f0d550b3f931b03d03 upstream.
KVM allows the guest to discover whether the ARCH_WORKAROUND SMCCC are implemented, and to preserve that state during migration through its firmware register interface.
Add the necessary boiler plate for SMCCC_ARCH_WORKAROUND_3.
--- arch/arm64/include/uapi/asm/kvm.h | 5 +++++ arch/arm64/kvm/hypercalls.c | 12 ++++++++++++ arch/arm64/kvm/psci.c | 18 +++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-)
arch/arm64/include/uapi/asm/kvm.h +5 -0
@@ -281,6 +281,11 @@ struct kvm_arm_copy_mte_tags {#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED 3#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED (1U << 4) +#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3 KVM_REG_ARM_FW_REG(3) +#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_NOT_AVAIL 0 +#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_AVAIL 1 +#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_NOT_REQUIRED 2 +/* SVE registers */ #define KVM_REG_ARM64_SVE (0x15 << KVM_REG_ARM_COPROC_SHIFT)
arch/arm64/kvm/hypercalls.c +12 -0
@@ -107,6 +107,18 @@ int kvm_hvc_call_handler(struct kvm_vcpubreak ; }break ; +case ARM_SMCCC_ARCH_WORKAROUND_3 : +switch (arm64_get_spectre_bhb_state ()) { +case SPECTRE_VULNERABLE : +break ; +case SPECTRE_MITIGATED : + val[0 ] =SMCCC_RET_SUCCESS ; +break ; +case SPECTRE_UNAFFECTED : + val[0 ] =SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED ; +break ; + } +break ;case ARM_SMCCC_HV_PV_TIME_FEATURES : val[0 ] =SMCCC_RET_SUCCESS ;break ;
arch/arm64/kvm/psci.c +17 -1
@@ -406,7 +406,7 @@ int kvm_psci_call(struct kvm_vcpu *vcpu)int kvm_arm_get_fw_num_regs (struct kvm_vcpu *vcpu) { -return 3 ;/* PSCI version and two workaround registers */ +return 4 ;/* PSCI version and three workaround registers */ }int kvm_arm_copy_fw_reg_indices (struct kvm_vcpu *vcpu,u64 __user *uindices)
@@ -420,6 +420,9 @@ int kvm_arm_copy_fw_reg_indices(struct kif (put_user (KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 , uindices++))return -EFAULT ; +if (put_user (KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3 , uindices++)) +return -EFAULT ; +return 0 ; }
@@ -459,6 +462,17 @@ static int get_kernel_wa_level(u64 regidcase SPECTRE_VULNERABLE :return KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL ; } +break ; +case KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3 : +switch (arm64_get_spectre_bhb_state ()) { +case SPECTRE_VULNERABLE : +return KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_NOT_AVAIL ; +case SPECTRE_MITIGATED : +return KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_AVAIL ; +case SPECTRE_UNAFFECTED : +return KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_NOT_REQUIRED ; + } +return KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_NOT_AVAIL ; }return -EINVAL ;
@@ -475,6 +489,7 @@ int kvm_arm_get_fw_reg(struct kvm_vcpu *break ;case KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 :case KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 : +case KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3 : val =get_kernel_wa_level (reg->id) &KVM_REG_FEATURE_LEVEL_MASK ;break ;default :
@@ -520,6 +535,7 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu * }case KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 : +case KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3 :if (val & ~KVM_REG_FEATURE_LEVEL_MASK )return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 35/37 arm64: Use the clearbhb instruction in mitigations
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 228a26b912287934789023b4132ba76065d9491c upstream.
Future CPUs may implement a clearbhb instruction that is sufficient to mitigate SpectreBHB. CPUs that implement this instruction, but not CSV2.3 must be affected by Spectre-BHB.
Add support to use this instruction as the BHB mitigation on CPUs that support it. The instruction is in the hint space, so it will be treated by a NOP as older CPUs.
--- arch/arm64/include/asm/assembler.h | 17 +++++++++++++++++ arch/arm64/include/asm/cpufeature.h | 13 +++++++++++++ arch/arm64/include/asm/insn.h | 1 + arch/arm64/include/asm/sysreg.h | 1 + arch/arm64/include/asm/vectors.h | 7 +++++++ arch/arm64/kernel/cpufeature.c | 1 + arch/arm64/kernel/entry.S | 8 ++++++++ arch/arm64/kernel/image-vars.h | 1 + arch/arm64/kernel/proton-pack.c | 29 +++++++++++++++++++++++++++++ arch/arm64/kvm/hyp/hyp-entry.S | 1 + 10 files changed, 79 insertions(+)
arch/arm64/include/asm/assembler.h +17 -0
@@ -109,6 +109,13 @@ .endm /* + * Clear Branch History instruction + */ + .macro clearbhb + hint #22 + .endm + +/* * Speculation barrier */ .macro sb
@@ -876,4 +883,14 @@ alternative_cb_end ldp x0, x1, [sp], #16 #endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ .endm + + .macro mitigate_spectre_bhb_clear_insn +#ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY +alternative_cb spectre_bhb_patch_clearbhb + /* Patched to NOP when not supported */ + clearbhb + isb +alternative_cb_end +#endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ + .endm #endif /* __ASM_ASSEMBLER_H */
arch/arm64/include/asm/cpufeature.h +13 -0
@@ -653,6 +653,19 @@ static inline bool supports_csv2p3(int sreturn 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 ); +} +const struct cpumask *system_32bit_el0_cpumask (void );DECLARE_STATIC_KEY_FALSE (arm64_mismatched_32bit_el0);
arch/arm64/include/asm/insn.h +1 -0
@@ -65,6 +65,7 @@ enum aarch64_insn_hint_cr_op {AARCH64_INSN_HINT_PSB =0x11 <<5 ,AARCH64_INSN_HINT_TSB =0x12 <<5 ,AARCH64_INSN_HINT_CSDB =0x14 <<5 , +AARCH64_INSN_HINT_CLEARBHB =0x16 <<5 ,AARCH64_INSN_HINT_BTI =0x20 <<5 , AARCH64_INSN_HINT_BTIC = 0x22 << 5,
arch/arm64/include/asm/sysreg.h +1 -0
@@ -773,6 +773,7 @@#define ID_AA64ISAR1_GPI_IMP_DEF 0x1/* id_aa64isar2 */ +#define ID_AA64ISAR2_CLEARBHB_SHIFT 28#define ID_AA64ISAR2_RPRES_SHIFT 4#define ID_AA64ISAR2_WFXT_SHIFT 0
arch/arm64/include/asm/vectors.h +7 -0
@@ -32,6 +32,12 @@ enum arm64_bp_harden_el1_vectors {* canonical vectors. */ EL1_VECTOR_BHB_FW , + +/* +* Use the ClearBHB instruction, before branching to the canonical +* vectors. +*/ + EL1_VECTOR_BHB_CLEAR_INSN, #endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY *//*
@@ -43,6 +49,7 @@ enum arm64_bp_harden_el1_vectors {#ifndef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY #define EL1_VECTOR_BHB_LOOP -1#define EL1_VECTOR_BHB_FW -1 +#define EL1_VECTOR_BHB_CLEAR_INSN -1#endif /* !CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ /* The vectors to use on return from EL0. e.g. to remap the kernel */
arch/arm64/kernel/cpufeature.c +1 -0
@@ -231,6 +231,7 @@ static const struct arm64_ftr_bits ftr_i };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_BITS (FTR_VISIBLE ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR2_RPRES_SHIFT ,4 ,0 ),ARM64_FTR_END , };
arch/arm64/kernel/entry.S +8 -0
@@ -657,6 +657,7 @@ alternative_else_nop_endif #define BHB_MITIGATION_NONE 0 #define BHB_MITIGATION_LOOP 1 #define BHB_MITIGATION_FW 2 +#define BHB_MITIGATION_INSN 3 .macro tramp_ventry, vector_start, regsize, kpti, bhb .align 7
@@ -673,6 +674,11 @@ alternative_else_nop_endif __mitigate_spectre_bhb_loop x30 .endif // \bhb == BHB_MITIGATION_LOOP + .if \bhb == BHB_MITIGATION_INSN + clearbhb + isb + .endif // \bhb == BHB_MITIGATION_INSN + .if \kpti == 1 /* * Defend against branch aliasing attacks by pushing a dummy
@@ -749,6 +755,7 @@ SYM_CODE_START_NOALIGN(tramp_vectors) #ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY generate_tramp_vector kpti=1, bhb=BHB_MITIGATION_LOOP generate_tramp_vector kpti=1, bhb=BHB_MITIGATION_FW + generate_tramp_vector kpti=1, bhb=BHB_MITIGATION_INSN #endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ generate_tramp_vector kpti=1, bhb=BHB_MITIGATION_NONE SYM_CODE_END(tramp_vectors)
@@ -811,6 +818,7 @@ SYM_CODE_START(__bp_harden_el1_vectors) #ifdef CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY generate_el1_vector bhb=BHB_MITIGATION_LOOP generate_el1_vector bhb=BHB_MITIGATION_FW + generate_el1_vector bhb=BHB_MITIGATION_INSN #endif /* CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY */ SYM_CODE_END(__bp_harden_el1_vectors) .popsection
arch/arm64/kernel/image-vars.h +1 -0
@@ -69,6 +69,7 @@ KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0KVM_NVHE_ALIAS (spectre_bhb_patch_loop_iter);KVM_NVHE_ALIAS (spectre_bhb_patch_loop_mitigation_enable);KVM_NVHE_ALIAS (spectre_bhb_patch_wa3); +KVM_NVHE_ALIAS (spectre_bhb_patch_clearbhb);/* Global kernel state accessed by nVHE hyp code. */ KVM_NVHE_ALIAS (kvm_vgic_global_state);
arch/arm64/kernel/proton-pack.c +29 -0
@@ -805,6 +805,7 @@ int arch_prctl_spec_ctrl_get(struct task* - Mitigated by a branchy loop a CPU specific number of times, and listed * in our "loop mitigated list". * - Mitigated in software by the firmware Spectre v2 call. +* - Has the ClearBHB instruction to perform the mitigation. * - Has the 'Exception Clears Branch History Buffer' (ECBHB) feature, so no * software mitigation in the vectors is needed. * - Has CSV2.3, so is unaffected.
@@ -820,6 +821,7 @@ enum bhb_mitigation_bits {BHB_LOOP ,BHB_FW ,BHB_HW , + BHB_INSN, };static unsigned long system_bhb_mitigations;
@@ -937,6 +939,9 @@ bool is_spectre_bhb_affected(const strucif (supports_csv2p3 (scope))return false; +if (supports_clearbhb (scope)) +return true; +if (spectre_bhb_loop_affected (scope))return true;
@@ -984,6 +989,17 @@ void spectre_bhb_enable_mitigation(const }else if (supports_ecbhb (SCOPE_LOCAL_CPU )) { state =SPECTRE_MITIGATED ;set_bit (BHB_HW , &system_bhb_mitigations); + }else if (supports_clearbhb (SCOPE_LOCAL_CPU )) { +/* +* Ensure KVM uses the indirect vector which will have ClearBHB +* added. +*/ +if (!data->slot) + data->slot =HYP_VECTOR_INDIRECT ; + +this_cpu_set_vectors (EL1_VECTOR_BHB_CLEAR_INSN ); + state =SPECTRE_MITIGATED ; +set_bit (BHB_INSN , &system_bhb_mitigations); }else if (spectre_bhb_loop_affected (SCOPE_LOCAL_CPU )) {/* * Ensure KVM uses the indirect vector which will have the
@@ -1096,3 +1112,16 @@ void noinstr spectre_bhb_patch_wa3(struc *updptr++ =cpu_to_le32 (insn); } + +/* Patched to NOP when not supported */ +void __init spectre_bhb_patch_clearbhb (struct alt_instr *alt, +__le32 *origptr,__le32 *updptr,int nr_inst) +{ +BUG_ON (nr_inst !=2 ); + +if (test_bit (BHB_INSN , &system_bhb_mitigations)) +return ; + + *updptr++ =cpu_to_le32 (aarch64_insn_gen_nop ()); + *updptr++ =cpu_to_le32 (aarch64_insn_gen_nop ()); +}
arch/arm64/kvm/hyp/hyp-entry.S +1 -0
@@ -213,6 +213,7 @@ SYM_CODE_END(__kvm_hyp_vector) .else stp x0, x1, [sp, #-16]! mitigate_spectre_bhb_loop x0 + mitigate_spectre_bhb_clear_insn .endif .if \indirect != 0 alternative_cb kvm_patch_vector_branch
Greg Kroah-Hartman
maintainerPATCH 36/37 arm64: proton-pack: Include unprivileged eBPF status in Spectre v2 mitigation reporting
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 58c9a5060cb7cd529d49c93954cdafe81c1d642a upstream.
The mitigations for Spectre-BHB are only applied when an exception is taken from user-space. The mitigation status is reported via the spectre_v2 sysfs vulnerabilities file.
When unprivileged eBPF is enabled the mitigation in the exception vectors can be avoided by an eBPF program.
When unprivileged eBPF is enabled, print a warning and report vulnerable via the sysfs vulnerabilities file.
--- arch/arm64/kernel/proton-pack.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
arch/arm64/kernel/proton-pack.c +26 -0
@@ -18,6 +18,7 @@*/ #include <linux/arm-smccc.h> +#include <linux/bpf.h> #include <linux/cpu.h> #include <linux/device.h> #include <linux/nospec.h>
@@ -111,6 +112,15 @@ static const char *get_bhb_affected_stri } } +static bool _unprivileged_ebpf_enabled (void ) +{ +#ifdef CONFIG_BPF_SYSCALL +return !sysctl_unprivileged_bpf_disabled; +#else +return false; +#endif +} +ssize_t cpu_show_spectre_v2 (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -130,6 +140,9 @@ ssize_t cpu_show_spectre_v2(struct devic v2_str ="CSV2" ; fallthrough;case SPECTRE_MITIGATED : +if (bhb_state ==SPECTRE_MITIGATED &&_unprivileged_ebpf_enabled ()) +return sprintf (buf,"Vulnerable: Unprivileged eBPF enabled\n" ); +return sprintf (buf,"Mitigation: %s%s\n" , v2_str, bhb_str);case SPECTRE_VULNERABLE : fallthrough;
@@ -1125,3 +1138,16 @@ void __init spectre_bhb_patch_clearbhb(s *updptr++ =cpu_to_le32 (aarch64_insn_gen_nop ()); *updptr++ =cpu_to_le32 (aarch64_insn_gen_nop ()); } + +#ifdef CONFIG_BPF_SYSCALL +#define EBPF_WARN "Unprivileged eBPF is enabled, data leaks possible via Spectre v2 BHB attacks!\n" +void unpriv_ebpf_notify (int new_state) +{ +if (spectre_v2_state ==SPECTRE_VULNERABLE || + spectre_bhb_state !=SPECTRE_MITIGATED ) +return ; + +if (!new_state) +pr_err ("WARNING: %s" ,EBPF_WARN ); +} +#endif
Greg Kroah-Hartman
maintainerPATCH 37/37 ARM: fix build error when BPF_SYSCALL is disabled
In reply to Greg Kroah-HartmanFrom: Emmanuel Gil Peyrot <[email protected]>
commit 330f4c53d3c2d8b11d86ec03a964b86dc81452f5 upstream.
It was missing a semicolon.
--- arch/arm/kernel/spectre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/spectre.c +1 -1
@@ -10,7 +10,7 @@ static bool _unprivileged_ebpf_enabled(v#ifdef CONFIG_BPF_SYSCALL return !sysctl_unprivileged_bpf_disabled;#else - return false +return false;#endif }
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.14 release. There are 37 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Mar 2022 15:58:48 +0000. Anything received after that time might be too late.
Almost all arm builds, all branches from 4.9.y to 5.16.y:
Error log:arch/arm/common/secure_cntvoff.S: Assembler messages:arch/arm/common/secure_cntvoff.S:24: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' arch/arm/common/secure_cntvoff.S:27: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' arch/arm/common/secure_cntvoff.S:29: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4'
bisect log:
# bad: [3416254dac79ea26e08dffde371ab1fd3130223c] Linux 5.16.14-rc1
# good: [6273c309621c9dd61c9c3f6d63f5d56ee2d89c73] Linux 5.16.13
git bisect start 'HEAD' 'v5.16.13'
# bad: [4403d69931dbc17659845d2d710602bbe35b4398] KVM: arm64: Allow indirect vectors to be used without SPECTRE_V3A git bisect bad 4403d69931dbc17659845d2d710602bbe35b4398
# good: [6f0cf3a1eb8b46a5d652a395ba25a59c32a86692] ARM: report Spectre v2 status through sysfs git bisect good 6f0cf3a1eb8b46a5d652a395ba25a59c32a86692
# bad: [87e96a363eb4a62b65bb974a46d518a87153cd1c] arm64: add ID_AA64ISAR2_EL1 sys register
git bisect bad 87e96a363eb4a62b65bb974a46d518a87153cd1c
# good: [654f0a73f042662a36155a0cafa30db846ccb5a9] ARM: use LOADADDR() to get load address of sections git bisect good 654f0a73f042662a36155a0cafa30db846ccb5a9
# bad: [91bdae56c40ee6de675fba6ac283311c92c437ce] ARM: include unprivileged BPF status in Spectre V2 reporting git bisect bad 91bdae56c40ee6de675fba6ac283311c92c437ce
# bad: [95ff4cb3b696a581d6166f0d754771bf9af5e27b] ARM: Spectre-BHB workaround
git bisect bad 95ff4cb3b696a581d6166f0d754771bf9af5e27b
# first bad commit: [95ff4cb3b696a581d6166f0d754771bf9af5e27b] ARM: Spectre-BHB workaround
Guenter
Greg Kroah-Hartman
maintainerQuoted 35 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.14 release. There are 37 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Mar 2022 15:58:48 +0000. Anything received after that time might be too late.
Almost all arm builds, all branches from 4.9.y to 5.16.y:
Error log:
arch/arm/common/secure_cntvoff.S: Assembler messages:arch/arm/common/secure_cntvoff.S:24: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' arch/arm/common/secure_cntvoff.S:27: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4'arch/arm/common/secure_cntvoff.S:29: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4'bisect log:
# bad: [
3416254dac79ea26e08dffde371ab1fd3130223c] Linux 5.16.14-rc1
# good: [6273c309621c9dd61c9c3f6d63f5d56ee2d89c73] Linux 5.16.13
git bisect start 'HEAD' 'v5.16.13'
# bad: [4403d69931dbc17659845d2d710602bbe35b4398] KVM: arm64: Allow indirect vectors to be used withoutSPECTRE_V3Agit bisect bad4403d69931dbc17659845d2d710602bbe35b4398
# good: [6f0cf3a1eb8b46a5d652a395ba25a59c32a86692] ARM: report Spectre v2 status through sysfs git bisect good6f0cf3a1eb8b46a5d652a395ba25a59c32a86692
# bad: [87e96a363eb4a62b65bb974a46d518a87153cd1c] arm64: addID_AA64ISAR2_EL1sys register
git bisect bad87e96a363eb4a62b65bb974a46d518a87153cd1c
# good: [654f0a73f042662a36155a0cafa30db846ccb5a9] ARM: useLOADADDR()to get load address of sections git bisect good654f0a73f042662a36155a0cafa30db846ccb5a9
# bad: [91bdae56c40ee6de675fba6ac283311c92c437ce] ARM: include unprivileged BPF status in Spectre V2 reporting git bisect bad91bdae56c40ee6de675fba6ac283311c92c437ce
# bad: [95ff4cb3b696a581d6166f0d754771bf9af5e27b] ARM: Spectre-BHB workaround
git bisect bad95ff4cb3b696a581d6166f0d754771bf9af5e27b
Quoted 3 lines
# first bad commit: [95ff4cb3b696a581d6166f0d754771bf9af5e27b] ARM: Spectre-BHB workaroundGuenter
Wow these are all broken, have I mentioned I hate working on patches in embargos?
I'll look at these in the morning, it's odd that Linus's tree isn't showing these same issue, but I might have messed up the arm backports somehow. I did test them on using the multi_v7_defconfig configuration and they built for me locally with gcc. I'll try to see what is different here...
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 40 lines · Greg Kroah-Hartman
Quoted 35 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.14 release. There are 37 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Mar 2022 15:58:48 +0000. Anything received after that time might be too late.
Almost all arm builds, all branches from 4.9.y to 5.16.y:
Error log:
arch/arm/common/secure_cntvoff.S: Assembler messages:arch/arm/common/secure_cntvoff.S:24: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' arch/arm/common/secure_cntvoff.S:27: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4'arch/arm/common/secure_cntvoff.S:29: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4'bisect log:
# bad: [
3416254dac79ea26e08dffde371ab1fd3130223c] Linux 5.16.14-rc1
# good: [6273c309621c9dd61c9c3f6d63f5d56ee2d89c73] Linux 5.16.13
git bisect start 'HEAD' 'v5.16.13'
# bad: [4403d69931dbc17659845d2d710602bbe35b4398] KVM: arm64: Allow indirect vectors to be used withoutSPECTRE_V3Agit bisect bad4403d69931dbc17659845d2d710602bbe35b4398
# good: [6f0cf3a1eb8b46a5d652a395ba25a59c32a86692] ARM: report Spectre v2 status through sysfs git bisect good6f0cf3a1eb8b46a5d652a395ba25a59c32a86692
# bad: [87e96a363eb4a62b65bb974a46d518a87153cd1c] arm64: addID_AA64ISAR2_EL1sys register
git bisect bad87e96a363eb4a62b65bb974a46d518a87153cd1c
# good: [654f0a73f042662a36155a0cafa30db846ccb5a9] ARM: useLOADADDR()to get load address of sections git bisect good654f0a73f042662a36155a0cafa30db846ccb5a9
# bad: [91bdae56c40ee6de675fba6ac283311c92c437ce] ARM: include unprivileged BPF status in Spectre V2 reporting git bisect bad91bdae56c40ee6de675fba6ac283311c92c437ce
# bad: [95ff4cb3b696a581d6166f0d754771bf9af5e27b] ARM: Spectre-BHB workaround
git bisect bad95ff4cb3b696a581d6166f0d754771bf9af5e27bQuoted 3 lines
# first bad commit: [95ff4cb3b696a581d6166f0d754771bf9af5e27b] ARM: Spectre-BHB workaroundGuenter
Quoted 8 lines
Wow these are all broken, have I mentioned I hate working on patches in embargos?
I'll look at these in the morning, it's odd that Linus's tree isn't showing these same issue, but I might have messed up the arm backports somehow. I did test them on using the
multi_v7_defconfigconfiguration and they built for me locally with gcc. I'll try to see what is different here...
Ah, 33970b031dc4 ("ARM: fix co-processor register typo") looks to solve a bunch of these, I'll queue that up now...
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.14 release. There are 37 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Mar 2022 15:58:48 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Hello!
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.14 release. There are 37 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Mar 2022 15:58:48 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
Regressions found.
The following Arm combinations failed to build:
- arm-gcc-8-bcm2835_defconfig
- arm-gcc-8-imx_v6_v7_defconfig
- arm-gcc-8-omap2plus_defconfig
- arm-gcc-9-bcm2835_defconfig
- arm-gcc-9-imx_v6_v7_defconfig
- arm-gcc-9-omap2plus_defconfig
- arm-gcc-10-bcm2835_defconfig
- arm-gcc-10-imx_v6_v7_defconfig
- arm-gcc-10-omap2plus_defconfig
- arm-gcc-11-bcm2835_defconfig
- arm-gcc-11-imx_v6_v7_defconfig
- arm-gcc-11-omap2plus_defconfig
- arm-clang-11-allnoconfig
- arm-clang-11-at91_dt_defconfig
- arm-clang-11-axm55xx_defconfig
- arm-clang-11-bcm2835_defconfig
- arm-clang-11-clps711x_defconfig
- arm-clang-11-davinci_all_defconfig
- arm-clang-11-defconfig
- arm-clang-11-exynos_defconfig
- arm-clang-11-footbridge_defconfig
- arm-clang-11-imx_v4_v5_defconfig
- arm-clang-11-imx_v6_v7_defconfig
- arm-clang-11-integrator_defconfig
- arm-clang-11-ixp4xx_defconfig
- arm-clang-11-keystone_defconfig
- arm-clang-11-lpc32xx_defconfig
- arm-clang-11-mini2440_defconfig
- arm-clang-11-multi_v5_defconfig
- arm-clang-11-mxs_defconfig
- arm-clang-11-nhk8815_defconfig
- arm-clang-11-omap1_defconfig
- arm-clang-11-omap2plus_defconfig
- arm-clang-11-orion5x_defconfig
- arm-clang-11-pxa910_defconfig
- arm-clang-11-s3c2410_defconfig
- arm-clang-11-s3c6400_defconfig
- arm-clang-11-s5pv210_defconfig
- arm-clang-11-sama5_defconfig
- arm-clang-11-shmobile_defconfig
- arm-clang-11-tinyconfig
- arm-clang-11-u8500_defconfig
- arm-clang-11-vexpress_defconfig
- arm-clang-12-allnoconfig
- arm-clang-12-at91_dt_defconfig
- arm-clang-12-axm55xx_defconfig
- arm-clang-12-bcm2835_defconfig
- arm-clang-12-clps711x_defconfig
- arm-clang-12-davinci_all_defconfig
- arm-clang-12-defconfig
- arm-clang-12-exynos_defconfig
- arm-clang-12-footbridge_defconfig
- arm-clang-12-imx_v4_v5_defconfig
- arm-clang-12-imx_v6_v7_defconfig
- arm-clang-12-integrator_defconfig
- arm-clang-12-ixp4xx_defconfig
- arm-clang-12-keystone_defconfig
- arm-clang-12-lpc32xx_defconfig
- arm-clang-12-mini2440_defconfig
- arm-clang-12-multi_v5_defconfig
- arm-clang-12-mxs_defconfig
- arm-clang-12-nhk8815_defconfig
- arm-clang-12-omap1_defconfig
- arm-clang-12-omap2plus_defconfig
- arm-clang-12-orion5x_defconfig
- arm-clang-12-pxa910_defconfig
- arm-clang-12-s3c2410_defconfig
- arm-clang-12-s3c6400_defconfig
- arm-clang-12-s5pv210_defconfig
- arm-clang-12-sama5_defconfig
- arm-clang-12-shmobile_defconfig
- arm-clang-12-tinyconfig
- arm-clang-12-u8500_defconfig
- arm-clang-12-vexpress_defconfig
- arm-clang-13-allnoconfig
- arm-clang-13-at91_dt_defconfig
- arm-clang-13-axm55xx_defconfig
- arm-clang-13-bcm2835_defconfig
- arm-clang-13-clps711x_defconfig
- arm-clang-13-davinci_all_defconfig
- arm-clang-13-defconfig
- arm-clang-13-exynos_defconfig
- arm-clang-13-footbridge_defconfig
- arm-clang-13-imx_v4_v5_defconfig
- arm-clang-13-imx_v6_v7_defconfig
- arm-clang-13-integrator_defconfig
- arm-clang-13-ixp4xx_defconfig
- arm-clang-13-keystone_defconfig
- arm-clang-13-lpc32xx_defconfig
- arm-clang-13-mini2440_defconfig
- arm-clang-13-multi_v5_defconfig
- arm-clang-13-mxs_defconfig
- arm-clang-13-nhk8815_defconfig
- arm-clang-13-omap1_defconfig
- arm-clang-13-omap2plus_defconfig
- arm-clang-13-orion5x_defconfig
- arm-clang-13-pxa910_defconfig
- arm-clang-13-s3c2410_defconfig
- arm-clang-13-s3c6400_defconfig
- arm-clang-13-s5pv210_defconfig
- arm-clang-13-sama5_defconfig
- arm-clang-13-shmobile_defconfig
- arm-clang-13-tinyconfig
- arm-clang-13-u8500_defconfig
- arm-clang-13-vexpress_defconfig
- arm-clang-14-allnoconfig
- arm-clang-14-at91_dt_defconfig
- arm-clang-14-axm55xx_defconfig
- arm-clang-14-bcm2835_defconfig
- arm-clang-14-clps711x_defconfig
- arm-clang-14-davinci_all_defconfig
- arm-clang-14-defconfig
- arm-clang-14-exynos_defconfig
- arm-clang-14-footbridge_defconfig
- arm-clang-14-imx_v4_v5_defconfig
- arm-clang-14-imx_v6_v7_defconfig
- arm-clang-14-integrator_defconfig
- arm-clang-14-ixp4xx_defconfig
- arm-clang-14-keystone_defconfig
- arm-clang-14-lpc32xx_defconfig
- arm-clang-14-mini2440_defconfig
- arm-clang-14-multi_v5_defconfig
- arm-clang-14-mxs_defconfig
- arm-clang-14-nhk8815_defconfig
- arm-clang-14-omap1_defconfig
- arm-clang-14-omap2plus_defconfig
- arm-clang-14-orion5x_defconfig
- arm-clang-14-pxa910_defconfig
- arm-clang-14-s3c2410_defconfig
- arm-clang-14-s3c6400_defconfig
- arm-clang-14-s5pv210_defconfig
- arm-clang-14-sama5_defconfig
- arm-clang-14-shmobile_defconfig
- arm-clang-14-tinyconfig
- arm-clang-14-u8500_defconfig
- arm-clang-14-vexpress_defconfig
- arm-clang-nightly-allnoconfig
- arm-clang-nightly-at91_dt_defconfig
- arm-clang-nightly-axm55xx_defconfig
- arm-clang-nightly-bcm2835_defconfig
- arm-clang-nightly-clps711x_defconfig
- arm-clang-nightly-davinci_all_defconfig
- arm-clang-nightly-defconfig
- arm-clang-nightly-exynos_defconfig
- arm-clang-nightly-footbridge_defconfig
- arm-clang-nightly-imx_v4_v5_defconfig
- arm-clang-nightly-imx_v6_v7_defconfig
- arm-clang-nightly-integrator_defconfig
- arm-clang-nightly-ixp4xx_defconfig
- arm-clang-nightly-keystone_defconfig
- arm-clang-nightly-lpc32xx_defconfig
- arm-clang-nightly-mini2440_defconfig
- arm-clang-nightly-multi_v5_defconfig
- arm-clang-nightly-mxs_defconfig
- arm-clang-nightly-nhk8815_defconfig
- arm-clang-nightly-omap1_defconfig
- arm-clang-nightly-omap2plus_defconfig
- arm-clang-nightly-orion5x_defconfig
- arm-clang-nightly-pxa910_defconfig
- arm-clang-nightly-s3c2410_defconfig
- arm-clang-nightly-s3c6400_defconfig
- arm-clang-nightly-s5pv210_defconfig
- arm-clang-nightly-sama5_defconfig
- arm-clang-nightly-shmobile_defconfig
- arm-clang-nightly-tinyconfig
- arm-clang-nightly-u8500_defconfig
- arm-clang-nightly-vexpress_defconfig
This is a GCC failure (bcm2835_defconfig with gcc-8):
/builds/linux/arch/arm/kernel/entry-common.S: Assembler messages:
/builds/linux/arch/arm/kernel/entry-common.S:166: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-common.S:175: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388: arch/arm/kernel/entry-common.o] Error 1 /builds/linux/arch/arm/kernel/entry-armv.S: Assembler messages:
/builds/linux/arch/arm/kernel/entry-armv.S:1090: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-armv.S:1113: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-armv.S:1136: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-armv.S:1159: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-armv.S:1198: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388: arch/arm/kernel/entry-armv.o] Error 1 /builds/linux/arch/arm/common/secure_cntvoff.S: Assembler messages:
/builds/linux/arch/arm/common/secure_cntvoff.S:24: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/common/secure_cntvoff.S:27: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/common/secure_cntvoff.S:29: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388: arch/arm/common/secure_cntvoff.o] Error 1 make[3]: Target '__build' not remade because of errors.
make[2]: *** [/builds/linux/scripts/Makefile.build:549: arch/arm/common] Error 2 /builds/linux/arch/arm/mm/cache-v7.S: Assembler messages:
/builds/linux/arch/arm/mm/cache-v7.S:42: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/cache-v7.S:69: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/cache-v7.S:142: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/cache-v7.S:179: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/cache-v7.S:312: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388: arch/arm/mm/cache-v7.o] Error 1 /builds/linux/arch/arm/mm/tlb-v7.S: Assembler messages:
/builds/linux/arch/arm/mm/tlb-v7.S:85: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388: arch/arm/mm/tlb-v7.o] Error 1 /builds/linux/arch/arm/mm/proc-v7-2level.S: Assembler messages:
/builds/linux/arch/arm/mm/proc-v7-2level.S:55: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/proc-v7-2level.S:57: Error: co-processor register expected -- mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/proc-v7.S:59: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388: arch/arm/mm/proc-v7.o] Error 1
make[3]: Target '__build' not remade because of errors.
make[2]: *** [/builds/linux/scripts/Makefile.build:549: arch/arm/mm] Error 2
And this is a Clang failure (
Oops! Slipped away.
Quoted 231 lines · Daniel Díaz
Hello!
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.14 release. There are 37 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Mar 2022 15:58:48 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.14-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.16.y and the diffstat can be found below.Quoted 3 lines
thanks,
greg k-h
Regressions found.
The following Arm combinations failed to build:
- arm-gcc-8-bcm2835_defconfig
- arm-gcc-8-imx_v6_v7_defconfig
- arm-gcc-8-omap2plus_defconfig
- arm-gcc-9-bcm2835_defconfig
- arm-gcc-9-imx_v6_v7_defconfig
- arm-gcc-9-omap2plus_defconfig
- arm-gcc-10-bcm2835_defconfig
- arm-gcc-10-imx_v6_v7_defconfig
- arm-gcc-10-omap2plus_defconfig
- arm-gcc-11-bcm2835_defconfig
- arm-gcc-11-imx_v6_v7_defconfig
- arm-gcc-11-omap2plus_defconfig
- arm-clang-11-allnoconfig
- arm-clang-11-at91_dt_defconfig
- arm-clang-11-axm55xx_defconfig
- arm-clang-11-bcm2835_defconfig
- arm-clang-11-clps711x_defconfig
- arm-clang-11-davinci_all_defconfig
- arm-clang-11-defconfig
- arm-clang-11-exynos_defconfig
- arm-clang-11-footbridge_defconfig
- arm-clang-11-imx_v4_v5_defconfig
- arm-clang-11-imx_v6_v7_defconfig
- arm-clang-11-integrator_defconfig
- arm-clang-11-ixp4xx_defconfig
- arm-clang-11-keystone_defconfig
- arm-clang-11-lpc32xx_defconfig
- arm-clang-11-mini2440_defconfig
- arm-clang-11-multi_v5_defconfig
- arm-clang-11-mxs_defconfig
- arm-clang-11-nhk8815_defconfig
- arm-clang-11-omap1_defconfig
- arm-clang-11-omap2plus_defconfig
- arm-clang-11-orion5x_defconfig
- arm-clang-11-pxa910_defconfig
- arm-clang-11-s3c2410_defconfig
- arm-clang-11-s3c6400_defconfig
- arm-clang-11-s5pv210_defconfig
- arm-clang-11-sama5_defconfig
- arm-clang-11-shmobile_defconfig
- arm-clang-11-tinyconfig
- arm-clang-11-u8500_defconfig
- arm-clang-11-vexpress_defconfig
- arm-clang-12-allnoconfig
- arm-clang-12-at91_dt_defconfig
- arm-clang-12-axm55xx_defconfig
- arm-clang-12-bcm2835_defconfig
- arm-clang-12-clps711x_defconfig
- arm-clang-12-davinci_all_defconfig
- arm-clang-12-defconfig
- arm-clang-12-exynos_defconfig
- arm-clang-12-footbridge_defconfig
- arm-clang-12-imx_v4_v5_defconfig
- arm-clang-12-imx_v6_v7_defconfig
- arm-clang-12-integrator_defconfig
- arm-clang-12-ixp4xx_defconfig
- arm-clang-12-keystone_defconfig
- arm-clang-12-lpc32xx_defconfig
- arm-clang-12-mini2440_defconfig
- arm-clang-12-multi_v5_defconfig
- arm-clang-12-mxs_defconfig
- arm-clang-12-nhk8815_defconfig
- arm-clang-12-omap1_defconfig
- arm-clang-12-omap2plus_defconfig
- arm-clang-12-orion5x_defconfig
- arm-clang-12-pxa910_defconfig
- arm-clang-12-s3c2410_defconfig
- arm-clang-12-s3c6400_defconfig
- arm-clang-12-s5pv210_defconfig
- arm-clang-12-sama5_defconfig
- arm-clang-12-shmobile_defconfig
- arm-clang-12-tinyconfig
- arm-clang-12-u8500_defconfig
- arm-clang-12-vexpress_defconfig
- arm-clang-13-allnoconfig
- arm-clang-13-at91_dt_defconfig
- arm-clang-13-axm55xx_defconfig
- arm-clang-13-bcm2835_defconfig
- arm-clang-13-clps711x_defconfig
- arm-clang-13-davinci_all_defconfig
- arm-clang-13-defconfig
- arm-clang-13-exynos_defconfig
- arm-clang-13-footbridge_defconfig
- arm-clang-13-imx_v4_v5_defconfig
- arm-clang-13-imx_v6_v7_defconfig
- arm-clang-13-integrator_defconfig
- arm-clang-13-ixp4xx_defconfig
- arm-clang-13-keystone_defconfig
- arm-clang-13-lpc32xx_defconfig
- arm-clang-13-mini2440_defconfig
- arm-clang-13-multi_v5_defconfig
- arm-clang-13-mxs_defconfig
- arm-clang-13-nhk8815_defconfig
- arm-clang-13-omap1_defconfig
- arm-clang-13-omap2plus_defconfig
- arm-clang-13-orion5x_defconfig
- arm-clang-13-pxa910_defconfig
- arm-clang-13-s3c2410_defconfig
- arm-clang-13-s3c6400_defconfig
- arm-clang-13-s5pv210_defconfig
- arm-clang-13-sama5_defconfig
- arm-clang-13-shmobile_defconfig
- arm-clang-13-tinyconfig
- arm-clang-13-u8500_defconfig
- arm-clang-13-vexpress_defconfig
- arm-clang-14-allnoconfig
- arm-clang-14-at91_dt_defconfig
- arm-clang-14-axm55xx_defconfig
- arm-clang-14-bcm2835_defconfig
- arm-clang-14-clps711x_defconfig
- arm-clang-14-davinci_all_defconfig
- arm-clang-14-defconfig
- arm-clang-14-exynos_defconfig
- arm-clang-14-footbridge_defconfig
- arm-clang-14-imx_v4_v5_defconfig
- arm-clang-14-imx_v6_v7_defconfig
- arm-clang-14-integrator_defconfig
- arm-clang-14-ixp4xx_defconfig
- arm-clang-14-keystone_defconfig
- arm-clang-14-lpc32xx_defconfig
- arm-clang-14-mini2440_defconfig
- arm-clang-14-multi_v5_defconfig
- arm-clang-14-mxs_defconfig
- arm-clang-14-nhk8815_defconfig
- arm-clang-14-omap1_defconfig
- arm-clang-14-omap2plus_defconfig
- arm-clang-14-orion5x_defconfig
- arm-clang-14-pxa910_defconfig
- arm-clang-14-s3c2410_defconfig
- arm-clang-14-s3c6400_defconfig
- arm-clang-14-s5pv210_defconfig
- arm-clang-14-sama5_defconfig
- arm-clang-14-shmobile_defconfig
- arm-clang-14-tinyconfig
- arm-clang-14-u8500_defconfig
- arm-clang-14-vexpress_defconfig
- arm-clang-nightly-allnoconfig
- arm-clang-nightly-at91_dt_defconfig
- arm-clang-nightly-axm55xx_defconfig
- arm-clang-nightly-bcm2835_defconfig
- arm-clang-nightly-clps711x_defconfig
- arm-clang-nightly-davinci_all_defconfig
- arm-clang-nightly-defconfig
- arm-clang-nightly-exynos_defconfig
- arm-clang-nightly-footbridge_defconfig
- arm-clang-nightly-imx_v4_v5_defconfig
- arm-clang-nightly-imx_v6_v7_defconfig
- arm-clang-nightly-integrator_defconfig
- arm-clang-nightly-ixp4xx_defconfig
- arm-clang-nightly-keystone_defconfig
- arm-clang-nightly-lpc32xx_defconfig
- arm-clang-nightly-mini2440_defconfig
- arm-clang-nightly-multi_v5_defconfig
- arm-clang-nightly-mxs_defconfig
- arm-clang-nightly-nhk8815_defconfig
- arm-clang-nightly-omap1_defconfig
- arm-clang-nightly-omap2plus_defconfig
- arm-clang-nightly-orion5x_defconfig
- arm-clang-nightly-pxa910_defconfig
- arm-clang-nightly-s3c2410_defconfig
- arm-clang-nightly-s3c6400_defconfig
- arm-clang-nightly-s5pv210_defconfig
- arm-clang-nightly-sama5_defconfig
- arm-clang-nightly-shmobile_defconfig
- arm-clang-nightly-tinyconfig
- arm-clang-nightly-u8500_defconfig
- arm-clang-nightly-vexpress_defconfigThis is a GCC failure (
bcm2835_defconfigwith gcc-8):/builds/linux/arch/arm/kernel/entry-common.S: Assembler messages:
/builds/linux/arch/arm/kernel/entry-common.S:166: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-common.S:175: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388:arch/arm/kernel/entry-common.o] Error 1 /builds/linux/arch/arm/kernel/entry-armv.S: Assembler messages:
/builds/linux/arch/arm/kernel/entry-armv.S:1090: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-armv.S:1113: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-armv.S:1136: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-armv.S:1159: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/kernel/entry-armv.S:1198: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388:arch/arm/kernel/entry-armv.o] Error 1 /builds/linux/arch/arm/common/secure_cntvoff.S: Assembler messages:
/builds/linux/arch/arm/common/secure_cntvoff.S:24: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/common/secure_cntvoff.S:27: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/common/secure_cntvoff.S:29: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388:arch/arm/common/secure_cntvoff.o] Error 1 make[3]: Target '__build' not remade because of errors.
make[2]: *** [/builds/linux/scripts/Makefile.build:549:arch/arm/common] Error 2 /builds/linux/arch/arm/mm/cache-v7.S: Assembler messages:
/builds/linux/arch/arm/mm/cache-v7.S:42: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/cache-v7.S:69: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/cache-v7.S:142: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/cache-v7.S:179: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/cache-v7.S:312: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388:arch/arm/mm/cache-v7.o] Error 1 /builds/linux/arch/arm/mm/tlb-v7.S: Assembler messages:
/builds/linux/arch/arm/mm/tlb-v7.S:85: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388:arch/arm/mm/tlb-v7.o] Error 1 /builds/linux/arch/arm/mm/proc-v7-2level.S: Assembler messages:
/builds/linux/arch/arm/mm/proc-v7-2level.S:55: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/proc-v7-2level.S:57: Error: co-processor register expected --mcr p15,0,r0,c7,r5,4' /builds/linux/arch/arm/mm/proc-v7.S:59: Error: co-processor register expected -- `mcr p15,0,r0,c7,r5,4' make[3]: *** [/builds/linux/scripts/Makefile.build:388:arch/arm/mm/proc-v7.o] Error 1
make[3]: Target '__build' not remade because of errors.
make[2]: *** [/builds/linux/scripts/Makefile.build:549:arch/arm/mm] Error 2
Quoted 1 line
And this is a Clang failure (
axm55xx_defconfig with clang-12)
ld.lld: error: ./arch/arm/kernel/vmlinux.lds:123: AT expected, but got NOCROSSREFS
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
__vectors_lma = .; OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { .vectors { *(.vectors) } .vectors.bhb.loop8 { *(.vectors.bhb.loop8) } .vectors.bhb.bpiall { *(.vectors.bhb.bpiall) } } __vectors_start = LOADADDR(.vectors); __vectors_end = LOADADDR(.vectors) + SIZEOF(.vectors); __vectors_bhb_loop8_start = LOADADDR(.vectors.bhb.loop8); __vectors_bhb_loop8_end = LOADADDR(.vectors.bhb.loop8) + SIZEOF(.vectors.bhb.loop8); __vectors_bhb_bpiall_start = LOADADDR(.vectors.bhb.bpiall); __vectors_bhb_bpiall_end = LOADADDR(.vectors.bhb.bpiall) + SIZEOF(.vectors.bhb.bpiall); . = __vectors_lma + SIZEOF(.vectors) + SIZEOF(.vectors.bhb.loop8) + SIZEOF(.vectors.bhb.bpiall); __stubs_lma = .; .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { *(.stubs) } __stubs_start = LOADADDR(.stubs); __stubs_end = LOADADDR(.stubs) + SIZEOF(.stubs); . = __stubs_lma + SIZEOF(.stubs); PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors)); ^
make[1]: *** [/builds/linux/Makefile:1161: vmlinux] Error 1
Greetings!
Daniel Díaz
[email protected]
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.14 release. There are 37 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Mar 2022 15:58:48 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
5.16.14-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.14 release. There are 37 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Successfully cross-compiled for arm64 (bcm2711_defconfig, gcc 10.2.0) and powerpc (ps3_defconfig, gcc 11.2.0).
Signature · 1 line
An old man doll... just what I always wanted! - Clara