summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2020-06-22 09:42:36 +0000
committerjsg <jsg@openbsd.org>2020-06-22 09:42:36 +0000
commit0e573d0c016e750eeaa45298bee58f4eb789390f (patch)
treef21e92d2122ebe4d388595c8eb9d29ab67806cf2
parentPrevent potencial `state_list' corruption while pppac(4) destroys pipex(4) (diff)
downloadwireguard-openbsd-0e573d0c016e750eeaa45298bee58f4eb789390f.tar.xz
wireguard-openbsd-0e573d0c016e750eeaa45298bee58f4eb789390f.zip
gup: document and work around "COW can break either way" issue
From Linus Torvalds 8e45fdafdecc8436c5b6e1620c30726056e6b29c in linux 5.7.y/5.7.3 17839856fd588f4ab6b789f482ed3ffd7c403e1f in mainline linux
-rw-r--r--sys/dev/pci/drm/i915/gem/i915_gem_userptr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/i915/gem/i915_gem_userptr.c b/sys/dev/pci/drm/i915/gem/i915_gem_userptr.c
index 68bb5c37b4d..3c7e6c825f4 100644
--- a/sys/dev/pci/drm/i915/gem/i915_gem_userptr.c
+++ b/sys/dev/pci/drm/i915/gem/i915_gem_userptr.c
@@ -600,6 +600,14 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)
GFP_KERNEL |
__GFP_NORETRY |
__GFP_NOWARN);
+ /*
+ * Using __get_user_pages_fast() with a read-only
+ * access is questionable. A read-only page may be
+ * COW-broken, and then this might end up giving
+ * the wrong side of the COW..
+ *
+ * We may or may not care.
+ */
if (pvec) /* defer to worker if malloc fails */
pinned = __get_user_pages_fast(obj->userptr.ptr,
num_pages,