Fix out-of-bounds read of the connection retry backoff table - #656
Open
csaavedra wants to merge 1 commit into
Open
Fix out-of-bounds read of the connection retry backoff table#656csaavedra wants to merge 1 commit into
csaavedra wants to merge 1 commit into
Conversation
table_size was computed by taking sizeof() of the whole array without dividing by the size of an element, so it ended up being 96 (the size of the table in bytes) instead of 12 (its number of entries). The guard that keeps m_inConnAttempt from growing further therefore let it reach 95, and from the 13th consecutive failed connection test onwards time_offset_table was indexed out of bounds. The delay until the next test then comes from whatever data happens to follow the table, which can leave a node flagged as not accepting incoming connections, and thus ineligible for any job, for an effectively unbounded time. Nothing recovers from that but the daemon reconnecting or the scheduler being restarted. With the number of entries computed correctly the index saturates on the last one again, so the retry interval stops growing at 4096 seconds as originally intended. Broken since 0d4b678.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
table_size was computed by taking sizeof() of the whole array without dividing by the size of an element, so it ended up being 96 (the size of the table in bytes) instead of 12 (its number of entries). The guard that keeps m_inConnAttempt from growing further therefore let it reach 95, and from the 13th consecutive failed connection test onwards time_offset_table was indexed out of bounds.
The delay until the next test then comes from whatever data happens to follow the table, which can leave a node flagged as not accepting incoming connections, and thus ineligible for any job, for an effectively unbounded time. Nothing recovers from that but the daemon reconnecting or the scheduler being restarted.
With the number of entries computed correctly the index saturates on the last one again, so the retry interval stops growing at 4096 seconds as originally intended.
Broken since 0d4b678.