WSL2-Linux-Kernel/arch/s390
Linus Torvalds f6f3732162 Revert "mm: replace p??_write with pte_access_permitted in fault + gup paths"
This reverts commits 5c9d2d5c26, c7da82b894, and e7fe7b5cae.

We'll probably need to revisit this, but basically we should not
complicate the get_user_pages_fast() case, and checking the actual page
table protection key bits will require more care anyway, since the
protection keys depend on the exact state of the VM in question.

Particularly when doing a "remote" page lookup (ie in somebody elses VM,
not your own), you need to be much more careful than this was.  Dave
Hansen says:

 "So, the underlying bug here is that we now a get_user_pages_remote()
  and then go ahead and do the p*_access_permitted() checks against the
  current PKRU. This was introduced recently with the addition of the
  new p??_access_permitted() calls.

  We have checks in the VMA path for the "remote" gups and we avoid
  consulting PKRU for them. This got missed in the pkeys selftests
  because I did a ptrace read, but not a *write*. I also didn't
  explicitly test it against something where a COW needed to be done"

It's also not entirely clear that it makes sense to check the protection
key bits at this level at all.  But one possible eventual solution is to
make the get_user_pages_fast() case just abort if it sees protection key
bits set, which makes us fall back to the regular get_user_pages() case,
which then has a vma and can do the check there if we want to.

We'll see.

Somewhat related to this all: what we _do_ want to do some day is to
check the PAGE_USER bit - it should obviously always be set for user
pages, but it would be a good check to have back.  Because we have no
generic way to test for it, we lost it as part of moving over from the
architecture-specific x86 GUP implementation to the generic one in
commit e585513b76 ("x86/mm/gup: Switch GUP to the generic
get_user_page_fast() implementation").

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: "Jérôme Glisse" <jglisse@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-12-15 18:53:22 -08:00
..
appldata s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
boot s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
configs s390: Remove CONFIG_HARDENED_USERCOPY 2017-11-16 13:12:21 +01:00
crypto s390: Remove redudant license text 2017-12-05 07:51:09 +01:00
hypfs s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
include Revert "mm: replace p??_write with pte_access_permitted in fault + gup paths" 2017-12-15 18:53:22 -08:00
kernel kernel: make groups_sort calling a responsibility group_info allocators 2017-12-14 16:00:49 -08:00
kvm KVM: s390: Fixes for 4.15 2017-12-06 15:55:44 +01:00
lib s390/spinlock: fix indentation 2017-11-14 22:07:58 +01:00
mm s390/mm: fix off-by-one bug in 5-level page table handling 2017-12-05 07:51:09 +01:00
net s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
numa s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
oprofile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
tools s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
Kbuild s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
Kconfig s390/perf: add perf_regs support and user stack dump 2017-11-16 15:06:11 +01:00
Kconfig.debug License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile s390: Remove redundant license text 2017-11-24 15:37:24 +01:00
defconfig s390: update defconfig 2017-10-16 08:19:28 +02:00