Re: [PATCH for-3.19] vhost/net: fix up num_buffers endian-ness

2015-02-04 Thread Al Viro
On Wed, Feb 04, 2015 at 01:59:42PM -0800, David Miller wrote: From: Michael S. Tsirkin m...@redhat.com Date: Tue, 3 Feb 2015 11:07:06 +0200 In virtio 1.0 mode, when mergeable buffers are enabled on a big-endian host, num_buffers wasn't byte-swapped correctly, so large incoming packets

[PATCH v3 18/18] vhost: vhost_scsi_handle_vq() should just use copy_from_user()

2015-02-03 Thread Al Viro
From: Al Viro v...@zeniv.linux.org.uk it has just verified that it asks no more than the length of the first segment of iovec. And with that the last user of stuff in lib/iovec.c is gone. RIP. Cc: Michael S. Tsirkin m...@redhat.com Cc: Nicholas A. Bellinger n...@linux-iscsi.org Cc: kvm

[PATCH v3 17/18] vhost: don't bother copying iovecs in handle_rx(), kill memcpy_toiovecend()

2015-02-03 Thread Al Viro
From: Al Viro v...@zeniv.linux.org.uk Cc: Michael S. Tsirkin m...@redhat.com Cc: kvm@vger.kernel.org Cc: virtualizat...@lists.linux-foundation.org Signed-off-by: Al Viro v...@zeniv.linux.org.uk --- drivers/vhost/net.c | 82 +++-- include/linux

[PATCH v3 16/18] vhost: don't bother with copying iovec in handle_tx()

2015-02-03 Thread Al Viro
From: Al Viro v...@zeniv.linux.org.uk just advance the msg.msg_iter and be done with that. Cc: Michael S. Tsirkin m...@redhat.com Cc: kvm@vger.kernel.org Cc: virtualizat...@lists.linux-foundation.org Signed-off-by: Al Viro v...@zeniv.linux.org.uk --- drivers/vhost/net.c | 9 + 1 file

[PATCH v3 15/18] vhost: switch vhost get_indirect() to iov_iter, kill memcpy_fromiovec()

2015-02-03 Thread Al Viro
From: Al Viro v...@zeniv.linux.org.uk Cc: Michael S. Tsirkin m...@redhat.com Cc: kvm@vger.kernel.org Cc: virtualizat...@lists.linux-foundation.org Signed-off-by: Al Viro v...@zeniv.linux.org.uk --- drivers/vhost/vhost.c | 6 -- include/linux/uio.h | 1 - lib/iovec.c | 25

Re: [PATCH v2 17/18] vhost: don't bother copying iovecs in handle_rx(), kill memcpy_toiovecend()

2015-02-03 Thread Al Viro
On Tue, Feb 03, 2015 at 04:21:54PM +0100, Michael S. Tsirkin wrote: Hmm having second thoughts here. Will this modify the iov in vq-iov? If yes, how will recvmsg fill it? OK that was just me misunderstanding what the function does. As it doesn't modify the iovec itself, I think there's

Re: [PATCH-v3 5/9] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-03 Thread Al Viro
On Tue, Feb 03, 2015 at 06:29:59AM +, Nicholas A. Bellinger wrote: + * Copy over the virtio-scsi request header, which when + * ANY_LAYOUT is enabled may span multiple iovecs, or a + * single iovec may contain both the header + outgoing +

[PATCH v2 17/18] vhost: don't bother copying iovecs in handle_rx(), kill memcpy_toiovecend()

2015-02-02 Thread Al Viro
From: Al Viro v...@zeniv.linux.org.uk Cc: Michael S. Tsirkin m...@redhat.com Cc: kvm@vger.kernel.org Signed-off-by: Al Viro v...@zeniv.linux.org.uk --- drivers/vhost/net.c | 79 ++--- include/linux/uio.h | 3 -- lib/iovec.c | 26

[PATCH v2 18/18] vhost: vhost_scsi_handle_vq() should just use copy_from_user()

2015-02-02 Thread Al Viro
From: Al Viro v...@zeniv.linux.org.uk it has just verified that it asks no more than the length of the first segment of iovec. And with that the last user of stuff in lib/iovec.c is gone. RIP. Cc: Michael S. Tsirkin m...@redhat.com Cc: Nicholas A. Bellinger n...@linux-iscsi.org Cc: kvm

[PATCH v2 15/18] vhost: switch vhost get_indirect() to iov_iter, kill memcpy_fromiovec()

