Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 91130 - cvs: symbol lookup error: cvs: undefined symbol: crypt
Summary: cvs: symbol lookup error: cvs: undefined symbol: crypt
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-02 01:13 UTC by Michael Caine
Modified: 2009-12-31 01:48 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Caine 2005-05-02 01:13:01 UTC
cvs (1.11.20, default) emerged just fine (--info below), but running cvs now produces:
    cvs: symbol lookup error: cvs: undefined symbol: crypt
arguments don't make any difference.

Reproducible: Always
Steps to Reproduce:
1.run cvs (any command; even just typing cvs and hitting enter produces this error, rather than a usage message)

Actual Results:  
see "Detail" section, bove. 

Expected Results:  
I expect CVS to run. 

Portage 2.0.51.19 (default-linux/ppc64/2005.0, gcc-3.4.3, 
glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r6 ppc64) 
================================================================= 
System uname: 2.6.11-gentoo-r6 ppc64 PPC970FX, altivec supported 
Gentoo Base System version 1.4.16 
Python:              dev-lang/python-2.3.4-r1 [2.3.4 (#1, May  1 2005, 
23:22:55)] 
dev-lang/python:     2.3.4-r1 
sys-apps/sandbox:    [Not Present] 
sys-devel/autoconf:  2.13, 2.59-r6 
sys-devel/automake:  1.8.5-r3, 1.5, 1.7.9-r1, 1.6.3, 1.4_p6, 1.9.4 
sys-devel/binutils:  2.15.90.0.3-r4 
sys-devel/libtool:   1.5.16 
virtual/os-headers:  2.6.8.1-r2 
ACCEPT_KEYWORDS="ppc64" 
AUTOCLEAN="yes" 
CFLAGS="-O2 -pipe" 
CHOST="powerpc64-unknown-linux-gnu" 
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" 
CXXFLAGS="-O2 -pipe" 
DISTDIR="/usr/portage/distfiles" 
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict" 
GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://adelie.polymtl.ca/ 
ftp://cs.ubishops.ca/pub/gentoo ftp://gentoo.risq.qc.ca/ 
ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo 
http://csociety-ftp.ecn.purdue.edu/pub/gentoo/ 
ftp://csociety-ftp.ecn.purdue.edu/pub/gentoo/" 
MAKEOPTS="-j3" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR="/usr/portage" 
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage" 
USE="X alsa apache2 arts berkdb bitmap-fonts cdr crypt cups curl dvd encode 
ethereal fam fortran gif gpm hardened imap jabber jack java jpeg kde ladcca mad 
motif mp3 mpeg ncurses nls ogg oggvorbis opengl oss pam perl png postgres ppc64 
python qt readline samba session sox speex spell ssl tcltk tcpd tiff truetype 
truetype-fonts type1-fonts unicode usb vorbis wifi xine xml2 xv zlib 
userland_GNU kernel_linux libc_glibc" 
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, 
PORTDIR_OVERLAY
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-05-02 12:14:09 UTC
please provide the output from:
ldd `which cvs`
nm /lib/libcrypt.so.1 | grep crypt

I really don't know how you broke your system libs (libcrypt is provided by glibc).
Comment 2 Michael Caine 2005-05-02 21:55:28 UTC
<g> I don't know how I broke them either... I don't think I've done anything particularly interesting.  Are there common ways to wind up in such a predicament?  --pretend said:
   [ebuild   R   ] sys-libs/glibc-2.3.4.20041102-r1
I re-emerged glibc, successfully.  Before doing so, the output you asked for looked like this:

# ldd `which cvs`
        libnsl.so.1 => /lib/libnsl.so.1 (0x0000008000033000)
        libc.so.6 => /lib/libc.so.6 (0x0000008000059000)
        /lib64/ld64.so.1 (0x0000008000000000)
# nm /lib/libcrypt.so.1 | grep crypt
nm: /lib/libcrypt.so.1: no symbols

