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

Fix and refactor ReadSingleClusterData #13468

Conversation

mlepage-google
Copy link
Contributor

Problem

PR #12660 seems to have refactored ReadSingleClusterData in such a way
that the access control check may be skipped. (Possibly due to merge?)

Change overview

Fix this by refactoring the function to a sensible flow of checks.
Progress towards #10239

Testing

Built and ran (all-clusters-app, REPL, on Linux) and read some attributes (including AttributeList)

PR project-chip#12660 seems to have refactored ReadSingleClusterData in such a way
that the access control check may be skipped. (Possibly due to merge?)

Fix this by refactoring the function to a sensible flow of checks.

Progress towards project-chip#10239
@github-actions
Copy link

github-actions bot commented Jan 11, 2022

PR #13468: Size comparison from 781f540 to e7498ef

Increases (10 builds for linux, nrfconnect)
platform target config section 781f540 e7498ef change % change
linux chip-tool-ipv6only arm64 (read only) 7183436 7183532 96 0.0
.text 6061956 6062052 96 0.0
thermostat-no-ble arm64 (read only) 2037468 2037564 96 0.0
.text 1693888 1693984 96 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 939295 939311 16 0.0
text 634112 634124 12 0.0
nrf52840dk_nrf52840+rpc (read/write) 924763 924779 16 0.0
text 629464 629480 16 0.0
nrf52840dongle_nrf52840 (read/write) 989971 989987 16 0.0
text 666308 666324 16 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 849154 849170 16 0.0
text 551032 551048 16 0.0
lock-app nrf52840dk_nrf52840 (read/write) 911567 911583 16 0.0
text 612104 612116 12 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 821606 821622 16 0.0
text 529064 529080 16 0.0
pump-app nrf52840dk_nrf52840 text 613364 613376 12 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 909647 909663 16 0.0
text 610852 610868 16 0.0
Decreases (5 builds for esp32, p6, telink)
platform target config section 781f540 e7498ef change % change
esp32 all-clusters-app c3devkit (read only) 898316 898264 -52 -0.0
.flash.text 898316 898264 -52 -0.0
m5stack (read only) 959427 959363 -64 -0.0
.flash.text 954043 953979 -64 -0.0
p6 all-clusters-app default (read/write) 2403200 2403184 -16 -0.0
.text 1361464 1361448 -16 -0.0
lock-app default (read/write) 2297320 2297304 -16 -0.0
.text 1255584 1255568 -16 -0.0
telink lighting-app tlsr9518adk80d (read/write) 835878 835822 -56 -0.0
text 583752 583694 -58 -0.0
Full report (32 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 781f540 e7498ef change % change
efr32 lighting-app BRD4161A (read only) 830256 830256 0 0.0
(read/write) 127300 127300 0 0.0
.bss 125420 125420 0 0.0
.data 1880 1880 0 0.0
.text 830248 830248 0 0.0
BRD4161A+rpc (read only) 817660 817660 0 0.0
(read/write) 143960 143960 0 0.0
.bss 141980 141980 0 0.0
.data 1980 1980 0 0.0
.text 817652 817652 0 0.0
window-app BRD4161A (read only) 804200 804200 0 0.0
(read/write) 126008 126008 0 0.0
.bss 124168 124168 0 0.0
.data 1836 1836 0 0.0
.text 804192 804192 0 0.0
esp32 all-clusters-app c3devkit (read only) 898316 898264 -52 -0.0
(read/write) 1316082 1316082 0 0.0
.dram0.bss 70168 70168 0 0.0
.dram0.data 14212 14212 0 0.0
.flash.rodata 178200 178200 0 0.0
.flash.text 898316 898264 -52 -0.0
.iram0.text 62056 62056 0 0.0
m5stack (read only) 959427 959363 -64 -0.0
(read/write) 448536 448536 0 0.0
.dram0.bss 74656 74656 0 0.0
.dram0.data 34064 34064 0 0.0
.flash.rodata 207688 207688 0 0.0
.flash.text 954043 953979 -64 -0.0
.iram0.text 123399 123399 0 0.0
k32w light k32w061+release (read/write) 656380 656380 0 0.0
.bss 76824 76824 0 0.0
.data 1852 1852 0 0.0
.text 571904 571904 0 0.0
lock k32w061+release (read/write) 660720 660720 0 0.0
.bss 77120 77120 0 0.0
.data 1872 1872 0 0.0
.text 575928 575928 0 0.0
linux chip-tool-ipv6only arm64 (read only) 7183436 7183532 96 0.0
(read/write) 344625 344625 0 0.0
.bss 54865 54865 0 0.0
.data 1096 1096 0 0.0
.data.rel.ro 226744 226744 0 0.0
.dynamic 560 560 0 0.0
.got 58232 58232 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 390308 390308 0 0.0
.text 6061956 6062052 96 0.0
thermostat-no-ble arm64 (read only) 2037468 2037564 96 0.0
(read/write) 145505 145505 0 0.0
.bss 64737 64737 0 0.0
.data 880 880 0 0.0
.data.rel.ro 72912 72912 0 0.0
.dynamic 560 560 0 0.0
.got 4040 4040 0 0.0
.init 24 24 0 0.0
.init_array 304 304 0 0.0
.rodata 129276 129276 0 0.0
.text 1693888 1693984 96 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2348912 2348912 0 0.0
.bss 188876 188876 0 0.0
.data 5320 5320 0 0.0
.text 1311488 1311488 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2330560 2330560 0 0.0
.bss 180416 180416 0 0.0
.data 5552 5552 0 0.0
.text 1293160 1293160 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2303784 2303784 0 0.0
.bss 179456 179456 0 0.0
.data 5544 5544 0 0.0
.text 1266384 1266384 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2054232 2054232 0 0.0
.bss 156876 156876 0 0.0
.data 4864 4864 0 0.0
.text 1016832 1016832 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 939295 939311 16 0.0
bss 119284 119284 0 0.0
rodata 108332 108332 0 0.0
text 634112 634124 12 0.0
nrf52840dk_nrf52840+rpc (read/write) 924763 924779 16 0.0
bss 116328 116328 0 0.0
rodata 100784 100784 0 0.0
text 629464 629480 16 0.0
nrf52840dongle_nrf52840 (read/write) 989971 989987 16 0.0
bss 122128 122128 0 0.0
rodata 113084 113084 0 0.0
text 666308 666324 16 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 849154 849170 16 0.0
bss 116072 116072 0 0.0
rodata 101508 101508 0 0.0
text 551032 551048 16 0.0
lock-app nrf52840dk_nrf52840 (read/write) 911567 911583 16 0.0
bss 118472 118472 0 0.0
rodata 103604 103604 0 0.0
text 612104 612116 12 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 821606 821622 16 0.0
bss 115288 115288 0 0.0
rodata 96832 96832 0 0.0
text 529064 529080 16 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 541835 541835 0 0.0
bss 52588 52588 0 0.0
rodata 50104 50104 0 0.0
text 376940 376940 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 912863 912863 0 0.0
bss 118232 118232 0 0.0
rodata 103820 103820 0 0.0
text 613364 613376 12 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 909647 909663 16 0.0
bss 118260 118260 0 0.0
rodata 103076 103076 0 0.0
text 610852 610868 16 0.0
shell nrf52840dk_nrf52840 (read/write) 798423 798423 0 0.0
bss 109776 109776 0 0.0
rodata 78284 78284 0 0.0
text 533856 533856 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 711238 711238 0 0.0
bss 107664 107664 0 0.0
rodata 72584 72584 0 0.0
text 451536 451536 0 0.0
p6 all-clusters-app default (read/write) 2403200 2403184 -16 -0.0
.bss 117148 117148 0 0.0
.data 2592 2592 0 0.0
.text 1361464 1361448 -16 -0.0
light-app default (read/write) 2325088 2325088 0 0.0
.bss 105728 105728 0 0.0
.data 2384 2384 0 0.0
.text 1283352 1283352 0 0.0
lock-app default (read/write) 2297320 2297304 -16 -0.0
.bss 104608 104608 0 0.0
.data 2344 2344 0 0.0
.text 1255584 1255568 -16 -0.0
qpg lighting-app qpg6105+debug (read only) 534060 534060 0 0.0
(read/write) 146940 146940 0 0.0
.bss 86672 86672 0 0.0
.data 1008 1008 0 0.0
.text 528740 528740 0 0.0
lock-app qpg6105+debug (read only) 505980 505980 0 0.0
(read/write) 146936 146936 0 0.0
.bss 85808 85808 0 0.0
.data 956 956 0 0.0
.text 500660 500660 0 0.0
persistent-storage-app qpg6105+debug (read only) 106448 106448 0 0.0
(read/write) 146938 146938 0 0.0
.bss 36146 36146 0 0.0
.data 288 288 0 0.0
.text 101128 101128 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 835878 835822 -56 -0.0
bss 86976 86976 0 0.0
noinit 37160 37160 0 0.0
text 583752 583694 -58 -0.0

@github-actions
Copy link

github-actions bot commented Jan 12, 2022

PR #13468: Size comparison from 781f540 to 78b0497

Increases above 0.2%:

platform target config section 781f540 78b0497b change % change
linux thermostat-no-ble arm64 .rodata 129276 129628 352 0.3
Increases (14 builds for efr32, k32w, linux, mbed, p6, qpg, telink)
platform target config section 781f540 78b0497b change % change
efr32 lighting-app BRD4161A (read only) 830256 830532 276 0.0
.text 830248 830524 276 0.0
BRD4161A+rpc (read only) 817660 817936 276 0.0
(read/write) 143960 143964 4 0.0
.text 817652 817928 276 0.0
window-app BRD4161A (read only) 804200 804476 276 0.0
.text 804192 804468 276 0.0
k32w light k32w061+release (read/write) 656380 656644 264 0.0
.text 571904 572168 264 0.0
lock k32w061+release (read/write) 660720 660980 260 0.0
.text 575928 576188 260 0.0
linux chip-tool-ipv6only arm64 (read only) 7183436 7184716 1280 0.0
.rodata 390308 390868 560 0.1
.text 6061956 6062676 720 0.0
thermostat-no-ble arm64 (read only) 2037468 2038540 1072 0.1
.rodata 129276 129628 352 0.3
.text 1693888 1694608 720 0.0
mbed lighting-app CY8CPROTO_062_4343W+release (read/write) 2330560 2330808 248 0.0
.text 1293160 1293408 248 0.0
lock-app CY8CPROTO_062_4343W+release (read/write) 2303784 2304032 248 0.0
.text 1266384 1266632 248 0.0
p6 light-app default (read/write) 2325088 2325376 288 0.0
.text 1283352 1283640 288 0.0
lock-app default (read/write) 2297320 2297600 280 0.0
.text 1255584 1255864 280 0.0
qpg lighting-app qpg6105+debug (read only) 534060 534308 248 0.0
.text 528740 528988 248 0.0
lock-app qpg6105+debug (read only) 505980 506228 248 0.0
.text 500660 500908 248 0.0
telink lighting-app tlsr9518adk80d (read/write) 835878 836102 224 0.0
text 583752 583852 100 0.0
Decreases (5 builds for efr32, esp32, mbed, p6)
platform target config section 781f540 78b0497b change % change
efr32 window-app BRD4161A (read/write) 126008 126004 -4 -0.0
esp32 all-clusters-app c3devkit (read only) 898316 896710 -1606 -0.2
(read/write) 1316082 1316074 -8 -0.0
.flash.rodata 178200 178192 -8 -0.0
.flash.text 898316 896710 -1606 -0.2
m5stack (read only) 959427 957963 -1464 -0.2
(read/write) 448536 448528 -8 -0.0
.flash.rodata 207688 207680 -8 -0.0
.flash.text 954043 952579 -1464 -0.2
mbed all-clusters-app CY8CPROTO_062_4343W+release (read/write) 2348912 2347392 -1520 -0.1
.text 1311488 1309968 -1520 -0.1
p6 all-clusters-app default (read/write) 2403200 2401432 -1768 -0.1
.text 1361464 1359696 -1768 -0.1
Full report (21 builds for efr32, esp32, k32w, linux, mbed, p6, qpg, telink)
platform target config section 781f540 78b0497b change % change
efr32 lighting-app BRD4161A (read only) 830256 830532 276 0.0
(read/write) 127300 127300 0 0.0
.bss 125420 125420 0 0.0
.data 1880 1880 0 0.0
.text 830248 830524 276 0.0
BRD4161A+rpc (read only) 817660 817936 276 0.0
(read/write) 143960 143964 4 0.0
.bss 141980 141980 0 0.0
.data 1980 1980 0 0.0
.text 817652 817928 276 0.0
window-app BRD4161A (read only) 804200 804476 276 0.0
(read/write) 126008 126004 -4 -0.0
.bss 124168 124168 0 0.0
.data 1836 1836 0 0.0
.text 804192 804468 276 0.0
esp32 all-clusters-app c3devkit (read only) 898316 896710 -1606 -0.2
(read/write) 1316082 1316074 -8 -0.0
.dram0.bss 70168 70168 0 0.0
.dram0.data 14212 14212 0 0.0
.flash.rodata 178200 178192 -8 -0.0
.flash.text 898316 896710 -1606 -0.2
.iram0.text 62056 62056 0 0.0
m5stack (read only) 959427 957963 -1464 -0.2
(read/write) 448536 448528 -8 -0.0
.dram0.bss 74656 74656 0 0.0
.dram0.data 34064 34064 0 0.0
.flash.rodata 207688 207680 -8 -0.0
.flash.text 954043 952579 -1464 -0.2
.iram0.text 123399 123399 0 0.0
k32w light k32w061+release (read/write) 656380 656644 264 0.0
.bss 76824 76824 0 0.0
.data 1852 1852 0 0.0
.text 571904 572168 264 0.0
lock k32w061+release (read/write) 660720 660980 260 0.0
.bss 77120 77120 0 0.0
.data 1872 1872 0 0.0
.text 575928 576188 260 0.0
linux chip-tool-ipv6only arm64 (read only) 7183436 7184716 1280 0.0
(read/write) 344625 344625 0 0.0
.bss 54865 54865 0 0.0
.data 1096 1096 0 0.0
.data.rel.ro 226744 226744 0 0.0
.dynamic 560 560 0 0.0
.got 58232 58232 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 390308 390868 560 0.1
.text 6061956 6062676 720 0.0
thermostat-no-ble arm64 (read only) 2037468 2038540 1072 0.1
(read/write) 145505 145505 0 0.0
.bss 64737 64737 0 0.0
.data 880 880 0 0.0
.data.rel.ro 72912 72912 0 0.0
.dynamic 560 560 0 0.0
.got 4040 4040 0 0.0
.init 24 24 0 0.0
.init_array 304 304 0 0.0
.rodata 129276 129628 352 0.3
.text 1693888 1694608 720 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2348912 2347392 -1520 -0.1
.bss 188876 188876 0 0.0
.data 5320 5320 0 0.0
.text 1311488 1309968 -1520 -0.1
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2330560 2330808 248 0.0
.bss 180416 180416 0 0.0
.data 5552 5552 0 0.0
.text 1293160 1293408 248 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2303784 2304032 248 0.0
.bss 179456 179456 0 0.0
.data 5544 5544 0 0.0
.text 1266384 1266632 248 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2054232 2054232 0 0.0
.bss 156876 156876 0 0.0
.data 4864 4864 0 0.0
.text 1016832 1016832 0 0.0
p6 all-clusters-app default (read/write) 2403200 2401432 -1768 -0.1
.bss 117148 117148 0 0.0
.data 2592 2592 0 0.0
.text 1361464 1359696 -1768 -0.1
light-app default (read/write) 2325088 2325376 288 0.0
.bss 105728 105728 0 0.0
.data 2384 2384 0 0.0
.text 1283352 1283640 288 0.0
lock-app default (read/write) 2297320 2297600 280 0.0
.bss 104608 104608 0 0.0
.data 2344 2344 0 0.0
.text 1255584 1255864 280 0.0
qpg lighting-app qpg6105+debug (read only) 534060 534308 248 0.0
(read/write) 146940 146940 0 0.0
.bss 86672 86672 0 0.0
.data 1008 1008 0 0.0
.text 528740 528988 248 0.0
lock-app qpg6105+debug (read only) 505980 506228 248 0.0
(read/write) 146936 146936 0 0.0
.bss 85808 85808 0 0.0
.data 956 956 0 0.0
.text 500660 500908 248 0.0
persistent-storage-app qpg6105+debug (read only) 106448 106448 0 0.0
(read/write) 146938 146938 0 0.0
.bss 36146 36146 0 0.0
.data 288 288 0 0.0
.text 101128 101128 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 835878 836102 224 0.0
bss 86976 86976 0 0.0
noinit 37160 37160 0 0.0
text 583752 583852 100 0.0

@bzbarsky-apple bzbarsky-apple merged commit 96c6645 into project-chip:master Jan 12, 2022
@mlepage-google mlepage-google deleted the fix-and-refactor-read-single-cluster-data branch January 12, 2022 15:49
selissia pushed a commit to selissia/connectedhomeip that referenced this pull request Jan 28, 2022
* Fix and refactor ReadSingleClusterData

PR project-chip#12660 seems to have refactored ReadSingleClusterData in such a way
that the access control check may be skipped. (Possibly due to merge?)

Fix this by refactoring the function to a sensible flow of checks.

Progress towards project-chip#10239

* Apply review comment.

Co-authored-by: Boris Zbarsky <[email protected]>
step0035 pushed a commit to hank820/connectedhomeip that referenced this pull request Feb 8, 2022
* Fix and refactor ReadSingleClusterData

PR project-chip#12660 seems to have refactored ReadSingleClusterData in such a way
that the access control check may be skipped. (Possibly due to merge?)

Fix this by refactoring the function to a sensible flow of checks.

Progress towards project-chip#10239

* Apply review comment.

Co-authored-by: Boris Zbarsky <[email protected]>
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