[alsa-devel] segmentation fault for snd_pcm_open after sudden removal for USB Camera (with USB Mic)

Kuldeep Ghan dhp764 at motorola.com
Fri Jul 13 20:29:15 CEST 2012


Hi All,

I am seeing segmentation fault in alsa-lib while recording using USB
Camera. Following is the test setup

1. Moto Razr (Android ICS, alsa-lib 1.0.24.1) is connected to Smart Dock
2. USB Camera (Philips SPC 1330NC) is connected to Razr through dock

While Video recording from USB Camera, suddenly Power Cable of Dock or USB
camera is removed, effectively resulting in USB camera removal from Razr.
The recording continues with still view, but when I stop recording session,
the snd_pcm_open to Play stop tone results in the crash as shown below.
Although we are using internal device mic for capture, the USB camera has
USB microphone which gets enumerated as card2, device 0.

I did some debugging with help of prints in alsa-lib but was not really
helpful to point to root cause. Logs with my added prints for snd_pcm_open
successful(*successful_open.txt*) and segmentation fault(*segfault_open.txt*)
case are attached.

I am not very familiar with alsa-lib internals. Is this a known issue?

Segmentation fault goes away with upgrade of alsa-lib to 1.0.25. But
currently Kernel is 1.0.24, and we can't upgrade the kernel at this time,
so is there any problem running lib 25 wither kernel 24?  If so, do you
have any suggestion of what fixes from .25 I should try back-porting?"

07-13 14:42:14.517   160   312 D AudioHardwareALSA: openOutputStream called
for devices: 0x00000002
07-13 14:42:14.517   160   312 D Omap4ALSA: open called for devices
00000002 in mode 0...
07-13 14:42:14.524   160   312 F libc    : Fatal signal 11 (SIGSEGV) at
0x00008140 (code=1)
07-13 14:42:14.532  6173  6173 I DEBUG   : *** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
07-13 14:42:14.532  6173  6173 I DEBUG   : Build fingerprint:
'ATT/edison_att_us/edison:4.0.4/6.7.2_245/3202:userdebug/test-keys'
07-13 14:42:14.532  6173  6173 I DEBUG   : pid: 160, tid: 312  >>>
/system/bin/mediaserver <<<
07-13 14:42:14.532  6173  6173 I DEBUG   : signal 11 (SIGSEGV), code 1
(SEGV_MAPERR), fault addr 00008140
07-13 14:42:14.532  6173  6173 I DEBUG   : tls: 41623f00
07-13 14:42:14.532  6173  6173 I DEBUG   :
07-13 14:42:14.532  6173  6173 I DEBUG   :  r0 0050e7fd  r1 00000004  r2
00000011  r3 00008130
07-13 14:42:14.532  6173  6173 I DEBUG   :  r4 b0009f58  r5 41623928  r6
4162390c  r7 000081fc
07-13 14:42:14.532  6173  6173 I DEBUG   :  r8 0000841c  r9 41623928  10
003e1dd0  fp 4162398c
07-13 14:42:14.532  6173  6173 I DEBUG   :  ip 00755f6c  sp 416238d0  lr
b00039f3  pc b00039f6  cpsr 48000030
07-13 14:42:14.532  6173  6173 I DEBUG   :  d0  636e75665f646e67  d1
6c75616665642e65
07-13 14:42:14.532  6173  6173 I DEBUG   :  d2  612f61736c612f74  d3
666e6f632e617365
07-13 14:42:14.532  6173  6173 I DEBUG   :  d4  0000000000000000  d5
0000100000000000
07-13 14:42:14.532  6173  6173 I DEBUG   :  d6  0000100045800000  d7
0000100000000000
07-13 14:42:14.532  6173  6173 I DEBUG   :  d8  0000000000000000  d9
0000000000000000
07-13 14:42:14.532  6173  6173 I DEBUG   :  d10 0000000000000000  d11
0000000000000000
07-13 14:42:14.532  6173  6173 I DEBUG   :  d12 0000000000000000  d13
0000000000000000
07-13 14:42:14.532  6173  6173 I DEBUG   :  d14 0000000000000000  d15
0000000000000000
07-13 14:42:14.532  6173  6173 I DEBUG   :  d16 0000000006ba1000  d17
3fdfffffe8287c00
07-13 14:42:14.532  6173  6173 I DEBUG   :  d18 3fe0000000000000  d19
3fe000000bebc200
07-13 14:42:14.532  6173  6173 I DEBUG   :  d20 0000000000000000  d21
0000000000000000
07-13 14:42:14.532  6173  6173 I DEBUG   :  d22 0000000000000000  d23
0000000000000000
07-13 14:42:14.540  6173  6173 I DEBUG   :  d24 0000000000000000  d25
0000000000000000
07-13 14:42:14.540  6173  6173 I DEBUG   :  d26 0000000000000000  d27
0000000000000000
07-13 14:42:14.540  6173  6173 I DEBUG   :  d28 0000000000000000  d29
0000000000000000
07-13 14:42:14.540  6173  6173 I DEBUG   :  d30 0000000000000000  d31
0000000000000000
07-13 14:42:14.540  6173  6173 I DEBUG   :  scr 80000010
07-13 14:42:14.540  6173  6173 I DEBUG   :
07-13 14:42:15.126  6173  6173 I DEBUG   :          #00  pc b00039f6
/system/bin/linker
07-13 14:42:15.126  6173  6173 I DEBUG   :          #01  lr b00039f3
/system/bin/linker
07-13 14:42:15.126  6173  6173 I DEBUG   :
07-13 14:42:15.126  6173  6173 I DEBUG   : code around pc:
07-13 14:42:15.126  6173  6173 I DEBUG   : b00039d4 00005b8e 47f0e92d
f8d04604 469170b0  .[..-..G.F...p.F
07-13 14:42:15.126  6173  6173 I DEBUG   : b00039e4 80acf8d0 f8d44608
f7fd10b4 f8d4ef4e  .....F......N...
07-13 14:42:15.134  6173  6173 I DEBUG   : b00039f4 f85330bc e0125021
187e0129 46495878  .0S.!P..).~.xXIF
07-13 14:42:15.134  6173  6173 I DEBUG   : b0003a04 f7fd4440 b930ece8
09037b30 2a011e5a  @D....0.0{..Z..*
07-13 14:42:15.134  6173  6173 I DEBUG   : b0003a14 89f1d801 f8d4b931
f85660c0 2d005025  ....1....`V.%P.-
07-13 14:42:15.134  6173  6173 I DEBUG   :
07-13 14:42:15.134  6173  6173 I DEBUG   : code around lr:
07-13 14:42:15.134  6173  6173 I DEBUG   : b00039d0 00011708 00005b8e
47f0e92d f8d04604  .....[..-..G.F..
07-13 14:42:15.134  6173  6173 I DEBUG   : b00039e0 469170b0 80acf8d0
f8d44608 f7fd10b4  .p.F.....F......
07-13 14:42:15.134  6173  6173 I DEBUG   : b00039f0 f8d4ef4e f85330bc
e0125021 187e0129  N....0S.!P..).~.
07-13 14:42:15.134  6173  6173 I DEBUG   : b0003a00 46495878 f7fd4440
b930ece8 09037b30  xXIF at D....0.0{..
07-13 14:42:15.134  6173  6173 I DEBUG   : b0003a10 2a011e5a 89f1d801
f8d4b931 f85660c0  Z..*....1....`V.
07-13 14:42:15.134  6173  6173 I DEBUG   :
07-13 14:42:15.134  6173  6173 I DEBUG   : memory map around addr 00008140:
07-13 14:42:15.134  6173  6173 I DEBUG   : (no map below)
07-13 14:42:15.134  6173  6173 I DEBUG   : (no map for address)
07-13 14:42:15.134  6173  6173 I DEBUG   : 003dc000-0047f000 [heap]
07-13 14:42:15.134  6173  6173 I DEBUG   :
07-13 14:42:15.134  6173  6173 I DEBUG   : stack:
07-13 14:42:15.134  6173  6173 I DEBUG   :     41623890  00000000
07-13 14:42:15.134  6173  6173 I DEBUG   :     41623894  00000000
07-13 14:42:15.134  6173  6173 I DEBUG   :     41623898  00000000
07-13 14:42:15.134  6173  6173 I DEBUG   :     4162389c  00000000
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238a0  400ec588
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238a4  ffffffff
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238a8  410d3eb8
/system/lib/libasound.so
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238ac  416238d4
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238b0  003e1dd0  [heap]
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238b4  416238d0
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238b8  416238cc
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238bc  4162392c
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238c0  416238fc
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238c4  055f67d1
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238c8  df0027ad
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238cc  00000000
07-13 14:42:15.134  6173  6173 I DEBUG   : #00 416238d0  b0009f58
/system/bin/linker
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238d4  41623928
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238d8  4162390c
07-13 14:42:15.134  6173  6173 I DEBUG   :     416238dc  055f67d1
07-13 14:42:15.142  6173  6173 I DEBUG   :     416238e0  41623928
07-13 14:42:15.142  6173  6173 I DEBUG   :     416238e4  00476150  [heap]
07-13 14:42:15.142  6173  6173 I DEBUG   :     416238e8  003e1dd0  [heap]
07-13 14:42:15.142  6173  6173 I DEBUG   :     416238ec  b0003d65
/system/bin/linker
07-13 14:42:15.142  6173  6173 I DEBUG   :     416238f0  ffffffff
07-13 14:42:15.142  6173  6173 I DEBUG   :     416238f4  4108ee80
/system/lib/libasound.so
07-13 14:42:15.142  6173  6173 I DEBUG   :     416238f8  41623928
07-13 14:42:15.142  6173  6173 I DEBUG   :     416238fc  ffffffff
07-13 14:42:15.142  6173  6173 I DEBUG   :     41623900  41623928
07-13 14:42:15.142  6173  6173 I DEBUG   :     41623904  b0005817
/system/bin/linker
07-13 14:42:15.142  6173  6173 I DEBUG   :     41623908  ffffffff
07-13 14:42:15.142  6173  6173 I DEBUG   :     4162390c  41623928
07-13 14:42:15.142  6173  6173 I DEBUG   :     41623910  410e19e4
/system/lib/libasound.so
07-13 14:42:15.142  6173  6173 I DEBUG   :     41623914  ffffff84


Thanks,
Kuldeep
-------------- next part --------------
160   595 D AudioHardwareMot: AudioStreamOutMot::getParameters() Fm-radio=
160   595 I MotUsbCameraHal: startRecording
160   327 D AudioHardwareALSA: openOutputStream called for devices: 0x00000002
160   327 D ALSA-LIB: open called for devices 00000002 in mode 0...
160   327 D         : snd_config_update 3746
160   327 D         : snd_config_update_r 3594
160   327 D         : snd_config_update_r 3615
160   327 D         : snd_config_update_r 3625
160   327 D         : snd_config_update_r 3639
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 hw:00
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4748
160   327 D         : snd_config_expand 4633
160   327 D         : snd_config_expand 4645
160   327 D         : snd_config_expand 4647
160   327 D         : snd_config_expand 4650
160   327 D         : snd_config_expand 4656
160   327 D         : snd_config_search_definition 4750
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 hw
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 hw
160   327 D ALSA-LIB: handle 0x6c55a0 device Name default
160   327 D         : snd_pcm_open 2242 default DHP764
160   327 D         : snd_config_update 3746
160   327 D         : snd_config_update_r 3594
160   327 D         : snd_config_update_r 3615
160   327 D         : snd_config_update_r 3625
160   327 D         : snd_config_update_r 3639
160   327 D         : snd_pcm_open 2244
160   327 D         : snd_pcm_open 2247
160   327 D         : snd_pcm_open_noupdate 2209 default 
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 default
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4748
160   327 D         : snd_config_expand 4633
160   327 D         : snd_config_expand 4645
160   327 D         : snd_config_expand 4647
160   327 D         : snd_config_expand 4650
160   327 D         : snd_config_expand 4656
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 getenv
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 getenv
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 refer
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 refer
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 defaults.pcm.card
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4748
160   327 D         : snd_config_expand 4633
160   327 D         : snd_config_expand 4640
160   327 D         : snd_config_search_definition 4750
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 refer
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 refer
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 concat
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 concat
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 card_driver
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 card_driver
160   327 D         : snd_config_update 3746
160   327 D         : snd_config_update_r 3594
160   327 D         : snd_config_update_r 3615
160   327 D         : snd_config_update_r 3625
160   327 D         : snd_config_update_r 3639
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 hw:0
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4748
160   327 D         : snd_config_expand 4633
160   327 D         : snd_config_expand 4645
160   327 D         : snd_config_expand 4647
160   327 D         : snd_config_expand 4650
160   327 D         : snd_config_expand 4656
160   327 D         : snd_config_search_definition 4750
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 hw
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 hw
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 cards..pcm.default:CARD=0
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 cards..pcm.default:CARD=0
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 refer
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 refer
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 defaults.pcm.dmix.device
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4748
160   327 D         : snd_config_expand 4633
160   327 D         : snd_config_expand 4640
160   327 D         : snd_config_search_definition 4750
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 refer
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 refer
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 defaults.pcm.dsnoop.device
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4748
160   327 D         : snd_config_expand 4633
160   327 D         : snd_config_expand 4640
160   327 D         : snd_config_search_definition 4750
160   327 D         : snd_config_search_definition 4750
160   327 D         : snd_pcm_open_noupdate 2216
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 empty
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 empty
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 plug
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 plug
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 hw
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 hw
160   327 D         : snd_pcm_open_noupdate 2224
160   327 D ALSA-LIB: handle 0x6c55a0 device Name default
-------------- next part --------------
160   327 D AudioHardwareALSA: openOutputStream called for devices: 0x00000002
160   327 D ALSA-LIB: open called for devices 00000002 in mode 0...
160   327 D         : snd_config_update 3746
160   327 D         : snd_config_update_r 3594
160   327 D         : snd_config_update_r 3615
160   327 D         : snd_config_update_r 3625
160   327 D         : snd_config_update_r 3639
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 hw:00
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4748
160   327 D         : snd_config_expand 4633
160   327 D         : snd_config_expand 4645
160   327 D         : snd_config_expand 4647
160   327 D         : snd_config_expand 4650
160   327 D         : snd_config_expand 4656
160   327 D         : snd_config_search_definition 4750
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 hw
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 hw
160   327 D ALSA-LIB: handle 0x6c55a0 device Name default
160   327 D         : snd_pcm_open 2242 default DHP764
160   327 D         : snd_config_update 3746
160   327 D         : snd_config_update_r 3594
160   327 D         : snd_config_update_r 3615
160   327 D         : snd_config_update_r 3625
160   327 D         : snd_config_update_r 3639
160   327 D         : snd_pcm_open 2244
160   327 D         : snd_pcm_open 2247
160   327 D         : snd_pcm_open_noupdate 2209 default 
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 default
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4748
160   327 D         : snd_config_expand 4633
160   327 D         : snd_config_expand 4645
160   327 D         : snd_config_expand 4647
160   327 D         : snd_config_expand 4650
160   327 D         : snd_config_expand 4656
160   327 D         : snd_config_search_definition 4724
160   327 D         : snd_config_search_definition 4733 0 getenv
160   327 D         : snd_config_search_definition 4738
160   327 D         : snd1_config_search_alias_hooks 3193
160   327 D         : snd_config_search_definition 4741
160   327 D         : snd_config_search_definition 4743
160   327 D         : snd_config_search_definition 4745 -2 getenv
160   327 F libc    : Fatal signal 11 (SIGSEGV) at 0x00008140 (code=1)
720  2720 I DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***


More information about the Alsa-devel mailing list