Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 140332 - samba-3.0.23 causes segfault with WINS resolution
Summary: samba-3.0.23 causes segfault with WINS resolution
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Gentoo's SAMBA Team
URL:
Whiteboard:
Keywords:
: 140996 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-07-14 03:33 UTC by Giacomo Graziosi
Modified: 2006-07-20 10:21 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
samba-3.0.23-util_unistr.patch (samba-3.0.23-util_unistr.patch,1.05 KB, patch)
2006-07-20 10:19 UTC, Wiktor Wandachowicz
Details | Diff
samba-3.0.23.ebuild.diff (samba-3.0.23.ebuild.diff,348 bytes, patch)
2006-07-20 10:21 UTC, Wiktor Wandachowicz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Giacomo Graziosi 2006-07-14 03:33:44 UTC
Gdb sessions without debuggin symbols:

flowolf@shannara ~ $ gdb /usr/lib/openoffice/program/soffice.bin
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run
Starting program: /usr/lib/openoffice/program/soffice.bin
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1234700624 (LWP 15266)]
[New Thread -1234834528 (LWP 15271)]
[New Thread -1269122144 (LWP 15272)]
[New Thread -1277650016 (LWP 15273)]
[New Thread -1288836192 (LWP 15274)]
[New Thread -1307313248 (LWP 15280)]
[Thread -1307313248 (LWP 15280) exited]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1234700624 (LWP 15266)]
0xb1886d46 in toupper_w () from /usr/lib/libnss_wins.so.2
(gdb) quit
The program is running.  Exit anyway? (y or n) y



flowolf@shannara ~ $ gdb /usr/lib/mozilla-firefox/firefox-bin
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run
Starting program: /usr/lib/mozilla-firefox/firefox-bin
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1220700496 (LWP 14766)]
[New Thread -1222947936 (LWP 14772)]
[New Thread -1241076832 (LWP 14773)]
[New Thread -1254274144 (LWP 14774)]
[New Thread -1268159584 (LWP 14776)]
[New Thread -1276552288 (LWP 14777)]
[Thread -1268159584 (LWP 14776) exited]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1276552288 (LWP 14777)]
0xb35c8d46 in toupper_w () from /usr/lib/libnss_wins.so.2
(gdb) quit
The program is running.  Exit anyway? (y or n) y


This is where libnss_wins.so came from:

shannara ~ # equery b /usr/lib/libnss_wins.so.2
[ Searching for file(s) /usr/lib/libnss_wins.so.2 in *... ]
net-fs/samba-3.0.23 (/usr/lib/libnss_wins.so.2 -> libnss_wins.so)

And my emerge --info:

shannara ~ # emerge --info
Portage 2.1.1_pre2-r8 (default-linux/x86/2005.1, gcc-4.1.1/vanilla, glibc-2.4-r3, 2.6.16-gentoo-r10 i686)
=================================================================
                       System Settings
