linux-sg2042/arch
Kirill A. Shutemov 4ecf886045 sparc32: fix broken set_pte()
32-bit sparc uses swap instruction to implement set_pte().  It called
using GCC inline assembler.  But it misses the "memory" clobber to
indicate that pte value will be updated in memory.

As result GCC doesn't know that it cannot postpone pte pointer dereference
which occurs before set_pte() to post-set_pte() time.

It leads to real-world bugs -- [1]. In this situation we have code:

	ptent = ptep_modify_prot_start(mm, addr, pte);
	ptent = pte_modify(ptent, newprot);
	...
	ptep_modify_prot_commit(mm, addr, pte, ptent);

ptep_modify_prot_start() in sparc case is just 'pte' dereference plus
pte_clear().  pte_clear() calls broken set_pte().  GCC thinks it's valid
to dereference 'pte' again on pte_modify() and gets cleared pte.
ptep_modify_prot_commit() puts 'pteent' with pfn==0 back to page table,
which eventually leads to the crash.

[1] http://lkml.kernel.org/r/54C06B19.8060305@roeck-us.net

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Cc: Paul Moore <pmoore@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-02-11 17:06:01 -08:00
..
alpha alpha: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:31 -08:00
arc arc: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:31 -08:00
arm mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
arm64 mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
avr32 avr32: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:31 -08:00
blackfin Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2015-02-10 18:57:15 -08:00
c6x c6x: drop pte_file() 2015-02-10 14:30:32 -08:00
cris cris: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:32 -08:00
frv Merge branch 'akpm' (patches from Andrew) 2015-02-10 16:45:56 -08:00
hexagon hexagon: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:32 -08:00
ia64 mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
m32r m32r: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:32 -08:00
m68k Merge branch 'akpm' (patches from Andrew) 2015-02-10 16:45:56 -08:00
metag mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
microblaze Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-02-10 20:01:30 -08:00
mips mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
mn10300 Merge branch 'akpm' (patches from Andrew) 2015-02-10 16:45:56 -08:00
nios2 nios2: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:32 -08:00
openrisc openrisc: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:33 -08:00
parisc parisc: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:33 -08:00
powerpc mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
s390 mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
score score: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:33 -08:00
sh mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
sparc sparc32: fix broken set_pte() 2015-02-11 17:06:01 -08:00
tile mm/hugetlb: reduce arch dependent code around follow_huge_* 2015-02-11 17:06:01 -08:00
um um: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:33 -08:00
unicore32 unicore32: drop pte_file()-related helpers 2015-02-10 14:30:33 -08:00
x86 mm/hugetlb: pmd_huge() returns true for non-present hugepage 2015-02-11 17:06:01 -08:00
xtensa xtensa: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:33 -08:00
.gitignore
Kconfig