Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC

Bug 432872

Summary: sys-libs/glibc-2.15-r2 - `getent passwd': segmentation fault in __rawmemchr_sse2 () at ../sysdeps/x86_64/multiarch/../rawmemchr.S:38
Product: Gentoo Linux Reporter: Bram Verweij <amverweij>
Component: [OLD] Core systemAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: strace of getent

Description Bram Verweij 2012-08-26 15:02:38 UTC
My system is configured to use LDAP authentication. When the network is unavailable, I'm using nss-db to retrieve the users and groups. These have been stored using nss_updatedb in /var/db/{passwd,group}.db.

I'm experiencing crashes in nss_db. Since my system boots up faster then my network; kdm will crash on first launch. Restarting kdm manually after the network is up works fine. Then, after logging in, I can crash getent. With the network enabled, getent works just fine. However, after disabling networking, getent crashes as well.
Comment 1 Bram Verweij 2012-08-26 15:04:51 UTC
Here is the backtrace from getent:

Program received signal SIGSEGV, Segmentation fault.
__rawmemchr_sse2 () at ../sysdeps/x86_64/multiarch/../rawmemchr.S:38
38      ../sysdeps/x86_64/multiarch/../rawmemchr.S: No such file or directory.
        in ../sysdeps/x86_64/multiarch/../rawmemchr.S
(gdb) bt
#0  __rawmemchr_sse2 () at ../sysdeps/x86_64/multiarch/../rawmemchr.S:38
#1  0x00007ffff61644d4 in _nss_db_getpwent_r (result=0x7ffff7dd7ec0, 
    buffer=0x609360 "ntp", buflen=1024, errnop=0x7ffff7fc86a8)
    at ./nss_files/../nss_db/db-XXX.c:263
#2  0x00007ffff7b2cc7a in __nss_getent_r (getent_func_name=0x7ffff7b9acff
"getpwent_r", 
    setent_func_name=0x7ffff7b9aced "setpwent", lookup_fct=<optimized out>, 
    nip=0x7ffff7dd7fc0, startp=<optimized out>, last_nip=0x7ffff7dd7fd0, 
    stayopen_tmp=0x0, res=0, resbuf=0x7ffff7dd7ec0, buffer=0x609360 "ntp",
buflen=1024, 
    result=0x7fffffffda98, h_errnop=0x0) at getnssent_r.c:164
#3  0x00007ffff7ae8936 in __getpwent_r (resbuf=<optimized out>,
buffer=<optimized out>, 
    buflen=<optimized out>, result=<optimized out>) at ../nss/getXXent_r.c:162
#4  0x00007ffff7b2c883 in __nss_getent (func=0x7ffff7ae88a0 <__getpwent_r>, 
    resbuf=0x7ffff7dd7ec0, buffer=0x7ffff7dd6798, buflen=<optimized out>, 
    buffer_size=0x7ffff7dd7ef0, h_errnop=0x0) at getnssent.c:37
#5  0x00007ffff7ae83c2 in getpwent () at ../nss/getXXent.c:85
#6  0x0000000000402d87 in passwd_keys (number=0, key=<optimized out>) at
getent.c:627
#7  0x000000000040466d in main (argc=<optimized out>, argv=0x7fffffffdc98)
    at getent.c:1008
(gdb)
Comment 2 Bram Verweij 2012-08-26 15:06:16 UTC
Created attachment 322274 [details]
strace of getent
Comment 3 Bram Verweij 2012-08-26 15:08:50 UTC
verweij@sonny ~ $ emerge --info
Portage 2.1.11.9 (default/linux/amd64/10.0/desktop/gnome, gcc-4.5.4, glibc-2.15-r2, 3.4.9-gentoo x86_64)
=================================================================
System uname: Linux-3.4.9-gentoo-x86_64-Intel-R-_Core-TM-_i5-2540M_CPU_@_2.60GHz-with-gentoo-2.1
Timestamp of tree: Thu, 23 Aug 2012 21:30:01 +0000
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.3-r2, 3.2.3
dev-util/cmake:           2.8.8-r3
dev-util/pkgconfig:       0.27
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.5.4
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.4-r2 (virtual/os-headers)
sys-libs/glibc:           2.15-r2
Repositories: gentoo swegener rion
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -mtune=generic -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-march=core2 -mtune=generic -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirrors.linuxant.fr/distfiles.gentoo.org/ http://mirror.leaseweb.com/gentoo/ http://gentoo.tiscali.nl/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="nl de fr en"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/swegener /var/lib/layman/rion"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 avahi berkdb bluetooth bonjour branding bzip2 cairo cdda cdr cjk cleartype cli colord consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr eds emboss encode evo exif fam firefox flac fontconfig fortran g3dvl gallium gdbm gif gnome gnome-keyring gnome-online-accounts gphoto2 gpm gstreamer gtk iconv ipv6 jack java jpeg kde lcms ldap libnotify lm_sensors mad mmx mng modules mp3 mp4 mpeg mudflap multilib nautilus ncurses nls nptl ogg opengl openmp pam pango pcre pdf phonon png policykit ppds pppd pulseaudio qt3support qt4 readline sdl session socialweb spell sse sse2 ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vdpau vorbis wxwidgets x264 xcb xml xv xvid xvmc zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="nl de fr en" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fglrx radeon r600 vesa fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 4 Bram Verweij 2012-08-26 15:15:44 UTC
Steps to reproduce:

1. Start with a system that uses LDAP authentication.

2. Tell the system to use nss_db when the ldap server is not available in /etc/nsswitch.conf:

passwd:      files ldap [NOTFOUND=return] db
group:       files ldap [NOTFOUND=return] db
shadow:      files ldap [NOTFOUND=return] db

3. Use "nss_updatedb ldap" (when connected to the LDAP server) to generate /var/db/{passwd,group}.db

4. Disconnect from the network

5. getent passwd
Comment 5 Bram Verweij 2012-08-26 15:20:44 UTC
I'm using nss_db succesfully on two other systems (one x86, one amd64) with a similar setup. However they are still on glibc-2.14.1-r3, with a separate libnss_db. Unfortunatey downgrading glibc doesn't seem that straightforward...
Comment 6 Bram Verweij 2012-08-29 23:15:08 UTC
It seems that glibc doesn't use db4.8 for its databases anymore, which is what nss_updatedb generates. No wonder that it crashes.

Instead there is a utility called "makedb". This subject is covered by Section 2.16 of the FAQ (/usr/share/doc/glibc-2.15-r2/FAQ.bz2). However, the db-Makefile that is provided generates /var/db/passwd.db exclusively from /etc/passwd, which does not contain the ldap users. Anyway the db-Makefile does give the awk needed to process the output of getent passwd, so rejoice! The problem is solved. It is just the pam_ccreds documentation that is out-of-date.