-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dns: fix exception unsafe behavior in c-ares callbacks. (#4307)
Previously, we were taking an exception due to the late validation of update_merge_window duration in ClusterManagerImpl::scheduleUpdate, which happened under a c-ares strict DNS host resolution callback. There are several related issues here: 1. c-ares is exception unsafe, see c-ares/c-ares#219. 2. We should be validating Durations with PGV, see bufbuild/protoc-gen-validate#97. 3. We should defer the c-ares resolution callbacks to be outside the c-ares callback context for exception safety. This PR addresses (3) by moving callbacks, even when they are "immediate", to a dispatcher post, so that we never take an exception under a c-ares callback. A workaround for (2) is provided, in lieu of bufbuild/protoc-gen-validate#97, which is blocked on our ability to bump PGV version in Envoy, see lyft/protoc-gen-star#28. Fixes oss-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9868. Risk level: Medium (DNS clusters will have some timing changes). Testing: Updated DNS implementation unit tests, server fuzz corpus entry added. Signed-off-by: Harvey Tuch <[email protected]>
- Loading branch information
Showing
8 changed files
with
199 additions
and
139 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
test/server/server_corpus/clusterfuzz-testcase-server_fuzz_test-6288786894880768
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
node { | ||
locality { | ||
} | ||
} | ||
static_resources { | ||
clusters { | ||
name: "x" | ||
type: STRICT_DNS | ||
connect_timeout { | ||
nanos: 250000000 | ||
} | ||
lb_policy: RING_HASH | ||
hosts { | ||
socket_address { | ||
address: "123.1.0.1" | ||
named_port: "x" | ||
} | ||
} | ||
hosts { | ||
socket_address { | ||
address: "127.0.0.2" | ||
named_port: "3" | ||
} | ||
} | ||
common_lb_config { | ||
update_merge_window { | ||
seconds: 281474976710656 | ||
} | ||
} | ||
} | ||
} | ||
admin { | ||
access_log_path: "@-" | ||
address { | ||
pipe { | ||
path: " " | ||
} | ||
} | ||
} |
This file contains 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