diff options
| -rw-r--r-- | arch/x86/include/asm/pgtable-invert.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/include/asm/pgtable-invert.h b/arch/x86/include/asm/pgtable-invert.h index 44b1203ece12..a0c1525f1b6f 100644 --- a/arch/x86/include/asm/pgtable-invert.h +++ b/arch/x86/include/asm/pgtable-invert.h | |||
| @@ -4,9 +4,18 @@ | |||
| 4 | 4 | ||
| 5 | #ifndef __ASSEMBLY__ | 5 | #ifndef __ASSEMBLY__ |
| 6 | 6 | ||
| 7 | /* | ||
| 8 | * A clear pte value is special, and doesn't get inverted. | ||
| 9 | * | ||
| 10 | * Note that even users that only pass a pgprot_t (rather | ||
| 11 | * than a full pte) won't trigger the special zero case, | ||
| 12 | * because even PAGE_NONE has _PAGE_PROTNONE | _PAGE_ACCESSED | ||
| 13 | * set. So the all zero case really is limited to just the | ||
| 14 | * cleared page table entry case. | ||
| 15 | */ | ||
| 7 | static inline bool __pte_needs_invert(u64 val) | 16 | static inline bool __pte_needs_invert(u64 val) |
| 8 | { | 17 | { |
| 9 | return !(val & _PAGE_PRESENT); | 18 | return val && !(val & _PAGE_PRESENT); |
| 10 | } | 19 | } |
| 11 | 20 | ||
| 12 | /* Get a mask to xor with the page table entry to get the correct pfn. */ | 21 | /* Get a mask to xor with the page table entry to get the correct pfn. */ |
