arm64: add support for VMAP_STACK

This patch enables VMAP_STACK support for arm64, with corresponding
overflow handling. This is intended to behave somewhat like the x86
double-fault handler, in that we detect when we cannot safely take an
exception due to insufficient stack space for the registers. However, we
also catch cases where the SP is out of expected bounds for the current
stack.

Note that this catches the case where we cannot enter the exception,
rather than all cases which are nominally stack overflows. Some of these
cases are left to the usual fault handling paths (which should treat
these bad accesses fatally).

For example, if we have 400 bytes of stack space available, and try to
execute a store with an out-of-bounds pre-index decrement of the stack
pointer:

	STP XZR, XZR, [SP, #-512]!

... the target address will be within the guard page below the stack,
and the access will trigger a data abort. As the instruction wasn't
retired, the SP is not decremented, and the exception handler has 400
bytes of stack space available. This is (currently) sufficient to store
the exception context to the stack, so we can safely enter the
exception. Ths bad access is then handled by the usual fault handling
routines.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
3 files changed