On Tue, 2011-04-26 at 13:28 +0000, Chow Loong Jin wrote:
> Okay, I think I've found the issue, based on a crash with liferea:-
>
> At wins.c:95, we have
> DEBUGLEVEL = 0;
>
> Somewhere in source3/include/debug.h, we have
> #define DEBUGLEVEL *debug_level
> extern int DEBUGLEVEL;
>
> In source3/lib/debug.c, we have:
> int DEBUGLEVEL = &debug_all_class_hack;
>
>
> Based on this, all seems well and good, except that due to a problematic build system, libnss_wins.so dynamically resolves this debug_level variable when loaded by libc. In the case of liferea, it uses a global int debug_level somewhere around its source code. I reckon the other applications that are affected by this bug also use something similar.
>
> Given that Natty is really near, and I reckon it's too late to be trying
> something grand like controlling what symbols do and do not get
> exported/dynamically resolved during load, I have come up with a patch
> that renames debug_level to smb_debug_level in source3/include/debug.h.
> This should solve the issue for the time being.
I'm surprised nss modules aren't loaded with RTLD_DEEPBIND specified.
This is a flag for dlopen() that allows you to indicate that module
local symbols should preferred to global ones.
From the manpage:
RTLD_DEEPBIND (since glibc 2.3.4)
Place the lookup scope of the symbols in this library ahead of
the global scope. This means that a self-contained library
will use its own symbols in preference to global symbols with
the same name contained in libraries that have already been
loaded. This flag is not specified in POSIX.1-2001.
On Tue, 2011-04-26 at 13:28 +0000, Chow Loong Jin wrote: include/ debug.h, we have lib/debug. c, we have: all_class_ hack; dynamically resolved during load, I have come up with a patch include/ debug.h.
> Okay, I think I've found the issue, based on a crash with liferea:-
>
> At wins.c:95, we have
> DEBUGLEVEL = 0;
>
> Somewhere in source3/
> #define DEBUGLEVEL *debug_level
> extern int DEBUGLEVEL;
>
> In source3/
> int DEBUGLEVEL = &debug_
>
>
> Based on this, all seems well and good, except that due to a problematic build system, libnss_wins.so dynamically resolves this debug_level variable when loaded by libc. In the case of liferea, it uses a global int debug_level somewhere around its source code. I reckon the other applications that are affected by this bug also use something similar.
>
> Given that Natty is really near, and I reckon it's too late to be trying
> something grand like controlling what symbols do and do not get
> exported/
> that renames debug_level to smb_debug_level in source3/
> This should solve the issue for the time being.
I'm surprised nss modules aren't loaded with RTLD_DEEPBIND specified.
This is a flag for dlopen() that allows you to indicate that module
local symbols should preferred to global ones.
From the manpage:
RTLD_DEEPBIND (since glibc 2.3.4)
Place the lookup scope of the symbols in this library ahead of
the global scope. This means that a self-contained library
will use its own symbols in preference to global symbols with
the same name contained in libraries that have already been
loaded. This flag is not specified in POSIX.1-2001.
Cheers,
Jelmer