From nobody@FreeBSD.org  Wed Dec 12 00:59:04 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 3263A37B405
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Dec 2001 00:59:03 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id fBC8x3N13976;
	Wed, 12 Dec 2001 00:59:03 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200112120859.fBC8x3N13976@freefall.freebsd.org>
Date: Wed, 12 Dec 2001 00:59:03 -0800 (PST)
From: "Lokendra Kr. Verma" <lokendra@npi.stpn.soft.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Getting segmentation fault in connect system call
X-Send-Pr-Version: www-1.0

>Number:         32741
>Category:       kern
>Synopsis:       Getting segmentation fault in connect system call
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 12 01:00:01 PST 2001
>Closed-Date:    Tue Dec 18 09:11:45 PST 2001
>Last-Modified:  Tue Dec 18 09:13:09 PST 2001
>Originator:     Lokendra Kr. Verma
>Release:        freeBSD 4.3
>Organization:
Network Programs(India)
>Environment:
FRee BSD YokoBSD.npi.stpn.soft.net 4.3-RELEASE FreeBSD #0: Sat Apr 21 10:54:49 GMT 2001
jkh@narf.osd.bsdi.com:/usr/src/sys/compile/GENERIC i386
>Description:
Sir, i m using freeBSD version 4.3.
I m making .so library of my application. This application establish
socket connection with remote machines. My problem is that when i link
this .so library with my main program and call the function of .so
library , i get segmentation fault on connect and inet_pton system
calls.
Instead of making .so library if i make the exe of my application and
then i do not get any segmentation fault.

Help me sir or suggest me somebody who can help me out.
I say thanx in advance.
Lokendra
>How-To-Repeat:
To repeat the problems, i have written simple client server programs 
for the socket communication. Instead of making exe of both the programs 
i have build (client.so and server.so) .so libraries separatly. 
Now for both the library i have written main function which calls 
the initial function of .so library.
now when i run server program i get segmentation fault in accept 
system call and when i run client program i get segmentation fault 
in connect system call.
I can send u the files which will make u understand the problem better.
>Fix:
i do not know.
>Release-Note:
>Audit-Trail:

From: Sheldon Hearn <sheldonh@starjuice.net>
To: "Lokendra Kr. Verma" <lokendra@npi.stpn.soft.net>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/32741: Getting segmentation fault in connect system call 
Date: Wed, 12 Dec 2001 11:11:00 +0200

 On Wed, 12 Dec 2001 00:59:03 PST, "Lokendra Kr. Verma" wrote:
 
 > >Description:
 > Sir, i m using freeBSD version 4.3.
 > I m making .so library of my application. This application establish
 > socket connection with remote machines. My problem is that when i link
 > this .so library with my main program and call the function of .so
 > library , i get segmentation fault on connect and inet_pton system
 > calls.
 
 Since you're skilled enough to be building libraries and stuff, can't
 you build your module with debugging symbols and use the debugger to
 analyze your core dump?
 
 Ciao,
 Sheldon.

From: "Lokendra Kr. Verma" <lokendra@npi.stpn.soft.net>
To: Sheldon Hearn <sheldonh@starjuice.net>
Cc:  
Subject: Re: kern/32741: Getting segmentation fault in connect system call
Date: Wed, 12 Dec 2001 14:54:51 +0530

 This is a multi-part message in MIME format.
 --------------51864F3D17923FA69CB49467
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 Hello sir,
 Thanx for quick response.
 I have already done it using gdb. Now i m sending u the detail which gdb is
 showing.
 ////////////////////////////////////////////////////////////////////////
 Running my client program without gdb following is the output.
 *****************************
 /run 5555
 before calling connect
 Segmentation fault (core dumped)
 /////////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////////////////////////////////////////
 Running my client program with gdb following is the output.
 *****************************
 %gdb run
 GNU gdb 4.18
 Copyright 1998 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 "i386-unknown-freebsd"...
 (gdb) r 5555
 Starting program: /home/lokendra/connecttesting/run 5555
 
  Before calling connect
 
 Program received signal SIGSEGV, Segmentation fault.
 0x280c7f46 in xdr_u_int () from /usr/lib/libc.so.4
 (gdb) where
 #0  0x280c7f46 in xdr_u_int () from /usr/lib/libc.so.4
 #1  0x280c86aa in xdr_bytes () from /usr/lib/libc.so.4
 #2  0x280c877c in xdr_netobj () from /usr/lib/libc.so.4
 #3  0x280ddfba in .cerror () from /usr/lib/libc.so.4
 #4  0x2806589e in start () from /home/lokendra/connecttesting/./client.so
 #5  0x8048589 in main (argc=2, argv=0xbfbffb90) at main.c:10
 #6  0x80484b5 in _start ()
 ///////////////////////////////////////////////////////////////////////////////////////////////////////
 
 if u need files, i can send those tooooo.
 Thanx for yor reply and waiting yor reply.
 Regards
 Lokendra.
 
 
 Sheldon Hearn wrote:
 
 > On Wed, 12 Dec 2001 00:59:03 PST, "Lokendra Kr. Verma" wrote:
 >
 > > >Description:
 > > Sir, i m using freeBSD version 4.3.
 > > I m making .so library of my application. This application establish
 > > socket connection with remote machines. My problem is that when i link
 > > this .so library with my main program and call the function of .so
 > > library , i get segmentation fault on connect and inet_pton system
 > > calls.
 >
 > Since you're skilled enough to be building libraries and stuff, can't
 > you build your module with debugging symbols and use the debugger to
 > analyze your core dump?
 >
 > Ciao,
 > Sheldon.
 
 --------------51864F3D17923FA69CB49467
 Content-Type: text/x-vcard; charset=us-ascii;
  name="lokendra.vcf"
 Content-Transfer-Encoding: 7bit
 Content-Description: Card for Lokendra Kr. Verma
 Content-Disposition: attachment;
  filename="lokendra.vcf"
 
 begin:vcard 
 n:Verma;Lokendra Kr.
 tel;work:Network Management Systems (NPI)
 x-mozilla-html:FALSE
 adr:;;;;;;
 version:2.1
 email;internet:lokendra@npi.stpn.soft.net
 fn:Lokendra Kr. Verma
 end:vcard
 
 --------------51864F3D17923FA69CB49467--
 

