eds: use-after-free in LEDS callback on subsequent EDS updates#43667
Check was skipped
This check was not triggered in this CI run
Details
Request (pr/43667/main@ee9057a)
@wdauchy
ee9057a #43667
merge main@5f9de99
eds: use-after-free in LEDS callback on subsequent EDS updates
Commit Message:
The LEDS subscription callback lambda capturedused_load_assignmentby value as a raw pointer to the object owned by thecluster_load_assignment_unique_ptr. When a subsequent EDS update reassignedcluster_load_assignment_, the old object was destroyed but existing LEDS subscriptions (not recreated for unchanged configs) still held the dangling pointer. When the LEDS subscription later fired its callback (e.g. onConfigUpdateFailed), dereferencing this pointer caused a segfault.Stack trace:
#0: [0x77b9d6de8330] #1: Envoy::Upstream::EdsClusterImpl::BatchUpdateHelper::batchUpdate() #2: Envoy::Upstream::PrioritySetImpl::batchHostUpdate() #3: std::__1::__function::__func<>::operator()() #4: Envoy::Upstream::LedsSubscription::onConfigUpdateFailed() #5: Envoy::Config::GrpcSubscriptionImpl::onConfigUpdateFailed() #6: event_process_active_single_queue #7: event_base_loop #8: Envoy::Server::InstanceBase::run()Fix by capturing
thisand accessingcluster_load_assignment_directly, which always reflects the current valid assignment.
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]
Environment
Request variables
| Key | Value |
|---|---|
| ref | 89e0719 |
| sha | ee9057a |
| pr | 43667 |
| base-sha | 5f9de99 |
| actor | |
| message | eds: use-after-free in LEDS callback on subsequent EDS updates... |
| started | 1772180059.808555 |
| target-branch | main |
| trusted | false |
Build image
Container image/s (as used in this CI run)
| Key | Value |
|---|---|
| default | docker.io/envoyproxy/envoy-build:86873047235e9b8232df989a5999b9bebf9db69c |
| mobile | docker.io/envoyproxy/envoy-build:mobile-86873047235e9b8232df989a5999b9bebf9db69c |
Version
Envoy version (as used in this CI run)
| Key | Value |
|---|---|
| major | 1 |
| minor | 38 |
| patch | 0 |
| dev | true |