esp-idf: mbedtls_ssl_handshake crash (PSRAM unicore + memw workaround) (IDFGH-3068)
Code to reproduce is based on a modified https_mbedtls example from esp-idf: https://github.com/szmodz/esp-idf/commits/mbedtls_crash
The code always ends up causing a WDT timeout sooner or later (timeout set to 60s) in UNICORE mode. CONFIG_MBEDTLS_HARDWARE_xxx are disabled, but it doesn’t really matter.
Seems to be MUCH more stable with dupldst rather than memw workaround (not sure if it’s completely stable though - too soon to tell). No other changes were made, and the effect on stability is obvious.
Perhaps it would be a good idea to also supply newlib and sdk libs compiled with dupldst?
The handshake is using nonblocking sockets and resets the WDT, so I don’t think it should ever exceed the 60s timeout. That, plus it seems stable (so far) with dupldst.
It’s a pretty intensive load, but that way the problem can be reproduced quickly. It also occurs under normal load conditions, but not as often. I noticed it in my actual application code.
- Development Kit: ESP32-DevKitC (but also custom hardware with ethernet)
- Kit version (for WroverKit/PicoKit/DevKitC): v4
- Module or chip used: ESP32-WROVER-B
- Build System: Make
- Compiler version (run
xtensa-esp32-elf-gcc --versionto find it): 2020r1 - Operating System: macOS
- Using an IDE?: No
- Power Supply: USB (custom HW has external power)
example output:
E (116633) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (116633) task_wdt: - https_get_task (CPU 0/1)
E (116633) task_wdt: - https_get_task (CPU 0/1)
E (116633) task_wdt: - https_get_task (CPU 0/1)
E (116633) task_wdt: - https_get_task (CPU 0/1)
E (116633) task_wdt: Tasks currently running:
E (116633) task_wdt: CPU 0: https_get_task
E (116633) task_wdt: Aborting.
abort() was called at PC 0x400d2e04 on core 0
0x400d2e04: esp_task_wdt_init at /Users/szmodz/xxx/esp-idf/components/esp_common/src/task_wdt.c:213
Backtrace:0x40087359:0x3ffb1350 0x400877dd:0x3ffb1370 0x40095c11:0x3ffb1390 0x400d2e04:0x3ffb1410 0x40082e8e:0x3ffb1430 0x400953a8:0x3fff2210 0x400e817e:0x3fff2220 0x400e8a17:0x3fff2240 0x400e8b1a:0x3fff2270 0x400ddab1:0x3fff2290 0x400de16b:0x3fff2320 0x400df2ba:0x3fff24c0 0x400eace9:0x3fff2650 0x400eaeaf:0x3fff26c0 0x400da5c1:0x3fff26f0 0x400d72e5:0x3fff27b0 0x400d7304:0x3fff27d0 0x400d732a:0x3fff27f0 0x400d4eb4:0x3fff2810
0x40087359: print_illegal_instruction_details at /Users/szmodz/xxx/esp-idf/components/esp_system/port/panic_handler.c:73
0x400877dd: esp_system_abort at /Users/szmodz/xxx/esp-idf/components/esp_system/system_api.c:68
0x40095c11: abort at /Users/szmodz/xxx/esp-idf/components/newlib/abort.c:46
0x400d2e04: esp_task_wdt_init at /Users/szmodz/xxx/esp-idf/components/esp_common/src/task_wdt.c:213
0x40082e8e: _xt_lowint1 at /Users/szmodz/xxx/esp-idf/components/freertos/xtensa/xtensa_vectors.S:1105
0x400953a8: strrchr at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin12/xtensa-esp32-elf/src/newlib/newlib/libc/string/strrchr.c:38
0x400e817e: mbedtls_internal_aes_decrypt at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/aes.c:961
0x400e8a17: mbedtls_aes_crypt_xts at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/aes.c:1246 (discriminator 3)
0x400e8b1a: mbedtls_aes_crypt_xts at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/aes.c:1222
0x400ddab1: ecp_normalize_jac at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ecp.c:1105
0x400de16b: ecp_normalize_jac_many at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ecp.c:1173
0x400df2ba: mbedtls_ecp_curve_info_from_tls_id at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ecp.c:490
(inlined by) mbedtls_ecp_tls_read_group_id at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ecp.c:953
0x400eace9: mbedtls_ecdsa_read_signature_restartable at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ecdsa.c:834
0x400eaeaf: mbedtls_asn1_write_len at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/asn1write.c:58
0x400da5c1: ssl_write_client_key_exchange at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ssl_cli.c:3160
(inlined by) mbedtls_ssl_handshake_client_step at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ssl_cli.c:3586
0x400d72e5: mbedtls_ssl_handshake_free at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ssl_tls.c:8837
0x400d7304: mbedtls_ssl_handshake_free at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ssl_tls.c:8866
0x400d732a: mbedtls_ssl_handshake_free at /Users/szmodz/xxx/esp-idf/components/mbedtls/mbedtls/library/ssl_tls.c:8893
0x400d4eb4: https_get_task at /Users/szmodz/xxx/esp-idf/examples/protocols/mbedtls_crash/main/https_mbedtls_example_main.c:202
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (5 by maintainers)
Commits related to this issue
- Update toolchain to esp-2020r2 Fixes PSRAM issues, volatile loads with -O2, std::locale, C++ exception crashs, FDE sorting switchable; Includes a 64-bit toolchain for Windows (win64); Closes https:... — committed to shubhamkulkarni97/esp-idf by antmak 4 years ago
- Update toolchain to esp-2020r2 Fixes PSRAM issues, volatile loads with -O2, std::locale, C++ exception crashs, FDE sorting switchable; Includes a 64-bit toolchain for Windows (win64); Closes https:... — committed to espressif/esp-idf by antmak 4 years ago
- Update toolchain to esp-2020r2 Fixes PSRAM issues, volatile loads with -O2, std::locale, C++ exception crashs, FDE sorting switchable; Includes a 64-bit toolchain for Windows (win64); Closes https:... — committed to espressif/esp-idf by antmak 4 years ago
- Update toolchain to esp-2020r2 Fixes PSRAM issues, volatile loads with -O2, std::locale, C++ exception crashs, FDE sorting switchable; Includes a 64-bit toolchain for Windows (win64); Closes https:... — committed to Wielebny666/esp-idf by antmak 4 years ago
@antmak it’s back up. https://github.com/szmodz/esp-idf/tree/mbedtls_crash