All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH v3] ALSA: control: Add memory consumption limit to user controls
Date: Thu, 08 Apr 2021 13:33:41 +0200	[thread overview]
Message-ID: <s5h1rbl80yy.wl-tiwai@suse.de> (raw)
In-Reply-To: <20210408105025.GB40407@workstation>

On Thu, 08 Apr 2021 12:50:25 +0200,
Takashi Sakamoto wrote:
> 
> Hi,
> 
> Some supplements.
> 
> On Thu, Apr 08, 2021 at 07:31:49PM +0900, Takashi Sakamoto wrote:
> > ALSA control interface allows users to add arbitrary control elements
> > (called "user controls" or "user elements"), and its resource usage is
> > limited just by the max number of control sets (currently 32).  This
> > limit, however, is quite loose: each allocation of control set may
> > have 1028 elements, and each element may have up to 512 bytes (ILP32) or
> > 1024 bytes (LP64) of value data. Moreover, each control set may contain
> > the enum strings and TLV data, which can be up to 64kB and 128kB,
> > respectively.  Totally, the whole memory consumption may go over 38MB --
> > it's quite large, and we'd rather like to reduce the size.
> > 
> > OTOH, there have been other requests even to increase the max number
> > of user elements; e.g. ALSA firewire stack require the more user
> > controls, hence we want to raise the bar, too.
> > 
> > For satisfying both requirements, this patch changes the management of
> > user controls: instead of setting the upper limit of the number of
> > user controls, we check the actual memory allocation size and set the
> > upper limit of the total allocation in bytes.  As long as the memory
> > consumption stays below the limit, more user controls are allowed than
> > the current limit 32. At the same time, we set the lower limit (8MB)
> > as default than the current theoretical limit, in order to lower the
> > risk of DoS.
> > 
> > As a compromise for lowering the default limit, now the actual memory
> > limit is defined as a module option, 'max_user_ctl_alloc_size', so that
> > user can increase/decrease the limit if really needed, too.
> > 
> > Co-developed-by: Takashi Iwai <tiwai@suse.de>
> > Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> > Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> > Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> > ---
> > v1->v2: Drop alloc_size field from user_element, calculate at private_free
> > v2->v3: Rebase. Fix boundary error. Obsolete macro usage relying on modern
> >         compiler optimization. Change comment style by modern coding
> >         convention. Rename module parameter so that users get it easily.
> >         Patch comment improvements.
> > ---
> >  include/sound/core.h |  2 +-
> >  sound/core/control.c | 75 ++++++++++++++++++++++++++++++--------------
> >  2 files changed, 52 insertions(+), 25 deletions(-)
> 
> The original content of patch comes from Iwai-san[1]. I have no clear
> idea to handle the case so add 'Co-developed-by' tag to the patch. If
> this is not good, I apologize the lack of my understanding to the
> development process in Linux kernel.

It depends.  In some cases, you just carry the patch with the original
authorship (From address) and put your sign-off.  In some cases,
Co-developed-by can be used.  I don't mind much either way, so I took
your v3 patch now (with the addition of the Link URL to v2 patch).


Thanks!

Takashi

  reply	other threads:[~2021-04-08 11:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 10:31 [PATCH v3] ALSA: control: Add memory consumption limit to user controls Takashi Sakamoto
2021-04-08 10:50 ` Takashi Sakamoto
2021-04-08 11:33   ` Takashi Iwai [this message]
2021-04-09  2:27     ` Takashi Sakamoto
2021-04-09 10:59       ` Takashi Iwai
2021-04-09 13:34         ` Jaroslav Kysela
2021-04-09 14:18           ` Takashi Iwai
2021-04-10  8:22             ` Takashi Sakamoto
2021-04-10  8:56               ` Takashi Iwai
2021-04-09 16:09         ` Takashi Iwai
2021-04-10  8:20           ` Takashi Sakamoto
2021-04-10  8:47             ` Takashi Iwai
2021-04-18 14:15               ` Takashi Sakamoto
2021-04-18 14:27         ` Takashi Sakamoto
2021-04-18 18:42           ` Jaroslav Kysela

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=s5h1rbl80yy.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=o-takashi@sakamocchi.jp \
    /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 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.