From: Sheldon Hearn <sheldonh@starjuice.net>
To: lokendra@npi.stpn.soft.net
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/32741: Getting segmentation fault in connect system call 
Date: Wed, 12 Dec 2001 11:34:39 +0200

 On Wed, 12 Dec 2001 14:54:51 +0530, "Lokendra Kr. Verma" wrote:
 
 > I have already done it using gdb. Now i m sending u the detail which gdb is
 > showing.
 
 It doesn't look like your library was built with debugging symbols?
 
 Ciao,
 Sheldon.

From: "Alexey V. Neyman" <alex.neyman@auriga.ru>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: kern/32741: Getting segmentation fault in connect system call
Date: Tue, 18 Dec 2001 10:03:38 +0300

 --------------Boundary-00=_2A2JZ8G1GSHP494KCN0J
 Content-Type: text/plain;
   charset="koi8-r"
 Content-Transfer-Encoding: 8bit
 
 Adding to Audit-Trail.
 
 This PR can be closed.
 
 ----------  Forwarded Message  ----------
 Subject: Re: kern/32741: Getting segmentation fault in connect system call
 Date: Tue, 18 Dec 2001 12:29:59 +0530
 From: "Lokendra Kr. Verma" <lokendra@npi.stpn.soft.net>
 To: "Alexey V. Neyman" <alex.neyman@auriga.ru>
 
 
 
 Hello sir,
 Thanx for reply.
 I got solved this problem last weak. U r right actually.
 I was building my .so file using libc_r library which is thread safe. But
 the exe on which this .so shall be loaded was not thread safe. I was
 linking the exe with libc which is not thread safe on freeBSD.
 Now everything is ok. Once again i say thanx.....
 PLease keep in touch.
 Lokendra
 
 "Alexey V. Neyman" wrote:
 
 > Hello there,
 >
 > seems that you have an isolated test case; may I have a look at it?
 > (the backtrace shown in PR does not look like that you're crashing in
 > connect(2), but rather you've got shared object linked incorrectly).
 >
 > What options do you pass to compiler/linker to build client.so?
 >
 > Regards,
 > Alexey.
 >
 > --
 > <------------------------->
 >  ) May the Sun and Water (   Regards, Alexey V. Neyman
 >  ) always fall upon you! (   mailto:alex.neyman@auriga.ru
 > <------------------------->
 
 
 -------------------------------------------------------
 
 -- 
 <------------------------->
  ) May the Sun and Water (   Regards, Alexey V. Neyman
  ) always fall upon you! (   mailto:alex.neyman@auriga.ru
 <------------------------->
 
 --------------Boundary-00=_2A2JZ8G1GSHP494KCN0J
 Content-Type: text/x-vcard;
   charset="us-ascii";
   name="lokendra.vcf"
 Content-Transfer-Encoding: 7bit
 Content-Description: Card for Lokendra Kr. Verma
 Content-Disposition: attachment;
  filename="lokendra.vcf"
 
 begin:vcard 
 n:Verma;Lokendra Kr.
 tel;work:Network Management Systems (NPI)
 x-mozilla-html:FALSE
 adr:;;;;;;
 version:2.1
 email;internet:lokendra@npi.stpn.soft.net
 fn:Lokendra Kr. Verma
 end:vcard
 
 --------------Boundary-00=_2A2JZ8G1GSHP494KCN0J--
State-Changed-From-To: open->closed 
State-Changed-By: bmah 
State-Changed-When: Tue Dec 18 09:11:45 PST 2001 
State-Changed-Why:  
Problem solved, according to follow-up from  
"Alexey V. Neyman" <alex.neyman@auriga.ru>. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32741 
>Unformatted:
