anolis: arm64: hookers: flush proper tlb range
OpenAnolis Bug Tracker: 0000546 We should flush PMD_SIZE range of tlb if we change prot of a huge pmd. Signed-off-by: Xu Yu <xuyu@linux.alibaba.com> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Signed-off-by: Xunlei Pang <xlpang@linux.alibaba.com>
This commit is contained in:
parent
8422570b0b
commit
ddd120fc9c
|
@ -299,14 +299,14 @@ static int remove_memprotect(unsigned long addr)
|
|||
// remove the pmd wirte protect attr if huge page
|
||||
if (pmd_huge(pmdd)) {
|
||||
set_pmd(pmd, __pmd(pmd_val(pmdd) & ~PMD_SECT_RDONLY));
|
||||
flush_tlb_kernel_range(addr_aligned, addr_aligned + PMD_SIZE);
|
||||
} else {
|
||||
pte = pte_offset_kernel(pmd, addr);
|
||||
pted = pte_mkwrite(*pte);
|
||||
set_pte(pte, pted);
|
||||
flush_tlb_kernel_range(addr_aligned, addr_aligned + PAGE_SIZE);
|
||||
}
|
||||
|
||||
flush_tlb_kernel_range(addr_aligned, addr_aligned + PAGE_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -333,14 +333,14 @@ static int set_memprotect(unsigned long addr)
|
|||
|
||||
if (pmd_huge(pmdd)) {
|
||||
set_pmd(pmd, __pmd(pmd_val(pmdd) | PMD_SECT_RDONLY));
|
||||
flush_tlb_kernel_range(addr_aligned, addr_aligned + PMD_SIZE);
|
||||
} else {
|
||||
pte = pte_offset_kernel(pmd, addr);
|
||||
pted = pte_wrprotect(*pte);
|
||||
set_pte(pte, pted);
|
||||
flush_tlb_kernel_range(addr_aligned, addr_aligned + PAGE_SIZE);
|
||||
}
|
||||
|
||||
flush_tlb_kernel_range(addr_aligned, addr_aligned + PAGE_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue