Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Cc: alsa-devel@alsa-project.org, Jaroslav Kysela <perex@perex.cz>
Subject: Re: [PATCH 6/8] ALSA: emu10k1: add support for 2x/4x word clocks in E-MU D.A.S. mode
Date: Wed, 14 Jun 2023 08:36:47 +0200	[thread overview]
Message-ID: <87sfaublds.wl-tiwai@suse.de> (raw)
In-Reply-To: <ZIij6mdc1utyBD93@ugly>

On Tue, 13 Jun 2023 19:14:18 +0200,
Oswald Buddenhagen wrote:
> 
> On Tue, Jun 13, 2023 at 05:43:58PM +0200, Takashi Iwai wrote:
> >> the notion of "malicious" is meaningless in this context. a valid
> >> attack vector would allow the application to do something that i
> >> cannot do otherwise. hogging a cpu thread while flooding the system
> >> with meaningless ioctls is something an app can do regardless, so
> >> whatever.
> > 
> > Adding/deleting kctl increases the numid.  It grows and grows.
> > 
> as the code handles numid wraparound just fine, that would be a rather
> pointless attack.
> 
> > Crashing an existing application is the worst-case scenario.
> > 
> a new driver (which this effectively is) crashing a broken application
> is perfectly legitimate, as it doesn't affect any existing users.

No, you can't ignore it.

> >> that would indeed be a problem, but fortunately the put() callback is
> >> nowadays invoked with a write lock (see also commit 06405d8ee).
> > 
> > Oh well, that's really not a change to be advertised for creating /
> > deleting kctls from the put callback at all.
> > 
> and? it's done, and it's basically impossible to revert. so we may
> reap its full benefits just as well, as i did in that previous commit.

Well, I can revert your commit, too...
Basically the content protection shouldn't be covered by this rwsem.
It's rather a misuse.

> > Sorry, but my answer is same: NO.  I see no reason why kctl deletion
> > and creation _must_ be implemented _inevitably_ in that way.
> > 
> being the most straight-forward way to implement it certainly
> qualifies as a good reason for doing it that way.
> and i still see no convincing reason why it shouldn't.

I still see no convincing reason why it must be done so, either.
The way you're trying to implement is an anti-pattern, not seen in
other drivers that have been developed over decades.

> > Actually, snd_ctl_remove() should be changed back to a version that
> > takes the lock by itself instead.  There is no reason to have a helper
> > without the lock called from leaf drivers.
> > 
> well, except that this driver shows that there _is_ a reason. one may
> choose to throw stones in one's own way, but that's rarely a wise
> decision ...

The fact that it has to take a rwsem from the caller side itself is a
very bad design, and it should be corrected at best.  The rwsem there
is rather an internal stuff and shouldn't be taken explicitly.  Most
of its use outside control.c is an abuse.


Takashi

  reply	other threads:[~2023-06-14  6:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13  7:38 [PATCH 0/8] ALSA: emu10k1: add support for high-bitrate modes of E-MU cards Oswald Buddenhagen
2023-06-13  7:38 ` [PATCH 1/8] ALSA: emu10k1: introduce alternative E-MU D.A.S. mode Oswald Buddenhagen
2023-06-13  7:38 ` [PATCH 2/8] ALSA: emu10k1: improve mixer control naming in " Oswald Buddenhagen
2023-06-13  7:38 ` [PATCH 3/8] ALSA: emu10k1: set the "no filtering" bits on PCM voices Oswald Buddenhagen
2023-06-13  7:38 ` [PATCH 4/8] ALSA: emu10k1: make playback in E-MU D.A.S. mode 32-bit Oswald Buddenhagen
2023-06-13  7:38 ` [PATCH 5/8] ALSA: add snd_ctl_add_locked() Oswald Buddenhagen
2023-06-13  7:38 ` [PATCH 6/8] ALSA: emu10k1: add support for 2x/4x word clocks in E-MU D.A.S. mode Oswald Buddenhagen
2023-06-13  9:20   ` Takashi Iwai
2023-06-13 10:52     ` Oswald Buddenhagen
2023-06-13 11:08       ` Takashi Iwai
2023-06-13 14:00         ` Oswald Buddenhagen
2023-06-13 14:13           ` Takashi Iwai
2023-06-13 15:23             ` Oswald Buddenhagen
2023-06-13 15:43               ` Takashi Iwai
2023-06-13 17:14                 ` Oswald Buddenhagen
2023-06-14  6:36                   ` Takashi Iwai [this message]
2023-06-14  8:52                     ` Oswald Buddenhagen
2023-06-14  9:16                       ` Takashi Iwai
2023-06-14 10:53                         ` Oswald Buddenhagen
2023-06-13  7:38 ` [PATCH 7/8] ALSA: emu10k1: add high-rate capture " Oswald Buddenhagen
2023-06-13  7:38 ` [PATCH 8/8] ALSA: emu10k1: add high-rate playback " Oswald Buddenhagen
2023-06-22  7:05   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfaublds.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=oswald.buddenhagen@gmx.de \
    --cc=perex@perex.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox