Skip to contentSkip to conversation

Patch "userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Dec 18, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
userfaultfd-shmem-__do_fault-requires-vm_fault_nopage.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Mon Dec 18 14:47:43 CET 2017

From: Andrea Arcangeli <[email protected]>
Date: Thu, 9 Mar 2017 16:16:28 -0800
Subject: userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE

From: Andrea Arcangeli <[email protected]>

[ Upstream commit 6bbc4a4144b1a69743022ac68dfaf6e7d993abb9 ]

__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.

---
 fs/userfaultfd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/userfaultfd.c +1 -1
@@ -386,7 +386,7 @@ int handle_userfault(struct vm_area_stru
 			 * in such case.
 			 */
 			down_read(&mm->mmap_sem);
-			ret = 0;
+			ret = VM_FAULT_NOPAGE;
 		}
 	}
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/userfaultfd-selftest-vm-allow-to-build-in-vm-directory.patch queue-4.4/userfaultfd-shmem-__do_fault-requires-vm_fault_nopage.patch