![](https://secure.gravatar.com/avatar/5b19e9d0e834ea10ef75803718ad564b.jpg?s=120&d=mm&r=g)
On Fri, 08 Oct 2021 13:45:45 +0200, Arnd Bergmann wrote:
On Fri, Oct 8, 2021 at 1:11 PM Takashi Iwai tiwai@suse.de wrote:
On Fri, 08 Oct 2021 11:24:39 +0200, Arnd Bergmann wrote:
I've tried to understand this part of musl's convert_ioctl_struct(), but I just can't figure out whether it does the conversion based the on the layout that is currently used in the kernel, or based on the layout we should have been using, and would use with the above fix. Rich, can you help me here?
So, at this moment, I'm not sure whether we should correct the struct at all. This will lead to yet more breakage, and basically the struct itself *works* -- the only bug is in 32bit compat handling in the kernel (again).
I'm still unsure if the musl fallback code is correct or not.
We need to verify the current behavior in anyway...
The below is a revised kernel patch (again untested), just correcting the behavior of 32bit compat mode. 32bit apps on 32bit kernel work fine as is, as well as 64bit apps on 64bit kernel.
Right, this should cover all cases of the ioctl itself misbehaving. In addition, we still need to disallow the mmap() interface on compat kernels then. Strictly speaking, we could allow the snd_pcm_mmap_status but not snd_pcm_mmap_control to be mapped, but I'm not sure if that's better than disallowing both.
IIRC, the compat mmap is already disallowed even for the SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW (in pcm_control_mmap_allowed()), so no need to change around that.
thanks,
Takashi