Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault #46

Closed
cyberblackhole opened this issue Nov 23, 2018 · 9 comments
Closed

Segmentation fault #46

cyberblackhole opened this issue Nov 23, 2018 · 9 comments

Comments

@cyberblackhole
Copy link

I'm using
ModSecurity v3.0.3 (Linux)

I pulled latest commit for modsecurity-apache just to test whether post data is accessible by ARGS_POST.

I'm getting the below error in apache error logs.

[Thu Nov 22 11:57:20.005976 2018] [core:notice] [pid 3768] AH00051: child pid 3823 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Nov 22 11:57:20.015739 2018] [watchdog:debug] [pid 3832] mod_watchdog.c(565): AH02980: Watchdog: nothing configured?
[Thu Nov 22 11:57:20.016621 2018] [proxy:debug] [pid 3832] proxy_util.c(1785): AH00925: initializing worker proxy:reverse shared
[Thu Nov 22 11:57:20.016965 2018] [proxy:debug] [pid 3832] proxy_util.c(1827): AH00927: initializing worker proxy:reverse local
[Thu Nov 22 11:57:20.017503 2018] [proxy:debug] [pid 3832] proxy_util.c(1878): AH00931: initialized single connection worker in child 3832 for (*)

Please let me know what is going wrong.

Originally posted by @Goron1606 in #22 (comment)

@c0deguard
Copy link

I'm also facing similar issue.
I guess this is because of some bug in "Proposed fix for msc_process_request_body call too early"
Here it shows building failed because of this https://travis-ci.org/SpiderLabs/ModSecurity-apache

@victorhora
Copy link
Collaborator

Hi all

I think there's an issue there indeed, but i'm not sure its related with the fact that the tests from Travis are failing. This is what Travis says about the build:

image

So Apache is failing to start (or the script is believes is the case) and unless the issue is happening right at the start of Apache/ModSecurity, it might be something wrong with the tests.

Could you please provide a full backtrace/stacktraces of this issue for further investigation?

Thanks

@cyberblackhole
Copy link
Author

cyberblackhole commented Nov 30, 2018

@victorhora Can you please specify the logs which you require and their file paths?

@victorhora
Copy link
Collaborator

I would recommend recompiling everything (ModSecurity, Apache, Apache-connector) with debug symbols. This is usually accomplished by appending CFLAGS/CPPFLAGS like so:

$ export CFLAGS="-g -O0"

After that you can collect the stack traces by following these steps: https://httpd.apache.org/dev/debugging.html

You should also check the debugging section in the README of libModSecurity and the Apache connector

Thanks for your support :)

@cyberblackhole
Copy link
Author

@victorhora Please find below the attached stacktrace of apache server

(gdb) run
Starting program: /usr/sbin/apache2 -X -d /etc/apache2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
warning: Temporarily disabling breakpoints for unloaded shared library "/opt/ModSecurity-apache/src/.libs/mod_security3.so"

Breakpoint 1, 0x00005555555c5ee0 in ap_process_request ()
(gdb) n
Single stepping until exit from function ap_process_request,
which has no line number information.

Breakpoint 2, create_tx_context (r=0x7fffe8c2a0a0) at src/mod_security3.c:135
135	    msc_t *msr = NULL;
(gdb) n
136	    msc_conf_t *z = NULL;
(gdb) n
137	    char *unique_id = NULL;
(gdb) n
139	    z = (msc_conf_t *)ap_get_module_config(r->per_dir_config,
(gdb) n
142	    msr = (msc_t *)apr_pcalloc(r->pool, sizeof(msc_t));
(gdb) n
143	    if (msr == NULL) {
(gdb) n
147	    msr->r = r;
(gdb) n
148	    unique_id = getenv("UNIQUE_ID");
(gdb) n
149	    if (unique_id != NULL || strlen(unique_id) > 0) {
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x00007fffe8c45222 in create_tx_context (r=0x7fffe8c2a0a0) at src/mod_security3.c:149
149	    if (unique_id != NULL || strlen(unique_id) > 0) {
(gdb) where
#0  0x00007fffe8c45222 in create_tx_context (r=0x7fffe8c2a0a0) at src/mod_security3.c:149
#1  0x00007fffe8c456b1 in hook_request_late (r=0x7fffe8c2a0a0) at src/mod_security3.c:371
#2  0x00005555555a3f00 in ap_run_fixups ()
#3  0x00005555555a661d in ap_process_request_internal ()
#4  0x00005555555c5d08 in ap_process_async_request ()
#5  0x00005555555c5ef0 in ap_process_request ()
#6  0x00005555555c213d in ?? ()
#7  0x00005555555b79f0 in ap_run_process_connection ()
#8  0x00007ffff4819831 in ?? () from /usr/lib/apache2/modules/mod_mpm_prefork.so
#9  0x00007ffff4819ae3 in ?? () from /usr/lib/apache2/modules/mod_mpm_prefork.so
#10 0x00007ffff481acad in ?? () from /usr/lib/apache2/modules/mod_mpm_prefork.so
#11 0x000055555559119e in ap_run_mpm ()
#12 0x0000555555589a7b in main ()
(gdb) 

@zimmerle
Copy link
Contributor

zimmerle commented Dec 4, 2018

Hi @Goron1606,

Do you happens to have mod_unique_id loaded?

@cyberblackhole
Copy link
Author

Hi @zimmerle ,

I confirm the module is enabled.

zimmerle pushed a commit that referenced this issue Dec 4, 2018
@zimmerle
Copy link
Contributor

zimmerle commented Dec 4, 2018

Fixed at: 61f2ff1

Thanks @Goron1606

@zimmerle zimmerle closed this as completed Dec 4, 2018
@cyberblackhole
Copy link
Author

cyberblackhole commented Dec 5, 2018

@zimmerle , @victorhora

Thanks for the support and quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants