Skip to contentSkip to conversation

i386/PAE: avoid temporarily inconsistent pte-s

PATCH In review Jan Beulich 2 participants 4 messages Sep 19, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386/PAE: avoid temporarily inconsistent pte-s

One more of these issues (which were considered fixed a few releases back): Other than on x86-64, i386 allows set_fixmap() to replace already present mappings. Consequently, on PAE, care must be taken to not update the high half of a pte while the low half is still holding the old value.

 arch/i386/mm/pgtable.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)
arch/i386/mm/pgtable.c +1 -2
@@ -97,8 +97,7 @@ static void set_pte_pfn(unsigned long va
 	}
 	pte = pte_offset_kernel(pmd, vaddr);
 	if (pgprot_val(flags))
-		/* <pfn,flags> stored as-is, to permit clearing entries */
-		set_pte(pte, pfn_pte(pfn, flags));
+		set_pte_present(&init_mm, vaddr, pte, pfn_pte(pfn, flags));
 	else
 		pte_clear(&init_mm, vaddr, pte);
 
#1 lore raw
Quoted 5 lines · On Wednesday 19 September 2007 16:39:39 Jan Beulich wrote:

One more of these issues (which were considered fixed a few releases back): Other than on x86-64, i386 allows set_fixmap() to replace already present mappings. Consequently, on PAE, care must be taken to not update the high half of a pte while the low half is still holding the old value.

Hmm perhaps it would be better to just forbid it on i386 too. Do you know who uses it?

-Andi

#2 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line

Andi Kleen <[email protected]> 19.09.07 18:09 >>>

Quoted 5 lines · On Wednesday 19 September 2007 16:39:39 Jan Beulich wrote:

One more of these issues (which were considered fixed a few releases back): Other than on x86-64, i386 allows set_fixmap() to replace already present mappings. Consequently, on PAE, care must be taken to not update the high half of a pte while the low half is still holding the old value.

Hmm perhaps it would be better to just forbid it on i386 too. Do you know who uses it?

PCI's mmconfig accessor. One could of course make it call clear_fixmap() prior to establishing a new mapping, but I thought that was not intended and is the reason for allowing this.

Jan

#3 lore raw
Quoted 8 lines · On Wednesday 19 September 2007 18:16:25 Jan Beulich wrote:
Quoted 8 lines
Quoted 1 line
Quoted 1 line

Andi Kleen <[email protected]> 19.09.07 18:09 >>>

Quoted 5 lines · On Wednesday 19 September 2007 16:39:39 Jan Beulich wrote:

One more of these issues (which were considered fixed a few releases back): Other than on x86-64, i386 allows set_fixmap() to replace already present mappings. Consequently, on PAE, care must be taken to not update the high half of a pte while the low half is still holding the old value.

Quoted 6 lines
Quoted 2 lines

Hmm perhaps it would be better to just forbid it on i386 too. Do you know who uses it?

PCI's mmconfig accessor. One could of course make it call clear_fixmap() prior to establishing a new mapping, but I thought that was not intended and is the reason for allowing this.

Makes sense. Applied thanks.

-Andi