diff options
author | Hugh Dickins <hugh@veritas.com> | 2008-05-20 08:59:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-20 11:14:45 -0400 |
commit | a8375bd81cf99cb81be37127eaf08316ecb87619 (patch) | |
tree | 8a657fe7e1a4afc762c0dafab10cfa89006dadc6 /include/asm-x86 | |
parent | cbb3077cbe718795d7ae5d78ed11659ca73c97b9 (diff) |
x86: strengthen 64-bit p?d_bad()
The x86_64 pgd_bad(), pud_bad(), pmd_bad() inlines have differed from
their x86_32 counterparts in a couple of ways: they've been unnecessarily
weak (e.g. letting 0 or 1 count as good), and were typed as unsigned long.
Strengthen them and return int.
The PAE pmd_bad was too weak before, allowing any junk in the upper half;
but got strengthened by the patch correcting its ~PAGE_MASK to ~PTE_MASK.
The PAE pud_bad already said ~PTE_MASK; and since it folds into pgd_bad,
and we don't set the protection bits at that level, it'll do as is.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-x86')
-rw-r--r-- | include/asm-x86/pgtable_64.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h index efe83dcbd412..1cc50d22d735 100644 --- a/include/asm-x86/pgtable_64.h +++ b/include/asm-x86/pgtable_64.h | |||
@@ -151,19 +151,19 @@ static inline void native_pgd_clear(pgd_t *pgd) | |||
151 | 151 | ||
152 | #ifndef __ASSEMBLY__ | 152 | #ifndef __ASSEMBLY__ |
153 | 153 | ||
154 | static inline unsigned long pgd_bad(pgd_t pgd) | 154 | static inline int pgd_bad(pgd_t pgd) |
155 | { | 155 | { |
156 | return pgd_val(pgd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); | 156 | return (pgd_val(pgd) & ~(PTE_MASK | _PAGE_USER)) != _KERNPG_TABLE; |
157 | } | 157 | } |
158 | 158 | ||
159 | static inline unsigned long pud_bad(pud_t pud) | 159 | static inline int pud_bad(pud_t pud) |
160 | { | 160 | { |
161 | return pud_val(pud) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); | 161 | return (pud_val(pud) & ~(PTE_MASK | _PAGE_USER)) != _KERNPG_TABLE; |
162 | } | 162 | } |
163 | 163 | ||
164 | static inline unsigned long pmd_bad(pmd_t pmd) | 164 | static inline int pmd_bad(pmd_t pmd) |
165 | { | 165 | { |
166 | return pmd_val(pmd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); | 166 | return (pmd_val(pmd) & ~(PTE_MASK | _PAGE_USER)) != _KERNPG_TABLE; |
167 | } | 167 | } |
168 | 168 | ||
169 | #define pte_none(x) (!pte_val((x))) | 169 | #define pte_none(x) (!pte_val((x))) |