But only nominally different after:

# ldd `which cvs`
        libnsl.so.1 => /lib/libnsl.so.1 (0x0000008000033000)
        libc.so.6 => /lib/libc.so.6 (0x000000800005a000)
        /lib64/ld64.so.1 (0x0000008000000000)
# nm /lib/libcrypt.so.1 | grep crypt
nm: /lib/libcrypt.so.1: no symbols
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-05-03 03:00:02 UTC
did it work after you merged glibc again?

My CVS (on ~x86) is linked against a lot more stuff:
x29 / # ldd `which cvs`
        linux-gate.so.1 =>  (0xffffe000)
        librt.so.1 => /lib/tls/librt.so.1 (0xb7fc4000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7f95000)
        libnsl.so.1 => /lib/libnsl.so.1 (0xb7f7f000)
        libz.so.1 => /lib/libz.so.1 (0x419a8000)
        libpam.so.0 => /lib/libpam.so.0 (0xb7f77000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb7e4a000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7e37000)
        /lib/ld-linux.so.2 (0xb7fea000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7e32000)
Comment 4 solar (RETIRED) gentoo-dev 2005-05-03 08:10:18 UTC
Don't use nm. It's not very effetive in case the of stripping.
Use rather.

readelf -s /lib/libcrypt.so.1 | grep [' ','\t']crypt

glibc should provide the symbol.
Comment 5 Michael Caine 2005-05-03 15:30:34 UTC
I believe this and a couple of other problems I've been having are related to my 'hardened' USE flag -- I've now removed that flag and am trying to rebuild gcc/glibc/etc., but am getting segfaults upon compilations.  And I just rebooted for the first time since I started this effort and the kernel crashed.  So I'm in a bit of a hosed state that I'll be trying to work my way out of and then I'll report back, hopefully with something useful for closing this bug out one way or another.
Comment 6 Michael Caine 2005-05-04 11:30:19 UTC
I've resolved this bug by un-hardening my machine.  Shall we mark it resolved and/or completely pass on to the hardened team?
Comment 7 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-05-04 12:23:28 UTC
hardened: user has found this bug went away after he un-hardened his machine, ergo I suspect the problem lies in your court.
Comment 8 solar (RETIRED) gentoo-dev 2005-05-04 15:47:46 UTC
Sure I'll take this one with dostrow who said he would confirm this later tonite.
Comment 9 Tom Gall (RETIRED) gentoo-dev 2005-10-17 19:45:22 UTC
any update on this one?  
Comment 10 solar (RETIRED) gentoo-dev 2005-10-19 11:25:33 UTC
Sorry no.. dostrow and myself have not had a chance to work much together 
on ppc64 support.
Comment 11 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2006-09-30 13:31:30 UTC
hardened: *bump*
is the problem still present, or can this bug be closed?
Comment 12 Tom Gall (RETIRED) gentoo-dev 2007-01-02 10:43:36 UTC
hardened? Comments?

Comment 13 solar (RETIRED) gentoo-dev 2007-01-02 16:29:04 UTC
Just tested and yes this is still a problem.
tested from a vanilla ppc64 and simply switched to some hardened specs.


power5 / # gcc-config -l
 [1] powerpc64-unknown-linux-gnu-3.4.4
 [2] powerpc64-unknown-linux-gnu-3.4.4-hardened *
 [3] powerpc64-unknown-linux-gnu-3.4.4-hardenednopie
 [4] powerpc64-unknown-linux-gnu-3.4.4-hardenednopiessp
 [5] powerpc64-unknown-linux-gnu-3.4.4-hardenednossp
 [6] powerpc64-unknown-linux-gnu-4.1.1
 

power5 / # env USE=crypt emerge cvs
..
power5 / # cvs
cvs: symbol lookup error: cvs: undefined symbol: crypt

power5 / # scanelf -Bn `which cvs`
ET_DYN libnsl.so.1,libz.so.1,libpam.so.0,libc.so.6 /usr/bin/cvs 

