mbox series

[0/2] arm64: fix+cleanup for ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD

Message ID 20240116110221.420467-1-mark.rutland@arm.com (mailing list archive)
Headers show
Series arm64: fix+cleanup for ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD | expand

Message

Mark Rutland Jan. 16, 2024, 11:02 a.m. UTC
Hi,

While testing an unrelated patch on the arm64 for-next/core branch, I
spotted an issue in the ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD
workaround. The first patch fixes that issue, and the second patch
cleans up the remaining logic.

The issue has existed since the workaround was introduced in commit:

  471470bc7052d28c ("arm64: errata: Add Cortex-A520 speculative unprivileged load workaround")

As that logic has recently been reworked in the arm64 for-next/core
branch, these patches are based atop that rework, specifically atop
commit:

  546b7cde9b1dd360 ("arm64: Rename ARM64_WORKAROUND_2966298")

As the patches alter the KPTI exception return logic, I've given this
testing with KPTI forced on, forced off, and disabled at build time,
which all appear to be fine. I don't have any hardware requiring the
ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD workaround, but as the
resulting logic for this is very simple I do not expect any issues with
that part of the logic.

Mark.

Mark Rutland (2):
  arm64: entry: fix ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD
  arm64: entry: simplify kernel_exit logic

 arch/arm64/kernel/entry.S | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

Comments

Will Deacon Jan. 18, 2024, 12:02 p.m. UTC | #1
On Tue, 16 Jan 2024 11:02:19 +0000, Mark Rutland wrote:
> While testing an unrelated patch on the arm64 for-next/core branch, I
> spotted an issue in the ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD
> workaround. The first patch fixes that issue, and the second patch
> cleans up the remaining logic.
> 
> The issue has existed since the workaround was introduced in commit:
> 
> [...]

Cheers, I picked these up, but you might need to shepherd them
through -stable, so please keep an eye out for any "failed to apply"
mails.

Talking of which, the original workaround didn't make it to any kernels
before 6.1:

[5.15] https://lore.kernel.org/r/2023100743-evasion-figment-fbcc@gregkh
[5.10] https://lore.kernel.org/r/2023100745-statute-component-dd0f@gregkh

Please can you or Rob have a crack at that?

[1/2] arm64: entry: fix ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD
      https://git.kernel.org/arm64/c/832dd634bd1b
[2/2] arm64: entry: simplify kernel_exit logic
      https://git.kernel.org/arm64/c/da59f1d051d5

Cheers,
Mark Rutland Jan. 19, 2024, 10:32 a.m. UTC | #2
On Thu, Jan 18, 2024 at 12:02:26PM +0000, Will Deacon wrote:
> On Tue, 16 Jan 2024 11:02:19 +0000, Mark Rutland wrote:
> > While testing an unrelated patch on the arm64 for-next/core branch, I
> > spotted an issue in the ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD
> > workaround. The first patch fixes that issue, and the second patch
> > cleans up the remaining logic.
> > 
> > The issue has existed since the workaround was introduced in commit:
> > 
> > [...]
> 
> Cheers, I picked these up, but you might need to shepherd them
> through -stable, so please keep an eye out for any "failed to apply"
> mails.
> 
> Talking of which, the original workaround didn't make it to any kernels
> before 6.1:
> 
> [5.15] https://lore.kernel.org/r/2023100743-evasion-figment-fbcc@gregkh
> [5.10] https://lore.kernel.org/r/2023100745-statute-component-dd0f@gregkh

From a quick look, these failed because we forgot to backport some prior errata
workarounds (which are still missing from stable), and backported others
out-of-order relative to mainline, so every subsequent backport is likely to
hit a massive text conflict in the diff.

I'll have a go at backorting the missing pieces in-order to get this closer to
mainline. I suspect that'll take a short while...

Going forwards, we should check that errata patches are CC'd to stable
appropriately when we merge them in the arm64 tree, and we should make sure
those are successfully backported in-order.

Mark.

> 
> Please can you or Rob have a crack at that?
> 
> [1/2] arm64: entry: fix ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD
>       https://git.kernel.org/arm64/c/832dd634bd1b
> [2/2] arm64: entry: simplify kernel_exit logic
>       https://git.kernel.org/arm64/c/da59f1d051d5
> 
> Cheers,
> -- 
> Will
> 
> https://fixes.arm64.dev
> https://next.arm64.dev
> https://will.arm64.dev