All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20170228154201.GH5816@redhat.com>

diff --git a/a/1.txt b/N1/1.txt
index c2d6944..65a1ea1 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -7,3 +7,38 @@ On Tue, Feb 28, 2017 at 03:04:53PM +0100, Dmitry Vyukov wrote:
 > https://gist.githubusercontent.com/dvyukov/27345737fca18d92ef761e7fa08aec9b/raw/d99d02511d0bf9a8d6f6bd9c79d373a26924e974/gistfile1.txt
 
 Can you verify this fix:
+
+>From a65381bc86d2963713b6a9c4a73cded7dd184282 Mon Sep 17 00:00:00 2001
+From: Andrea Arcangeli <aarcange@redhat.com>
+Date: Tue, 28 Feb 2017 16:36:59 +0100
+Subject: [PATCH 1/1] userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE
+
+__do_fault assumes vmf->page has been initialized and is valid if
+VM_FAULT_NOPAGE is not returned by vma->vm_ops->fault(vma, vmf).
+
+handle_userfault() in turn should return VM_FAULT_NOPAGE if it doesn't
+return VM_FAULT_SIGBUS or VM_FAULT_RETRY (the other two
+possibilities).
+
+This VM_FAULT_NOPAGE case is only invoked when signal are pending and
+it didn't matter for anonymous memory before. It only started to
+matter since shmem was introduced. hugetlbfs also takes a different
+path and doesn't exercise __do_fault.
+
+Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
+---
+ fs/userfaultfd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
+index fb6d02b..de28f43 100644
+--- a/fs/userfaultfd.c
++++ b/fs/userfaultfd.c
+@@ -500,7 +500,7 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason)
+ 			 * in such case.
+ 			 */
+ 			down_read(&mm->mmap_sem);
+-			ret = 0;
++			ret = VM_FAULT_NOPAGE;
+ 		}
+ 	}
diff --git a/a/content_digest b/N1/content_digest
index 512a620..0cd328b 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -22,6 +22,41 @@
  "> The following program triggers GPF in __do_fault:\n"
  "> https://gist.githubusercontent.com/dvyukov/27345737fca18d92ef761e7fa08aec9b/raw/d99d02511d0bf9a8d6f6bd9c79d373a26924e974/gistfile1.txt\n"
  "\n"
- Can you verify this fix:
+ "Can you verify this fix:\n"
+ "\n"
+ ">From a65381bc86d2963713b6a9c4a73cded7dd184282 Mon Sep 17 00:00:00 2001\n"
+ "From: Andrea Arcangeli <aarcange@redhat.com>\n"
+ "Date: Tue, 28 Feb 2017 16:36:59 +0100\n"
+ "Subject: [PATCH 1/1] userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE\n"
+ "\n"
+ "__do_fault assumes vmf->page has been initialized and is valid if\n"
+ "VM_FAULT_NOPAGE is not returned by vma->vm_ops->fault(vma, vmf).\n"
+ "\n"
+ "handle_userfault() in turn should return VM_FAULT_NOPAGE if it doesn't\n"
+ "return VM_FAULT_SIGBUS or VM_FAULT_RETRY (the other two\n"
+ "possibilities).\n"
+ "\n"
+ "This VM_FAULT_NOPAGE case is only invoked when signal are pending and\n"
+ "it didn't matter for anonymous memory before. It only started to\n"
+ "matter since shmem was introduced. hugetlbfs also takes a different\n"
+ "path and doesn't exercise __do_fault.\n"
+ "\n"
+ "Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>\n"
+ "---\n"
+ " fs/userfaultfd.c | 2 +-\n"
+ " 1 file changed, 1 insertion(+), 1 deletion(-)\n"
+ "\n"
+ "diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c\n"
+ "index fb6d02b..de28f43 100644\n"
+ "--- a/fs/userfaultfd.c\n"
+ "+++ b/fs/userfaultfd.c\n"
+ "@@ -500,7 +500,7 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason)\n"
+ " \t\t\t * in such case.\n"
+ " \t\t\t */\n"
+ " \t\t\tdown_read(&mm->mmap_sem);\n"
+ "-\t\t\tret = 0;\n"
+ "+\t\t\tret = VM_FAULT_NOPAGE;\n"
+ " \t\t}\n"
+ " \t}"
 
-ec68d788d87e271c858f8ad6a584138dd60f782defdb2031179601cd2a08bb10
+970c0e3886b0008edf378b9f2054cde825be62e46d0b6be56b691d4fce0723de

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.