ARM: BUG if jumping to usermode address in kernel mode
authorRussell King <rmk+kernel@armlinux.org.uk>
Fri, 24 Nov 2017 23:49:34 +0000 (23:49 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Dec 2017 08:53:05 +0000 (09:53 +0100)
commit21e1e6192ba653dfcc42bb0b275a4af7af5e32b0
tree316e6a851c13f93257a250f551e71e7fc66911af
parent077415efefe77f6f3e82ae4868867e32ede01286
ARM: BUG if jumping to usermode address in kernel mode

commit 8bafae202c82dc257f649ea3c275a0f35ee15113 upstream.

Detect if we are returning to usermode via the normal kernel exit paths
but the saved PSR value indicates that we are in kernel mode.  This
could occur due to corrupted stack state, which has been observed with
"ftracetest".

This ensures that we catch the problem case before we get to user code.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Alex Shi <alex.shi@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/include/asm/assembler.h
arch/arm/kernel/entry-header.S