linux-stable/arch/parisc
John David Anglin 8301503a72 parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page
commit 38860b2c8b upstream.

For years, there have been random segmentation faults in userspace on
SMP PA-RISC machines.  It occurred to me that this might be a problem in
set_pte_at().  MIPS and some other architectures do cache flushes when
installing PTEs with the present bit set.

Here I have adapted the code in update_mmu_cache() to flush the kernel
mapping when the kernel flush is deferred, or when the kernel mapping
may alias with the user mapping.  This simplifies calls to
update_mmu_cache().

I also changed the barrier in set_pte() from a compiler barrier to a
full memory barrier.  I know this change is not sufficient to fix the
problem.  It might not be needed.

I have had a few days of operation with 5.14.16 to 5.15.1 and haven't
seen any random segmentation faults on rp3440 or c8000 so far.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@kernel.org # 5.12+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-18 19:17:14 +01:00
..
boot parisc: Add missing FORCE prerequisite in Makefile 2021-09-09 12:44:30 +02:00
configs configs: remove the obsolete CONFIG_INPUT_POLLDEV 2021-09-08 11:50:28 -07:00
include parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page 2021-11-18 19:17:14 +01:00
kernel parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page 2021-11-18 19:17:14 +01:00
lib parisc: Declare pci_iounmap() parisc version only when CONFIG_PCI enabled 2021-09-19 10:36:09 -07:00
math-emu parisc: math-emu: Fix fall-through warnings 2021-09-01 22:18:18 +02:00
mm parisc: fix warning in flush_tlb_all 2021-11-18 19:16:21 +01:00
defpalo.conf
install.sh parisc: Install vmlinuz instead of zImage file 2020-10-15 08:10:39 +02:00
Kbuild parisc: move core-y in arch/parisc/Makefile to arch/parisc/Kbuild 2021-08-30 10:18:25 +02:00
Kconfig firmware: include drivers/firmware/Kconfig unconditionally 2021-10-07 16:51:26 +02:00
Kconfig.debug tracing: Refactor TRACE_IRQFLAGS_SUPPORT in Kconfig 2021-08-16 11:37:21 -04:00
Makefile parisc: Fix compile failure when building 64-bit kernel natively 2021-09-01 21:52:02 +02:00
nm