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:
Rafal Jaworowski 2013-08-19 15:12:36 +00:00
parent 06b6590c4a
commit 30f7f10e66
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254532
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -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))