2015-02-02 Thread Al Viro
From: Al Viro v...@zeniv.linux.org.uk Cc: Michael S. Tsirkin m...@redhat.com Cc: kvm@vger.kernel.org Signed-off-by: Al Viro v...@zeniv.linux.org.uk --- drivers/vhost/vhost.c | 6 -- include/linux/uio.h | 1 - lib/iovec.c | 25 - 3 files changed, 4

[PATCH v2 16/18] vhost: don't bother with copying iovec in handle_tx()

2015-02-02 Thread Al Viro
From: Al Viro v...@zeniv.linux.org.uk just advance the msg.msg_iter and be done with that. Cc: Michael S. Tsirkin m...@redhat.com Cc: kvm@vger.kernel.org Signed-off-by: Al Viro v...@zeniv.linux.org.uk --- drivers/vhost/net.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff

Re: [PATCH-v2 01/11] lib/iovec: Add memcpy_fromiovec_out library function

2015-02-01 Thread Al Viro
On Mon, Feb 02, 2015 at 04:06:24AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a new memcpy_fromiovec_out() library function which modifies the passed *iov following memcpy_fromiovec(), but also returns the next current iovec pointer

Re: [PATCH-v2 01/11] lib/iovec: Add memcpy_fromiovec_out library function

2015-02-01 Thread Al Viro
On Mon, Feb 02, 2015 at 04:44:12AM +, Al Viro wrote: On Mon, Feb 02, 2015 at 04:06:24AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a new memcpy_fromiovec_out() library function which modifies the passed *iov following

Re: [PATCH] vfio-pci: Use fdget() rather than eventfd_fget()

2013-08-20 Thread Al Viro
On Tue, Aug 20, 2013 at 01:18:07PM -0600, Alex Williamson wrote: eventfd_fget() tests to see whether the file is an eventfd file, which we then immediately pass to eventfd_ctx_fileget(), which again tests whether the file is an eventfd file. Simplify slightly by using fdget() so that we only

Re: [PATCH] vfio-pci: PCI hot reset interface

2013-08-19 Thread Al Viro
pulling file.h; move that include there. Switch from eventfd_fget()/fput() to fdget()/fdput(), while we are at it - eventfd_ctx_fileget() will fail on non-eventfd descriptors just fine, no need to do that check twice... Signed-off-by: Al Viro v...@zeniv.linux.org.uk --- diff --git a/include/linux

Re: [patch 1/2] vhost: potential integer overflows

2010-10-11 Thread Al Viro
On Mon, Oct 11, 2010 at 07:22:57PM +0200, Dan Carpenter wrote: I did an audit for potential integer overflows of values which get passed to access_ok() and here are the results. FWIW, UINT_MAX is wrong here. What you want is maximal size_t value. Signed-off-by: Dan Carpenter

Re: [KVM PATCH v4 1/2] eventfd: export eventfd interfaces for module use

2009-05-04 Thread Al Viro
On Mon, May 04, 2009 at 01:57:45PM -0400, Gregory Haskins wrote: @@ -56,6 +57,7 @@ int eventfd_signal(struct file *file, int n) return n; } +EXPORT_SYMBOL_GPL(eventfd_signal); perhaps, but... @@ -197,6 +199,7 @@ struct file *eventfd_fget(int fd) return file; }

Re: [KVM PATCH v3 2/2] kvm: add support for irqfd via eventfd-notification interface

2009-05-03 Thread Al Viro
On Mon, Apr 27, 2009 at 02:33:34PM -0400, Gregory Haskins wrote: + /* We re-use eventfd for irqfd */ + fd = sys_eventfd2(0, 0); + if (fd 0) { + ret = fd; + goto fail; + } + + /* We maintain a reference to eventfd for the irqfd lifetime */ +

Re: [KVM PATCH v3 2/2] kvm: add support for irqfd via eventfd-notification interface

2009-05-03 Thread Al Viro
On Sun, May 03, 2009 at 11:07:26AM -0700, Davide Libenzi wrote: On Sun, 3 May 2009, Al Viro wrote: On Mon, Apr 27, 2009 at 02:33:34PM -0400, Gregory Haskins wrote: + /* We re-use eventfd for irqfd */ + fd = sys_eventfd2(0, 0); + if (fd 0) { + ret = fd; + goto

file descriptor abuses

2009-05-03 Thread Al Viro
On Sun, May 03, 2009 at 08:01:36PM +0100, Al Viro wrote: General rules: * descriptor you've generated is fit only for return to userland; * descriptor you've got from userland is fit only for *single* fget() or equivalent, unless you are one of the core syscalls manipulating