Bugs item #437414, was opened at 2001-06-29 10:58
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=103152&aid=437414&group_id=3152

Category: Configuration: Server
Group: aolserver3_4
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Urban (simba5)
Assigned to: Nobody/Anonymous (nobody)
Summary: Segfault on FreeBSD 5.0-CURRENT

Initial Comment:
I am having a problem with AOL Server 3.4 causing a
segmentation fault on FreeBSD 5.0-CURRENT as soon as I
try to start it. It will run fine on port 8000, but it
segfaults anytime I try to start it on port 80. I have
not tested this on the release version of FreeBSD (4.3)
so I am not sure if it is a problem with the server, or
a problem with something in FreeBSD 5.0.

Here is the gdb trace that I get when trying to run the
server on port 80:
[25/Jun/2001:16:30:13][15486.135540736][-main-] Notice:
binder:
listen(205.216.111.20,80) = 15
[25/Jun/2001:16:30:13][15486.135540736][-main-] Notice:
nssock: listening on 205.216.111.20:80

Program received signal SIGSEGV, Segmentation fault.
0x281820ff in ioctl () from /usr/lib/libc_r.so.5

(gdb) bt
#0  0x281820ff in ioctl () from /usr/lib/libc_r.so.5
#1  0x80805df in Ns_SockSetNonBlocking (sock=15) at
sock.c:385
#2  0x2824551a in SockStart (server=0x8145560
"server1",
    label=0x8145b10 "nssock", drvDataPtr=0x8171208) at
sock.cpp:474
#3  0x806e326 in NsStartDrivers (server=0x8145560
"server1") at drv.c:225
#4  0x8077491 in Ns_Main (argc=8, argv=0xbfbffadc,
        initProc=0x807445c <ServerInit>) at
nsmain.c:697
#5  0x8074448 in main (argc=8, argv=0xbfbffadc) at
main.c:64
#6  0x805ae7f in _start ()
(gdb)

I am starting the server as root and then having it
switch to the user and group "www". Like I said, this
only occurs on port 80 and not on 8000, so I assume it
has to do with privilaged ports.

Any ideas?

Thanks,

Mike

----------------------------------------------------------------------

Comment By: Ayan George (ayangeorge)
Date: 2001-08-16 10:58

Message:
Logged In: YES
user_id=296776

Hey Guys,

As you probably already know, there is a problem with
AOLserver and
FreeBSD 5.0-CURRENT.

I've tracked the problem down the to ioctl() call in the
reentrant
libc (libc_r) in FreeBSD.

>From what I can understand, AOLserver forks a child which
waits for
bind requests.  When the child receives a request, it binds to a
port and returns the file descriptor to listen on to the parent
(this stuff is in nsd/binder.c of course).

It seems there is a a _thread_fd_table[] array (of size
_thread_dtable)
for each process linked with libc_r.  The table index
corresponds
with file descriptors (ie, _thread_fd_table[12] has data about
descriptor 12) and each element needs to be initialized
before being
used with _thread_fd_table_init().  If the parent doesn't
call any
routine that initializes the file descriptor's element in the
_thread_fd_table_init() structure, the threaded ioctl function
causes an error when it dereferences _thread_fd_table[fd].

Such seems to be the case when the child sends the file
descriptor
to the parent and the parent attempts to set it
non-blocking.  The
parent process has no initialized _thread_fd_table[] entry
for the
fd the child creates but ioctl tries to use
_thread_fd_table[fd]->flags
(this is done on line 61 of
/usr/src/lib/libc_r/uthread/uthread_ioctl.c
in FreeBSD 5.0-CURRENT).

A kludge for this is performing a _thread_fd_table_init on
the file
descriptor within ioctl function some time before the
dereference.
This will have no effect on the descriptor if it is already
initialized
and if the descriptor is valid.

So, first: I'm not 100% sure I understand what is breaking.  If
anyone has any more insight, please let me know.  If this seems
accurate, I'm interested in knowing how this could be resolved
better.

-Ayan


----------------------------------------------------------------------

Comment By: Michael Urban (simba5)
Date: 2001-06-30 15:40

Message:
Logged In: YES
user_id=257485

I found someone to test this for me on FreeBSD 4.3 and the
server runs fine. This seems to be a bug in the ioctl()
function of FreeBSD 5.0-CURRENT or something.  I posted a
message to the FreeBSD CURRENT mailing list regarding the
problem and am awaiting a response from there.

----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=103152&aid=437414&group_id=3152

Reply via email to