Azure / iot-hub-device-update

Device Update for IoT Hub agent
MIT License
51 stars 36 forks source link

Registering extensions fails on arm32 due to bug in STRING_construct_sprintf() invocation #634

Open HarryWaschkeit opened 4 weeks ago

HarryWaschkeit commented 4 weeks ago

Expected Behavior

When device update agent starts up, prestep handlers prepare for extensions to be loaded later on by providing json descriptions bearing the SHA256 sum of the extension library.

Current Behavior

While the json files are generated the sha256sum fields contain "(null)" on arm32 (i.MX6) causing the agent startup to fail.

Steps to Reproduce

Provide a detailed set of steps to reproduce the bug.

  1. compile and use on arm32 platform

Device Information

Logs

Jun 07 08:36:14 hwt-tx6s systemd[1]: Starting Device Update Agent daemon.... Jun 07 08:36:14 hwt-tx6s AducIotAgent[8351]: Successfully registered a handler for 'microsoft/steps:1'. Registration file: /var/lib/adu/extensions/update_content_handlers/microsoft_steps_1/content_handler.json. Jun 07 08:36:14 hwt-tx6s AducIotAgent[8352]: Successfully registered a handler for 'microsoft/swupdate:2'. Registration file: /var/lib/adu/extensions/update_content_handlers/microsoft_swupdate_2/content_handler.json. Jun 07 08:36:15 hwt-tx6s AducIotAgent[8353]: Successfully registered a handler for 'microsoft/update-manifest:5'. Registration file: /var/lib/adu/extensions/update_content_handlers/microsoft_update-manifest_5/content_handler.json. Jun 07 08:36:15 hwt-tx6s AducIotAgent[8354]: Successfully registered a handler for 'omnect/swupdate_consent:1'. Registration file: /var/lib/adu/extensions/update_content_handlers/omnect_swupdate_consent_1/content_handler.json. Jun 07 08:36:15 hwt-tx6s AducIotAgent[8355]: Successfully registered an extension. Info: /var/lib/adu/extensions/content_downloader/extension.json Jun 07 08:36:16 hwt-tx6s AducIotAgent[8360]: 2024-06-07T08:36:16.2596Z 8360[8360] [E] Hash for /usr/lib/adu/extensions/libdeliveryoptimization_content_downloader.so is not valid [LoadExtensionLibrary:140] Jun 07 08:36:16 hwt-tx6s AducIotAgent[8360]: 2024-06-07T08:36:16.2625Z 8360[8360] [E] Failed to set DO connection string in Nested Edge scenario, result: 0x00000000 [StartupAgent:798] [...]

Additional Information

Root cause for the bug is using string format specifier "%d" for a "long long [int]" argument which confuses vsnprintf(). Fix already available as PR #633.

Sorry for creating a PR before reporting, next time I'll do it the other way around ;-)