=================================================================
System uname: 2.6.16-gentoo-r10 i686 Intel(R) Celeron(R) M processor         1.50GHz
Gentoo Base System version 1.12.1
app-admin/eselect-compiler: 2.0.0_rc2-r1
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.60
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.17
sys-devel/gcc-config: [Not Present]
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r5
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/eselect/compiler /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -march=pentium-m -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://www.die.unipd.it/pub/Linux/distributions/gentoo-sources/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo/"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LINGUAS="en it"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/overlays/main"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 3ds 7zip X a52 aac aalib acpi alsa asf avahi avi berkdb bitmap-fonts bluetooth bogofilter bonjour bonobo boo bzip2 cairo cdinstall cdio cdparanoia cdr cdrom cegui cg cgi chm crypt cups curl daap dba dbus devil directfb djvu dri dts dvd dvdread eds effects encode expat fastcgi fbcon ffmpeg firefox flac foomaticdb gcj gd gdbm gif gimp glade glitz glut glx gmail gnome gphoto2 gpm gsl gstreamer gstreamer010 gtk gtk2 gtkhtml gvim hal howl httpd icq idn ilbc imlib inkjar input_devices_keyboard input_devices_mouse input_devices_synaptics ipod ipv6 irda jabber jack javascript joystick jpeg kdeenablefinal kdehiddenvisibility kqemu libg++ libwww lighttpd live lm_sensors lua mad matroska mbrola mikmod mmx mng mono mozilla moznocompose moznoirc moznomail mp3 mp4 mpeg mplayer musepack musicbrainz mysql mysqli nautilus ncurses nfs nls nodrm nptl nptlonly ntfs ode offensive ogg oggvorbis openal opengl pam pcmcia pcre pdf pdflib perl php plugin png pop postgres ppds python qemu-fast quicktime rar readline real reiserfs rtsp ruby samba scanner sdl session shout skins speex sql sqlite sqlite3 sse sse2 ssl stream subversion svg sysfs syslog tagwriting tcpd theora threads tiff truetype truetype-fonts type1-fonts udev unicode usb userlocales utf8 v4l v4l2 video_cards_i810 vorbis wifi win32codecs x264 xinerama xml xml2 xmlrpc xorg xv xvid zlib elibc_glibc input_devices_evdev kernel_linux linguas_en linguas_it lirc_devices_serial userland_GNU"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Giacomo Graziosi 2006-07-16 16:05:41 UTC
I found a way to "disable" the bug:
changing
hosts:       files dns wins mdns
to
hosts:       files dns mdns
in /etc/nsswitch.conf
appears to be a workaround for the bug.
I tried to recompile samba, glibc and firefox but the problem is still here, this is the only way I found to disable the crashes.
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2006-07-18 20:03:02 UTC
*** Bug 140996 has been marked as a duplicate of this bug. ***
Comment 3 John Russell 2006-07-18 20:05:27 UTC
This Ubuntu thread has a patch for the fix
https://launchpad.net/distros/ubuntu/+source/samba/+bug/39990
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2006-07-18 20:07:01 UTC
Err, can you package.mask this badly broken stuff meanwhile?
Comment 5 Christian Andreetta (RETIRED) gentoo-dev 2006-07-20 04:53:54 UTC
samba-3.0.23 masked. There is also a problem in ldap filter calls...
Staying tuned with upstream.
Comment 6 Wiktor Wandachowicz 2006-07-20 10:19:10 UTC
Created attachment 92325 [details, diff]
samba-3.0.23-util_unistr.patch

I've looked at the Ubuntu patch mentioned and there's a function in the
samba's source, lazy_initialize_conv(). It's already called from within
check_dos_char().

In original it looks like this:

/*
  see if a ucs2 character can be mapped correctly to a dos character
  and mapped back to the same character in ucs2
*/

int check_dos_char(smb_ucs2_t c)
{
        lazy_initialize_conv();

        /* Find the right byte, and right bit within the byte; return
         * 1 or 0 */
        return (doschar_table[(c & 0xffff) / 8] & (1 << (c & 7))) != 0;
}


and the lazy function in question looks like this:


void lazy_initialize_conv(void)
{
        static int initialized = False;

        if (!initialized) {
                initialized = True;
                load_case_tables();
                init_iconv();
        }
}


So I guess it's more efficient to call lazy_initialize_conv() instead
of load_case_tables() every time one of the offending functions gets
called and uses uninitialized tables. This way load_case_tables() is
used as well, but only when necessary.

I've just added a required call to these functions, like this:


/*******************************************************************
 Convert a wchar to upper case.
********************************************************************/

smb_ucs2_t toupper_w(smb_ucs2_t val)
{
        lazy_initialize_conv();
        return upcase_table[SVAL(&val,0)];
}


Is this a good workaround for this bug?
Comment 7 Wiktor Wandachowicz 2006-07-20 10:21:19 UTC
Created attachment 92326 [details, diff]
samba-3.0.23.ebuild.diff

A diff against samba-3.0.23.ebuild from my overlay - for easier reference.