android_kernel_xiaomi_sm8450/arch/parisc
John David Anglin 7bbdf49e26 parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page
[ Upstream commit 38860b2c8bb1b92f61396eb06a63adff916fc31d ]

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: Sasha Levin <sashal@kernel.org>
2022-09-23 14:16:56 +02:00
..
boot vmlinux.lds.h: Split ELF_DETAILS from STABS_DEBUG 2020-09-01 09:50:35 +02:00
configs parisc: disable CONFIG_IDE in defconfigs 2020-10-15 08:10:38 +02:00
include parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page 2022-09-23 14:16:56 +02:00
kernel parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page 2022-09-23 14:16:56 +02:00
lib parisc: Add ioread64_lo_hi() and iowrite64_lo_hi() 2022-02-23 12:00:58 +01:00
math-emu parisc: math-emu: Fix fall-through warnings 2021-10-27 09:56:46 +02:00
mm parisc: Optimize per-pagetable spinlocks 2022-09-23 14:16:56 +02:00
oprofile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
defpalo.conf parisc: switch to gzip-compressed vmlinuz kernel 2013-07-09 22:09:20 +02:00
install.sh parisc: Fix "make install" on newer debian releases 2021-12-08 09:03:28 +01:00
Kconfig parisc: Optimize per-pagetable spinlocks 2022-09-23 14:16:56 +02:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Makefile parisc: Fix KBUILD_IMAGE for self-extracting kernel 2021-12-08 09:03:28 +01:00
nm