mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
powerpc: Implement set_memory_rox()
Same as x86 and s390, add set_memory_rox() to avoid doing one pass with set_memory_ro() and a second pass with set_memory_x(). See commit60463628c9
("x86/mm: Implement native set_memory_rox()") and commit22e99fa564
("s390/mm: implement set_memory_rox()") for more information. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/dc9a794f82ab62572d7d0be5cb4b8b27920a4f78.1708078316.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
d5835fb60b
commit
09ca1b1171
@ -8,6 +8,7 @@
|
||||
#define SET_MEMORY_X 3
|
||||
#define SET_MEMORY_NP 4 /* Set memory non present */
|
||||
#define SET_MEMORY_P 5 /* Set memory present */
|
||||
#define SET_MEMORY_ROX 6
|
||||
|
||||
int change_memory_attr(unsigned long addr, int numpages, long action);
|
||||
|
||||
@ -41,4 +42,10 @@ static inline int set_memory_p(unsigned long addr, int numpages)
|
||||
return change_memory_attr(addr, numpages, SET_MEMORY_P);
|
||||
}
|
||||
|
||||
static inline int set_memory_rox(unsigned long addr, int numpages)
|
||||
{
|
||||
return change_memory_attr(addr, numpages, SET_MEMORY_ROX);
|
||||
}
|
||||
#define set_memory_rox set_memory_rox
|
||||
|
||||
#endif
|
||||
|
@ -38,6 +38,10 @@ static int change_page_attr(pte_t *ptep, unsigned long addr, void *data)
|
||||
/* Don't clear DIRTY bit */
|
||||
pte_update_delta(ptep, addr, _PAGE_KERNEL_RW & ~_PAGE_DIRTY, _PAGE_KERNEL_RO);
|
||||
break;
|
||||
case SET_MEMORY_ROX:
|
||||
/* Don't clear DIRTY bit */
|
||||
pte_update_delta(ptep, addr, _PAGE_KERNEL_RW & ~_PAGE_DIRTY, _PAGE_KERNEL_ROX);
|
||||
break;
|
||||
case SET_MEMORY_RW:
|
||||
pte_update_delta(ptep, addr, _PAGE_KERNEL_RO, _PAGE_KERNEL_RW);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user