android_kernel_oneplus_msm8998/arch
Mark Rutland 8323d0555f arm64: avoid returning from bad_mode
commit 7d9e8f71b989230bc613d121ca38507d34ada849 upstream.

Generally, taking an unexpected exception should be a fatal event, and
bad_mode is intended to cater for this. However, it should be possible
to contain unexpected synchronous exceptions from EL0 without bringing
the kernel down, by sending a SIGILL to the task.

We tried to apply this approach in commit 9955ac47f4 ("arm64:
don't kill the kernel on a bad esr from el0"), by sending a signal for
any bad_mode call resulting from an EL0 exception.

However, this also applies to other unexpected exceptions, such as
SError and FIQ. The entry paths for these exceptions branch to bad_mode
without configuring the link register, and have no kernel_exit. Thus, if
we take one of these exceptions from EL0, bad_mode will eventually
return to the original user link register value.

This patch fixes this by introducing a new bad_el0_sync handler to cater
for the recoverable case, and restoring bad_mode to its original state,
whereby it calls panic() and never returns. The recoverable case
branches to bad_el0_sync with a bl, and returns to userspace via the
usual ret_to_user mechanism.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Fixes: 9955ac47f4 ("arm64: don't kill the kernel on a bad esr from el0")
Reported-by: Mark Salter <msalter@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-26 08:23:50 +01:00
..
alpha alpha: fix copy_from_user() 2016-09-24 10:07:45 +02:00
arc ARC: mm: arc700: Don't assume 2 colours for aliasing VIPT dcache 2017-01-09 08:07:48 +01:00
arm ARM: 8613/1: Fix the uaccess crash on PB11MPCore 2017-01-26 08:23:49 +01:00
arm64 arm64: avoid returning from bad_mode 2017-01-26 08:23:50 +01:00
avr32 avr32: off by one in at32_init_pio() 2016-10-07 15:23:45 +02:00
blackfin net: smc91x: fix SMC accesses 2016-09-30 10:18:37 +02:00
c6x
cris cris: Only build flash rescue image if CONFIG_ETRAX_AXISFLASHMAP is selected 2017-01-12 11:22:48 +01:00
frv frv: fix clear_user() 2016-09-24 10:07:44 +02:00
h8300 h8300: fix syscall restarting 2016-11-10 16:36:32 +01:00
hexagon hexagon: fix strncpy_from_user() error return 2016-09-24 10:07:44 +02:00
ia64 ia64: copy_from_user() should zero the destination on access_ok() failure 2016-09-24 10:07:46 +02:00
m32r m32r: fix __get_user() 2016-09-24 10:07:43 +02:00
m68k m68k: Fix ndelay() macro 2016-12-15 08:49:23 -08:00
metag metag: Only define atomic_dec_if_positive conditionally 2016-10-28 03:01:31 -04:00
microblaze microblaze: fix copy_from_user() 2016-09-24 10:07:43 +02:00
mips KVM: MIPS: Flush KVM entry code from icache globally 2017-01-12 11:22:43 +01:00
mn10300 mn10300: copy_from_user() should zero on access_ok() failure... 2016-09-24 10:07:45 +02:00
nios2 nios2: copy_from_user() should zero the tail of destination 2016-09-24 10:07:45 +02:00
openrisc openrisc: fix the fix of copy_from_user() 2016-09-24 10:07:46 +02:00
parisc parisc: Fix TLB related boot crash on SMP machines 2016-12-15 08:49:22 -08:00
powerpc powerpc/ibmebus: Fix device reference leaks in sysfs interface 2017-01-19 20:17:22 +01:00
s390 s390/crypto: unlock on error in prng_tdes_read() 2017-01-12 11:22:49 +01:00
score score: fix copy_from_user() and friends 2016-09-24 10:07:44 +02:00
sh sh: fix copy_from_user() 2016-09-24 10:07:44 +02:00
sparc sparc64: fix compile warning section mismatch in find_node() 2016-12-10 19:07:25 +01:00
tile tile: avoid using clocksource_cyc2ns with absolute cycle count 2016-12-02 09:09:01 +01:00
um um: Don't discard .text.exit section 2016-09-07 08:32:38 +02:00
unicore32 pwm: Changes for v4.4-rc1 2015-11-11 09:16:10 -08:00
x86 x86/ioapic: Restore IO-APIC irq_chip retrigger callback 2017-01-26 08:23:48 +01:00
xtensa xtensa: clear all DBREAKC registers on start 2016-04-12 09:08:55 -07:00
.gitignore
Kconfig