power5 / # qlist -Uv cvs
dev-util/cvs-1.12.12-r2 (crypt pam)

And of course.

power5 / # LD_PRELOAD=/lib/libcrypt.so.1 cvs
Usage: cvs [cvs-options] command [command-options-and-arguments]

---

The fix is simple.

inherit flag-o-matic

..

src_compile() {
...
    use crypt && apppend-ldflags -lcrypt
..
}
Comment 14 Kevin F. Quinn (RETIRED) gentoo-dev 2007-01-03 05:11:48 UTC
When built vanilla on ppc64, does the executable have the entry for libcrypt?

I'm assuming it's failing on hardened due to BIND_NOW (forcing all symbol references to be resolved at load time).  If this is the case, then the vanilla version has unresolvable references that would probably segfault if the code path that uses them is taken.

What does the configure phase (config.log et. al.) show? (why is it failing to locate and include lcrypt?)
Comment 15 solar (RETIRED) gentoo-dev 2007-01-03 10:34:05 UTC
Non hardened compiler thats gcc-4.1.1 based results in
power5 / # scanelf -Bn `which cvs`
ET_EXEC librt.so.1,libcrypt.so.1,libnsl.so.1,libz.so.1,libpam.so.0,libc.so.6 /usr/bin/cvs 

Then switching back to gcc-3.x-hardened.specs
./configure --stuff ...
...
checking for library containing crypt... none required

This is probably due to symbol visibility in pic objects.
Comment 16 Kevin F. Quinn (RETIRED) gentoo-dev 2007-01-03 11:09:43 UTC
config.log should show why it thinks it doesn't need the library - it tries to build a simple program that uses crypt, which should fail to link; e.g.:

configure:36691: checking for library containing crypt
configure:36721: i686-pc-linux-gnu-gcc -o conftest -O2 -pipe conftest.c -lresolv -lcom_err -lnsl  >&5
/data/g2/tmp/portage/dev-util/cvs-1.12.12-r2/temp/ccSnLZfL.o: In function `main':
/data/g2/tmp/portage/dev-util/cvs-1.12.12-r2/work/cvs-1.12.12/conftest.c:258: undefined reference to `crypt'
collect2: ld returned 1 exit status
configure:36727: $? = 1
configure: failed program was:
...


It'd be useful to know what's in config.log for the case where the test decides libcrypt is not required (i.e. gcc-3 - hmm; I take it that the configure check is ok when using gcc-3 vanilla?).  There's a comment in the configure script that suggests there's a built-in crypt() in gcc2 that it has to explicitly avoid - so perhaps there's something similar happening.
Comment 17 solar (RETIRED) gentoo-dev 2007-01-03 15:22:08 UTC
Yeah maybe. but the solution in comment #15 simply works.
Comment 18 solar (RETIRED) gentoo-dev 2007-01-03 15:22:59 UTC
comment #13 rather..

inherit flag-o-matic

..

src_compile() {
...
    use crypt && append-ldflags -lcrypt
..
Comment 19 Kevin F. Quinn (RETIRED) gentoo-dev 2007-01-03 16:48:56 UTC
Certainly :)  I'm worrying about the more general case - if the configure check (which comes from simple use of the standard AC_SEARCH_LIBS macro) isn't working right in this particular case, maybe it also fails elsewhere.
Comment 20 solar (RETIRED) gentoo-dev 2007-01-03 17:09:32 UTC
Oh it for sure fails elsewhere. This has been a long standing problem from nearly hardened day 0x03.. 
Comment 21 Markus Rothe (RETIRED) gentoo-dev 2007-03-29 15:03:00 UTC
this is a hardened bug, not a ppc64 one.
Comment 22 Jory A. Pratt gentoo-dev 2009-12-31 01:48:40 UTC
This appears to be fixed, no comments in almost 2 years. Reopen if problem still persists.