Clear all L2 PTE protection bits before their configuration.
Revise L2_S_PROT_MASK to include all of the protection bits. Notice that clearing these bits does not always take away the corresponding permissions (for example, permission is granted when the bit is cleared). The bits are cleared but are to be set or left cleared accordingly in pmap_set_prot(), pmap_enter_locked(), etc. Clear L2_XN along with L2_S_PROT_MASK in pmap_set_prot() so that all permissions related bits are cleared before actual configuration. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Reviewed by: gber Sponsored by: The FreeBSD Foundation, Semihalf
This commit is contained in:
parent
38347b87b7
commit
f8dbb37330
@ -1046,7 +1046,7 @@ static void
|
||||
pmap_set_prot(pt_entry_t *ptep, vm_prot_t prot, uint8_t user)
|
||||
{
|
||||
|
||||
*ptep &= ~L2_S_PROT_MASK;
|
||||
*ptep &= ~(L2_S_PROT_MASK | L2_XN);
|
||||
|
||||
if (!(prot & VM_PROT_EXECUTE))
|
||||
*ptep |= L2_XN;
|
||||
|
@ -390,7 +390,7 @@ extern int pmap_needs_pte_sync;
|
||||
#define L2_S_PROT_U (L2_AP0(2)) /* user read */
|
||||
#define L2_S_REF (L2_AP0(1)) /* reference flag */
|
||||
|
||||
#define L2_S_PROT_MASK (L2_S_PROT_U|L2_S_PROT_R)
|
||||
#define L2_S_PROT_MASK (L2_S_PROT_U|L2_S_PROT_R|L2_APX)
|
||||
#define L2_S_EXECUTABLE(pte) (!(pte & L2_XN))
|
||||
#define L2_S_WRITABLE(pte) (!(pte & L2_APX))
|
||||
#define L2_S_REFERENCED(pte) (!!(pte & L2_S_REF))
|
||||
|
Loading…
x
Reference in New Issue
Block a user