Re: [PATCH 4.19 06/48] ALSA: seq: oss: Serialize ioctls

From: Takashi Iwai
Date: Mon Aug 10 2020 - 13:53:11 EST


On Mon, 10 Aug 2020 18:37:17 +0200,
Pavel Machek wrote:
>
> Hi!
>
> > commit 80982c7e834e5d4e325b6ce33757012ecafdf0bb upstream.
> >
> > Some ioctls via OSS sequencer API may race and lead to UAF when the
> > port create and delete are performed concurrently, as spotted by a
> > couple of syzkaller cases. This patch is an attempt to address it by
> > serializing the ioctls with the existing register_mutex.
> >
> > Basically OSS sequencer API is an obsoleted interface and was designed
> > without much consideration of the concurrency. There are very few
> > applications with it, and the concurrent performance isn't asked,
> > hence this "big hammer" approach should be good enough.
>
> That really is a "big hammer". And I believe it is too big.
>
> In particular, do we need to drop the lock while sleeping in
> SNDCTL_SEQ_SYNC: => snd_seq_oss_writeq_sync ?

Well, do you see any issue with this for really used applications?
If yes, I'd happily take a look and give finer locking.


thanks,

Takashi