diff options
author | Jonathan Austin <jonathan.austin@arm.com> | 2013-04-18 18:37:24 +0100 |
---|---|---|
committer | Jonathan Austin <jonathan.austin@arm.com> | 2013-06-17 15:13:18 +0100 |
commit | 9dfc28b6308096e48b54c28259825a1200f60742 (patch) | |
tree | 44e8b6cbe0935b20767bc79099780244d4c6722e /arch/arm/kernel/elf.c | |
parent | 801bb21c600161c8626d7d9cb649be869ee4dbbe (diff) |
ARM: mpu: protect the vectors page with an MPU region
Without an MMU it is possible for userspace programs to start executing code
in places that they have no business executing. The MPU allows some level of
protection against this.
This patch protects the vectors page from access by userspace processes.
Userspace tasks that dereference a null pointer are already protected by an
svc at 0x0 that kills them. However when tasks use an offset from a null
pointer (eg a function in a null struct) they miss this carefully placed svc
and enter the exception vectors in user mode, ending up in the kernel.
This patch causes programs that do this to receive a SEGV instead of happily
entering the kernel in user-mode, and hence avoid a 'Bad Mode' panic.
As part of this change it is necessary to make sigreturn happen via the
stack when there is not an sa_restorer function. This change is invisible to
userspace, and irrelevant to code compiled using a uClibc toolchain, which
always uses an sa_restorer function.
Because we don't get to remap the vectors in !MMU kuser_helpers are not
in a defined location, and hence aren't usable. This means we don't need to
worry about keeping them accessible from PL0
Signed-off-by: Jonathan Austin <jonathan.austin@arm.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
CC: Nicolas Pitre <nico@linaro.org>
CC: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm/kernel/elf.c')
0 files changed, 0 insertions, 0 deletions