-
Notifications
You must be signed in to change notification settings - Fork 2.1k
examples: gcoap: stack overflow when NON times out #8981
Copy link
Copy link
Closed
Labels
Area: networkArea: NetworkingArea: NetworkingType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)
Milestone
Description
Description
When I send a NON GET with the gcoap example the coap thread overflows if there is no request.
Steps to reproduce the issue
- Flash gcoap example to board (I used
samr21-xpro, did not check for other types of boards) - Check current stack usage:
> ps
2018-04-19 11:26:19,614 - INFO # ps
2018-04-19 11:26:19,622 - INFO # pid | name | state Q | pri | stack ( used) | base addr | current
2018-04-19 11:26:19,630 - INFO # - | isr_stack | - - | - | 512 ( 148) | 0x20000000 | 0x200001b8
2018-04-19 11:26:19,638 - INFO # 1 | idle | pending Q | 15 | 256 ( 156) | 0x200006c0 | 0x20000724
2018-04-19 11:26:19,646 - INFO # 2 | main | running Q | 7 | 1536 ( 1040) | 0x200007c0 | 0x20000c04
2018-04-19 11:26:19,655 - INFO # 3 | 6lo | bl rx _ | 3 | 1024 ( 460) | 0x200036a0 | 0x2000396c
2018-04-19 11:26:19,663 - INFO # 4 | ipv6 | bl rx _ | 4 | 1024 ( 432) | 0x20001764 | 0x20001a2c
2018-04-19 11:26:19,671 - INFO # 5 | udp | bl rx _ | 5 | 1024 ( 272) | 0x20003e6c | 0x2000415c
2018-04-19 11:26:19,680 - INFO # 6 | coap | bl mbox _ | 6 | 1024 ( 776) | 0x200012c4 | 0x200013bc
2018-04-19 11:26:19,688 - INFO # 7 | at86rf2xx | bl rx _ | 2 | 1024 ( 504) | 0x20000e84 | 0x20001174
2018-04-19 11:26:19,694 - INFO # | SUM | | | 7424 ( 3788)
Send CoAP NON to fake destination:
> coap get affe::1 5683 /test
2018-04-19 11:32:47,258 - INFO # coap get affe::1 5683 /test
2018-04-19 11:32:47,262 - INFO # gcoap_cli: sending msg ID 22606, 11 bytes
> 2018-04-19 11:32:52,271 - INFO # gcoap: timeout for msg ID 22606
Check stack usage again:
ps
2018-04-19 11:32:55,406 - INFO # ps
2018-04-19 11:32:55,414 - INFO # pid | name | state Q | pri | stack ( used) | base addr | current
2018-04-19 11:32:55,422 - INFO # - | isr_stack | - - | - | 512 ( 164) | 0x20000000 | 0x200001b8
2018-04-19 11:32:55,430 - INFO # 1 | idle | pending Q | 15 | 256 ( 156) | 0x200006c0 | 0x20000724
2018-04-19 11:32:55,439 - INFO # 2 | main | running Q | 7 | 1536 ( 1052) | 0x200007c0 | 0x20000c04
2018-04-19 11:32:55,447 - INFO # 3 | 6lo | bl rx _ | 3 | 1024 ( 460) | 0x200036a0 | 0x2000396c
2018-04-19 11:32:55,455 - INFO # 4 | ipv6 | bl rx _ | 4 | 1024 ( 432) | 0x20001764 | 0x20001a2c
2018-04-19 11:32:55,463 - INFO # 5 | udp | bl rx _ | 5 | 1024 ( 328) | 0x20003e6c | 0x2000415c
2018-04-19 11:32:55,472 - INFO # 6 | coap | bl mbox _ | 6 | 1024 ( 1024) | 0x200012c4 | 0x200013bc
2018-04-19 11:32:55,480 - INFO # 7 | �D | bl rx _ | 2 | 279 ( -241) | 0x20000e84 | 0x20001174
2018-04-19 11:32:55,486 - INFO # | SUM | | | 6679 ( 3375)
Expected results
Stack should not overflow.
Actual results
Stack overflows and overwrites TCB of following thread (might cause crash later on).
Versions
This was done on 689333f of RIOT.
Reactions are currently unavailable
Metadata
Metadata
Labels
Area: networkArea: NetworkingArea: NetworkingType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)