OSDN Git Service

arm64: kdump: protect crash dump kernel memory
authorTakahiro Akashi <takahiro.akashi@linaro.org>
Mon, 3 Apr 2017 02:24:34 +0000 (11:24 +0900)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 5 Apr 2017 17:28:35 +0000 (18:28 +0100)
commit98d2e1539b84abddce4b3c2ca8733f6aeacdee47
treeb807b678cd2092db641a00296c5e740d87861dd9
parent9b0aa14e31555b64460c1ee323d0e19bf891958b
arm64: kdump: protect crash dump kernel memory

arch_kexec_protect_crashkres() and arch_kexec_unprotect_crashkres()
are meant to be called by kexec_load() in order to protect the memory
allocated for crash dump kernel once the image is loaded.

The protection is implemented by unmapping the relevant segments in crash
dump kernel memory, rather than making it read-only as other archs do,
to prevent coherency issues due to potential cache aliasing (with
mismatched attributes).

Page-level mappings are consistently used here so that we can change
the attributes of segments in page granularity as well as shrink the region
also in page granularity through /sys/kernel/kexec_crash_size, putting
the freed memory back to buddy system.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/machine_kexec.c
arch/arm64/mm/mmu.c