[vlc-devel] Re: Strange crash on Solaris

Alexander Gall gall at switch.ch
Fri Dec 15 14:22:35 CET 2006

I was able to identify this phenomenon as a bug in gcc 3.4.3 that is
bundled with Solaris 11 (opensolaris).  I'll describe it breifly here
in case somebody else encounters it.

It appears that starting with version 3.4, gcc assigns static
variables that are initialized to 0 to the .bss ELF section rather
than the .data section to save space in the object file.  This
particular version of gcc miscalculates the size of the .bss section
in certain cases.  This causes some variables to be located outside
the space allocated to the .bss section at load time, which explains
the effect described in my original posting.

As a workaround, one needs to disable this feature with the
-fno-zero-initialized-in-bss option.


On Mon, 4 Dec 2006 15:55:08 +0100, Alexander Gall <gall at switch.ch> said:

> Sorry about the unspecific subject, but I just couldn't find a short
> way to describe this issue :-)

> I'm seeing a strange effect when building a current trunk snapshot on
> Solaris 11 with gcc 3.4.3 and the native Solaris linker.  When I run
> vlc, it crashes in src/misc/variables.c:DupList()

> Program received signal SIGSEGV, Segmentation fault.
> 0xff20f7cc in DupList (p_val=0x133360) at misc/variables.c:81
> 81              p_list->p_values[i] = p_val->p_list->p_values[i];
> (gdb) bt
> #0  0xff20f7cc in DupList (p_val=0x133360) at misc/variables.c:81
> #1  0xff2126b8 in __var_Create (p_this=0x314b8, psz_name=0xff22b340 "programs", i_type=32912) at misc/variables.c:272
> #2  0xff1cf12c in input_ControlVarInit (p_input=0x314b8) at input/var.c:130
> #3  0xff1c33f8 in Create (p_parent=0x0, p_item=0x31438, psz_header=0x0, b_quick=0) at input/input.c:200
> #4  0xff1c975c in __input_Read (p_parent=0x303a8, p_item=0x31438, b_block=1) at input/input.c:315
> #5  0xff1b3ae0 in playlist_MLLoad (p_playlist=0x303a8) at playlist/loadsave.c:107
> #6  0xff1b3140 in playlist_Create (p_parent=0x270f8) at playlist/engine.c:153
> #7  0xff1adedc in __playlist_ThreadCreate (p_parent=0x270f8) at playlist/thread.c:204
> #8  0xff19f484 in libvlc_InternalInit (p_libvlc=0x270f8, i_argc=1, ppsz_argv=0xffbfebbc) at libvlc-common.c:866
> #9  0xff19c3c0 in VLC_Init (i_object=0, i_argc=194376, ppsz_argv=0xffbfebbc) at libvlc.c:123
> #10 0x0001178c in main (i_argc=1, ppsz_argv=0xffbfebbc) at src/vlc.c:102

> It turns out that this is because the static dummy_null_list of
> src/misc/variables.c:__var_Create() gets overwritten at some point.  I
> tracked this to the peculiar fact that dummy_null_list is stored at
> the exact same place as the file-scope variable from_locale in
> src/text/unicode.c.  When I break at the first invocation of
> __var_Create(), I see this:

> (gdb) run
> Starting program: /usr/local/bin/vlc 
> warning: Lowest section in /lib/librt.so.1 is .dynamic at 00000074
> warning: Lowest section in /lib/libpthread.so.1 is .dynamic at 00000074
> Breakpoint 3 at 0xff1fac64: file text/unicode.c, line 95.
> Pending breakpoint "LocaleInit" resolved
> Breakpoint 4 at 0xff2122fc: file ../include/vlc_threads_funcs.h, line 79.
> Pending breakpoint "__var_Create" resolved
> VLC media player 0.9.0-svn Grishenko

> Breakpoint 4, __var_Create (p_this=0xff24d990, psz_name=0xff233df0 "list", 
>     i_type=8256) at ../include/vlc_threads_funcs.h:79
> (gdb) p &from_locale
> $1 = (locale_data_t *) 0xff24d988
> (gdb) print &dummy_null_list
> $2 = (vlc_list_t *) 0xff24d988

> dummy_null_list gets corrupted as soon as from_locale is initialized
> in src/text/unicode.c:LocaleInit().

> How can this be?  Compiler or linker bug?

> --
> Alex

This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html

More information about the vlc-devel mailing list