Fwd: Tracking down mod_ssl/OpenSSL bug
am 11.07.2003 18:18:07 von fischerdk--=====================_357959608==_
Content-Type: text/plain; charset="us-ascii"; format=flowed
----- Begin forwarded message -----
Ralf,
I have been doing some code-walking to track down a problem we've been
having since last November with Apache child processes getting segmentation
faults periodically, and it appears to boil down to something with mod_ssl
and/or OpenSSL. I was hoping you could help shed some light on this, and/or
suggest where to next extend my search. Here are the details thus far:
- Running Apache 1.3.27 and mod_ssl 2.8.14 with OpenSSL 0.9.7b (also tried
with the 0.9.6 line with the same results)
gdb backtrace (attached) shows the segmentation fault being generated by
ssl3_write_pending(). This happens when a timeout occurs during
ap_send_fd() or ap_send_mmap(). The Apache timeout() handler is invoked by
the SIGALRM handler, which closes the connection and frees the SSL context.
When the signal handler finishes and returns to the stack (where we were in
the middle of a write operation somewhere inside of ssl3_write_pending()),
ssl3_write_pending() segfaults when it tries to access the non-existent
context.
I'm not sure if this would be considered a deficiency in how mod_ssl closes
the connection, in how OpenSSL's ssl3_write_pending() checks for a valid
context after BIO_write(), or something else entirely.
Any direction you can provide would be greatly appreciated. I'd be more
than happy to provide any additional info or debugging/troubleshooting steps.
Many thanks,
Doug
------------------------------------------------------------
This email, and any included attachments, have been checked
by Norton AntiVirus Corporate Edition (Version 8.0), AVG
Server Edition 6.0, and Merak Email Server Integrated
Antivirus (Alwil Software's aVast! engine) and is certified
Virus Free.
--=====================_357959608==_
Content-Type: text/plain; name="apache_sigsegv_gdb_bt.txt";
x-mac-type="42494E41"; x-mac-creator="74747874"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="apache_sigsegv_gdb_bt.txt"
W3Jvb3RAdGVzdDAxIH5dIyBnZGIgLXggL3RtcC9nZGIuY21kIGh0dHBkCkdO VSBnZGIgUmVkIEhh
dCBMaW51eCAoNS4yLTIpCkNvcHlyaWdodCAyMDAyIEZyZWUgU29mdHdhcmUg Rm91bmRhdGlvbiwg
SW5jLgpHREIgaXMgZnJlZSBzb2Z0d2FyZSwgY292ZXJ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ow
eDA4MGZkODkxIGluIHNzbDNfd3JpdGVfcGVuZGluZyAocz0weDgyZTc1MzAs IHR5cGU9MjMsIAog
ICAgYnVmPTB4YmZmZmI4YjAgIi1EYXRlaSDkcXVpdmFsZW50IGlzdDsgenVz 5HR6bGljaGUgVHJl
aWJlciBcbmv2bm50ZW4gd2VpdGVyaGluIGVyZm9yZGVybGljaCBzZWluLlxu XG4iLCAnPScgPHJl
cGVhdHMgNzYgdGltZXM+LCAiXG5ISUxGRSBBTkZPUk5ERVJOXG5cblp1Z3Jp ZmYg/GJlciBkYXMg
V2ViIGh0Ii4uLiwgbGVuPTgxOTIpIGF0IHMzX3BrdC5jOjc0OQo3NDkgICAg ICAgICAgICAgICAg
ICAgICBpZiAoaSA9PSBzLT5zMy0+d2J1Zi5sZWZ0KQooZ2RiKSBxdWl0ClRo ZSBwcm9ncmFtIGlz
IHJ1bm5pbmcuICBFeGl0IGFueXdheT8gKHkgb3IgbikgeQpbcm9vdEB0ZXN0 MDEgfl0jIAo=
--=====================_357959608==_--
____________________________________________________________ __________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List modssl-users@modssl.org
Automated List Manager majordomo@modssl.org