Re: [PATCH v1 7/7] selftests/vm: anon_cow: add R/O longterm tests via gup_test

From: David Hildenbrand
Date: Wed Oct 19 2022 - 08:50:38 EST


On 27.09.22 13:01, David Hildenbrand wrote:
Let's trigger a R/O longterm pin on three cases of R/O mapped anonymous
pages:
* exclusive (never shared)
* shared (child still alive)
* previously shared (child no longer alive)

... and make sure that the pin is reliable: whatever we write via the page
tables has to be observable via the pin.

Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
---

The following on top should silence the warning on 32bit:

https://lore.kernel.org/all/202210182101.XOyPZEQV-lkp@xxxxxxxxx/T/#u


diff --git a/mm/gup_test.c b/mm/gup_test.c
index 2bbfacd31f5a..57c343f2dc51 100644
--- a/mm/gup_test.c
+++ b/mm/gup_test.c
@@ -299,7 +299,8 @@ static inline int pin_longterm_test_read(unsigned long arg)
for (i = 0; i < pin_longterm_test_nr_pages; i++) {
void *addr = page_to_virt(pin_longterm_test_pages[i]);
- if (copy_to_user((void __user *)user_addr, addr, PAGE_SIZE))
+ if (copy_to_user((void __user *)(unsigned long)user_addr, addr,
+ PAGE_SIZE))
return -EFAULT;
user_addr += PAGE_SIZE;
}


--
Thanks,

David / dhildenb