Skip to content
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

[Tizen] Call mDNS resolve callback under stack lock #19947

Merged
merged 1 commit into from
Jun 24, 2022

Conversation

arkq
Copy link
Contributor

@arkq arkq commented Jun 24, 2022

Problem

Changes in dc3862a has uncovered potential race condition in Tizen mDNS
resolver. The callback function was called outside of the Matter stack
lock. This callback might perform PASE session paring which involves
message exchanges, which requires locking. Simple fix for that is to
call the callback under the lock.

Change overview

  • call mDNS resolver callback under stack lock

Testing

Manually tested that Tizen chip-tool can commission lighting-app running on the network.

Previously we've got this:

On Linux:

./out/linux-x64-light/chip-lighting-app --passcode 4321

On Tizen:

/opt/usr/apps/chip-tool pairing onnetwork 1 9999

....
D/CHIP    ( 6968): DL: DNSsd OnResolve: IPv4: 192.168.88.10, IPv6: FE80:0000:0000:0000:4510:EABB:CBCC:C729, ret: 0
I/CHIP    ( 6968): TOO: Discovered Device: fe80::4510:eabb:cbcc:c729:5540
D/CHIP    ( 6968): IN: SecureSession[0x1091908]: Allocated Type:1 LSID:43601
D/CHIP    ( 6968): SC: Assigned local session key ID 43601
D/CHIP    ( 6968): SC: Including MRP parameters in PBKDF param request
E/CHIP    ( 6968): DL: Chip stack locking error at '../../examples/chip-tool/third_party/connectedhomeip/src/messaging/ExchangeContext.cpp:138'. Code is unsafe/racy
E/CHIP    ( 6968): -: chipDie chipDie chipDie

Changes in dc3862a has uncovered potential race condition in Tizen mDNS
resolver. The callback function was called outside of the Matter stack
lock. This callback might perform PASE session paring which involves
message exchanges, which requires locking. Simple fix for that is to
call the callback under the lock.
@github-actions
Copy link

github-actions bot commented Jun 24, 2022

PR #19947: Size comparison from 2d0c529 to ad93cea

Increases (2 builds for cc13x2_26x2, telink)
platform target config section 2d0c529 ad93cea change % change
cc13x2_26x2 lock-mtd LP_CC2652R7 (read only) 612931 612939 8 0.0
.text 537384 537392 8 0.0
telink lighting-app tlsr9518adk80d text 577684 577686 2 0.0
Full report (30 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 2d0c529 ad93cea change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 660539 660539 0 0.0
(read/write) 192132 192132 0 0.0
.bss 75564 75564 0 0.0
.data 3352 3352 0 0.0
.rodata 87059 87059 0 0.0
.text 573168 573168 0 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 649431 649431 0 0.0
(read/write) 159120 159120 0 0.0
.bss 74852 74852 0 0.0
.data 3352 3352 0 0.0
.rodata 90671 90671 0 0.0
.text 558440 558440 0 0.0
lock-ftd LP_CC2652R7 (read only) 663523 663523 0 0.0
(read/write) 179292 179292 0 0.0
.bss 72596 72596 0 0.0
.data 3276 3276 0 0.0
.rodata 75179 75179 0 0.0
.text 587864 587864 0 0.0
lock-mtd LP_CC2652R7 (read only) 612931 612939 8 0.0
(read/write) 145724 145724 0 0.0
.bss 68332 68332 0 0.0
.data 3276 3276 0 0.0
.rodata 75059 75059 0 0.0
.text 537384 537392 8 0.0
pump-app LP_CC2652R7 (read only) 673439 673439 0 0.0
(read/write) 170240 170240 0 0.0
.bss 72692 72692 0 0.0
.data 3276 3276 0 0.0
.rodata 87831 87831 0 0.0
.text 585124 585124 0 0.0
pump-controller-app LP_CC2652R7 (read only) 659319 659319 0 0.0
(read/write) 184472 184472 0 0.0
.bss 72804 72804 0 0.0
.data 3272 3272 0 0.0
.rodata 83671 83671 0 0.0
.text 575168 575168 0 0.0
shell LP_CC2652R7 (read only) 690378 690378 0 0.0
(read/write) 157796 157796 0 0.0
.bss 77868 77868 0 0.0
.data 3356 3356 0 0.0
.rodata 109922 109922 0 0.0
.text 580144 580144 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 592610 592610 0 0.0
.app_xip_area 462732 462732 0 0.0
.bss 72848 72848 0 0.0
.data 712 712 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 594218 594218 0 0.0
.app_xip_area 464132 464132 0 0.0
.bss 73048 73048 0 0.0
.data 716 716 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 595238 595238 0 0.0
.app_xip_area 466232 466232 0 0.0
.bss 72032 72032 0 0.0
.data 656 656 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read/write) 1073348 1073348 0 0.0
.bss 134316 134316 0 0.0
.data 2044 2044 0 0.0
.text 936968 936968 0 0.0
BRD4161A+rpc (read/write) 1127436 1127436 0 0.0
.bss 151004 151004 0 0.0
.data 2256 2256 0 0.0
.text 974156 974156 0 0.0
BRD4161A+rs911x (read/write) 937376 937376 0 0.0
.bss 140088 140088 0 0.0
.data 2044 2044 0 0.0
.text 795220 795220 0 0.0
lock-app BRD4161A+wf200 (read/write) 1117580 1117580 0 0.0
.bss 140536 140536 0 0.0
.data 2056 2056 0 0.0
.text 974968 974968 0 0.0
window-app BRD4161A (read/write) 1058600 1058600 0 0.0
.bss 134388 134388 0 0.0
.data 2072 2072 0 0.0
.text 922120 922120 0 0.0
esp32 all-clusters-app c3devkit (read only) 1014322 1014322 0 0.0
(read/write) 1485698 1485698 0 0.0
.dram0.bss 71424 71424 0 0.0
.dram0.data 14624 14624 0 0.0
.flash.rodata 214224 214224 0 0.0
.flash.text 1014322 1014322 0 0.0
.iram0.text 62902 62902 0 0.0
m5stack (read only) 1068583 1068583 0 0.0
(read/write) 487800 487800 0 0.0
.dram0.bss 76936 76936 0 0.0
.dram0.data 34144 34144 0 0.0
.flash.rodata 244724 244724 0 0.0
.flash.text 1063199 1063199 0 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 662824 662824 0 0.0
.bss 70988 70988 0 0.0
.data 1988 1988 0 0.0
.text 584048 584048 0 0.0
lock k32w061+release (read/write) 695120 695120 0 0.0
.bss 71460 71460 0 0.0
.data 2000 2000 0 0.0
.text 615860 615860 0 0.0
linux chip-tool-no-interactive-ipv6only arm64 (read only) 9903788 9903788 0 0.0
(read/write) 675249 675249 0 0.0
.bss 42641 42641 0 0.0
.data 1152 1152 0 0.0
.data.rel.ro 614176 614176 0 0.0
.dynamic 528 528 0 0.0
.got 13472 13472 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 471484 471484 0 0.0
.text 7893428 7893428 0 0.0
thermostat-no-ble arm64 (read only) 2579164 2579164 0 0.0
(read/write) 180593 180593 0 0.0
.bss 87905 87905 0 0.0
.data 1696 1696 0 0.0
.data.rel.ro 82888 82888 0 0.0
.dynamic 528 528 0 0.0
.got 5088 5088 0 0.0
.init 24 24 0 0.0
.init_array 400 400 0 0.0
.rodata 164812 164812 0 0.0
.text 2175296 2175296 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2444192 2444192 0 0.0
.bss 214724 214724 0 0.0
.data 5872 5872 0 0.0
.text 1406836 1406836 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1203803 1203803 0 0.0
bss 144246 144246 0 0.0
rodata 156436 156436 0 0.0
text 824304 824304 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1151151 1151151 0 0.0
bss 143482 143482 0 0.0
rodata 132768 132768 0 0.0
text 796096 796096 0 0.0
p6 all-clusters-app default (read/write) 2556024 2556024 0 0.0
.bss 149872 149872 0 0.0
.data 2768 2768 0 0.0
.text 1514288 1514288 0 0.0
all-clusters-minimal-app default (read/write) 2501872 2501872 0 0.0
.bss 149152 149152 0 0.0
.data 2768 2768 0 0.0
.text 1460136 1460136 0 0.0
light-app default (read/write) 2432632 2432632 0 0.0
.bss 141232 141232 0 0.0
.data 2584 2584 0 0.0
.text 1390896 1390896 0 0.0
lock-app default (read/write) 2458896 2458896 0 0.0
.bss 141080 141080 0 0.0
.data 2600 2600 0 0.0
.text 1417160 1417160 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 793188 793188 0 0.0
bss 71924 71924 0 0.0
noinit 40416 40416 0 0.0
text 561224 561224 0 0.0
lighting-app tlsr9518adk80d (read/write) 813500 813500 0 0.0
bss 72772 72772 0 0.0
noinit 40416 40416 0 0.0
text 577684 577686 2 0.0

@bzbarsky-apple bzbarsky-apple merged commit ede80ab into project-chip:master Jun 24, 2022
@arkq arkq deleted the tizen-lock-matter branch June 25, 2022 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants