Skip to content

[ciqlts9_6] x86/bugs: Make Safe-RET robust against interrupt injection - #1726

Open
ciq-kernel-automation[bot] wants to merge 1 commit into
ciqlts9_6from
{bmastbergen_cves}_ciqlts9_6
Open

ciq-kernel-automation[bot] wants to merge 1 commit into
ciqlts9_6from
{bmastbergen_cves}_ciqlts9_6

Conversation

@ciq-kernel-automation

Copy link
Copy Markdown

Summary

This PR has been automatically created after successful completion of all CI stages.

Commit Message(s)

x86/bugs: Make Safe-RET robust against interrupt injection

jira VULN-196245
cve CVE-2026-68480
commit-author Borislav Petkov (AMD) <bp@alien8.de>
commit 7e7f81cf6f5ca3311e526308f55d7c54d3ba71f9
upstream-diff This tree predates the v6.11 alternative-macro rework,
              so its assembler ALTERNATIVE_2 cannot expand a
              multi-instruction macro like upstream's
              __HANDLE_INTR_SAFERET() into an alternative replacement.
              Instead, HANDLE_INTR_SAFERET() calls out-of-line helpers
              __handle_intr_saferet() / __handle_intr_saferet_alias()
              added to retpoline.S through a 5-byte CALL alternative
              per SRSO variant, matching the official 5.15.y
              (52db77a13be2) and 5.10.y (dfefa3c51370) backports of
              this fix; <asm/ptrace-abi.h> is included by retpoline.S
              accordingly.  Everything else - the paranoid_entry /
              error_entry call sites, the VALIDATE_UNRET_END relocation
              in error_entry, the Safe-RET ANNOTATE_NOENDBR annotations
              and handle_interrupted_saferet() in bugs.c - is identical
              to upstream (minor comment wording and indentation tweaks
              follow the stable backports).

Test Results

✅ Build Stage

Architecture Build Time Total Time
x86_64 24m 0s 25m 10s
aarch64 19m 50s 20m 36s

✅ Boot Verification

✅ Kernel Selftests

Architecture Passed Failed Compared Against Status
x86_64 206 43 ciqlts9_6 ✅ No regressions
aarch64 155 44 ciqlts9_6 ✅ No regressions

✅ LTP Results

Architecture Passed Failed Compared Against Status
x86_64 1453 82 ciqlts9_6 ✅ No regressions
aarch64 1426 83 ciqlts9_6 ✅ No regressions

🤖 This PR was automatically generated by GitHub Actions
Run ID: 39664748730

@ciq-kernel-automation ciq-kernel-automation Bot added the created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI) label Oct 21, 2026
@github-actions

Copy link
Copy Markdown

🤖 Validation Checks In Progress Workflow run: https://github.com/ctrliq/kernel-src-tree/actions/runs/39695862842

@github-actions

Copy link
Copy Markdown

🔍 Diffofdiffs: 1 backport differs from upstream

View the diffofdiffs report.

Open to anyone signed in to GitHub. Report expires 2027-01-19 23:42 UTC.

# Subject Backport Upstream
1 x86/bugs: Make Safe-RET robust against interrupt injection b896930d0352 7e7f81cf6f5c

Checked PR revision b896930d0352 against base 1db6d00b0eae.

@github-actions

Copy link
Copy Markdown

JIRA PR Check Results

1 commit(s) with issues found:

Commit b896930d0352

Summary: x86/bugs: Make Safe-RET robust against interrupt injection

⚠️ Warnings:

  • VULN-196245: No time logged - please log time manually

Summary: Checked 1 commit(s) total.

@github-actions

Copy link
Copy Markdown

✅ Validation checks completed successfully View full results: https://github.com/ctrliq/kernel-src-tree/actions/runs/39695862842

@PlaidCat
PlaidCat requested a review from a team October 22, 2026 13:44
@bmastbergen

Copy link
Copy Markdown
Collaborator

JIRA PR Check Results

1 commit(s) with issues found:

Commit b896930d0352

Summary: x86/bugs: Make Safe-RET robust against interrupt injection

⚠️ Warnings:

  • VULN-196245: No time logged - please log time manually

Summary: Checked 1 commit(s) total.

Time logged.

Comment thread arch/x86/lib/retpoline.S Outdated
SYM_CODE_END(srso_alias_return_thunk)
.popsection

.pushsection .noinstr.text, "ax"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In upstream and linux-5.15.y this is wrapped in

#ifdef CONFIG_CPU_SRSO
<code>
#endif /* CONFIG_CPU_SRSO */

There are other sections of this commit wrapped in this ... was there a specific reason the ifdef was dropped here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block sits inside the pre-existing #ifdef CONFIG_MITIGATION_SRSO region that wraps the whole SRSO section (that is this trees equivalent to CONFIG_CPU_SRSO). in 5.15.y and 5.10.y that wasn't the case which is why it needed to be independently #ifdef'd.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't unroll enough to see that it was WAY up there

PlaidCat
PlaidCat previously approved these changes Oct 22, 2026

@PlaidCat PlaidCat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Comment thread arch/x86/lib/retpoline.S Outdated
SYM_CODE_END(srso_alias_return_thunk)
.popsection

.pushsection .noinstr.text, "ax"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't unroll enough to see that it was WAY up there

@PlaidCat
PlaidCat requested a review from a team October 22, 2026 15:22
@shreeya-patel98
shreeya-patel98 self-requested a review October 23, 2026 11:03

@shreeya-patel98 shreeya-patel98 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the upstream commit can be cherry-picked as is on 9.6. ciqlts9_6 has apply_relocation(), so the old ALTERNATIVE_2 can carry the inline __HANDLE_INTR_SAFERET() sequence.

The only thing that breaks is the build: upstream's new #include <asm/ptrace-abi.h> in nospec-branch.h makes RIP expand to 128 in .S files, and aesni-intel_asm.S still uses ONE(%RIP). Lowercasing those two operands fixes it:

--- a/arch/x86/crypto/aesni-intel_asm.S
+++ b/arch/x86/crypto/aesni-intel_asm.S
@@ -799 +799 @@
-       MOVADQ          ONE(%RIP),\TMP1
+       MOVADQ          ONE(%rip),\TMP1
@@ -871 +871 @@         
-       MOVADQ     ONE(%RIP),\TMP1
+       MOVADQ     ONE(%rip),\TMP1

Beyond that, only minor context conflicts in nospec-branch.h needed resolving. With these changes, vmlinux builds cleanly with objtool. Also register names are case-insensitive in gas, so this doesn't change the generated code.

@shreeya-patel98
shreeya-patel98 self-requested a review October 23, 2026 11:30
@bmastbergen
bmastbergen dismissed stale reviews from shreeya-patel98 and PlaidCat via c9b17d7 October 23, 2026 14:09
@bmastbergen
bmastbergen force-pushed the {bmastbergen_cves}_ciqlts9_6 branch from b896930 to c9b17d7 Compare October 23, 2026 14:09
@github-actions

Copy link
Copy Markdown

🤖 Validation Checks In Progress Workflow run: https://github.com/ctrliq/kernel-src-tree/actions/runs/39968508220

@github-actions

Copy link
Copy Markdown

🔍 Diffofdiffs: 1 backport differs from upstream

View the diffofdiffs report.

Open to anyone signed in to GitHub. Report expires 2027-01-21 14:09 UTC.

# Subject Backport Upstream
1 x86/bugs: Make Safe-RET robust against interrupt injection c9b17d7ba743 7e7f81cf6f5c

Checked PR revision c9b17d7ba743 against base 1db6d00b0eae.

@github-actions

Copy link
Copy Markdown

✅ Validation checks completed successfully View full results: https://github.com/ctrliq/kernel-src-tree/actions/runs/39968508220

