* [PATCH v3] ALSA: compress: add support for 32bit calls in a 64bit kernel
@ 2015-12-07 6:38 Ravindra Lokhande
2015-12-07 9:34 ` Vinod Koul
2015-12-07 9:52 ` Takashi Iwai
0 siblings, 2 replies; 4+ messages in thread
From: Ravindra Lokhande @ 2015-12-07 6:38 UTC (permalink / raw)
To: vinod.koul, perex, tiwai; +Cc: alsa-devel, Ravindra Lokhande
Compress offload does not support ioctl calls from a 32bit userspace
in a 64 bit kernel. This patch adds support for ioctls from a 32bit
userspace in a 64bit kernel
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
---
v1 -> v2: use compat_ptr to convert 32 bit address to 64 bit pointer
v2 -> v3: add header file compat.h
sound/core/compress_offload.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index b123c42..4597820 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -38,6 +38,7 @@
#include <linux/uio.h>
#include <linux/uaccess.h>
#include <linux/module.h>
+#include <linux/compat.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/compress_params.h>
@@ -847,6 +848,15 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
return retval;
}
+/* support of 32bit userspace on 64bit platforms */
+#ifdef CONFIG_COMPAT
+static long snd_compr_ioctl_compat(struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ return snd_compr_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
+}
+#endif
+
static const struct file_operations snd_compr_file_ops = {
.owner = THIS_MODULE,
.open = snd_compr_open,
@@ -854,6 +864,9 @@ static const struct file_operations snd_compr_file_ops = {
.write = snd_compr_write,
.read = snd_compr_read,
.unlocked_ioctl = snd_compr_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = snd_compr_ioctl_compat,
+#endif
.mmap = snd_compr_mmap,
.poll = snd_compr_poll,
};
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] ALSA: compress: add support for 32bit calls in a 64bit kernel
2015-12-07 6:38 [PATCH v3] ALSA: compress: add support for 32bit calls in a 64bit kernel Ravindra Lokhande
@ 2015-12-07 9:34 ` Vinod Koul
2015-12-07 9:44 ` Takashi Iwai
2015-12-07 9:52 ` Takashi Iwai
1 sibling, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2015-12-07 9:34 UTC (permalink / raw)
To: Ravindra Lokhande; +Cc: alsa-devel, tiwai
On Mon, Dec 07, 2015 at 12:08:31PM +0530, Ravindra Lokhande wrote:
> Compress offload does not support ioctl calls from a 32bit userspace
> in a 64 bit kernel. This patch adds support for ioctls from a 32bit
> userspace in a 64bit kernel
>
> Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
> ---
>
> v1 -> v2: use compat_ptr to convert 32 bit address to 64 bit pointer
> v2 -> v3: add header file compat.h
>
> sound/core/compress_offload.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> index b123c42..4597820 100644
> --- a/sound/core/compress_offload.c
> +++ b/sound/core/compress_offload.c
> @@ -38,6 +38,7 @@
> #include <linux/uio.h>
> #include <linux/uaccess.h>
> #include <linux/module.h>
> +#include <linux/compat.h>
> #include <sound/core.h>
> #include <sound/initval.h>
> #include <sound/compress_params.h>
> @@ -847,6 +848,15 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
> return retval;
> }
>
> +/* support of 32bit userspace on 64bit platforms */
> +#ifdef CONFIG_COMPAT
> +static long snd_compr_ioctl_compat(struct file *file, unsigned int cmd,
> + unsigned long arg)
> +{
> + return snd_compr_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
> +}
> +#endif
> +
> static const struct file_operations snd_compr_file_ops = {
> .owner = THIS_MODULE,
> .open = snd_compr_open,
> @@ -854,6 +864,9 @@ static const struct file_operations snd_compr_file_ops = {
> .write = snd_compr_write,
> .read = snd_compr_read,
> .unlocked_ioctl = snd_compr_ioctl,
> +#ifdef CONFIG_COMPAT
> + .compat_ioctl = snd_compr_ioctl_compat,
> +#endif
While this change is okay and required, I can't help wondering why the core
does not take care of this.
When a driver does not support compat_ioctl as it was done recently and
takes care of 32/64 bit issues we should call ioctl for that driver..
Neverthless, Acked-by Vinod Koul <vinod.koul@intel.com>
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] ALSA: compress: add support for 32bit calls in a 64bit kernel
2015-12-07 9:34 ` Vinod Koul
@ 2015-12-07 9:44 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-12-07 9:44 UTC (permalink / raw)
To: Vinod Koul; +Cc: alsa-devel, Ravindra Lokhande
On Mon, 07 Dec 2015 10:34:00 +0100,
Vinod Koul wrote:
>
> On Mon, Dec 07, 2015 at 12:08:31PM +0530, Ravindra Lokhande wrote:
> > Compress offload does not support ioctl calls from a 32bit userspace
> > in a 64 bit kernel. This patch adds support for ioctls from a 32bit
> > userspace in a 64bit kernel
> >
> > Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
> > ---
> >
> > v1 -> v2: use compat_ptr to convert 32 bit address to 64 bit pointer
> > v2 -> v3: add header file compat.h
> >
> > sound/core/compress_offload.c | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> > diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> > index b123c42..4597820 100644
> > --- a/sound/core/compress_offload.c
> > +++ b/sound/core/compress_offload.c
> > @@ -38,6 +38,7 @@
> > #include <linux/uio.h>
> > #include <linux/uaccess.h>
> > #include <linux/module.h>
> > +#include <linux/compat.h>
> > #include <sound/core.h>
> > #include <sound/initval.h>
> > #include <sound/compress_params.h>
> > @@ -847,6 +848,15 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
> > return retval;
> > }
> >
> > +/* support of 32bit userspace on 64bit platforms */
> > +#ifdef CONFIG_COMPAT
> > +static long snd_compr_ioctl_compat(struct file *file, unsigned int cmd,
> > + unsigned long arg)
> > +{
> > + return snd_compr_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
> > +}
> > +#endif
> > +
> > static const struct file_operations snd_compr_file_ops = {
> > .owner = THIS_MODULE,
> > .open = snd_compr_open,
> > @@ -854,6 +864,9 @@ static const struct file_operations snd_compr_file_ops = {
> > .write = snd_compr_write,
> > .read = snd_compr_read,
> > .unlocked_ioctl = snd_compr_ioctl,
> > +#ifdef CONFIG_COMPAT
> > + .compat_ioctl = snd_compr_ioctl_compat,
> > +#endif
>
> While this change is okay and required, I can't help wondering why the core
> does not take care of this.
The core can't know whether it's 100% compatible. So NULL means it's
not compatible.
Takashi
> When a driver does not support compat_ioctl as it was done recently and
> takes care of 32/64 bit issues we should call ioctl for that driver..
>
> Neverthless, Acked-by Vinod Koul <vinod.koul@intel.com>
>
> --
> ~Vinod
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] ALSA: compress: add support for 32bit calls in a 64bit kernel
2015-12-07 6:38 [PATCH v3] ALSA: compress: add support for 32bit calls in a 64bit kernel Ravindra Lokhande
2015-12-07 9:34 ` Vinod Koul
@ 2015-12-07 9:52 ` Takashi Iwai
1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-12-07 9:52 UTC (permalink / raw)
To: Ravindra Lokhande; +Cc: vinod.koul, alsa-devel
On Mon, 07 Dec 2015 07:38:31 +0100,
Ravindra Lokhande wrote:
>
> Compress offload does not support ioctl calls from a 32bit userspace
> in a 64 bit kernel. This patch adds support for ioctls from a 32bit
> userspace in a 64bit kernel
>
> Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
> ---
>
> v1 -> v2: use compat_ptr to convert 32 bit address to 64 bit pointer
> v2 -> v3: add header file compat.h
Applied now with Vinod's ack. Thanks.
Takashi
>
> sound/core/compress_offload.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> index b123c42..4597820 100644
> --- a/sound/core/compress_offload.c
> +++ b/sound/core/compress_offload.c
> @@ -38,6 +38,7 @@
> #include <linux/uio.h>
> #include <linux/uaccess.h>
> #include <linux/module.h>
> +#include <linux/compat.h>
> #include <sound/core.h>
> #include <sound/initval.h>
> #include <sound/compress_params.h>
> @@ -847,6 +848,15 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
> return retval;
> }
>
> +/* support of 32bit userspace on 64bit platforms */
> +#ifdef CONFIG_COMPAT
> +static long snd_compr_ioctl_compat(struct file *file, unsigned int cmd,
> + unsigned long arg)
> +{
> + return snd_compr_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
> +}
> +#endif
> +
> static const struct file_operations snd_compr_file_ops = {
> .owner = THIS_MODULE,
> .open = snd_compr_open,
> @@ -854,6 +864,9 @@ static const struct file_operations snd_compr_file_ops = {
> .write = snd_compr_write,
> .read = snd_compr_read,
> .unlocked_ioctl = snd_compr_ioctl,
> +#ifdef CONFIG_COMPAT
> + .compat_ioctl = snd_compr_ioctl_compat,
> +#endif
> .mmap = snd_compr_mmap,
> .poll = snd_compr_poll,
> };
> --
> 2.1.4
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-07 9:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-07 6:38 [PATCH v3] ALSA: compress: add support for 32bit calls in a 64bit kernel Ravindra Lokhande
2015-12-07 9:34 ` Vinod Koul
2015-12-07 9:44 ` Takashi Iwai
2015-12-07 9:52 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.