linux-next: manual merge of the tip tree with the mm-unstable tree

From: Mark Brown
Date: Thu May 04 2023 - 09:21:58 EST


Hi all,

Today's linux-next merge of the tip tree got a conflict in:

mm/gup.c

between commit:

2353d85b4e9c2 ("mm/gup: disallow FOLL_LONGTERM GUP-nonfast writing to file-backed mappings")

from the mm-unstable tree and commit:

75818f575af6d ("mm: Don't allow write GUPs to shadow stack memory")

from the tip tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc mm/gup.c
index 802dbe46a401a,80258a640135a..0000000000000
--- a/mm/gup.c
+++ b/mm/gup.c
@@@ -1017,11 -978,7 +1017,11 @@@ static int check_vma_flags(struct vm_ar
return -EFAULT;

if (write) {
+ if (!vma_anon &&
+ !writable_file_mapping_allowed(vma, gup_flags))
+ return -EFAULT;
+
- if (!(vm_flags & VM_WRITE)) {
+ if (!(vm_flags & VM_WRITE) || (vm_flags & VM_SHADOW_STACK)) {
if (!(gup_flags & FOLL_FORCE))
return -EFAULT;
/* hugetlb does not support FOLL_FORCE|FOLL_WRITE. */