Bug 3531 - All idmap plugins core dump winbindd on AIX
Summary: All idmap plugins core dump winbindd on AIX
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: winbind (show other bugs)
Version: 3.0.21b
Hardware: Other AIX
: P3 major
Target Milestone: none
Assignee: William Jojo
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-20 15:53 UTC by David Shapiro
Modified: 2006-03-10 17:20 UTC (History)
3 users (show)

See Also:


Attachments
core from winbindd when trying to use idmap rid (12.87 KB, application/octet-stream)
2006-02-20 16:12 UTC, David Shapiro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Shapiro 2006-02-20 15:53:19 UTC
All idmap plugins core dump winbindd.  It looks like they do not like pthreads in aix.  I am using 5.2.0.7 aix.  The compiler is gcc 4.0.2 with thread model: aix.

(gdb) core-file core
A program is being debugged already.  Kill it? (y or n) y
Core was generated by `winbindd'.
Program terminated with signal 6, Aborted.
warning: you won't be able to access this core file until you terminate
your AIX pthread support; do ``info files''

(not sure how to terminate aix pthread...)
 
 
 
(gdb) bt
#0  0x1007a050 in smb_probe_module ()
#1  0x616c2f73 in ?? ()
Previous frame inner to this frame (corrupt stack?)
(gdb) up
#1  0x616c2f73 in ?? ()
(gdb) up

 
 
(gdb) list
1       in iconv.c
(gdb) info file
Symbols from "/usr/local/samba/sbin/winbindd".
Local core dump file:
        `/usr/local/samba/lib/core', file type aixcoff-rs6000.
        0x2ff21000 - 0x2ff23000 is .stack
Local exec file:
        `/usr/local/samba/sbin/winbindd', file type aixcoff-rs6000.
        Entry point: 0x2000bbd4
        0x10000178 - 0x1037b4ab is .text
        0x200004ab - 0x20023a6c is .data
        0x20023a6c - 0x200347f0 is .bss
        0x00000000 - 0x000766a3 is .loader
        Mapping info for file `/usr/local/samba/sbin/winbindd'.
            tstart       tend     dstart       dend  section file(member)
        0x10000178 0x1041510f 0x200004ab 0x200347f0 /usr/local/samba/sbin/winbindd
        0xd067fd40 0xd06f3f5e 0xf047b180 0xf04aefe0 /usr/lib/librtl.a(shr.o)
        0xd0044124 0xd00479e1 0xf05a6000 0xf05e8398 /usr/lib/libpthreads.a(shr_comm.o)
        0xd0048180 0xd0075f14 0xf05a0000 0xf05a500c /usr/lib/libpthreads.a(shr_xpg5.o)
        0xd0702250 0xd071034c 0xf031c6c0 0xf031d568 /usr/local/lib/libgcc_s.a(shr.o)
        0xd06f4270 0xd0701065 0xf0229d9c 0xf022a691 /usr/local/openldap/lib/liblber.a(liblber-2.3.so.0)
        0xd0e46270 0xd0fccf0b 0xf05646c5 0xf0581358 /usr/local/openldap/lib/libldap.a(libldap-2.3.so.0)
        0xd01511d4 0xd01527b7 0xf0228020 0xf0228160 /usr/lib/libc.a(posix_aio.o)
        0xd0153222 0xd01533ba 0xf020d0fe 0xf020d0fe /usr/lib/librt.a(posix_aio.o)
        0xd0d66250 0xd0e45dce 0xf031ebeb 0xf0320a44 /usr/local/lib/libiconv.a(libiconv.so.2)
        0xd007621c 0xd007693e 0xf0171508 0xf0171630 /usr/lib/libcrypt.a(shr.o)
        0xd0205f80 0xd0406cff 0xf04cd050 0xf0563358 /usr/lib/libc.a(shr.o)
        0xd0c2a320 0xd0d656e0 0xf04af720 0xf04cc15c /opt/freeware/lib/libcrypto.a(libcrypto.so.0.9.7)
        0xd0077128 0xd0079d81 0xd007a130 0xd007c464 /usr/lib/nls/loc/en_US
        0xd00f8600 0xd0117d83 0x20073400 0x20079978 /usr/lib/libC.a(shrcore.o)
        0xd00dfac0 0xd00f7f2b 0x20069ac0 0x20072029 /usr/lib/libC.a(ansicore_32.o)
        0xd00bf300 0xd00def90 0x20065d00 0x20068de9 /usr/lib/libC.a(shr.o)
        0xd1128128 0xd11353bc 0x2007ac38 0x2007ba58 /usr/local/samba/lib/idmap/rid.so

 
David Shapiro
Unix Team Lead
919-765-2011
Comment 1 David Shapiro 2006-02-20 16:12:14 UTC
Created attachment 1747 [details]
core from winbindd when trying to use idmap rid

This is a core from winbindd when I enable any idmap.  This one was for rid.
Comment 2 Jeremy Allison 2006-02-20 17:10:01 UTC
Why are you building winbindd with pthreads ? None of this code is pthread safe.
Jeremy.
Comment 3 David Shapiro 2006-02-21 09:19:31 UTC
My build methods (I do not see how I specified pthread usage with winbindd?!?)

Install gcc 4.0.2 for your os level (http://aixpdslib.seas.ucla.edu/categories/development.html)
Install gnu make 3.80 and rename it gmake
Install binutils 2.16.1 (Commented out line 119: 
Install m4 1.4.3
Install autoconf 2.59
-----------------------
Install libiconv 1.9.1
-----------------------
env CC="gcc -D_LINUX_SOURCE_COMPAT" \
./configure --enable-static=yes --enable-shared=no
gmake
gmake install

Install bison 2.0

-----------------------
Install db-4.4.20
-----------------------
cd into dist
mkdir build
cd build
env CC="gcc -D_LINUX_SOURCE_COMPAT" ../configure \
--prefix=/usr/local/bdb \
--enable-static-yes --enable-shared=no
gmake
gmake install

--------------
openssl-0.9.8a
--------------
./config threads no-shared --prefix=/usr/local/ssl

gmake
gmake install

-----------------
cyrus-sasl-2.1.21
-----------------
Comment out line 111 in saslint.h: 
/* extern sasl_global_callbacks_t global_callbacks; */

env CC="gcc -D_LINUX_SOURCE_COMPAT" \
CPPFLAGS="-I/usr/include" \
LDFLAGS="-L/usr/lib" \
../configure --with-openssl=/usr/local/ssl \
--with-bdb-libdir=/usr/local/bdb/lib \
--with-bdb-incdir=/usr/local/bdb/include \
--disable-gssapi --prefix=/usr/local/cyrus-sasl
gmake
gmake install

---------------
openldap-2.3.11
---------------
mkdir build2
cd build2
env CC="gcc -D_LINUX_SOURCE_COMPAT -D_THREAD_SAFE" \
CPPFLAGS="-I/usr/include -I/usr/local/bdb/include -I/usr/local/cyrus-sasl/include -I /usr/local/ssl/include" \
LDFLAGS="-L/usr/lib -L/usr/local/ssl/lib -L/usr/local/bdb/lib -lpthread" \
../configure --enable-dynamic --enable-spasswd \
--enable-bdb --enable-crypt --enable-slapd --enable-slurpd \
--with-cyrus-sasl=yes --with-tls=openssl --enable-rlookups \
--with-threads=posix --prefix=/usr/local/openldap \
--enable-shared=no --enable-static=yes \
--with-ssl=/usr/local/ssl --with-tls
gmake depend
gmake
gmake install

-----------------------
Heimdal-0.7 Kerberos
-----------------------
env CC="gcc -D_LINUX_SOURCE_COMPAT -D_THREAD_SAFE" \
../configure --prefix=/usr/local/heimdal-krb5 \
--prefix=/usr/local/heimdal-krb5 \
--with-openldap=/usr/local/openldap \
--with-openldap-lib=/usr/local/openldap/lib \
--with-openssl=/usr/local/ssl \
--with-openssl-lib=/usr/local/ssl/lib \
--with-openssl-include=/usr/local/ssl/include \
--enable-shared=no --enable-static=yes

gmake
gmake install

Enable AIO:
AIO support is installed in this package. If you have problems starting Samba,
try the following:

	$ lsdev -Cc posix_aio
	posix_aio0 Available  Posix Asynchronous I/O
	
If the above says "Defined" instead of "Available":
	
	$ mkdev -l posix_aio0
	posix_aio0 Available

	$ chdev -l posix_aio0 -a autoconfig=available -P
	posix_aio0 changed


-----------------------
Samba 3.0.21b
-----------------------
#!/bin/ksh -x

env CC=gcc \
CFLAGS="-DPAM_AUTHTOK_RECOVER_ERR=PAM_AUTHTOK_RECOVERY_ERR -DPAM_EXTERN=extern -D_LINUX
_SOURCE_COMPAT" \
CPPFLAGS="-I/usr/local/bdb/include -I/usr/local/ssl/include -I/usr/local/openldap/lib" \
LDFLAGS="-L/usr/local/bdb/lib -L/usr/local/cyrus-sasl/lib -L/usr/local/openldap/lib -L/usr/local/ssl/lib" \
../configure --prefix=/usr/local/samba --with-shared-modules=idmap_ad,idmap_rid  --with-ads \
--with-ldap --with-pam --with-krb5=/usr/local/kerberos --with-winbind --with-acl-support \
--with-utmp --with-quotas --with-sendfile-support --with-aio-support \
--enable-shared=no --enable-static=yes 

if [ $? != 0 ]; then
        echo "Configure failed so exiting..."
        exit 1
fi

/usr/local/bin/gmake && /usr/local/bin/gmake install

if [ $? != 0 ]; then
        echo "Build failed so exiting..."
        exit 1
fi

for i in WINBIND pam_winbind.so; do
        if [ -f /usr/lib/security/$i ]; then
                mv /usr/lib/security/$i /usr/lib/security/$i.old
                chmod 555 nsswitch/$i
                cp nsswitch/$i /usr/lib/security
                rm /usr/lib/security/$i.old
        else
                cp nsswitch/$i /usr/lib/security
        fi
done
Comment 4 Gerald (Jerry) Carter (dead mail address) 2006-02-21 09:22:30 UTC
David, Could you test the AIX binary packages from samba.org
at http://us2.samba.org/samba/ftp/Binary_Packages/AIX/ ?
Comment 5 David Shapiro 2006-02-21 09:24:40 UTC
The binary you refer to does not include ads support.
Comment 6 David Shapiro 2006-02-21 09:25:31 UTC
 ldd /usr/local/samba/sbin/winbindd
/usr/local/samba/sbin/winbindd needs:
         /usr/lib/librt.a(posix_aio.o)
         /usr/local/openldap/lib/libldap.a(libldap-2.3.so.0)
         /usr/local/openldap/lib/liblber.a(liblber-2.3.so.0)
         /usr/lib/libc.a(shr.o)
         /usr/lib/libc.a(posix_aio.o)
         /usr/lib/librtl.a(shr.o)
         /usr/lib/libs.a(shr.o)
         /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/libgcc_s.a(shr.o)
         /usr/lib/libpthread.a(shr_xpg5.o)
         /unix
         /usr/lib/libcrypt.a(shr.o)
         /usr/lib/libpthreads.a(shr_comm.o)
Comment 7 David Shapiro 2006-02-21 09:36:09 UTC
(In reply to comment #4)
> David, Could you test the AIX binary packages from samba.org
> at http://us2.samba.org/samba/ftp/Binary_Packages/AIX/ ?

That binary does not have ads support or the modules for things like rid.
Comment 8 David Shapiro 2006-02-27 07:31:55 UTC
I buildt samba 3.0.21c and it still has the same issue. The winbindd has the following with the new build (note I changed it to use whatever iconv aix has in /usr/lib):


winbindd needs:
         /usr/lib/librt.a(posix_aio.o)
         /usr/local/openldap/lib/libldap.a(libldap-2.3.so.0)
         /usr/local/openldap/lib/liblber.a(liblber-2.3.so.0)
         /usr/lib/libc.a(shr.o)
         /usr/lib/libc.a(posix_aio.o)
         /usr/lib/librtl.a(shr.o)
         /usr/lib/libs.a(shr.o)
         /usr/local/lib/libgcc_s.a(shr.o)
         /usr/lib/libpthread.a(shr_xpg5.o)
         /unix
         /usr/lib/libcrypt.a(shr.o)
         /usr/lib/libpthreads.a(shr_comm.o)


gcc -v:

Target: powerpc-ibm-aix5.2.0.0
Configured with: ../gcc-4.0.2/configure --disable-aix64 --disable-nls
Thread model: aix
gcc version 4.0.2


Note that gcc was not buildt with threading options.  Where is winbindd picking up threading?  I guess it comes from gcc, but how do you turn that off?  Some programs have --disable-threads, does samba have this?

David
Comment 9 David Shapiro 2006-03-01 08:17:20 UTC
I see that other aix users are having the same issue even though they use aix ibm compiler instead of gcc.  Any status on work being done on this?  Do you need new cores or anything else to help work on this?
Comment 10 David Shapiro 2006-03-01 08:38:36 UTC
I am starting to think that the issue is related possibly to libiconv issue.  I have compiled with 1.91 (--with-iconv=/usr/local) and just with IBM's /usr/lib/libiconv.a.  Note that I have another bug report that shows that/usr/local/samba/lib/charset/ISO8859-1.so does not exist in both builds 21b and 21c. 
Comment 11 David Shapiro 2006-03-02 08:55:16 UTC
I found that for some reason when compiling libiconv, configure works and gmake works, but when you run gmake check, you get a core.  I don't know why this is happening.  Anyway, I instead got the binary version from pdslib and this version is fine.  However, the rid idmap issue core dump problem has not gone away.  The core still refers to pthread kill.  I just don't know how to disable/stop the use of pthreads.  How do you do that?

David
Comment 12 William Jojo 2006-03-09 15:50:40 UTC
(In reply to comment #11)
> I found that for some reason when compiling libiconv, configure works and gmake
> works, but when you run gmake check, you get a core.  I don't know why this is
> happening.  Anyway, I instead got the binary version from pdslib and this
> version is fine.  However, the rid idmap issue core dump problem has not gone
> away.  The core still refers to pthread kill.  I just don't know how to
> disable/stop the use of pthreads.  How do you do that?
> David

Can you try the patch in bug #1649?

Run "make distclean" then you'll need to run autogen.sh after updating the configure.in file. Then run configure and build.

Bill
Comment 13 David Shapiro 2006-03-10 17:19:39 UTC
Good news.  I modified configure.in as follows:

*aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
                        BLDSHARED="true"
                        LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
                        DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc"
                        PICFLAGS="-O2"
                        case "$host_os" in
                                *aix4*|*aix3*)
                                        LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
                                        ;;
                                *)      LDSHFLAGS="-Wl,-G,-bexpall,-bnoentry"
                                        case `uname -r` in
                                                0|1)
                                                ;;
                                                *)   AC_DEFINE(AIX52,1,[Whether the host os is aix 5.2 or later])
                                                ;;
                                        esac
                                        ;;
                        esac
                        if test "${GCC}" != "yes"; then
                                ## for funky AIX compiler using strncpy()
                                CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
                        else
                                LDSHFLAGS="-nostartfiles $LDSHFLAGS"
                        fi

                        AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
                        AC_DEFINE(BROKEN_STRNLEN,1,[Does strnlen work correctly])
                        ;;


