]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Fix compat regression in process_vm_rw()
authorJens Axboe <axboe@kernel.dk>
Tue, 27 Oct 2020 00:03:18 +0000 (18:03 -0600)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 27 Oct 2020 16:57:46 +0000 (09:57 -0700)
The removal of compat_process_vm_{readv,writev} didn't change
process_vm_rw(), which always assumes it's not doing a compat syscall.

Instead of passing in 'false' unconditionally for 'compat', make it
conditional on in_compat_syscall().

[ Both Al and Christoph point out that trying to access a 64-bit process
  from a 32-bit one cannot work anyway, and is likely better prohibited,
  but that's a separate issue    - Linus ]

Fixes: c3973b401ef2 ("mm: remove compat_process_vm_{readv,writev}")
Reported-and-tested-by: Kyle Huey <me@kylehuey.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/process_vm_access.c

index fd12da80b6f27bab90763d9cca7c43d38f226b06..05676722d9cd6afb98812da6a9b8c471545031fe 100644 (file)
@@ -273,7 +273,8 @@ static ssize_t process_vm_rw(pid_t pid,
                return rc;
        if (!iov_iter_count(&iter))
                goto free_iov_l;
-       iov_r = iovec_from_user(rvec, riovcnt, UIO_FASTIOV, iovstack_r, false);
+       iov_r = iovec_from_user(rvec, riovcnt, UIO_FASTIOV, iovstack_r,
+                               in_compat_syscall());
        if (IS_ERR(iov_r)) {
                rc = PTR_ERR(iov_r);
                goto free_iov_l;