2018-03-14 21:37:47

by Sonny Rao

[permalink] [raw]
Subject: [PATCH v2] vhost: add vsock compat ioctl

This will allow usage of vsock from 32-bit binaries on a 64-bit
kernel.

Signed-off-by: Sonny Rao <[email protected]>
---
drivers/vhost/vsock.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index 0d14e2ff19f16..ee0c385d9fe54 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -699,12 +699,23 @@ static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl,
}
}

+#ifdef CONFIG_COMPAT
+static long vhost_vsock_dev_compat_ioctl(struct file *f, unsigned int ioctl,
+ unsigned long arg)
+{
+ return vhost_vsock_dev_ioctl(f, ioctl, (unsigned long)compat_ptr(arg));
+}
+#endif
+
static const struct file_operations vhost_vsock_fops = {
.owner = THIS_MODULE,
.open = vhost_vsock_dev_open,
.release = vhost_vsock_dev_release,
.llseek = noop_llseek,
.unlocked_ioctl = vhost_vsock_dev_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = vhost_vsock_dev_compat_ioctl,
+#endif
};

static struct miscdevice vhost_vsock_misc = {
--
2.13.5



2018-03-16 14:30:09

by Stefan Hajnoczi

[permalink] [raw]
Subject: Re: [PATCH v2] vhost: add vsock compat ioctl

On Wed, Mar 14, 2018 at 02:36:25PM -0700, Sonny Rao wrote:
> This will allow usage of vsock from 32-bit binaries on a 64-bit
> kernel.
>
> Signed-off-by: Sonny Rao <[email protected]>
> ---
> drivers/vhost/vsock.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)

Reviewed-by: Stefan Hajnoczi <[email protected]>


Attachments:
(No filename) (335.00 B)
signature.asc (465.00 B)
Download all attachments