* [PATCH 2/2] install_page pte use-after-free fix
@ 2003-09-05 18:35 Rajesh Venkatasubramanian
0 siblings, 0 replies; only message in thread
From: Rajesh Venkatasubramanian @ 2003-09-05 18:35 UTC (permalink / raw)
To: akpm, Ingo Molnar, linux-mm
There seems to be a use-after-free bug in the install_page.
The newly installed pte is unmapped and then used in the
update_mmu_cache function call. This may result in a BUG()
in PPC highmem.
Please apply if it is not a dubious fix.
Thanks,
Rajesh
mm/fremap.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff -puN mm/fremap.c~fremap-pte_unmap mm/fremap.c
--- dev-2.6.0-test4/mm/fremap.c~fremap-pte_unmap Fri Sep 5 12:58:44 2003
+++ dev-2.6.0-test4-vrajesh/mm/fremap.c Fri Sep 5 12:58:44 2003
@@ -61,6 +61,7 @@ int install_page(struct mm_struct *mm, s
pte_t *pte;
pgd_t *pgd;
pmd_t *pmd;
+ pte_t pte_val;
struct pte_chain *pte_chain;
pte_chain = pte_chain_alloc(GFP_KERNEL);
@@ -83,10 +84,11 @@ int install_page(struct mm_struct *mm, s
flush_icache_page(vma, page);
set_pte(pte, mk_pte(page, prot));
pte_chain = page_add_rmap(page, pte, pte_chain);
+ pte_val = *pte;
pte_unmap(pte);
if (flush)
flush_tlb_page(vma, addr);
- update_mmu_cache(vma, addr, *pte);
+ update_mmu_cache(vma, addr, pte_val);
spin_unlock(&mm->page_table_lock);
pte_chain_free(pte_chain);
return 0;
@@ -111,6 +113,7 @@ int install_file_pte(struct mm_struct *m
pte_t *pte;
pgd_t *pgd;
pmd_t *pmd;
+ pte_t pte_val;
pgd = pgd_offset(mm, addr);
spin_lock(&mm->page_table_lock);
@@ -126,10 +129,11 @@ int install_file_pte(struct mm_struct *m
flush = zap_pte(mm, vma, addr, pte);
set_pte(pte, pgoff_to_pte(pgoff));
+ pte_val = *pte;
pte_unmap(pte);
if (flush)
flush_tlb_page(vma, addr);
- update_mmu_cache(vma, addr, *pte);
+ update_mmu_cache(vma, addr, pte_val);
spin_unlock(&mm->page_table_lock);
return 0;
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-09-05 18:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-05 18:35 [PATCH 2/2] install_page pte use-after-free fix Rajesh Venkatasubramanian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox