Hi there,
I'm facing a very strange bug that causes InstrFetchProhibited or IllegalInstruction exceptions on ESP32's on a code that runs:
- GCC 12.2.0
- ESP-IDF v5.1
- Mbedtls v3.4
- Esp-Lwip v2.1.3
- Arduino Core v3 (Custom build)
Wherein the bug comes when the application tries to call `pbuf_free()` of newly received data that have been decrypted by mbedtls.
The calls heirarchy is lwip tcp->altcp_tls->mbedtls->altcp_tls->application
However, I'm trying to narrow down the issue, as it was not an issue for the older major versions:
- GCC 8.4.0
- ESP-IDF v4.4.5
- Mbedtls v2.28.3
- Esp-Lwip v2.1.2
- Arduino Core v2 (Custom build)
However, I maintain a branch of esp-lwip, had to tweak little bits in altcp_tls_mbedtls file to cope with mbedtls major changes.
Other codes (pbuf.c) isn't changed lately (See https://github.com/espressif/esp-lwip/c ... ore/pbuf.c).
I'm suspecting the mbedtls to be the major root of the bug, as:
- Tried to compile the prior with GCC 12.2.0, and it worked as expected.
- Tried to build with no TLS (Plain TCP), it worked.
However, I tried to make a small testbed without Arduino (small esp-idf project on vscode), couldn't get the TCP working without LoadProhibited bug on the first received TCP data (`pbuf_copy_partial()` that copies the received data to an allocated memory).
The bug comes just after receiving the decrypted data by the mbedtls (Over the`mbedtls_ssl_read()` call).
So, to narrow down the issue, is there a way to compile mbedtls v2.28.3 to esp-idf v5.1, or it's not recommended/not possible?
And what do you think for the bug?
Note: Here's the modified lwip pointing to the patched altcp_tls_mbedtls (https://github.com/HamzaHajeir/esp-lwip ... _mbedtls.c), it doesn't hold the applied patches to cope with mbedtls 3.4.0 yet, but it has a similar state to the patched esp-lwip v2.1.2.
Mbedtls v2 on IDF v5.1
-
- Posts: 11
- Joined: Tue Dec 27, 2022 6:02 pm
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: No registered users and 98 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.