Bug 8104 - Crash in libnss_wins.so (in nss_wins_init)
Summary: Crash in libnss_wins.so (in nss_wins_init)
Status: NEW
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: Winbind (show other bugs)
Version: 3.5.8
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Michael Adam
QA Contact: Samba QA Contact
Depends on:
Reported: 2011-04-23 20:50 UTC by Chow Loong Jin
Modified: 2011-04-26 14:53 UTC (History)
0 users

See Also:

Patch to change debug_level to smb_debug_level (1.45 KB, patch)
2011-04-26 14:42 UTC, Chow Loong Jin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chow Loong Jin 2011-04-23 20:50:25 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.
Comment 1 Chow Loong Jin 2011-04-26 14:42:39 UTC
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

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.
Comment 2 Volker Lendecke 2011-04-26 14:53:37 UTC
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.