Skip to content

Commit c5c9c2a

Browse files
committed
Merge remote-tracking branch 'stable/linux-6.12.y' into rpi-6.12.y
2 parents 22121c5 + 5be5dbf commit c5c9c2a

File tree

187 files changed

+3219
-1086
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+3219
-1086
lines changed

.clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ check-private-items = true
55
disallowed-macros = [
66
# The `clippy::dbg_macro` lint only works with `std::dbg!`, thus we simulate
77
# it here, see: https://github.com/rust-lang/rust-clippy/issues/11303.
8-
{ path = "kernel::dbg", reason = "the `dbg!` macro is intended as a debugging tool" },
8+
{ path = "kernel::dbg", reason = "the `dbg!` macro is intended as a debugging tool", allow-invalid = true },
99
]

Documentation/ABI/testing/sysfs-devices-system-cpu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ Description: information about CPUs heterogeneity.
511511

512512
What: /sys/devices/system/cpu/vulnerabilities
513513
/sys/devices/system/cpu/vulnerabilities/gather_data_sampling
514+
/sys/devices/system/cpu/vulnerabilities/indirect_target_selection
514515
/sys/devices/system/cpu/vulnerabilities/itlb_multihit
515516
/sys/devices/system/cpu/vulnerabilities/l1tf
516517
/sys/devices/system/cpu/vulnerabilities/mds

