Commit 6f81bcc2 authored by Russell King's avatar Russell King Committed by Zheng Zengkai
Browse files

ARM: kexec: fix oops after TLB are invalidated



stable inclusion
from stable-5.10.17
commit 249735b011234a65a720952d5451156be8baa50f
bugzilla: 48169

--------------------------------

[ Upstream commit 4d62e81b ]

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: default avatarGiancarlo Ferrari <giancarlo.ferrari89@gmail.com>
Tested-by: default avatarGiancarlo Ferrari <giancarlo.ferrari89@gmail.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent 0e89820f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment