Bug#802651: [Pkg-alsa-devel] Bug#802651: [libasound2] SIG11 on 'aplay -L'

2016-05-15 Thread Michał Mirosław
On Mon, May 09, 2016 at 09:52:41PM +0200, Michał Mirosław wrote:
> On Mon, May 09, 2016 at 02:31:11PM +0200, Elimar Riesebieter wrote:
> > * Michał Mirosław  [2016-05-09 12:07 +0200]:
> > 
> > > On Sun, May 08, 2016 at 05:14:30PM +0200, Elimar Riesebieter
> > > wrote:
> > > > * Michał Mirosław  [2015-10-22 08:46
> > > > +0200]:
> > > > 
> > > > > Package: libasound2 Version: 1.0.28 Severity: normal Tags:
> > > > > patch
> > > > > 
> > > > > --- Please enter the report below this line. ---
> > > > > 
> > > > > 'aplay -L' segfaults with ALSA configuration containing
> > > > > multiple "@hooks" entries. This happens, eg. with
> > > > > libasound2-plugins installed and having one @hooks in
> > > > > /etc/asound.conf like following:
> > > > > 
> > > > > @hooks [ { func load files [ "/usr/share/alsa/bluetooth.conf"
> > > > > ] errors false } ]
> > > > 
> > > > I can reproduce this segfault. Well,
> > > > /usr/share/alsa/bluetooth.conf isn't distributed by any Debian
> > > > package and is not available in my default installation. Do you
> > > > installed that file? Anyway, what is your goal with that hook?
> > > 
> > > Hmm. This comes from bluez-alsa package - it seems this was left
> > > after an upgrade from wheezy (the file is from bluez-alsa
> > > package). This seems irrelevant, though, as you should be able to
> > > trigger the bug with any two files.
> > 
> > Wrong, if I use the existing /usr/share/alsa/smixer.conf instead of
> > /usr/share/alsa/bluetooth.conf there is no segfault.
> > 
> > Could you please provide your bluetooth.conf?
> That's the one from wheezy's bluez-alsa (version 4.99-2). Attached.

BTW, for me, it's enough to put:

@hooks [ { func load files [ "/dev/null" ] } ]

in /etc/asound.conf to make 'aplay -L' blow up.

Best Regards,
Michał Mirosław



Bug#802651: [Pkg-alsa-devel] Bug#802651: [libasound2] SIG11 on 'aplay -L'

2016-05-09 Thread Michał Mirosław
On Mon, May 09, 2016 at 02:31:11PM +0200, Elimar Riesebieter wrote:
> * Michał Mirosław  [2016-05-09 12:07 +0200]:
> 
> > On Sun, May 08, 2016 at 05:14:30PM +0200, Elimar Riesebieter
> > wrote:
> > > * Michał Mirosław  [2015-10-22 08:46
> > > +0200]:
> > > 
> > > > Package: libasound2 Version: 1.0.28 Severity: normal Tags:
> > > > patch
> > > > 
> > > > --- Please enter the report below this line. ---
> > > > 
> > > > 'aplay -L' segfaults with ALSA configuration containing
> > > > multiple "@hooks" entries. This happens, eg. with
> > > > libasound2-plugins installed and having one @hooks in
> > > > /etc/asound.conf like following:
> > > > 
> > > > @hooks [ { func load files [ "/usr/share/alsa/bluetooth.conf"
> > > > ] errors false } ]
> > > 
> > > I can reproduce this segfault. Well,
> > > /usr/share/alsa/bluetooth.conf isn't distributed by any Debian
> > > package and is not available in my default installation. Do you
> > > installed that file? Anyway, what is your goal with that hook?
> > 
> > Hmm. This comes from bluez-alsa package - it seems this was left
> > after an upgrade from wheezy (the file is from bluez-alsa
> > package). This seems irrelevant, though, as you should be able to
> > trigger the bug with any two files.
> 
> Wrong, if I use the existing /usr/share/alsa/smixer.conf instead of
> /usr/share/alsa/bluetooth.conf there is no segfault.
> 
> Could you please provide your bluetooth.conf?

