Commit 531deb70 authored by Andrea Arcangeli's avatar Andrea Arcangeli Committed by Linus Torvalds

[PATCH] ptep_establish smp race x86 PAE >4G

This avoid userspace mm corruption during COWs with threads (i.e. 
malloc;fork;clone) on x86 PAE with >4G of ram
Signed-Off-By: default avatarAndrea Arcangeli <andrea@novell.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 056bb24d
...@@ -13,11 +13,19 @@ ...@@ -13,11 +13,19 @@
* Note: the old pte is known to not be writable, so we don't need to * Note: the old pte is known to not be writable, so we don't need to
* worry about dirty bits etc getting lost. * worry about dirty bits etc getting lost.
*/ */
#ifndef __HAVE_ARCH_SET_PTE_ATOMIC
#define ptep_establish(__vma, __address, __ptep, __entry) \ #define ptep_establish(__vma, __address, __ptep, __entry) \
do { \ do { \
set_pte(__ptep, __entry); \ set_pte(__ptep, __entry); \
flush_tlb_page(__vma, __address); \ flush_tlb_page(__vma, __address); \
} while (0) } while (0)
#else /* __HAVE_ARCH_SET_PTE_ATOMIC */
#define ptep_establish(__vma, __address, __ptep, __entry) \
do { \
set_pte_atomic(__ptep, __entry); \
flush_tlb_page(__vma, __address); \
} while (0)
#endif /* __HAVE_ARCH_SET_PTE_ATOMIC */
#endif #endif
#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
......
...@@ -54,6 +54,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte) ...@@ -54,6 +54,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
smp_wmb(); smp_wmb();
ptep->pte_low = pte.pte_low; ptep->pte_low = pte.pte_low;
} }
#define __HAVE_ARCH_SET_PTE_ATOMIC
#define set_pte_atomic(pteptr,pteval) \ #define set_pte_atomic(pteptr,pteval) \
set_64bit((unsigned long long *)(pteptr),pte_val(pteval)) set_64bit((unsigned long long *)(pteptr),pte_val(pteval))
#define set_pmd(pmdptr,pmdval) \ #define set_pmd(pmdptr,pmdval) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment