-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fixing few issues with BindingManager and issues with how clients used BindingManager #22133
Fixing few issues with BindingManager and issues with how clients used BindingManager #22133
Conversation
Fixed: * Issue where BindingManager::EstablishConnection only called once * Prevented used after free * Prevented buffer overrun
Justification for 1.0 inclusion: Fixes a use-after-free bug with Bindings which can/should crash. |
PR #22133: Size comparison from 591b386 to bc56a4a Increases (7 builds for bl602, cc13x2_26x2, efr32, psoc6)
Decreases (4 builds for cc13x2_26x2, cyw30739, psoc6)
Full report (41 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6)
|
This allows multiple connection async establishments to multiple nodes.
PR #22133: Size comparison from 591b386 to 780e73b Increases (2 builds for nrfconnect)
Decreases (2 builds for nrfconnect)
Full report (2 builds for nrfconnect)
|
PR #22133: Size comparison from 7870328 to 6c78c16 Increases (23 builds for bl602, cc13x2_26x2, esp32, linux, nrfconnect, psoc6, telink)
Decreases (20 builds for cc13x2_26x2, esp32, linux, nrfconnect, psoc6, telink)
Full report (43 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, telink)
|
PR #22133: Size comparison from 3d7cc78 to 13e80a9 Increases (25 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, linux, nrfconnect, psoc6, telink)
Decreases (20 builds for cc13x2_26x2, esp32, linux, nrfconnect, psoc6, telink)
Full report (43 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, telink)
|
if (mLastSessionEstablishmentError == CHIP_ERROR_NO_MEMORY) | ||
{ | ||
// Release the least recently used entry | ||
// TODO: Some reference counting mechanism shall be added the CASESessionManager | ||
// so that other session clients don't get accidentally closed. | ||
ScopedNodeId peerToRemove; | ||
if (mPendingNotificationMap.FindLRUConnectPeer(peerToRemove) == CHIP_NO_ERROR) | ||
{ | ||
mPendingNotificationMap.RemoveAllEntriesForNode(peerToRemove); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this help, though? If we got NO_MEMORY that means the SessionSetup pool is full, no? How else can we end up here? And messing with our notification map will not help with that, I don't think; we would have to cancel some session setups, which is what this code used to do when it was working with OperationalDeviceProxy.
This part needs some thought as to how exactly it should work. Is this what #22173 is about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…d BindingManager (project-chip#22133) * Couple with BindingManager Fixed: * Issue where BindingManager::EstablishConnection only called once * Prevented used after free * Prevented buffer overrun * Restyle * Allocate callbacks in EstablishConnection This allows multiple connection async establishments to multiple nodes. * Address PR comments
Problem
Change overview
Testing
scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone chip_config_network_layer_ble=false chip_build_libshell=true
rm -f rm -f kvs1 kvs2 kvs3
Terminal 1
run./out/debug/standalone/chip-all-clusters-app --secured-device-port 72564 --KVS kvs1
(port was picked by mashing keys)Terminal 2
run./out/debug/standalone/chip-tool pairing onnetwork 1 20202021
Terminal 3
run./out/debug/standalone/chip-all-clusters-app --secured-device-port 72574 --KVS kvs2
Terminal 2
run./out/debug/standalone/chip-tool pairing onnetwork 2 20202021
Terminal 4
run./out/debug/standalone/chip-all-clusters-app --KVS kvs3
Terminal 2
run./out/debug/standalone/chip-tool pairing onnetwork 3 20202021
Terminal 2
run./out/debug/standalone/chip-tool binding write binding '[{"fabricIndex": 1, "node": 2, "endpoint": 1, "cluster": 6}, {"fabricIndex": 1, "node": 3, "endpoint": 1, "cluster": 6}]' 1 1
Terminal 1
runswitch on
Terminal 3
run./out/debug/standalone/chip-all-clusters-app --secured-device-port 72574 --KVS kvs2
Terminal 4
run./out/debug/standalone/chip-all-clusters-app --KVS kvs3
Terminal 1
runswitch on