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

[Inet] fix lwIP UDPEndpoint crash on large packets #21897

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

gjc13
Copy link
Contributor

@gjc13 gjc13 commented Aug 16, 2022

Problem

When copying the UDP packets, the default parameter reserves about 150 bytes of memory. If the UDP packet size is close to IP MTU, the copy will fail and cause a crash.

Fixes #21832

Change overview

  • Set reserved size to 0 to avoid failed copies
  • Drop the UDP packet on failed copies to prevent future crashes

Testing

@github-actions
Copy link

github-actions bot commented Aug 16, 2022

PR #21897: Size comparison from 488262f to 838fe7f

Increases (19 builds for bl602, cc13x2_26x2, efr32, esp32, p6, telink)
platform target config section 488262f 838fe7f change % change
bl602 lighting-app bl602 (read/write) 1383346 1383426 80 0.0
.text 1050916 1050960 44 0.0
bl602+rpc (read/write) 1428858 1428938 80 0.0
.text 1082676 1082724 48 0.0
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 672287 672323 36 0.0
.rodata 88719 88747 28 0.0
.text 583252 583260 8 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 637671 637707 36 0.0
.rodata 77951 77979 28 0.0
.text 559396 559404 8 0.0
lock-ftd LP_CC2652R7 (read only) 674011 674047 36 0.0
.rodata 76643 76671 28 0.0
.text 596888 596896 8 0.0
lock-mtd LP_CC2652R7 (read only) 656747 656775 28 0.0
.rodata 101731 101759 28 0.0
pump-app LP_CC2652R7 (read only) 684691 684711 20 0.0
.rodata 89931 89959 28 0.0
pump-controller-app LP_CC2652R7 (read only) 669175 669203 28 0.0
.rodata 85487 85515 28 0.0
shell LP_CC2652R7 (read only) 664986 665014 28 0.0
.rodata 85666 85694 28 0.0
efr32 lighting-app BRD4161A+rs911x (read/write) 989608 989668 60 0.0
.text 825188 825248 60 0.0
lock-app BRD4161A+wf200 (read/write) 1139124 1139152 28 0.0
.text 991520 991548 28 0.0
esp32 all-clusters-app c3devkit (read only) 1029876 1029910 34 0.0
(read/write) 1488650 1488674 24 0.0
.flash.rodata 217752 217776 24 0.0
.flash.text 1029876 1029910 34 0.0
m5stack (read only) 1083251 1083287 36 0.0
(read/write) 490608 490632 24 0.0
.flash.rodata 248092 248116 24 0.0
.flash.text 1077867 1077903 36 0.0
p6 all-clusters-app default (read/write) 1698844 1698884 40 0.0
.text 1538480 1538520 40 0.0
all-clusters-minimal-app default (read/write) 1642852 1642892 40 0.0
.text 1483208 1483248 40 0.0
light-app default (read/write) 1560140 1560180 40 0.0
.text 1408840 1408880 40 0.0
lock-app default (read/write) 1597420 1597460 40 0.0
.text 1441624 1441664 40 0.0
telink light-switch-app tlsr9518adk80d text 571272 571274 2 0.0
lighting-app tlsr9518adk80d (read/write) 830280 830288 8 0.0
text 589362 589366 4 0.0
Decreases (7 builds for cc13x2_26x2, cyw30739)
platform target config section 488262f 838fe7f change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read/write) 179224 179188 -36 -0.0
lock-ftd LP_CC2652R7 (read/write) 167716 167680 -36 -0.0
lock-mtd LP_CC2652R7 (read/write) 180668 180640 -28 -0.0
pump-app LP_CC2652R7 (read/write) 157844 157824 -20 -0.0
.text 594276 594268 -8 -0.0
pump-controller-app LP_CC2652R7 (read/write) 173480 173452 -28 -0.0
shell LP_CC2652R7 (read/write) 182044 182016 -28 -0.0
cyw30739 ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 598970 598962 -8 -0.0
.app_xip_area 476324 476316 -8 -0.0
Full report (43 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 488262f 838fe7f change % change
bl602 lighting-app bl602 (read/write) 1383346 1383426 80 0.0
.bss 119906 119906 0 0.0
.data 4480 4480 0 0.0
.text 1050916 1050960 44 0.0
bl602+rpc (read/write) 1428858 1428938 80 0.0
.bss 127346 127346 0 0.0
.data 4600 4600 0 0.0
.text 1082676 1082724 48 0.0
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 672287 672323 36 0.0
(read/write) 179224 179188 -36 -0.0
.bss 74404 74404 0 0.0
.data 3372 3372 0 0.0
.rodata 88719 88747 28 0.0
.text 583252 583260 8 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 637671 637707 36 0.0
(read/write) 157980 157980 0 0.0
.bss 73692 73692 0 0.0
.data 3372 3372 0 0.0
.rodata 77951 77979 28 0.0
.text 559396 559404 8 0.0
lock-ftd LP_CC2652R7 (read only) 674011 674047 36 0.0
(read/write) 167716 167680 -36 -0.0
.bss 71508 71508 0 0.0
.data 3296 3296 0 0.0
.rodata 76643 76671 28 0.0
.text 596888 596896 8 0.0
lock-mtd LP_CC2652R7 (read only) 656747 656775 28 0.0
(read/write) 180668 180640 -28 -0.0
.bss 67196 67196 0 0.0
.data 3296 3296 0 0.0
.rodata 101731 101759 28 0.0
.text 554536 554536 0 0.0
pump-app LP_CC2652R7 (read only) 684691 684711 20 0.0
(read/write) 157844 157824 -20 -0.0
.bss 71548 71548 0 0.0
.data 3296 3296 0 0.0
.rodata 89931 89959 28 0.0
.text 594276 594268 -8 -0.0
pump-controller-app LP_CC2652R7 (read only) 669175 669203 28 0.0
(read/write) 173480 173452 -28 -0.0
.bss 71668 71668 0 0.0
.data 3292 3292 0 0.0
.rodata 85487 85515 28 0.0
.text 583208 583208 0 0.0
shell LP_CC2652R7 (read only) 664986 665014 28 0.0
(read/write) 182044 182016 -28 -0.0
.bss 76724 76724 0 0.0
.data 3376 3376 0 0.0
.rodata 85666 85694 28 0.0
.text 579004 579004 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 586022 586022 0 0.0
.app_xip_area 462656 462656 0 0.0
.bss 65800 65800 0 0.0
.data 744 744 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 591838 591838 0 0.0
.app_xip_area 463688 463688 0 0.0
.bss 70584 70584 0 0.0
.data 748 748 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 598970 598962 -8 -0.0
.app_xip_area 476324 476316 -8 -0.0
.bss 65112 65112 0 0.0
.data 716 716 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read/write) 1100212 1100212 0 0.0
.bss 133004 133004 0 0.0
.data 2068 2068 0 0.0
.text 965120 965120 0 0.0
BRD4161A+rpc (read/write) 1154464 1154464 0 0.0
.bss 149692 149692 0 0.0
.data 2280 2280 0 0.0
.text 1002472 1002472 0 0.0
BRD4161A+rs911x (read/write) 989608 989668 60 0.0
.bss 162344 162344 0 0.0
.data 2056 2056 0 0.0
.text 825188 825248 60 0.0
lock-app BRD4161A+wf200 (read/write) 1139124 1139152 28 0.0
.bss 145520 145520 0 0.0
.data 2064 2064 0 0.0
.text 991520 991548 28 0.0
window-app BRD4161A (read/write) 1091644 1091644 0 0.0
.bss 134436 134436 0 0.0
.data 2096 2096 0 0.0
.text 955092 955092 0 0.0
esp32 all-clusters-app c3devkit (read only) 1029876 1029910 34 0.0
(read/write) 1488650 1488674 24 0.0
.dram0.bss 70864 70864 0 0.0
.dram0.data 14600 14600 0 0.0
.flash.rodata 217752 217776 24 0.0
.flash.text 1029876 1029910 34 0.0
.iram0.text 62902 62902 0 0.0
m5stack (read only) 1083251 1083287 36 0.0
(read/write) 490608 490632 24 0.0
.dram0.bss 76376 76376 0 0.0
.dram0.data 34144 34144 0 0.0
.flash.rodata 248092 248116 24 0.0
.flash.text 1077867 1077903 36 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w0+release (read/write) 645044 645044 0 0.0
.bss 69848 69848 0 0.0
.data 2044 2044 0 0.0
.text 570424 570424 0 0.0
lock k32w0+release (read/write) 702588 702588 0 0.0
.bss 70320 70320 0 0.0
.data 2052 2052 0 0.0
.text 627488 627488 0 0.0
linux all-clusters-app debug (read only) 3033889 3033889 0 0.0
(read/write) 155920 155920 0 0.0
.bss 61888 61888 0 0.0
.data 2096 2096 0 0.0
.data.rel.ro 85560 85560 0 0.0
.dynamic 608 608 0 0.0
.got 4568 4568 0 0.0
.init 27 27 0 0.0
.init_array 1160 1160 0 0.0
.rodata 274443 274443 0 0.0
.text 2580370 2580370 0 0.0
all-clusters-minimal-app debug (read only) 2873745 2873745 0 0.0
(read/write) 147624 147624 0 0.0
.bss 61152 61152 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 78120 78120 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 1152 1152 0 0.0
.rodata 274635 274635 0 0.0
.text 2422738 2422738 0 0.0
bridge-app debug+rpc (read only) 2372601 2372601 0 0.0
(read/write) 127584 127584 0 0.0
.bss 50656 50656 0 0.0
.data 3600 3600 0 0.0
.data.rel.ro 67464 67464 0 0.0
.dynamic 608 608 0 0.0
.got 4392 4392 0 0.0
.init 27 27 0 0.0
.init_array 824 824 0 0.0
.rodata 203432 203432 0 0.0
.text 2006546 2006546 0 0.0
chip-tool debug (read only) 10724297 10724297 0 0.0
(read/write) 650912 650912 0 0.0
.bss 25240 25240 0 0.0
.data 3266 3266 0 0.0
.data.rel.ro 615880 615880 0 0.0
.dynamic 608 608 0 0.0
.got 5096 5096 0 0.0
.init 27 27 0 0.0
.init_array 768 768 0 0.0
.rodata 556213 556213 0 0.0
.text 8662340 8662340 0 0.0
chip-tool-ipv6only arm64 (read only) 10130420 10130420 0 0.0
(read/write) 698657 698657 0 0.0
.bss 33297 33297 0 0.0
.data 3272 3272 0 0.0
.data.rel.ro 643408 643408 0 0.0
.dynamic 560 560 0 0.0
.got 13720 13720 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 487396 487396 0 0.0
.text 8006068 8006068 0 0.0
lighting-app debug+rpc (read only) 2596585 2596585 0 0.0
(read/write) 130176 130176 0 0.0
.bss 49760 49760 0 0.0
.data 2096 2096 0 0.0
.data.rel.ro 72360 72360 0 0.0
.dynamic 608 608 0 0.0
.got 4392 4392 0 0.0
.init 27 27 0 0.0
.init_array 920 920 0 0.0
.rodata 220208 220208 0 0.0
.text 2205666 2205666 0 0.0
lock-app debug (read only) 2580497 2580497 0 0.0
(read/write) 125512 125512 0 0.0
.bss 48288 48288 0 0.0
.data 1712 1712 0 0.0
.data.rel.ro 69512 69512 0 0.0
.dynamic 608 608 0 0.0
.got 4464 4464 0 0.0
.init 27 27 0 0.0
.init_array 896 896 0 0.0
.rodata 237264 237264 0 0.0
.text 2176578 2176578 0 0.0
ota-provider-app debug (read only) 2357657 2357657 0 0.0
(read/write) 118976 118976 0 0.0
.bss 47808 47808 0 0.0
.data 1936 1936 0 0.0
.data.rel.ro 63336 63336 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 760 760 0 0.0
.rodata 209240 209240 0 0.0
.text 1984946 1984946 0 0.0
ota-requestor-app debug (read only) 2522873 2522873 0 0.0
(read/write) 127320 127320 0 0.0
.bss 50336 50336 0 0.0
.data 2304 2304 0 0.0
.data.rel.ro 68728 68728 0 0.0
.dynamic 608 608 0 0.0
.got 4480 4480 0 0.0
.init 27 27 0 0.0
.init_array 848 848 0 0.0
.rodata 216000 216000 0 0.0
.text 2134306 2134306 0 0.0
shell debug (read only) 2602193 2602193 0 0.0
(read/write) 142040 142040 0 0.0
.bss 57800 57800 0 0.0
.data 1264 1264 0 0.0
.data.rel.ro 77160 77160 0 0.0
.dynamic 608 608 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 1032 1032 0 0.0
.rodata 234546 234546 0 0.0
.text 2209298 2209298 0 0.0
thermostat-no-ble arm64 (read only) 2356836 2356836 0 0.0
(read/write) 141825 141825 0 0.0
.bss 55345 55345 0 0.0
.data 1672 1672 0 0.0
.data.rel.ro 75984 75984 0 0.0
.dynamic 560 560 0 0.0
.got 5048 5048 0 0.0
.init 24 24 0 0.0
.init_array 408 408 0 0.0
.rodata 140524 140524 0 0.0
.text 1978592 1978592 0 0.0
tv-app debug (read only) 3173641 3173641 0 0.0
(read/write) 257968 257968 0 0.0
.bss 167480 167480 0 0.0
.data 4736 4736 0 0.0
.data.rel.ro 79184 79184 0 0.0
.dynamic 608 608 0 0.0
.got 4856 4856 0 0.0
.init 27 27 0 0.0
.init_array 1072 1072 0 0.0
.rodata 258856 258856 0 0.0
.text 2725042 2725042 0 0.0
tv-casting-app debug (read only) 5415025 5415025 0 0.0
(read/write) 159088 159088 0 0.0
.bss 51448 51448 0 0.0
.data 2432 2432 0 0.0
.data.rel.ro 98776 98776 0 0.0
.dynamic 608 608 0 0.0
.got 4776 4776 0 0.0
.init 27 27 0 0.0
.init_array 1040 1040 0 0.0
.rodata 342449 342449 0 0.0
.text 4804226 4804226 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2454264 2454264 0 0.0
.bss 214692 214692 0 0.0
.data 5872 5872 0 0.0
.text 1416908 1416908 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1179619 1179619 0 0.0
bss 143375 143375 0 0.0
rodata 143268 143268 0 0.0
text 814028 814028 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1159495 1159495 0 0.0
bss 142612 142612 0 0.0
rodata 134944 134944 0 0.0
text 803016 803016 0 0.0
p6 all-clusters-app default (read only) 881368 881368 0 0.0
(read/write) 1698844 1698884 40 0.0
.bss 149320 149320 0 0.0
.data 2656 2656 0 0.0
.text 1538480 1538520 40 0.0
all-clusters-minimal-app default (read only) 882088 882088 0 0.0
(read/write) 1642852 1642892 40 0.0
.bss 148600 148600 0 0.0
.data 2656 2656 0 0.0
.text 1483208 1483248 40 0.0
light-app default (read only) 890432 890432 0 0.0
(read/write) 1560140 1560180 40 0.0
.bss 140464 140464 0 0.0
.data 2448 2448 0 0.0
.text 1408840 1408880 40 0.0
lock-app default (read only) 885936 885936 0 0.0
(read/write) 1597420 1597460 40 0.0
.bss 144944 144944 0 0.0
.data 2464 2464 0 0.0
.text 1441624 1441664 40 0.0
telink light-switch-app tlsr9518adk80d (read/write) 808344 808344 0 0.0
bss 71096 71096 0 0.0
noinit 43488 43488 0 0.0
text 571272 571274 2 0.0
lighting-app tlsr9518adk80d (read/write) 830280 830288 8 0.0
bss 71952 71952 0 0.0
noinit 43488 43488 0 0.0
text 589362 589366 4 0.0

@woody-apple woody-apple merged commit 5a05207 into project-chip:master Aug 16, 2022
isiu-apple pushed a commit to isiu-apple/connectedhomeip that referenced this pull request Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants