mirror-linux/arch
Ada Couprie Diaz 43e2ae77fc arm64: debug: split hardware breakpoint exception entry
Currently all debug exceptions share common entry code and are routed
to `do_debug_exception()`, which calls dynamically-registered
handlers for each specific debug exception. This is unfortunate as
different debug exceptions have different entry handling requirements,
and it would be better to handle these distinct requirements earlier.

Hardware breakpoints exceptions are generated by the hardware after user
configuration. As such, they can be exploited when training branch
predictors outside of the userspace VA range: they still need to call
`arm64_apply_bp_hardening()` if needed to mitigate against this attack.

However, they do not need to handle the Cortex-A76 erratum #1463225 as
it only applies to single stepping exceptions.
It does not set an address in FAR_EL1 either, only the hardware
watchpoint does.

As the hardware breakpoint handler only returns 0 and never triggers
the call to `arm64_notify_die()`, we can call it directly from
`entry-common.c`.
Split the hardware breakpoint exception entry, adjust
the function signature, and handling of the Cortex-A76 erratum to fit
the behaviour of the exception.

Move the call to `arm64_apply_bp_hardening()` to `entry-common.c` so that
we can do it as early as possible, and only for the exceptions coming
from EL0, where it is needed.
This is safe to do as it is `noinstr`, as are all the functions it
may call. `el0_ia()` and `el0_pc()` already call it this way.

Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Reviewed-by: Will Deacon <will@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20250707114109.35672-8-ada.coupriediaz@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
2025-07-08 13:27:41 +01:00
..
alpha treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
arc Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
arm Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
arm64 arm64: debug: split hardware breakpoint exception entry 2025-07-08 13:27:41 +01:00
csky Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
hexagon Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
loongarch Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
m68k Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
microblaze Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
mips Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
nios2 Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
openrisc Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
parisc Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
powerpc treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
riscv Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
s390 Kbuild updates for v6.16 2025-06-07 10:05:35 -07:00
sh treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
sparc treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
um treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
x86 The delayed from_timer() API cleanup: 2025-06-08 11:33:00 -07:00
xtensa treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
.gitignore
Kconfig fs/resctrl: Add boiler plate for external resctrl code 2025-05-16 11:05:40 +02:00