www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Korthof ...@cloudfactory.org>
Subject Re: mod_jserv/5420: Segmentation Fault
Date Thu, 09 Dec 1999 22:50:02 GMT
The following reply was made to PR mod_jserv/5420; it has been noted by GNATS.

From: Ed Korthof <ed@cloudfactory.org>
To: Thierry Delaitre <delaitt@cpc.wmin.ac.uk>
Cc: apbugs@hyperreal.org
Subject: Re: mod_jserv/5420: Segmentation Fault
Date: Thu, 9 Dec 1999 14:42:34 -0800 (PST)

 This is interesting.  It does look like the compiler may be doing
 something wrong ... or an intialization function is corrupting some
 memory.  Here's two things you can try:
 
 First, compile this program and run it; see what the output is:
 
 ******
 #include <stdio.h>
 #include <stdlib.h>
 
 typedef struct test_struct { const char *name; } test_struct;
 
 test_struct test = { __FILE__ };
 
 int main() {
         fprintf (stderr, "file is: %s\n", test.name);
 }
 ******
 
 This would test to see if the __FILE__ macro is working correctly all by
 itself ... if not, that'd explain the problem.  I'd guess that it'll work. 
 Another thing to test would involve running your httpd w/ gdb, and setting
 a break point in the add_named_module command, and taking a look at the
 jserv_module structure right after it's loaded.  This is easier with extra
 debugging information -- add '-g' to your CFLAGS (or EXTRA_CFLAGS) and
 recompile Apache... I've shown a transcript of how this might be done: 
 
 *****
 stratus:~/projects/t/httpd> gdb bin/httpd
 GNU gdb 4.17
 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 "i586-slackware-linux"...
 (gdb) set args -X -f /home/ed/projects/t/httpd/conf/httpd.conf
 (gdb) b ap_os_dso_load
 Breakpoint 1 at 0x808f35b: file os.c, line 117.
 (gdb) run
 Starting program: /home/ed/projects/t/httpd/bin/httpd -X -f /home/ed/projects/t/httpd/conf/httpd.conf
 mesg: /dev/ttya1: Operation not permitted
 
 Breakpoint 1, ap_os_dso_load (
     path=0x80dd684 "/home/ed/projects/t/httpd/libexec/mod_jserv.so")
     at os.c:117
 117         return dlopen(path, RTLD_NOW | RTLD_GLOBAL);
 (gdb) n
 119     }
 (gdb) p jserv_module
 $1 = {version = 19990320, minor_version = 6, module_index = -1,
   name = 0x400e8337 "mod_jserv.c", dynamic_load_handle = 0x0, next = 0x0,
   magic = 1095774515, init = 0x400df2b4 <jserv_init>, create_dir_config = 0,
   merge_dir_config = 0,
   create_server_config = 0x400dde78 <jserv_server_config_create>,
   merge_server_config = 0x400ddf4c <jserv_server_config_merge>,
   cmds = 0x400ed42c, handlers = 0x400ed40c,
   translate_handler = 0x400df650 <jserv_translate_handler>,
   ap_check_user_id = 0, auth_checker = 0, access_checker = 0,
   type_checker = 0x400df718 <jserv_type_match>, fixer_upper = 0, logger = 0,
   header_parser = 0, child_init = 0x400df37c <jserv_child_init>,
   child_exit = 0, post_read_request = 0}
 (gdb)
 *****
 
 Note that if you have other DSO modules, you should continue until you're
 loading the jserv DSO.
 
 The question is simply what the structure of the jserv_module looks like
 -- again, i want to see if the name element has a valid value.  If it
 doesn't, then there's a problem in your version of gcc -- and you should
 move back to a previous version (2.7.2 works).  If it does have a good
 value, then there's a bug somewhere in our initialization.
 
 If you could try these tests, I'd appreciate it.
 
 thanks!
 
 Ed
 
 On Wed, 8 Dec 1999, Thierry Delaitre wrote:
 
 > Date: Wed, 8 Dec 1999 10:29:47 +0000 (GMT)
 > From: Thierry Delaitre <delaitt@cpc.wmin.ac.uk>
 > To: Ed Korthof <ed@cloudfactory.org>
 > Cc: apbugs@hyperreal.org
 > Subject: Re: mod_jserv/5420: Segmentation Fault
 > 
 > 
 > Hi,
 > 
 > On Mon, 6 Dec 1999, Ed Korthof wrote:
 > 
 > > hi --
 > > 
 > > the place where the problem is occuring is populated by the __FILE__
 > > macro; apache expects certain things there, in the module_structure.  so
 > > either the wrong thing is there, or the memory got corrupted already at
 > > the point when this was called.  
 > > 
 > > in the testing environment which i have, DSOs work fine.  i'm guessing
 > > that you're seeing one of two things.  either the gcc which you're using
 > > is buggy, or you built the mod_jserv.so file on a different machine from
 > > the one used to build your httpd (or with different compiler settings).
 > 
 > I'm sure I've used the same gcc.
 > 
 > > the version of gcc which you're using isn't in that common of use (i've
 > > generally seen 2.7.x, with the explanation that the 2.8.x series is buggy) 
 > > -- but if this were a bug in that, i'd expect a work-around in the apache
 > > source. 
 > 
 > > but it's also possible that the jserv initialization is corrupting the
 > > stack; if that's the case, it's not triggered by my environment.  if
 > > that's what's going on, it'd be helpful to see your conf file. 
 > > 
 > > are you certain the .so file was compiled on the same machine (and with
 > > the same compiler) as apache?
 > 
 > yes it was compiled on the same machine using same gcc.
 > 
 > >  if so, could you gdb one of the core files
 > > and send me the output from 'p jserv_module'?
 > 
 > Sure. Please find the output below:
 > 
 > Starting program: /rhino_local/apache-internet/bin/httpd 
 > 
 > Program received signal SIGSEGV, Segmentation fault.
 > 0xef6505e0 in strrchr () from /usr/lib/libc.so.1
 > (gdb) bt
 > #0  0xef6505e0 in strrchr () from /usr/lib/libc.so.1
 > #1  0x4f96c in ap_add_module ()
 > #2  0x4fb24 in ap_add_loaded_module ()
 > #3  0x471d0 in load_module ()
 > #4  0x50314 in invoke_cmd ()
 > #5  0x510e4 in ap_handle_command ()
 > #6  0x511c4 in ap_srm_command_loop ()
 > #7  0x51928 in ap_process_resource_config ()
 > #8  0x58a74 in include_config ()
 > #9  0x501fc in invoke_cmd ()
 > #10 0x510e4 in ap_handle_command ()
 > #11 0x511c4 in ap_srm_command_loop ()
 > #12 0x51928 in ap_process_resource_config ()
 > #13 0x5251c in ap_read_config ()
 > #14 0x60b3c in main ()
 > (gdb) p jserv_module
 > $1 = {version = 19990320, minor_version = 6, module_index = 21, 
 >   name = 0x5c0e18 <Address 0x5c0e18 out of bounds>, dynamic_load_handle = 0xef770b00,
next = 0xd0a7c, 
 >   magic = 1095774515, init = 0x5b7360, create_dir_config = 0, merge_dir_config = 0,

 >   create_server_config = 0x5b5c98, merge_server_config = 0x5b5d50, cmds = 0x5d68a8,
handlers = 0x5d6888, 
 >   translate_handler = 0x5b77a0, ap_check_user_id = 0, auth_checker = 0, access_checker
= 0, 
 >   type_checker = 0x5b787c, fixer_upper = 0, logger = 0, header_parser = 0, child_init
= 0x5b746c, 
 >   child_exit = 0, post_read_request = 0}
 > (gdb) 
 > 
 >   it should look something
 > > like this: 
 > > 
 > > *****
 > > (gdb) p jserv_module
 > > $1 = {version = 19990320, minor_version = 6, module_index = 20,
 > >   name = 0x400e8337 "mod_jserv.c", dynamic_load_handle = 0x80de9b8,
 > >   next = 0x80c8518, magic = 1095774515, init = 0x400df2b4 <jserv_init>,
 > >   create_dir_config = 0, merge_dir_config = 0,
 > >   create_server_config = 0x400dde78 <jserv_server_config_create>,
 > >   merge_server_config = 0x400ddf4c <jserv_server_config_merge>,
 > >   cmds = 0x400ed42c, handlers = 0x400ed40c,
 > >   translate_handler = 0x400df650 <jserv_translate_handler>,
 > >   ap_check_user_id = 0, auth_checker = 0, access_checker = 0,
 > >   type_checker = 0x400df718 <jserv_type_match>, fixer_upper = 0, logger =
0,
 > >   header_parser = 0, child_init = 0x400df37c <jserv_child_init>,
 > >   child_exit = 0, post_read_request = 0}
 > > (gdb)
 > > *****
 > > 
 > > what do you mean when you say the system was solaris 7 w/ 32 bits?
 > 
 > The Sun/Solaris OS runs in 64 bits on Ultra Sparc processor only. The
 > Sun architecture I have only supports 32 bits. BTW, only the Sun C
 > compiler is able to produce 64 bits binaries.
 > 
 > I'm using the default httpd.conf file. The only addition I did is to add
 > the Include statement at the bottom of the file to load jserv.conf.
 > 
 > I use the following options with configure for Apache 1.3.9
 > 
 > ./configure     --prefix=/rhino_local/apache-internet \
 >                 --enable-module=so \
 >                 --enable-module=info \
 >                 --enable-module=status \
 >                 --enable-module=rewrite \
 >                 --enable-suexec --suexec-caller=www
 > 
 > I use the following options with configure for ApacheJserv-1.1.b3
 > 
 > ./configure --prefix=/rhino_local/apache-internet/jserv \
 >         --with-apxs=/rhino_local/apache-internet/bin/apxs \
 >         --with-jdk-home=/usr/java \
 >         --with-JSDK=/rhino_local/JSDK2.0/lib/jsdk.jar
 > 
 > Thierry.
 > 
 > 
 

Mime
View raw message