health_check: fix divide-by-zero in retry interval calculations. (#4737)

A fuzz failure indicated a divide-by-zero in HealthCheckerImplBase::interval(). Beyond this, on
inspection, it seems we allow zero retry intervals, which can live lock the main thread. This PR
fixes these issues.

Fixes oss-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10786.

Risk Level: Low
Testing: Additional unit test and a corpus entry added.

Signed-off-by: Harvey Tuch <htuch@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ b61b28fe7ae9927452477a0f4e337c53830a7070
pull/620/head
data-plane-api(CircleCI) 6 years ago
parent 741df9be8f
commit d608334530
  1. 12
      envoy/api/v2/core/health_check.proto

@ -39,11 +39,11 @@ message HealthCheck {
]; ];
// An optional jitter amount in millseconds. If specified, during every // An optional jitter amount in millseconds. If specified, during every
// interval Envoy will add 0 to interval_jitter to the wait time. // interval Envoy will add interval_jitter to the wait time.
google.protobuf.Duration interval_jitter = 3; google.protobuf.Duration interval_jitter = 3;
// An optional jitter amount as a percentage of interval_ms. If specified, // An optional jitter amount as a percentage of interval_ms. If specified,
// during every interval Envoy will add 0 to interval_ms * // during every interval Envoy will add interval_ms *
// interval_jitter_percent / 100 to the wait time. // interval_jitter_percent / 100 to the wait time.
// //
// If interval_jitter_ms and interval_jitter_percent are both set, both of // If interval_jitter_ms and interval_jitter_percent are both set, both of
@ -185,14 +185,14 @@ message HealthCheck {
// any other. // any other.
// //
// The default value for "no traffic interval" is 60 seconds. // The default value for "no traffic interval" is 60 seconds.
google.protobuf.Duration no_traffic_interval = 12; google.protobuf.Duration no_traffic_interval = 12 [(validate.rules).duration.gt = {}];
// The "unhealthy interval" is a health check interval that is used for hosts that are marked as // The "unhealthy interval" is a health check interval that is used for hosts that are marked as
// unhealthy. As soon as the host is marked as healthy, Envoy will shift back to using the // unhealthy. As soon as the host is marked as healthy, Envoy will shift back to using the
// standard health check interval that is defined. // standard health check interval that is defined.
// //
// The default value for "unhealthy interval" is the same as "interval". // The default value for "unhealthy interval" is the same as "interval".
google.protobuf.Duration unhealthy_interval = 14; google.protobuf.Duration unhealthy_interval = 14 [(validate.rules).duration.gt = {}];
// The "unhealthy edge interval" is a special health check interval that is used for the first // The "unhealthy edge interval" is a special health check interval that is used for the first
// health check right after a host is marked as unhealthy. For subsequent health checks // health check right after a host is marked as unhealthy. For subsequent health checks
@ -200,14 +200,14 @@ message HealthCheck {
// check interval that is defined. // check interval that is defined.
// //
// The default value for "unhealthy edge interval" is the same as "unhealthy interval". // The default value for "unhealthy edge interval" is the same as "unhealthy interval".
google.protobuf.Duration unhealthy_edge_interval = 15; google.protobuf.Duration unhealthy_edge_interval = 15 [(validate.rules).duration.gt = {}];
// The "healthy edge interval" is a special health check interval that is used for the first // The "healthy edge interval" is a special health check interval that is used for the first
// health check right after a host is marked as healthy. For subsequent health checks // health check right after a host is marked as healthy. For subsequent health checks
// Envoy will shift back to using the standard health check interval that is defined. // Envoy will shift back to using the standard health check interval that is defined.
// //
// The default value for "healthy edge interval" is the same as the default interval. // The default value for "healthy edge interval" is the same as the default interval.
google.protobuf.Duration healthy_edge_interval = 16; google.protobuf.Duration healthy_edge_interval = 16 [(validate.rules).duration.gt = {}];
// Specifies the path to the :ref:`health check event log <arch_overview_health_check_logging>`. // Specifies the path to the :ref:`health check event log <arch_overview_health_check_logging>`.
// If empty, no event log will be written. // If empty, no event log will be written.

Loading…
Cancel
Save