All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Ensure stack is aligned for kernel entries
@ 2018-09-26 13:56 Julien Thierry
  2018-09-26 13:56 ` [PATCH 1/7] arm64: Add static check for pt_regs alignment Julien Thierry
                   ` (10 more replies)
  0 siblings, 11 replies; 50+ messages in thread
From: Julien Thierry @ 2018-09-26 13:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Having SCTLR_ELx.SA enabled requires the SP to be 16-bytes aligned before
using it to access memory. When taking an exception, it is possible that
the context during which the exception occured had SP mis-aligned. The
entry code needs to make sure that the stack is aligned before using it to
save the context.

This is only a concern when taking exception from an EL using the same
SP_ELx as the handler. In other cases it can be assumed that the SP being
picked up on exception entry is aligned under the condition that SP is
always aligned when doing eret to an EL using a different SP.

On Juno I see a runtime difference <1% for hackbench. If I do not include
the fast path@EL1 (patch 4) I see a diff of 1-2%.

For EL2 entries, a bit of clean up of stuff getting patched in the vector
has been needed.

Cheers,

Julien

-->

Julien Thierry (7):
  arm64: Add static check for pt_regs alignment
  arm64: sdei: Always use sdei stack for sdei events
  arm64: Align stack when taking exception from EL1
  arm64: Add fast-path for stack alignment
  arm64: Do not apply BP hardening for hyp entries from EL2
  arm64: Do not apply vector harderning for hyp entries from EL2
  arm64: kvm: Align stack for exception coming from EL2

 arch/arm64/include/asm/assembler.h |  9 +++++
 arch/arm64/include/asm/ptrace.h    |  2 +
 arch/arm64/include/asm/sdei.h      |  2 -
 arch/arm64/kernel/cpu_errata.c     | 10 ++++-
 arch/arm64/kernel/entry.S          | 43 +++++++++++++++++++--
 arch/arm64/kernel/sdei.c           | 23 ++++-------
 arch/arm64/kvm/hyp/hyp-entry.S     | 78 +++++++++++++++++++++++++++++++-------
 drivers/firmware/Kconfig           |  1 +
 8 files changed, 132 insertions(+), 36 deletions(-)

--
1.9.1

^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2018-11-22 15:12 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26 13:56 [PATCH 0/7] Ensure stack is aligned for kernel entries Julien Thierry
2018-09-26 13:56 ` [PATCH 1/7] arm64: Add static check for pt_regs alignment Julien Thierry
2018-11-07 21:58   ` Will Deacon
2018-11-08 10:16     ` Mark Rutland
2018-11-08 11:57       ` Julien Thierry
2018-11-08 16:53         ` Will Deacon
2018-11-08 18:35   ` Ard Biesheuvel
2018-09-26 13:56 ` [PATCH 2/7] arm64: sdei: Always use sdei stack for sdei events Julien Thierry
2018-11-07 21:58   ` Will Deacon
2018-11-21 11:15     ` James Morse
2018-09-26 13:56 ` [PATCH 3/7] arm64: Align stack when taking exception from EL1 Julien Thierry
2018-11-07 21:59   ` Will Deacon
2018-11-08 12:20     ` Julien Thierry
2018-09-26 13:56 ` [PATCH 4/7] arm64: Add fast-path for stack alignment Julien Thierry
2018-11-07 21:59   ` Will Deacon
2018-11-08 12:21     ` Julien Thierry
2018-09-26 13:56 ` [PATCH 5/7] arm64: Do not apply BP hardening for hyp entries from EL2 Julien Thierry
2018-09-26 13:56   ` Julien Thierry
2018-11-07 21:59   ` Will Deacon
2018-11-07 21:59     ` Will Deacon
2018-11-08 12:23     ` Julien Thierry
2018-11-08 12:23       ` Julien Thierry
2018-09-26 13:56 ` [PATCH 6/7] arm64: Do not apply vector harderning " Julien Thierry
2018-09-26 13:56   ` Julien Thierry
2018-11-07 21:59   ` Will Deacon
2018-11-07 21:59     ` Will Deacon
2018-11-08 12:31     ` Julien Thierry
2018-11-08 12:31       ` Julien Thierry
2018-09-26 13:56 ` [PATCH 7/7] arm64: kvm: Align stack for exception coming " Julien Thierry
2018-09-26 13:56   ` Julien Thierry
2018-10-19  8:07 ` [PATCH 0/7] Ensure stack is aligned for kernel entries Julien Thierry
2018-11-07 21:58 ` Will Deacon
2018-11-08 12:43   ` Julien Thierry
2018-11-08 13:04 ` Ard Biesheuvel
2018-11-08 13:27   ` Julien Thierry
2018-11-08 14:10     ` Ard Biesheuvel
2018-11-08 14:19       ` Ramana Radhakrishnan
2018-11-08 15:01         ` Julien Thierry
2018-11-08 15:33           ` Ramana Radhakrishnan
2018-11-08 15:41             ` Julien Thierry
2018-11-08 15:30         ` Dave Martin
2018-11-08 15:33           ` Ramana Radhakrishnan
2018-11-08 15:39             ` Dave Martin
2018-11-08 15:44               ` Ard Biesheuvel
2018-11-08 16:57                 ` Ramana Radhakrishnan
2018-11-08 17:14                   ` Ard Biesheuvel
2018-11-22 11:49 ` Julien Thierry
2018-11-22 12:11   ` Ard Biesheuvel
2018-11-22 15:10     ` Julien Thierry
2018-11-22 15:12     ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.