Skip to content

Commit e6f39e8

Browse files
joergroedeltorvalds
authored andcommitted
x86/ldt: Fix support_pte_mask filtering in map_ldt_struct()
The |= operator will let us end up with an invalid PTE. Use the correct &= instead. [ The bug was also independently reported by Shuah Khan ] Fixes: fb43d6c ('x86/mm: Do not auto-massage page protections') Acked-by: Andy Lutomirski <[email protected]> Acked-by: Dave Hansen <[email protected]> Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 60cc43f commit e6f39e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/ldt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
166166
*/
167167
pte_prot = __pgprot(__PAGE_KERNEL_RO & ~_PAGE_GLOBAL);
168168
/* Filter out unsuppored __PAGE_KERNEL* bits: */
169-
pgprot_val(pte_prot) |= __supported_pte_mask;
169+
pgprot_val(pte_prot) &= __supported_pte_mask;
170170
pte = pfn_pte(pfn, pte_prot);
171171
set_pte_at(mm, va, ptep, pte);
172172
pte_unmap_unlock(ptep, ptl);

0 commit comments

Comments
 (0)