mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
arm64: mm: add set_memory_valid()
This function validates and invalidates PTE entries, and will be utilized
in kdump to protect loaded crash dump kernel image.
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>
Conflicts:
arch/arm64/mm/pageattr.c
due to missing commit 83863f25e4 ("arm64: Add support for
ARCH_SUPPORTS_DEBUG_PAGEALLOC")
This commit is contained in:
@@ -155,5 +155,6 @@ int set_memory_ro(unsigned long addr, int numpages);
|
||||
int set_memory_rw(unsigned long addr, int numpages);
|
||||
int set_memory_x(unsigned long addr, int numpages);
|
||||
int set_memory_nx(unsigned long addr, int numpages);
|
||||
int set_memory_valid(unsigned long addr, unsigned long size, int enable);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -125,6 +125,19 @@ int set_memory_x(unsigned long addr, int numpages)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(set_memory_x);
|
||||
|
||||
|
||||
int set_memory_valid(unsigned long addr, int numpages, int enable)
|
||||
{
|
||||
if (enable)
|
||||
return __change_memory_common(addr, PAGE_SIZE * numpages,
|
||||
__pgprot(PTE_VALID),
|
||||
__pgprot(0));
|
||||
else
|
||||
return __change_memory_common(addr, PAGE_SIZE * numpages,
|
||||
__pgprot(0),
|
||||
__pgprot(PTE_VALID));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_PAGEALLOC
|
||||
void __kernel_map_pages(struct page *page, int numpages, int enable)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user