Documentation/admin-guide/hw-vuln/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ are configurable at compile, boot or run time.
2222
srso
2323
gather_data_sampling
2424
reg-file-data-sampling
25+
indirect-target-selection
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
Indirect Target Selection (ITS)
4+
===============================
5+
6+
ITS is a vulnerability in some Intel CPUs that support Enhanced IBRS and were
7+
released before Alder Lake. ITS may allow an attacker to control the prediction
8+
of indirect branches and RETs located in the lower half of a cacheline.
9+
10+
ITS is assigned CVE-2024-28956 with a CVSS score of 4.7 (Medium).
11+
12+
Scope of Impact
13+
---------------
14+
- **eIBRS Guest/Host Isolation**: Indirect branches in KVM/kernel may still be
15+
predicted with unintended target corresponding to a branch in the guest.
16+
17+
- **Intra-Mode BTI**: In-kernel training such as through cBPF or other native
18+
gadgets.
19+
20+
- **Indirect Branch Prediction Barrier (IBPB)**: After an IBPB, indirect
21+
branches may still be predicted with targets corresponding to direct branches
22+
executed prior to the IBPB. This is fixed by the IPU 2025.1 microcode, which
23+
should be available via distro updates. Alternatively microcode can be
24+
obtained from Intel's github repository [#f1]_.
25+
26+
Affected CPUs
27+
-------------
28+
Below is the list of ITS affected CPUs [#f2]_ [#f3]_:
29+
30+
======================== ============ ==================== ===============
31+
Common name Family_Model eIBRS Intra-mode BTI
32+
Guest/Host Isolation
33+
======================== ============ ==================== ===============
34+
SKYLAKE_X (step >= 6) 06_55H Affected Affected
35+
ICELAKE_X 06_6AH Not affected Affected
36+
ICELAKE_D 06_6CH Not affected Affected
37+
ICELAKE_L 06_7EH Not affected Affected
38+
TIGERLAKE_L 06_8CH Not affected Affected
39+
TIGERLAKE 06_8DH Not affected Affected
40+
KABYLAKE_L (step >= 12) 06_8EH Affected Affected
41+
KABYLAKE (step >= 13) 06_9EH Affected Affected
42+
COMETLAKE 06_A5H Affected Affected
43+
COMETLAKE_L 06_A6H Affected Affected
44+
ROCKETLAKE 06_A7H Not affected Affected
45+
======================== ============ ==================== ===============
46+
47+
- All affected CPUs enumerate Enhanced IBRS feature.
48+
- IBPB isolation is affected on all ITS affected CPUs, and need a microcode
49+
update for mitigation.
50+
- None of the affected CPUs enumerate BHI_CTRL which was introduced in Golden
51+
Cove (Alder Lake and Sapphire Rapids). This can help guests to determine the
52+
host's affected status.
53+
- Intel Atom CPUs are not affected by ITS.
54+
55+
Mitigation
56+
----------
57+
As only the indirect branches and RETs that have their last byte of instruction
58+
in the lower half of the cacheline are vulnerable to ITS, the basic idea behind
59+
the mitigation is to not allow indirect branches in the lower half.
60+
61+
This is achieved by relying on existing retpoline support in the kernel, and in
62+
compilers. ITS-vulnerable retpoline sites are runtime patched to point to newly
63+
added ITS-safe thunks. These safe thunks consists of indirect branch in the
64+
second half of the cacheline. Not all retpoline sites are patched to thunks, if
65+
a retpoline site is evaluated to be ITS-safe, it is replaced with an inline
66+
indirect branch.
67+
68+
Dynamic thunks
69+
~~~~~~~~~~~~~~
70+
From a dynamically allocated pool of safe-thunks, each vulnerable site is
71+
replaced with a new thunk, such that they get a unique address. This could
72+
improve the branch prediction accuracy. Also, it is a defense-in-depth measure
73+
against aliasing.
74+
75+
Note, for simplicity, indirect branches in eBPF programs are always replaced
76+
with a jump to a static thunk in __x86_indirect_its_thunk_array. If required,
77+
in future this can be changed to use dynamic thunks.
78+
79+
All vulnerable RETs are replaced with a static thunk, they do not use dynamic
80+
thunks. This is because RETs get their prediction from RSB mostly that does not
81+
depend on source address. RETs that underflow RSB may benefit from dynamic
82+
thunks. But, RETs significantly outnumber indirect branches, and any benefit
83+
from a unique source address could be outweighed by the increased icache
84+
footprint and iTLB pressure.
85+
86+
Retpoline
87+
~~~~~~~~~
88+
Retpoline sequence also mitigates ITS-unsafe indirect branches. For this
89+
reason, when retpoline is enabled, ITS mitigation only relocates the RETs to
90+
safe thunks. Unless user requested the RSB-stuffing mitigation.
91+
92+
RSB Stuffing
93+
~~~~~~~~~~~~
94+
RSB-stuffing via Call Depth Tracking is a mitigation for Retbleed RSB-underflow
95+
attacks. And it also mitigates RETs that are vulnerable to ITS.
96+
97+
Mitigation in guests
98+
^^^^^^^^^^^^^^^^^^^^
99+
All guests deploy ITS mitigation by default, irrespective of eIBRS enumeration
100+
and Family/Model of the guest. This is because eIBRS feature could be hidden
101+
from a guest. One exception to this is when a guest enumerates BHI_DIS_S, which
102+
indicates that the guest is running on an unaffected host.
103+
104+
To prevent guests from unnecessarily deploying the mitigation on unaffected
105+
platforms, Intel has defined ITS_NO bit(62) in MSR IA32_ARCH_CAPABILITIES. When
106+
a guest sees this bit set, it should not enumerate the ITS bug. Note, this bit
107+
is not set by any hardware, but is **intended for VMMs to synthesize** it for
108+
guests as per the host's affected status.
109+
110+
Mitigation options
111+
^^^^^^^^^^^^^^^^^^
112+
The ITS mitigation can be controlled using the "indirect_target_selection"
113+
kernel parameter. The available options are:
114+
115+
======== ===================================================================
116+
on (default) Deploy the "Aligned branch/return thunks" mitigation.
117+
If spectre_v2 mitigation enables retpoline, aligned-thunks are only
118+
deployed for the affected RET instructions. Retpoline mitigates
119+
indirect branches.
120+
121+
off Disable ITS mitigation.
122+
123+
vmexit Equivalent to "=on" if the CPU is affected by guest/host isolation
124+
part of ITS. Otherwise, mitigation is not deployed. This option is
125+
useful when host userspace is not in the threat model, and only
126+
attacks from guest to host are considered.
127+
128+
stuff Deploy RSB-fill mitigation when retpoline is also deployed.
129+
Otherwise, deploy the default mitigation. When retpoline mitigation
130+
is enabled, RSB-stuffing via Call-Depth-Tracking also mitigates
131+
ITS.
132+
133+
force Force the ITS bug and deploy the default mitigation.
134+
======== ===================================================================
135+
136+
Sysfs reporting
137+
---------------
138+
139+
The sysfs file showing ITS mitigation status is:
140+
141+
/sys/devices/system/cpu/vulnerabilities/indirect_target_selection
142+
143+
Note, microcode mitigation status is not reported in this file.
144+
145+
The possible values in this file are:
146+
147+
.. list-table::
148+
149+
* - Not affected
150+
- The processor is not vulnerable.
151+
* - Vulnerable
152+
- System is vulnerable and no mitigation has been applied.
153+
* - Vulnerable, KVM: Not affected
154+
- System is vulnerable to intra-mode BTI, but not affected by eIBRS
155+
guest/host isolation.
156+
* - Mitigation: Aligned branch/return thunks
157+
- The mitigation is enabled, affected indirect branches and RETs are
158+
relocated to safe thunks.
159+
* - Mitigation: Retpolines, Stuffing RSB
160+
- The mitigation is enabled using retpoline and RSB stuffing.
161+
162+
References
163+
----------
164+
.. [#f1] Microcode repository - https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files
165+
166+
.. [#f2] Affected Processors list - https://www.intel.com/content/www/us/en/developer/topic-technology/software-security-guidance/processors-affected-consolidated-product-cpu-model.html
167+
168+
.. [#f3] Affected Processors list (machine readable) - https://github.com/intel/Intel-affected-processor-list

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,6 +2149,23 @@
21492149
different crypto accelerators. This option can be used
21502150
to achieve best performance for particular HW.
21512151

2152+
indirect_target_selection= [X86,Intel] Mitigation control for Indirect
2153+
Target Selection(ITS) bug in Intel CPUs. Updated
2154+
microcode is also required for a fix in IBPB.
2155+
2156+
on: Enable mitigation (default).
2157+
off: Disable mitigation.
2158+
force: Force the ITS bug and deploy default
2159+
mitigation.
2160+
vmexit: Only deploy mitigation if CPU is affected by
2161+
guest/host isolation part of ITS.
2162+
stuff: Deploy RSB-fill mitigation when retpoline is
2163+
also deployed. Otherwise, deploy the default
2164+
mitigation.
2165+
2166+
For details see:
2167+
Documentation/admin-guide/hw-vuln/indirect-target-selection.rst
2168+
21522169
init= [KNL]
21532170
Format: <full_path>
21542171
Run specified binary instead of /sbin/init as init
@@ -3510,6 +3527,7 @@
35103527
expose users to several CPU vulnerabilities.
35113528
Equivalent to: if nokaslr then kpti=0 [ARM64]
35123529
gather_data_sampling=off [X86]
3530+
indirect_target_selection=off [X86]
35133531
kvm.nx_huge_pages=off [X86]
35143532
l1tf=off [X86]
35153533
mds=off [X86]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 6
33
PATCHLEVEL = 12
4-
SUBLEVEL = 28
4+
SUBLEVEL = 29
55
EXTRAVERSION =
66
NAME = Baby Opossum Posse
77

arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,19 @@
165165
startup-delay-us = <20000>;
166166
};
167167

168+
reg_usdhc2_vqmmc: regulator-usdhc2-vqmmc {
169+
compatible = "regulator-gpio";
170+
pinctrl-names = "default";
171+
pinctrl-0 = <&pinctrl_usdhc2_vsel>;
172+
gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
173+
regulator-max-microvolt = <3300000>;
174+
regulator-min-microvolt = <1800000>;
175+
states = <1800000 0x1>,
176+
<3300000 0x0>;
177+
regulator-name = "PMIC_USDHC_VSELECT";
178+
vin-supply = <&reg_nvcc_sd>;
179+
};
180+
168181
reserved-memory {
169182
#address-cells = <2>;
170183
#size-cells = <2>;
@@ -290,7 +303,7 @@
290303
"SODIMM_19",
291304
"",
292305
"",
293-
"",
306+
"PMIC_USDHC_VSELECT",
294307
"",
295308
"",
296309
"",
@@ -801,6 +814,7 @@
801814
pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_cd>;
802815
pinctrl-3 = <&pinctrl_usdhc2_sleep>, <&pinctrl_usdhc2_cd_sleep>;
803816
vmmc-supply = <&reg_usdhc2_vmmc>;
817+
vqmmc-supply = <&reg_usdhc2_vqmmc>;
804818
};
805819

806820
&wdog1 {
@@ -1222,13 +1236,17 @@
12221236
<MX8MM_IOMUXC_NAND_CLE_GPIO3_IO5 0x6>; /* SODIMM 76 */
12231237
};
12241238

1239+
pinctrl_usdhc2_vsel: usdhc2vselgrp {
1240+
fsl,pins =
1241+
<MX8MM_IOMUXC_GPIO1_IO04_GPIO1_IO4 0x10>; /* PMIC_USDHC_VSELECT */
1242+
};
1243+
12251244
/*
12261245
* Note: Due to ERR050080 we use discrete external on-module resistors pulling-up to the
12271246
* on-module +V3.3_1.8_SD (LDO5) rail and explicitly disable the internal pull-ups here.
12281247
*/
12291248
pinctrl_usdhc2: usdhc2grp {
12301249
fsl,pins =
1231-
<MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x10>,
12321250
<MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x90>, /* SODIMM 78 */
12331251
<MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x90>, /* SODIMM 74 */
12341252
<MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x90>, /* SODIMM 80 */
@@ -1239,7 +1257,6 @@
12391257

12401258
pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
12411259
fsl,pins =
1242-
<MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x10>,
12431260
<MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x94>,
12441261
<MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x94>,
12451262
<MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x94>,
@@ -1250,7 +1267,6 @@
12501267

12511268
pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
12521269
fsl,pins =
1253-
<MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x10>,
12541270
<MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x96>,
12551271
<MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x96>,
12561272
<MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x96>,
@@ -1262,7 +1278,6 @@
12621278
/* Avoid backfeeding with removed card power */
12631279
pinctrl_usdhc2_sleep: usdhc2slpgrp {
12641280
fsl,pins =
1265-
<MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x0>,
12661281
<MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x0>,
12671282
<MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x0>,
12681283
<MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x0>,

arch/arm64/include/asm/cputype.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#define ARM_CPU_PART_CORTEX_A78AE 0xD42
8282
#define ARM_CPU_PART_CORTEX_X1 0xD44
8383
#define ARM_CPU_PART_CORTEX_A510 0xD46
84+
#define ARM_CPU_PART_CORTEX_X1C 0xD4C
8485
#define ARM_CPU_PART_CORTEX_A520 0xD80
8586
#define ARM_CPU_PART_CORTEX_A710 0xD47
8687
#define ARM_CPU_PART_CORTEX_A715 0xD4D
@@ -166,6 +167,7 @@
166167
#define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)
167168
#define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1)
168169
#define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)
170+
#define MIDR_CORTEX_X1C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1C)
169171
#define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520)
170172
#define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
171173
#define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715)

arch/arm64/include/asm/insn.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ u32 aarch64_insn_gen_cas(enum aarch64_insn_register result,
693693
}
694694
#endif
695695
u32 aarch64_insn_gen_dmb(enum aarch64_insn_mb_type type);
696+
u32 aarch64_insn_gen_dsb(enum aarch64_insn_mb_type type);
696697
u32 aarch64_insn_gen_mrs(enum aarch64_insn_register result,
697698
enum aarch64_insn_system_register sysreg);
698699

arch/arm64/include/asm/spectre.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ enum mitigation_state arm64_get_meltdown_state(void);
9797

9898
enum mitigation_state arm64_get_spectre_bhb_state(void);
9999
bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry, int scope);
100+
extern bool __nospectre_bhb;
101+
u8 get_spectre_bhb_loop_value(void);
102+
bool is_spectre_bhb_fw_mitigated(void);
100103
void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
101104
bool try_emulate_el1_ssbs(struct pt_regs *regs, u32 instr);
102105

arch/arm64/kernel/cpufeature.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,14 @@ static struct arm64_cpu_capabilities const __ro_after_init *cpucap_ptrs[ARM64_NC
111111

112112
DECLARE_BITMAP(boot_cpucaps, ARM64_NCAPS);
113113

114-
bool arm64_use_ng_mappings = false;
114+
/*
115+
* arm64_use_ng_mappings must be placed in the .data section, otherwise it
116+
* ends up in the .bss section where it is initialized in early_map_kernel()
117+
* after the MMU (with the idmap) was enabled. create_init_idmap() - which
118+
* runs before early_map_kernel() and reads the variable via PTE_MAYBE_NG -
119+
* may end up generating an incorrect idmap page table attributes.
120+
*/
121+
bool arm64_use_ng_mappings __read_mostly = false;
115122
EXPORT_SYMBOL(arm64_use_ng_mappings);
116123

117124
DEFINE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector) = vectors;

0 commit comments

Comments
 (0)