The Samba-Bugzilla – Bug 8104
Crash in libnss_wins.so (in nss_wins_init)
Last modified: 2011-04-26 14:53:37 UTC
This bug, originally reported in https://bugs.launchpad.net/ubuntu/+source/samba/+bug/529714, causes Banshee to crash and burn miserably when attempting to resolve a hostname during startup. I don't think this crash it limited to Banshee though.
According to the stacktrace (full text found at https://launchpadlibrarian.net/69547170/Stacktrace.txt),
we have a crash at
#5 0x00007f1c488d2fb4 in nss_wins_init (hostname=0x3f00b70 "one.ubuntu.com", he=0x7f1c54597b00, buffer=0x7f1c545977f0 "\377\002", buflen=512, h_errnop=<value optimized out>) at ../nsswitch/wins.c:95
That file/lineno points to this:
DEBUGLEVEL = 0;
where DEBUGLEVEL resolves to *debug_level somewhere or other. I reckon the crash arises from debug_level not being set to an appropriate address.
Created attachment 6426 [details]
Patch to change debug_level to smb_debug_level
Cross-posting from https://bugs.launchpad.net/ubuntu/+source/samba/+bug/529714/comments/54,
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.
In the future, I would like to remove all the complexity of wins.c and convert it into a very small layer calling winbind via libwbclient. This is the real solution IMHO.