Skip to content

Commit 874bb5d

Browse files
committed
Rebuild rocky9_4 with kernel-5.14.0-427.42.1.el9_4
Rebuild_History BUILDABLERebuilding Kernel from rpm changelog with Fuzz Limit: 87.50% Number of commits in upstream range v5.14~1..master: 244733 Number of commits in rpm: 78 Number of commits matched with upstream: 70 (89.74%) Number of commits in upstream but not in rpm: 244663 Number of commits NOT found in upstream: 8 (10.26%) Rebuilding Kernel on Branch rocky9_4_rebuild_kernel-5.14.0-427.42.1.el9_4 for kernel-5.14.0-427.42.1.el9_4 Clean Cherry Picks: 50 (71.43%) Empty Cherry Picks: 20 (28.57%) _______________________________ Full Details Located here: ciq/ciq_backports/kernel-5.14.0-427.42.1.el9_4/rebuild.details.txt Includes: * git commit header above * Empty Commits with upstream SHA * RPM ChangeLog Entries that could not be matched Individual Empty Commit failures contained in the same containing directory. The git message for empty commits will have the path for the failed commit. File names are the first 8 characters of the upstream SHA
1 parent 3cd13b9 commit 874bb5d

Some content is hidden

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

56 files changed

+673
-284
lines changed
File renamed without changes.

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

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,10 @@ associated with the source address of the indirect branch. Specifically,
138138
the BHB might be shared across privilege levels even in the presence of
139139
Enhanced IBRS.
140140

141-
Currently the only known real-world BHB attack vector is via
142-
unprivileged eBPF. Therefore, it's highly recommended to not enable
143-
unprivileged eBPF, especially when eIBRS is used (without retpolines).
144-
For a full mitigation against BHB attacks, it's recommended to use
145-
retpolines (or eIBRS combined with retpolines).
141+
Previously the only known real-world BHB attack vector was via unprivileged
142+
eBPF. Further research has found attacks that don't require unprivileged eBPF.
143+
For a full mitigation against BHB attacks it is recommended to set BHI_DIS_S or
144+
use the BHB clearing sequence.
146145

147146
Attack scenarios
148147
----------------
@@ -430,6 +429,23 @@ The possible values in this file are:
430429
'PBRSB-eIBRS: Not affected' CPU is not affected by PBRSB
431430
=========================== =======================================================
432431

432+
- Branch History Injection (BHI) protection status:
433+
434+
.. list-table::
435+
436+
* - BHI: Not affected
437+
- System is not affected
438+
* - BHI: Retpoline
439+
- System is protected by retpoline
440+
* - BHI: BHI_DIS_S
441+
- System is protected by BHI_DIS_S
442+
* - BHI: SW loop, KVM SW loop
443+
- System is protected by software clearing sequence
444+
* - BHI: Vulnerable
445+
- System is vulnerable to BHI
446+
* - BHI: Vulnerable, KVM: SW loop
447+
- System is vulnerable; KVM is protected by software clearing sequence
448+
433449
Full mitigation might require a microcode update from the CPU
434450
vendor. When the necessary microcode is not available, the kernel will
435451
report vulnerability.
@@ -484,7 +500,11 @@ Spectre variant 2
484500

485501
Systems which support enhanced IBRS (eIBRS) enable IBRS protection once at
486502
boot, by setting the IBRS bit, and they're automatically protected against
487-
Spectre v2 variant attacks.
503+
some Spectre v2 variant attacks. The BHB can still influence the choice of
504+
indirect branch predictor entry, and although branch predictor entries are
505+
isolated between modes when eIBRS is enabled, the BHB itself is not isolated
506+
between modes. Systems which support BHI_DIS_S will set it to protect against
507+
BHI attacks.
488508

489509
On Intel's enhanced IBRS systems, this includes cross-thread branch target
490510
injections on SMT systems (STIBP). In other words, Intel eIBRS enables
@@ -638,6 +658,18 @@ kernel command line.
638658
spectre_v2=off. Spectre variant 1 mitigations
639659
cannot be disabled.
640660

661+
spectre_bhi=
662+
663+
[X86] Control mitigation of Branch History Injection
664+
(BHI) vulnerability. This setting affects the deployment
665+
of the HW BHI control and the SW BHB clearing sequence.
666+
667+
on
668+
(default) Enable the HW or SW mitigation as
669+
needed.
670+
off
671+
Disable the mitigation.
672+
641673
For spectre_v2_user see Documentation/admin-guide/kernel-parameters.txt
642674

643675
Mitigation selection guide

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,6 +3286,7 @@
32863286
retbleed=off [X86]
32873287
spec_rstack_overflow=off [X86]
32883288
spec_store_bypass_disable=off [X86,PPC]
3289+
spectre_bhi=off [X86]
32893290
spectre_v2_user=off [X86]
32903291
srbds=off [X86,INTEL]
32913292
ssbd=force-off [ARM64]
@@ -5722,6 +5723,15 @@
57225723
sonypi.*= [HW] Sony Programmable I/O Control Device driver
57235724
See Documentation/admin-guide/laptops/sonypi.rst
57245725

