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

[backport v2.1] lib: updatehub: Improve download on slow networks and apply security fix #27893

Closed

Conversation

nandojve
Copy link
Member

This backport apply:
#25683, #26093, #27223, #27222, #27865

and fixes:
#25704, #26992, #26993, #26994, #27718

CC @otavio

nandojve and others added 14 commits August 30, 2020 18:06
The conversion from DT_FLASH_AREA to FLASH_AREA macros don't add the
storage flash_map.h include file.

Fixes: zephyrproject-rtos#25332

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Based on the current platform a warning can raise becase of missing
string.h include file.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Add missing sample.yaml file to enable CI build tests. Local tests can
be executed executing sanitycheck:

./scripts/sanitycheck -l --testcase-root samples/net/updatehub

On zephyr 2.1 frdm-k64f is the reference platform.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Fix variable-size string copy patch that introduced a runtime bug that
causes a bus fault.

Fixes zephyrproject-rtos#24853.

Signed-off-by: Tahir Akram <mtahirbutt@hotmail.com>
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Current log only prints default log level. Add LOG_LEVEL at updatehub
to switch between log variations based on CONFIG_UPDATEHUB_LOG_LEVEL.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
The hints variable is used without a defined state. This fill the struct
with zeros to set variable at a well known state.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Init metadata variable to a defined state.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
The current implementation uses a fixed value for max retries. That
value could be good for an wired network like Ethernet. However,
wireless network can suffer with higher packet collision, low reception
signal etc. This refacts the variable to be defined at Kconfig. This
way max retries can be adjust conform the current media.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Allow select max CoAP block size for exchange data using coap protocol.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Add missing freeaddrinfo to fix memory leak.

Fixes zephyrproject-rtos#26994.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
The struct pollfd context variable is not proper initialized and index
is out-of-bounds. Adjusts index to be inside scope boundary.

Fixes zephyrproject-rtos#26993.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
The flash_img_int return value is not checked for fail conditions.
This can result on useless download attempts once image will not
be properly recorded. Add return value check and on error execute
default treatment.

Fixes zephyrproject-rtos#26992.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
There are several references to objects[1] at updatehub_probe function.
The structures are decoded from json, and have a maximum length of 2.
However, if the returned json only has a single element in this array,
this objects[1] value will be uninitialized. Because the structure
contains pointers, these will be uninitialized, causing the code to
reference uninitialized memory as pointers.

Add zeroing memory before passing it to the JSON API and do check if
objects_len field is two.

Fixes zephyrproject-rtos#27718.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
When running shell commands updatehub alloc data from shell stack.
Increase shell room stack to avoid shell issues.  Memory tuning
should be performed accord with available resources.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
@nandojve
Copy link
Member Author

2020-08-30 21:34:55 FATAL Could not find a default pipeline configuration file.

@github-actions
Copy link

github-actions bot commented Nov 1, 2020

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Nov 1, 2020
@nandojve
Copy link
Member Author

nandojve commented Nov 5, 2020

It is on todo, removing Stale.

@nandojve nandojve removed the Stale label Nov 5, 2020
@nashif
Copy link
Member

nashif commented Nov 17, 2020

2.1 is out of scope for backports now, closing.

@nashif nashif closed this Nov 17, 2020
@nandojve nandojve deleted the topic/v2.1-branch branch November 17, 2020 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[v2.1.x] lib: updatehub: Improve download on slow networks and security fix
4 participants