-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Bad SDS Host URL causes seg fault #903
Comments
Output from a debug build with backtrace decoded:
|
The segfault is caused by the secondary_init_clusters_ list being modified within the for loop that traverses it inside ClusterManagerInitHelper::maybeFinishInitialize().
In frame #24, we are inside the for loop over secondary clusters. In frame #4 we are in removeCluster which modifies the list of secondary clusters by removing the only element. After returning to the loop invalid memory access occurs as a result. |
I have a working fix for this specific issue but I need to understand the code better and think a bit more to decide if it's the right solution. |
Thanks for fixing my bug @dnoe! Let me know if you need help with anything. |
A segfault arose when iterating over the list of secondary_init_clusters_ and calling initialize(). The call to initialize may result in the initialized item being removed from the secondary_init_clusters_ list while walking through the list. The initialized item can only remove itself, not any other item in the list. However, this resulted in chasing an invalidated iterator when trying to go to the next element in the list. To fix this the loop is modified so that the iterator is advanced to the next item (or end() if no more items) before calling Cluster::initialize(). A test is included which exercises this scenario Fixes envoyproxy#903
A segfault arose when iterating over the list of secondary_init_clusters_ and calling initialize(). The call to initialize may result in the initialized item being removed from the secondary_init_clusters_ list while walking through the list. The initialized item can only remove itself, not any other item in the list. However, this resulted in chasing an invalidated iterator when trying to go to the next element in the list. To fix this the loop is modified so that the iterator is advanced to the next item (or end() if no more items) before calling Cluster::initialize(). A test is included which exercises this scenario Fixes #903
@dnoe may I ask how did you generate the |
Automatic merge from submit-queue. [DO NOT MERGE] Auto PR to update dependencies of proxy This PR will be merged automatically once checks are successful. ```release-note none ```
Signed-off-by: Jose Nino <jnino@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
Signed-off-by: Jose Nino <jnino@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
If an unresolvable URL is specified in the Cluster Manger SDS Hosts URL, a Segmentation fault will be raised without any helpful error text, even at a debug log level.
Below is an example
Dockerfile
andfront-envoy.config
for repro. Replacingtcp://does-not-exist.amazonaws.com:80
with a valid SDS host resolves the issue.Dockerfile
front-envoy.json
The text was updated successfully, but these errors were encountered: