Re: [PULL] vhost: cleanups and fixes

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
2018-11-01 23:06:41
Also in
kvm, lkml
Reply to
Kees Cook, 2018-11-01
On Thu, Nov 1, 2018 at 4:00 PM Kees Cook [off-list ref] wrote:
+       memset(&rsp, 0, sizeof(rsp));
+       rsp.response = VIRTIO_SCSI_S_FUNCTION_REJECTED;
+       resp = vq->iov[out].iov_base;
+       ret = __copy_to_user(resp, &rsp, sizeof(rsp));

Is it actually safe to trust that iov_base has passed an earlier
access_ok() check here? Why not just use copy_to_user() instead?
Good point.

We really should have removed those double-underscore things ages ago.

Also, apart from the address, what about the size? Wouldn't it be
better to use copy_to_iter() rather than implement it badly by hand?

               Linus
Thread (19 messages) 19 messages, 6 authors, last reply 2018-11-30
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help