-
Notifications
You must be signed in to change notification settings - Fork 581
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
[CRASH] Compression module memory corruption #2602
Comments
The overwritten tail from the dbg logs is c0c0c0c0c0c0c0c0 != c0c0c0c0c0c0c00a... which seems to indicate that the compacted message buffer from From frame 2 of the backtrace we have the fragment of issue Is possible to print the contents of this fragment? I was unsuccessful, but maybe this will shed some light into the unexpected buffer. Any other ideas for debugging the issue? |
Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days. |
Hey team! This one was tricky to identify, but is related to miscalculated buffer length due to header sanitization. If you apply the first commit from the PR that I just submitted (a5b6d2e) and send a request with some non-compacted header that will be sanitized when parsed then you will see the new LM_BUG report an overflow. Example:
In the PR that I submitted, I removed the shortcutting on header assembly. Let me know if you have a better solution! |
Hi @john08burke , thanks for your work here !! Are you talking about #2632 , right ? |
Hey @bogdan-iancu, yes that's the one! Let me know if you need more info to reproduce. You should be able to trigger the overflow log if you cherry-pick a5b6d2e. Ideally Q_MALLOC+DBG should catch it too, but in my test env I could never get it to dump! |
I also realized that I detailed the bug in my commit (ba89136), but didn't really put the info here! The cause of the overflow seems to be with the shortcutting of non-compact SIP headers when re-assembling after compaction, especially in case when "sanitization" was performed. The calculation for memory allocation is always done with the For example, something like:
where there is an extra space will lead to allocation len being 1 byte less than what will be written to buffer! |
Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days. |
keepalive, I can provide an env to replicate this if that would help! |
Hey @bogdan-iancu! Any chance we can try to get this one reviewed and closed out? I've been running with the submitted patch for ~2months and haven't seen the crash since. |
Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days. |
Marking as closed due to lack of progress for more than 30 days. If this issue is still relevant, please re-open it with additional details. |
OpenSIPS version you are running
This is with nightly 3.1 (right before 3.1.4 was tagged). I have been chasing a segfault for quite some time now in our production environment and haven't been able to reproduce in our lab / dev environments. The crash is very intermittent (a month between crashes) but always triggers a similar set of logs:
The logs seem to indicate some memory corruption, so I ran with Q_MALLOC + DBG and within a few calls OpenSIPS crashed with SIGABRT and seems the allocator detected memory issue with the compression module:
We only use the
mc_compact
method, so it seems that themc_compact_cb
function is likely the culprit.Here is the core dump that was produced (purged of sensitive info). I can provide the full dump if needed via email.
Let me know if you need any further info!
To Reproduce
The crash is random and I haven't been able to reproduce.
OS/environment information
The text was updated successfully, but these errors were encountered: