History

arm64: mm: fix p?d_leaf()

The pmd_leaf() is used to test a leaf mapped PMD, however, it misses the PROT_NONE mapped PMD on arm64. Fix it. A real world issue [1] caused by this was reported by Qian Cai. Also fix pud_leaf().

Muchun Song committed 4 years ago

Commit 23bc8f61 parent 0ff74a21 file · +2 −2Browse files

Unified · Split

arch/arm64/include/asm/pgtable.h+2−2
@@ -535,7 +535,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, · 534 unmodified lines
535 PMD_TYPE_TABLE)535 PMD_TYPE_TABLE)
536#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \536#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \
537 PMD_TYPE_SECT)537 PMD_TYPE_SECT)
538#define pmd_leaf(pmd) pmd_sect(pmd)538#define pmd_leaf(pmd) (pmd_present(pmd) && !pmd_table(pmd))
539#define pmd_bad(pmd) (!pmd_table(pmd))539#define pmd_bad(pmd) (!pmd_table(pmd))
540 540
541#define pmd_leaf_size(pmd) (pmd_cont(pmd) ? CONT_PMD_SIZE : PMD_SIZE)541#define pmd_leaf_size(pmd) (pmd_cont(pmd) ? CONT_PMD_SIZE : PMD_SIZE)
@@ -625,7 +625,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) · 83 unmodified lines
625#define pud_none(pud) (!pud_val(pud))625#define pud_none(pud) (!pud_val(pud))
626#define pud_bad(pud) (!pud_table(pud))626#define pud_bad(pud) (!pud_table(pud))
627#define pud_present(pud) pte_present(pud_pte(pud))627#define pud_present(pud) pte_present(pud_pte(pud))
628#define pud_leaf(pud) pud_sect(pud)628#define pud_leaf(pud) (pud_present(pud) && !pud_table(pud))
629#define pud_valid(pud) pte_valid(pud_pte(pud))629#define pud_valid(pud) pte_valid(pud_pte(pud))
630 630
631static inline void set_pud(pud_t *pudp, pud_t pud)631static inline void set_pud(pud_t *pudp, pud_t pud)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t