That's the one from wheezy's bluez-alsa (version 4.99-2). Attached.

Best Regards,
Michał Mirosław
# Please note that this ALSA configuration file fragment needs be enabled in
# /etc/asound.conf or a similar configuration file with directives similar to
# the following:
#
#@hooks [
#   {
#   func load
#   files [
#   "/etc/alsa/bluetooth.conf"
#   ]
#   errors false
#   }
#]

pcm.rawbluetooth {
@args [ ADDRESS ]
@args.ADDRESS {
type string
}
type bluetooth
device $ADDRESS
}

pcm.bluetooth {
@args [ ADDRESS ]
@args.ADDRESS {
type string
}
type plug
slave {
pcm {
type bluetooth
device $ADDRESS
}
}
}


Bug#802651: [Pkg-alsa-devel] Bug#802651: [libasound2] SIG11 on 'aplay -L'

2016-05-09 Thread Elimar Riesebieter
* Michał Mirosław  [2016-05-09 12:07 +0200]:

> On Sun, May 08, 2016 at 05:14:30PM +0200, Elimar Riesebieter
> wrote:
> > * Michał Mirosław  [2015-10-22 08:46
> > +0200]:
> > 
> > > Package: libasound2 Version: 1.0.28 Severity: normal Tags:
> > > patch
> > > 
> > > --- Please enter the report below this line. ---
> > > 
> > > 'aplay -L' segfaults with ALSA configuration containing
> > > multiple "@hooks" entries. This happens, eg. with
> > > libasound2-plugins installed and having one @hooks in
> > > /etc/asound.conf like following:
> > > 
> > > @hooks [ { func load files [ "/usr/share/alsa/bluetooth.conf"
> > > ] errors false } ]
> > 
> > I can reproduce this segfault. Well,
> > /usr/share/alsa/bluetooth.conf isn't distributed by any Debian
> > package and is not available in my default installation. Do you
> > installed that file? Anyway, what is your goal with that hook?
> 
> Hmm. This comes from bluez-alsa package - it seems this was left
> after an upgrade from wheezy (the file is from bluez-alsa
> package). This seems irrelevant, though, as you should be able to
> trigger the bug with any two files.

Wrong, if I use the existing /usr/share/alsa/smixer.conf instead of
/usr/share/alsa/bluetooth.conf there is no segfault.

Could you please provide your bluetooth.conf?

Thanks Elimar
-- 
  Do you smell something burning or is it me?



Bug#802651: [Pkg-alsa-devel] Bug#802651: [libasound2] SIG11 on 'aplay -L'

2016-05-09 Thread Michał Mirosław
On Sun, May 08, 2016 at 05:14:30PM +0200, Elimar Riesebieter wrote:
> * Michał Mirosław  [2015-10-22 08:46 +0200]:
> 
> > Package: libasound2
> > Version: 1.0.28
> > Severity: normal
> > Tags: patch
> > 
> > --- Please enter the report below this line. ---
> > 
> > 'aplay -L' segfaults with ALSA configuration containing multiple "@hooks" 
> > entries. This happens, eg. with libasound2-plugins installed and having one 
> > @hooks in /etc/asound.conf like following:
> > 
> > @hooks [
> > {
> > func load
> > files [ 
> > "/usr/share/alsa/bluetooth.conf"
> > ]
> > errors false
> > }
> > ]
> 
> I can reproduce this segfault. Well, /usr/share/alsa/bluetooth.conf
> isn't distributed by any Debian package and is not available in my
> default installation. Do you installed that file? Anyway, what is
> your goal with that hook?

Hmm. This comes from bluez-alsa package - it seems this was left after an 
upgrade
from wheezy (the file is from bluez-alsa package). This seems irrelevant, 
though,
as you should be able to trigger the bug with any two files.

Best Regards,
Michał Mirosław



Bug#802651: [Pkg-alsa-devel] Bug#802651: [libasound2] SIG11 on 'aplay -L'

