OpenCloudOS-Kernel/arch/s390/mm
Gerald Schaefer 41ac42f137 s390/mm: do not trigger write fault when vma does not allow VM_WRITE
For non-protection pXd_none() page faults in do_dat_exception(), we
call do_exception() with access == (VM_READ | VM_WRITE | VM_EXEC).
In do_exception(), vma->vm_flags is checked against that before
calling handle_mm_fault().

Since commit 92f842eac7 ("[S390] store indication fault optimization"),
we call handle_mm_fault() with FAULT_FLAG_WRITE, when recognizing that
it was a write access. However, the vma flags check is still only
checking against (VM_READ | VM_WRITE | VM_EXEC), and therefore also
calling handle_mm_fault() with FAULT_FLAG_WRITE in cases where the vma
does not allow VM_WRITE.

Fix this by changing access check in do_exception() to VM_WRITE only,
when recognizing write access.

Link: https://lkml.kernel.org/r/20220811103435.188481-3-david@redhat.com
Fixes: 92f842eac7 ("[S390] store indication fault optimization")
Cc: <stable@vger.kernel.org>
Reported-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2022-08-25 15:12:32 +02:00
..
Makefile s390/extable: move extable related functions to mm/extable.c 2022-03-08 00:33:00 +01:00
cmm.c s390/cmm: add missing virt_to_phys() conversion 2021-12-10 16:14:25 +01:00
dump_pagetables.c Revert "s390/smp,ptdump: add absolute lowcore markers" 2022-08-06 09:13:28 +02:00
extable.c s390/uaccess: use exception handler to zero result on get_user() failure 2022-06-01 12:03:17 +02:00
extmem.c s390/extmem: remove stale -ENOSPC comment and handling 2020-07-03 10:49:16 +02:00
fault.c s390/mm: do not trigger write fault when vma does not allow VM_WRITE 2022-08-25 15:12:32 +02:00
gmap.c KVM: s390: pv: refactor s390_reset_acc 2022-07-13 14:42:11 +00:00
hugetlbpage.c s390/mm,hugetlb: don't use pte_val()/pXd_val() as lvalue 2022-03-01 21:05:10 +01:00
init.c Revert "s390/smp: rework absolute lowcore access" 2022-08-06 09:24:07 +02:00
kasan_init.c s390/mm: use set_pXd()/set_pte() helper functions everywhere 2022-03-01 21:05:10 +01:00
maccess.c Revert "s390/smp: rework absolute lowcore access" 2022-08-06 09:24:07 +02:00
mmap.c s390/mm: enable ARCH_HAS_VM_GET_PAGE_PROT 2022-07-17 17:14:40 -07:00
page-states.c s390/extable: move EX_TABLE define to asm-extable.h 2022-03-08 00:33:00 +01:00
pageattr.c s390/mm,pageattr: don't use pte_val()/pXd_val() as lvalue 2022-03-01 21:05:10 +01:00
pgalloc.c s390/mm: use CRST_ALLOC_ORDER instead of number 2022-02-09 22:56:04 +01:00
pgtable.c s390/mm: use non-quiescing sske for KVM switch to keyed guest 2022-06-01 12:03:16 +02:00
vmem.c Revert "s390/smp: rework absolute lowcore access" 2022-08-06 09:24:07 +02:00