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
Clear next field when returnining list elements in queue.c #2283
Conversation
Could you please add line: |
@frozencemetery nevermind I did it myself :) |
FYI I tested a 4.6 version of this and it seems to fix the crash. I've run tests similar to the pagure 7262 description for many hours (12 last night, multiple tests before). I've seen no new crashes since applying this patch. |
It would be really great to have a unit test to test the queueing code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
please find an inline comment.
ca830e9
to
0ea425c
Compare
Also added unit tests. |
Hello @frozencemetery, |
Hi @frozencemetery |
The ipa-otpd code occasionally removes elements from one queue, inspects and modifies them, and then inserts them into another (possibly identical, possibly different) queue. When the next pointer isn't cleared, this can result in element membership in both queues, leading to double frees, or even self-referential elements, causing infinite loops at traversal time. Rather than eliminating the pattern, make it safe by clearing the next field any time an element enters or exits a queue. Related https://pagure.io/freeipa/issue/7262
e109481
to
c8cd4eb
Compare
Heh, sorry @Tiboris! Fixed now. |
The ipa-otpd code occasionally removes elements from one queue,
inspects and modifies them, and then inserts them into
another (possibly identical, possibly different) queue. When the next
pointer isn't cleared, this can result in element membership in both
queues, leading to double frees, or even self-referential elements,
causing infinite loops at traversal time.
Rather than eliminating the pattern, make it safe by clearing the next
field any time an element enters or exits a queue.
Related https://pagure.io/freeipa/issue/7262