2016-05-08 Thread Elimar Riesebieter
* Michał Mirosław  [2015-10-22 08:46 +0200]:

> Package: libasound2
> Version: 1.0.28
> Severity: normal
> Tags: patch
> 
> --- Please enter the report below this line. ---
> 
> 'aplay -L' segfaults with ALSA configuration containing multiple "@hooks" 
> entries. This happens, eg. with libasound2-plugins installed and having one 
> @hooks in /etc/asound.conf like following:
> 
> @hooks [
> {
> func load
> files [ 
> "/usr/share/alsa/bluetooth.conf"
> ]
> errors false
> }
> ]

I can reproduce this segfault. Well, /usr/share/alsa/bluetooth.conf
isn't distributed by any Debian package and is not available in my
default installation. Do you installed that file? Anyway, what is
your goal with that hook?

Elimar
-- 
  >what IMHO then?
  IMHO - Inhalation of a Multi-leafed Herbal Opiate ;)
  --posting from alex in debian-user--



Bug#802651: [libasound2] SIG11 on 'aplay -L'

2015-10-22 Thread Michał Mirosław
Package: libasound2
Version: 1.0.28
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

'aplay -L' segfaults with ALSA configuration containing multiple "@hooks" 
entries. This happens, eg. with libasound2-plugins installed and having one 
@hooks in /etc/asound.conf like following:

@hooks [
{
func load
files [ 
"/usr/share/alsa/bluetooth.conf"
]
errors false
}
]

Attached is a fix for the SIG11 alone - it adds a missing error return check 
from snd_config_copy.

There is another bug somewhere that triggers duplicate entry check in 
snd_config_add (called from snd_config_copy). I added following code
in snd_device_name_hint():

snd_output_t *errout;

fprintf(stderr, "* snd_config_copy: %d\n", err);
snd_output_stdio_attach(, stderr, 0);
snd_config_save(local_config, errout);
snd_output_close(errout);

And got this [fragment] that make snd_config_copy() fail (note two '0' entries 
below '@hooks'):

@hooks {
0 {
func pulse_load_if_running
files { 
0 '/usr/share/alsa/pulse-alsa.conf'
}
errors false
}
0 {
func load
files { 
0 '/usr/share/alsa/bluetooth.conf'
}
errors false
}
}

--- System information. ---
Architecture: amd64
Kernel:   Linux 4.2.3mq

Debian Release: 8.2
  900 stable  www.deb-multimedia.org 
  900 stable  security.debian.org 
  900 stable  repos.fds-team.de 
  900 stable  ftp.icm.edu.pl 
  800 oldstable   security.debian.org 
  800 oldstable   ftp.icm.edu.pl 
  700 unstablewww.deb-multimedia.org 
  700 unstableftp.icm.edu.pl 
  600 experimentalftp.icm.edu.pl 
  500 stable  deb.opera.com 
  500 oldstable-proposed-updates ftp.icm.edu.pl 
  500 debian  packages.linuxmint.com 

--- Package information. ---
Package's Depends field is empty.

Package's Recommends field is empty.

Package's Suggests field is empty.commit 57778277e16a2ec735bd42b2f8e7cc2420ebb7f4
Author: Michał Mirosław 
Date:   Thu Oct 22 07:50:01 2015 +0200

snd_device_name_hint: handle snd_config_copy() failure

Fixes: f49b2dc522a2564315c76d075203b15a39941e8a
Signed-off-by: Michał Mirosław 

diff --git a/src/control/namehint.c b/src/control/namehint.c
index b3e646e..1c16362 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -559,6 +559,8 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
 	if (err < 0)
 		return err;
 	err = snd_config_copy(_config_rw, local_config);
+	if (err < 0)
+		goto _copy_error;
 	list.list = NULL;
 	list.count = list.allocated = 0;
 	list.siface = iface;
@@ -634,6 +636,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
 		snd_config_delete(local_config_rw);
 	if (local_config)
 		snd_config_delete(local_config);
+  __copy_error:
 	if (local_config_update)
 		snd_config_update_free(local_config_update);
 	return err;