Fix a suppressor segfault due to being called twice from wordlist#5714
Fix a suppressor segfault due to being called twice from wordlist#5714magnumripper wants to merge 1 commit intoopenwall:bleeding-jumbofrom
Conversation
91f9227 to
581c3f0
Compare
581c3f0 to
d226d45
Compare
|
Just for reference, it looks like using |
I've just tried using |
| void suppressor_init(unsigned int new_flags) | ||
| { | ||
| if (old_process_key) | ||
| return; |
There was a problem hiding this comment.
Actually, this may be wrong. We do call suppressor_init a second time on purpose when transitioning from wordlist to incremental mode. I guess that worked fine because crk_process_key got reset to incremental mode's before that second call. But now the above check probably breaks it.
There was a problem hiding this comment.
Maybe we could just do this
diff --git a/src/suppressor.c b/src/suppressor.c
index d4537f19e..3b36476c9 100644
--- a/src/suppressor.c
+++ b/src/suppressor.c
@@ -66,7 +66,8 @@ void suppressor_init(unsigned int new_flags)
flags = new_flags;
status.suppressor_end = 0;
status.suppressor_end_time = 0;
- old_process_key = crk_process_key;
+ if (!old_process_key)
+ old_process_key = crk_process_key;
crk_process_key = suppressor_process_key;
}
There was a problem hiding this comment.
Hmm no that might not be right either, as crk_process_key apparently changes over time.
There was a problem hiding this comment.
Perhaps this (edited for typo)
diff --git a/src/suppressor.c b/src/suppressor.c
index 7fa3fef0d..bed090f54 100644
--- a/src/suppressor.c
+++ b/src/suppressor.c
@@ -27,6 +27,9 @@ static int suppressor_process_key(char *key);
void suppressor_init(unsigned int new_flags)
{
+ if (crk_process_key == suppressor_process_key)
+ return;
+
if (!flags) {
if (!(new_flags & SUPPRESSOR_UPDATE))
return;
I didn't verify but it sure looks like it. Did you run it until the "Disabling duplicate candidate password suppressor" appeared? After that, next |
I am able to reproduce this part, as seen from a debugging print I added.
I could not reproduce this part yet. I'd expect we'd first trigger recursion when |
|
I'll try to come up with a proper fix. This is quite a bit more involved. |
With |
I debugged it now, and it doesn't happen because the pipe buffer is (always?) large enough that dupe suppression gets disabled before the goto, and then a re-init should be OK - right? |
Previously, we only supported a repeated initialization call after cracking mode transition, but as magnum found we may also call more than once from within wordlist mode. Fixes openwall#5714
No, these two statements don't sound right to me. Anyway, I've just prepared a new PR, which passes my tests (including with debugging print added, and with wordlist to incremental mode transitions and the suppressor getting disabled before or after the transition). |
This statement may be right. Looks like the |
I believe the first statement is correct, I saw suppression being disabled way before any goto/re-init. The default pipe buffer is 150 MB. Then again it would depend on number of rules - I used |
Previously, we only supported a repeated initialization call after cracking mode transition, but as magnum found we may also call more than once from within wordlist mode. Fixes #5714
We had a dupe suppression segfault (mentioned with the mgetl problem in #5704, but unrelated). It turns out it would only trigger when running
--loopback. The problem is that wordlist.c would callsuppressor_init()twice in that case, resulting inold_process_keybeing set tosuppressor_process_key()and losing the original pointer tocrk_process_key()forever. Later,crk_process_keywould be reset to the incorrectold_process_keyand as a result we'd eventually callsuppressor_process_key()afterfilteris freed.In wordlist.c, the label
REDO_AFTER_LMLOOP:is a hint of why it happens. I separately added protection in suppressor.c as well (does not affect performance) - in my opinion we should do both.BTW Presumably the problem would only surface when we actually had some LM hashes in the input file, and some of them was present in the pot file so assembled to the special loop. That's why it went under the radar for quite some time. I didn't verify this explanation though, the
available time / curiosityratio is too low.