AND:

In source\nsswitch\winbind_nss_aix.c I added these lines between the ZERO_STRUCTP(methods) line and the HAVE_STRUCT_SECMETHODS lines:

#ifdef AIX52
        methods->method_version = SECMETHOD_VERSION_520;
#endif

(It looks like this last change is already covered by the HAVE_STRUCT_SECMETHODS lines, but I wanted to play it safe since it takes so long to compile on my slow system.

Note that when I ran autogen.sh, it whined about my environment lang = en_US.  I set it to lang = en_US in /etc/environment instead.  I still get an error with smbstatus about about the .msg file for whatever lang I pick not being found.  In this case it said it could not find C.msg, so I copied en.msg to C.msg and that resolved that issue.  I do have another bug question about this.  Anyway, in the source directory I made a directory called build and copied the following into a script in that directory called setup.sh:

#!/bin/ksh -x

env "CC=gcc" \
CFLAGS="-DPAM_AUTHTOK_RECOVER_ERR=PAM_AUTHTOK_RECOVERY_ERR -DPAM_EXTERN=extern -D_LINUX_SOURCE_COMPAT" \
CPPFLAGS="-I/usr/local/bdb/include -I/usr/local/ssl/include -I/usr/local/include -I/usr/local" \
LDFLAGS="-L/usr/local/bdb/lib -L/usr/local/cyrus-sasl/lib -L/usr/local/ssl/lib -L/usr/local/openldap/lib -L/usr/l
ocal/lib /usr/local/lib/libiconv.a /usr/local/lib/libintl.a /usr/local/ssl/lib/libcrypto.a /usr/local/ssl/lib/lib
ssl.a /usr/local/heimdal-krb5/lib/libgssapi.a /usr/local/heimdal-krb5/lib/libkrb5.a -L/usr/lib -lc" \
../configure --prefix=/usr/local/samba --with-shared-modules=idmap_ad,idmap_rid --with-ads --with-ldap --with-pam
 --with-krb5=/usr/local/heimdal-krb5 --with-winbind --with-acl-support --with-utmp --with-quotas --with-sendfile-
support --with-aio-support --enable-shared=yes --disable-static --with-libiconv=/usr/local


/usr/local/bin/gmake
/usr/local/bin/make install

for i in WINBIND pam_winbind.so; do
        if [ -f /usr/lib/security/$i ]; then
                mv /usr/lib/security/$i /usr/lib/security/$i.old
                chmod 555 nsswitch/$i
                cp nsswitch/$i /usr/lib/security
                rm /usr/lib/security/$i.old
        else
                cp nsswitch/$i /usr/lib/security
        fi
done


When I re-enabled rid lines in smb.conf winbind does not core now.  The lines I added:

allow trusted domains = No
idmap backend = rid:MYREALM=1000000-200000
idmap uid = 1000000-2000000
idmap gid = 1000000-2000000

So far all is well in the universe with samba on aix with these changes.
Comment 14 David Shapiro 2006-03-10 17:20:54 UTC
Can we get the changes to configure.in and winbind_nss_aix.c added to the next version/verified?