linux-stable/arch
Huacai Chen e19b63d000 LoongArch: Set _PAGE_DIRTY only if _PAGE_WRITE is set in {pmd,pte}_mkdirty()
commit bf2f34a506 upstream.

Now {pmd,pte}_mkdirty() set _PAGE_DIRTY bit unconditionally, this causes
random segmentation fault after commit 0ccf7f168e ("mm/thp: carry
over dirty bit when thp splits on pmd").

The reason is: when fork(), parent process use pmd_wrprotect() to clear
huge page's _PAGE_WRITE and _PAGE_DIRTY (for COW); then pte_mkdirty() set
_PAGE_DIRTY as well as _PAGE_MODIFIED while splitting dirty huge pages;
once _PAGE_DIRTY is set, there will be no tlb modify exception so the COW
machanism fails; and at last memory corruption occurred between parent
and child processes.

So, we should set _PAGE_DIRTY only when _PAGE_WRITE is set in {pmd,pte}_
mkdirty().

Cc: stable@vger.kernel.org
Cc: Peter Xu <peterx@redhat.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-12-02 17:43:13 +01:00
..
alpha
arc
arm ARM: dts: imx6q-prti6q: Fix ref/tcxo-clock-frequency properties 2022-12-02 17:43:05 +01:00
arm64 arm64: dts: rockchip: lower rk3399-puma-haikou SD controller clock frequency 2022-12-02 17:43:10 +01:00
csky
hexagon
ia64
loongarch LoongArch: Set _PAGE_DIRTY only if _PAGE_WRITE is set in {pmd,pte}_mkdirty() 2022-12-02 17:43:13 +01:00
m68k m68k: Rework BI_VIRT_RNG_SEED as BI_RNG_SEED 2022-11-16 10:03:48 +01:00
microblaze
mips MIPS: pic32: treat port as signed integer 2022-12-02 17:43:02 +01:00
nios2 nios2: add FORCE for vmlinuz.gz 2022-12-02 17:43:11 +01:00
openrisc
parisc parisc: Avoid printing the hardware path twice 2022-11-10 18:17:36 +01:00
powerpc powerpc/64e: Fix amdgpu build on Book3E w/o AltiVec 2022-11-26 09:27:19 +01:00
riscv RISC-V: vdso: Do not add missing symbols to version section in linker script 2022-12-02 17:43:02 +01:00
s390 s390/crashdump: fix TOD programmable field size 2022-12-02 17:43:09 +01:00
sh
sparc
um
x86 x86/ioremap: Fix page aligned size calculation in __ioremap_caller() 2022-12-02 17:43:13 +01:00
xtensa
.gitignore
Kconfig