]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: kexec: fix oops after TLB are invalidated
authorRussell King <rmk+kernel@armlinux.org.uk>
Mon, 1 Feb 2021 19:40:01 +0000 (19:40 +0000)
committerRussell King <rmk+kernel@armlinux.org.uk>
Fri, 5 Feb 2021 10:23:29 +0000 (10:23 +0000)
commita1ef25b4cabdd0ce5b836a22c347d243024472de
tree2254e87cef4bea58743d06f4a835384e1faf42d2
parent71cbd2bdf9e0c456e8cf4f4c84cc4e24c67a086a
ARM: kexec: fix oops after TLB are invalidated

Giancarlo Ferrari reports the following oops while trying to use kexec:

 Unable to handle kernel paging request at virtual address 80112f38
 pgd = fd7ef03e
 [80112f38] *pgd=0001141e(bad)
 Internal error: Oops: 80d [#1] PREEMPT SMP ARM
 ...

This is caused by machine_kexec() trying to set the kernel text to be
read/write, so it can poke values into the relocation code before
copying it - and an interrupt occuring which changes the page tables.
The subsequent writes then hit read-only sections that trigger a
data abort resulting in the above oops.

Fix this by copying the relocation code, and then writing the variables
into the destination, thereby avoiding the need to make the kernel text
read/write.

Reported-by: Giancarlo Ferrari <giancarlo.ferrari89@gmail.com>
Tested-by: Giancarlo Ferrari <giancarlo.ferrari89@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/include/asm/kexec-internal.h [new file with mode: 0644]
arch/arm/kernel/asm-offsets.c
arch/arm/kernel/machine_kexec.c
arch/arm/kernel/relocate_kernel.S