lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 24 Apr 2018 15:27:27 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Baolin Wang <baolin.wang@...aro.org>
Cc:     Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Takashi Sakamoto <o-takashi@...amocchi.jp>,
        Ingo Molnar <mingo@...nel.org>,
        SF Markus Elfring <elfring@...rs.sourceforge.net>,
        Dan Carpenter <dan.carpenter@...cle.com>, jeeja.kp@...el.com,
        Vinod Koul <vinod.koul@...el.com>,
        Guneshwor Singh <guneshwor.o.singh@...el.com>,
        subhransu.s.prusty@...el.com, Bhumika Goyal <bhumirks@...il.com>,
        gudishax.kranthikumar@...el.com, Naveen M <naveen.m@...el.com>,
        hardik.t.shah@...el.com, Arvind Yadav <arvind.yadav.cs@...il.com>,
        Fabian Frederick <fabf@...net.be>, alsa-devel@...a-project.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 8/8] ALSA: add new 32-bit layout for snd_pcm_mmap_status/control

On Tue, Apr 24, 2018 at 2:06 PM, Baolin Wang <baolin.wang@...aro.org> wrote:

> @@ -544,6 +543,8 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
>         case SNDRV_PCM_IOCTL_XRUN:
>         case SNDRV_PCM_IOCTL_LINK:
>         case SNDRV_PCM_IOCTL_UNLINK:
> +       case __SNDRV_PCM_IOCTL_SYNC_PTR32:
> +       case __SNDRV_PCM_IOCTL_SYNC_PTR64:
>                 return snd_pcm_common_ioctl(file, substream, cmd, argp);
>         case SNDRV_PCM_IOCTL_HW_REFINE32:
>                 return snd_pcm_ioctl_hw_params_compat(substream, 1, argp);
> @@ -555,8 +556,6 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
>                 return snd_pcm_status_user32(substream, argp, false);
>         case SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT32:
>                 return snd_pcm_status_user32(substream, argp, true);
> -       case SNDRV_PCM_IOCTL_SYNC_PTR32:
> -               return snd_pcm_ioctl_sync_ptr_compat(substream, argp);
>         case SNDRV_PCM_IOCTL_CHANNEL_INFO32:
>                 return snd_pcm_ioctl_channel_info_compat(substream, argp);
>         case SNDRV_PCM_IOCTL_WRITEI_FRAMES32:

I found a bug here while doing some more testing on my own patch:
__SNDRV_PCM_IOCTL_SYNC_PTR64 has the same value as
SNDRV_PCM_IOCTL_SYNC_PTR_X32, so we get a duplicate case
error when CONFIG_X86_X32 is enabled. We still need both handlers,
so the fix I came up with is:

diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index 51a9447442f3..dbeeae50fb8d 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -543,8 +543,13 @@ static long snd_pcm_ioctl_compat(struct file
*file, unsigned int cmd, unsigned l
        case SNDRV_PCM_IOCTL_XRUN:
        case SNDRV_PCM_IOCTL_LINK:
        case SNDRV_PCM_IOCTL_UNLINK:
-       case __SNDRV_PCM_IOCTL_SYNC_PTR32:
        case __SNDRV_PCM_IOCTL_SYNC_PTR64:
+#ifdef CONFIG_X86_X32
+               if (in_x32_syscall())
+                       return snd_pcm_ioctl_sync_ptr_x32(substream, argp);
+               /* fallthru */
+#endif /* CONFIG_X86_X32 */
+       case __SNDRV_PCM_IOCTL_SYNC_PTR32:
                return snd_pcm_common_ioctl(file, substream, cmd, argp);
        case SNDRV_PCM_IOCTL_HW_REFINE32:
                return snd_pcm_ioctl_hw_params_compat(substream, 1, argp);
@@ -577,8 +582,6 @@ static long snd_pcm_ioctl_compat(struct file
*file, unsigned int cmd, unsigned l
        case SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64:
                return snd_pcm_status_user_compat64(substream, argp, true);
 #ifdef CONFIG_X86_X32
-       case SNDRV_PCM_IOCTL_SYNC_PTR_X32:
-               return snd_pcm_ioctl_sync_ptr_x32(substream, argp);
        case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32:
                return snd_pcm_ioctl_channel_info_x32(substream, argp);
 #endif /* CONFIG_X86_X32 */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