cow_user_page() needs to create a user pointer from scratch in order to copy data from an existing user page. To make this safer in PCuABI, create a user (capability) pointer with appropriate bounds and permissions, preventing invalid accesses to user memory.
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com ---
Just an example of what replacing uaddr_to_user_ptr_safe() with make_privileged_user_ptr() looks like, not to be merged on its own.
mm/memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/memory.c b/mm/memory.c index ab7e87de3314..7ed4365b628d 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2778,7 +2778,8 @@ static inline bool cow_user_page(struct page *dst, struct page *src, * fails, we just zero-fill it. Live with it. */ kaddr = kmap_atomic(dst); - uaddr = uaddr_to_user_ptr_safe(addr & PAGE_MASK); + uaddr = make_privileged_user_ptr(addr & PAGE_MASK, PAGE_SIZE, + USER_PTR_CAN_READ);
/* * On architectures with software "accessed" bits, we would