AMD64 only Segmentation fault (was: 7-STABLE(AMD64)+Qmail-LDAP core dump)

Alexandre Biancalana biancalana at
Mon Mar 3 22:24:19 UTC 2008

Hi list,

  I found a situation that I can't explain, I have qmail-ldap running
at some FreeBSD 6.2 without any problem. Friday after Installed a new
server this time with 7-STABLE. I stated to get core dumped from
qmail-ldap when they try access the OpenLDAP database.

 I compiled/run this simple C program in 7-STABLE i386 and AMD64 and
the program dumps the core only in AMD64.

 The following the C program trigger the core dump

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <lber.h>
#include <ldap.h>

int main (void ) {

        LDAP *ld;
        int rc,version;

        if ( (ld = ldap_init("",LDAP_PORT)) == 0) {

        rc = ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version);

        if ( rc != LDAP_OPT_SUCCESS) {

                printf("Errorrrr (%s)\n", ldap_err2string(rc));


Using the following commands to compile:
# gcc -I/usr/local/include -g -c  a.c
# gcc -L/usr/local/lib -o a  a.o -lldap

When I run the binary in AMD64 I get this:

# ./a
Segmentation fault (core dumped)

Then I compiled the with debug symbols and run the program
througth gdb:

# gdb a
                                                      GNU gdb 6.1.1
Copyright 2004 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 "amd64-marcel-freebsd"...
(gdb) run
Starting program: /tmp/a

Program received signal SIGSEGV, Segmentation fault.
ldap_set_option (ld=0xf30040, option=17, invalue=0x7fffffffec2c) at
358                     assert( LDAP_VALID( ld ) );
(gdb) bt
#0  ldap_set_option (ld=0xf30040, option=17, invalue=0x7fffffffec2c)
at options.c:358
#1  0x000000000040083c in main () at a.c:19

 Now I reach to a point that I don't know what more to do....

 Any help is *very* appreciated !

 Best Regards,


More information about the freebsd-stable mailing list