5726+
spectre_bhi= [X86] Control mitigation of Branch History Injection
5727+
(BHI) vulnerability. This setting affects the
5728+
deployment of the HW BHI control and the SW BHB
5729+
clearing sequence.
5730+
5731+
on - (default) Enable the HW or SW mitigation
5732+
as needed.
5733+
off - Disable the mitigation.
5734+
57255735
spectre_v2= [X86] Control mitigation of Spectre variant 2
57265736
(indirect branch speculation) vulnerability.
57275737
The default operation protects the kernel from

Makefile.rhelver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RHEL_MINOR = 4
1212
#
1313
# Use this spot to avoid future merge conflicts.
1414
# Do not trim this comment.
15-
RHEL_RELEASE = 427.40.1
15+
RHEL_RELEASE = 427.42.1
1616

1717
#
1818
# ZSTREAM

arch/x86/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,6 +2641,16 @@ config MITIGATION_RFDS
26412641
stored in floating point, vector and integer registers.
26422642
See also <file:Documentation/admin-guide/hw-vuln/reg-file-data-sampling.rst>
26432643

2644+
config MITIGATION_SPECTRE_BHI
2645+
bool "Mitigate Spectre-BHB (Branch History Injection)"
2646+
depends on CPU_SUP_INTEL
2647+
default y
2648+
help
2649+
Enable BHI mitigations. BHI attacks are a form of Spectre V2 attacks
2650+
where the branch history buffer is poisoned to speculatively steer
2651+
indirect branches.
2652+
See <file:Documentation/admin-guide/hw-vuln/spectre.rst>
2653+
26442654
endif
26452655

26462656
config ARCH_HAS_ADD_PAGES

arch/x86/entry/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static __always_inline bool int80_is_external(void)
148148
}
149149

