mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-22 11:37:45 +07: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>
This commit is contained in:
parent
764b51ead1
commit
9b0aa14e31
@ -154,5 +154,6 @@ int set_memory_ro(unsigned long addr, int numpages);
|
|||||||
int set_memory_rw(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_x(unsigned long addr, int numpages);
|
||||||
int set_memory_nx(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
|
#endif
|
||||||
|
@ -125,20 +125,23 @@ int set_memory_x(unsigned long addr, int numpages)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(set_memory_x);
|
EXPORT_SYMBOL_GPL(set_memory_x);
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_PAGEALLOC
|
int set_memory_valid(unsigned long addr, int numpages, int enable)
|
||||||
void __kernel_map_pages(struct page *page, int numpages, int enable)
|
|
||||||
{
|
{
|
||||||
unsigned long addr = (unsigned long) page_address(page);
|
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
__change_memory_common(addr, PAGE_SIZE * numpages,
|
return __change_memory_common(addr, PAGE_SIZE * numpages,
|
||||||
__pgprot(PTE_VALID),
|
__pgprot(PTE_VALID),
|
||||||
__pgprot(0));
|
__pgprot(0));
|
||||||
else
|
else
|
||||||
__change_memory_common(addr, PAGE_SIZE * numpages,
|
return __change_memory_common(addr, PAGE_SIZE * numpages,
|
||||||
__pgprot(0),
|
__pgprot(0),
|
||||||
__pgprot(PTE_VALID));
|
__pgprot(PTE_VALID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_PAGEALLOC
|
||||||
|
void __kernel_map_pages(struct page *page, int numpages, int enable)
|
||||||
|
{
|
||||||
|
set_memory_valid((unsigned long)page_address(page), numpages, enable);
|
||||||
|
}
|
||||||
#ifdef CONFIG_HIBERNATION
|
#ifdef CONFIG_HIBERNATION
|
||||||
/*
|
/*
|
||||||
* When built with CONFIG_DEBUG_PAGEALLOC and CONFIG_HIBERNATION, this function
|
* When built with CONFIG_DEBUG_PAGEALLOC and CONFIG_HIBERNATION, this function
|
||||||
|
Loading…
Reference in New Issue
Block a user