jira VULN-196245
cve CVE-2026-68480
commit-author Borislav Petkov (AMD) <bp@alien8.de>
commit 7e7f81c
upstream-diff Two adjustments: (1) __HANDLE_INTR_SAFERET() is inserted
              before this tree's #ifdef __ASSEMBLY__ boundary where
              upstream adds it before its #ifdef __ASSEMBLER__
              boundary - the same shared macro zone, so only the
              surrounding context differs; (2) upstream's new
              <asm/ptrace-abi.h> include in nospec-branch.h defines
              RIP as 128, which the preprocessor substitutes into the
              two uppercase ONE(%RIP) operands in
              arch/x86/crypto/aesni-intel_asm.S (lines 799 and 871,
              the only uppercase register-name operands in any .S
              file), so those are lowercased to ONE(%rip); register
              names are case-insensitive in gas and the assembled
              objects are byte-identical.

An attacker injecting interrupts while the Safe-RET mitigation executes
on machines affected by SRSO can neutralize the safe return sequence,
potentially leading to data leakage through speculative execution.

Fixup register state as if the Safe-RET sequence executed successfully
by "emulating" it, in a manner of speaking, and avoid executing a RET
instruction after returning from the interrupt.

Co-developed-by: David Kaplan <David.Kaplan@amd.com>
	Signed-off-by: David Kaplan <David.Kaplan@amd.com>
	Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
(cherry picked from commit 7e7f81c)
	Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>
@bmastbergen
bmastbergen force-pushed the {bmastbergen_cves}_ciqlts9_6 branch from c9b17d7 to b97b40e Compare October 23, 2026 14:26
@bmastbergen

Copy link
Copy Markdown
Collaborator

I think the upstream commit can be cherry-picked as is on 9.6. ciqlts9_6 has apply_relocation(), so the old ALTERNATIVE_2 can carry the inline __HANDLE_INTR_SAFERET() sequence.

The only thing that breaks is the build: upstream's new #include <asm/ptrace-abi.h> in nospec-branch.h makes RIP expand to 128 in .S files, and aesni-intel_asm.S still uses ONE(%RIP). Lowercasing those two operands fixes it:

--- a/arch/x86/crypto/aesni-intel_asm.S
+++ b/arch/x86/crypto/aesni-intel_asm.S
@@ -799 +799 @@
-       MOVADQ          ONE(%RIP),\TMP1
+       MOVADQ          ONE(%rip),\TMP1
@@ -871 +871 @@         
-       MOVADQ     ONE(%RIP),\TMP1
+       MOVADQ     ONE(%rip),\TMP1

Beyond that, only minor context conflicts in nospec-branch.h needed resolving. With these changes, vmlinux builds cleanly with objtool. Also register names are case-insensitive in gas, so this doesn't change the generated code.

You are right. I think when it didn't apply I instantly went down the 5.15/5.10 route which kinda led me down this hybrid path. I've pushed something closer to upstream. See what you think.

@github-actions

Copy link
Copy Markdown

🤖 Validation Checks In Progress Workflow run: https://github.com/ctrliq/kernel-src-tree/actions/runs/39970743678

@github-actions

Copy link
Copy Markdown

🔍 Diffofdiffs: 1 backport differs from upstream

View the diffofdiffs report.

Open to anyone signed in to GitHub. Report expires 2027-01-21 14:26 UTC.

# Subject Backport Upstream
1 x86/bugs: Make Safe-RET robust against interrupt injection b97b40ebe1fd 7e7f81cf6f5c

Checked PR revision b97b40ebe1fd against base 1db6d00b0eae.

@github-actions

Copy link
Copy Markdown

✅ Validation checks completed successfully View full results: https://github.com/ctrliq/kernel-src-tree/actions/runs/39970743678

@bmastbergen
bmastbergen requested a review from PlaidCat October 23, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI)

Development

Successfully merging this pull request may close these issues.

3 participants