150150
/**
151-
* int80_emulation - 32-bit legacy syscall entry
151+
* do_int80_emulation - 32-bit legacy syscall C entry from asm
152152
*
153153
* This entry point can be used by 32-bit and 64-bit programs to perform
154154
* 32-bit system calls. Instances of INT $0x80 can be found inline in
@@ -166,7 +166,7 @@ static __always_inline bool int80_is_external(void)
166166
* eax: system call number
167167
* ebx, ecx, edx, esi, edi, ebp: arg1 - arg 6
168168
*/
169-
DEFINE_IDTENTRY_RAW(int80_emulation)
169+
__visible noinstr void do_int80_emulation(struct pt_regs *regs)
170170
{
171171
int nr;
172172

arch/x86/entry/entry_64.S

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ SYM_INNER_LABEL(entry_SYSCALL_64_after_hwframe, SYM_L_GLOBAL)
116116
/* clobbers %rax, make sure it is after saving the syscall nr */
117117
IBRS_ENTER
118118
UNTRAIN_RET
119+
CLEAR_BRANCH_HISTORY
119120

120121
call do_syscall_64 /* returns with IRQs disabled */
121122

@@ -1551,3 +1552,63 @@ SYM_CODE_START_NOALIGN(rewind_stack_and_make_dead)
15511552
call make_task_dead
15521553
SYM_CODE_END(rewind_stack_and_make_dead)
15531554
.popsection
1555+
1556+
/*
1557+
* This sequence executes branches in order to remove user branch information
1558+
* from the branch history tracker in the Branch Predictor, therefore removing
1559+
* user influence on subsequent BTB lookups.
1560+
*
1561+
* It should be used on parts prior to Alder Lake. Newer parts should use the
1562+
* BHI_DIS_S hardware control instead. If a pre-Alder Lake part is being
1563+
* virtualized on newer hardware the VMM should protect against BHI attacks by
1564+
* setting BHI_DIS_S for the guests.
1565+
*
1566+
* CALLs/RETs are necessary to prevent Loop Stream Detector(LSD) from engaging
1567+
* and not clearing the branch history. The call tree looks like:
1568+
*
1569+
* call 1
1570+
* call 2
1571+
* call 2
1572+
* call 2
1573+
* call 2
1574+
* call 2
1575+
* ret
1576+
* ret
1577+
* ret
1578+
* ret
1579+
* ret
1580+
* ret
1581+
*
1582+
* This means that the stack is non-constant and ORC can't unwind it with %rsp
1583+
* alone. Therefore we unconditionally set up the frame pointer, which allows
1584+
* ORC to unwind properly.
1585+
*
1586+
* The alignment is for performance and not for safety, and may be safely
1587+
* refactored in the future if needed.
1588+
*/
1589+
SYM_FUNC_START(clear_bhb_loop)
1590+
push %rbp
1591+
mov %rsp, %rbp
1592+
movl $5, %ecx
1593+
ANNOTATE_INTRA_FUNCTION_CALL
1594+
call 1f
1595+
jmp 5f
1596+
.align 64, 0xcc
1597+
ANNOTATE_INTRA_FUNCTION_CALL
1598+
1: call 2f
1599+
RET
1600+
.align 64, 0xcc
1601+
2: movl $5, %eax
1602+
3: jmp 4f
1603+
nop
1604+
4: sub $1, %eax
1605+
jnz 3b
1606+
sub $1, %ecx
1607+
jnz 1b
1608+
RET
1609+
5: lfence
1610+
pop %rbp
1611+
RET
1612+
SYM_FUNC_END(clear_bhb_loop)
1613+
EXPORT_SYMBOL_GPL(clear_bhb_loop)
1614+
STACK_FRAME_NON_STANDARD(clear_bhb_loop)

arch/x86/entry/entry_64_compat.S

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ SYM_INNER_LABEL(entry_SYSENTER_compat_after_hwframe, SYM_L_GLOBAL)
9292

9393
IBRS_ENTER
9494
UNTRAIN_RET
95+
CLEAR_BRANCH_HISTORY
9596

9697
/*
9798
* SYSENTER doesn't filter flags, so we need to clear NT and AC
@@ -209,6 +210,7 @@ SYM_INNER_LABEL(entry_SYSCALL_compat_after_hwframe, SYM_L_GLOBAL)
209210

210211
IBRS_ENTER
211212
UNTRAIN_RET
213+
CLEAR_BRANCH_HISTORY
212214

213215
movq %rsp, %rdi
214216
call do_fast_syscall_32
@@ -274,3 +276,17 @@ SYM_INNER_LABEL(entry_SYSRETL_compat_unsafe_stack, SYM_L_GLOBAL)
274276
sysretl
275277
SYM_INNER_LABEL(entry_SYSRETL_compat_end, SYM_L_GLOBAL)
276278
SYM_CODE_END(entry_SYSCALL_compat)
279+
280+
/*
281+
* int 0x80 is used by 32 bit mode as a system call entry. Normally idt entries
282+
* point to C routines, however since this is a system call interface the branch
283+
* history needs to be scrubbed to protect against BHI attacks, and that
284+
* scrubbing needs to take place in assembly code prior to entering any C
285+
* routines.
286+
*/
287+
SYM_CODE_START(int80_emulation)
288+
ANNOTATE_NOENDBR
289+
UNWIND_HINT_FUNC
290+
CLEAR_BRANCH_HISTORY
291+
jmp do_int80_emulation
292+
SYM_CODE_END(int80_emulation)

arch/x86/include/asm/cpufeatures.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,15 @@
457457

458458
/*
459459
* Extended auxiliary flags: Linux defined - for features scattered in various
460-
* CPUID levels like 0x80000022, etc.
460+
* CPUID levels like 0x80000022, etc and Linux defined features.
461461
*
462462
* Reuse free bits when adding new feature flags!
463463
*/
464464
#define X86_FEATURE_AMD_LBR_PMC_FREEZE (21*32+ 0) /* AMD LBR and PMC Freeze */
465+
#define X86_FEATURE_CLEAR_BHB_LOOP (21*32+ 1) /* "" Clear branch history at syscall entry using SW loop */
466+
#define X86_FEATURE_BHI_CTRL (21*32+ 2) /* "" BHI_DIS_S HW control available */
467+
#define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* "" BHI_DIS_S HW control enabled */
468+
#define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* "" Clear branch history at vmexit using SW loop */
465469

466470
/*
467471
* BUG word(s)

arch/x86/include/asm/msr-index.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@
5050
#define SPEC_CTRL_SSBD BIT(SPEC_CTRL_SSBD_SHIFT) /* Speculative Store Bypass Disable */
5151
#define SPEC_CTRL_RRSBA_DIS_S_SHIFT 6 /* Disable RRSBA behavior */
5252
#define SPEC_CTRL_RRSBA_DIS_S BIT(SPEC_CTRL_RRSBA_DIS_S_SHIFT)
53+
#define SPEC_CTRL_BHI_DIS_S_SHIFT 10 /* Disable Branch History Injection behavior */
54+
#define SPEC_CTRL_BHI_DIS_S BIT(SPEC_CTRL_BHI_DIS_S_SHIFT)
5355

5456
/* A mask for bits which the kernel toggles when controlling mitigations */
5557
#define SPEC_CTRL_MITIGATIONS_MASK (SPEC_CTRL_IBRS | SPEC_CTRL_STIBP | SPEC_CTRL_SSBD \
56-
| SPEC_CTRL_RRSBA_DIS_S)
58+
| SPEC_CTRL_RRSBA_DIS_S \
59+
| SPEC_CTRL_BHI_DIS_S)
5760

5861
#define MSR_IA32_PRED_CMD 0x00000049 /* Prediction Command */
5962
#define PRED_CMD_IBPB BIT(0) /* Indirect Branch Prediction Barrier */

0 commit comments

Comments
 (0)