Commit Graph
37964 Commits
Author SHA1 Message Date
Konstantin Kondrashov 217fc2b7e5 Merge branch 'fix/esp_timer_task_dispatch_wedge' into 'master'
fix(esp_timer): Fix esp_timer task dispatch stall

Closes IDFGH-17935

See merge request espressif/esp-idf!50788
2026-07-22 13:47:58 +03:00
sonika.rathi 78e78d7996 fix(nvs_flash): initialize accumulatedCRC32 in cmpItem 2026-07-22 10:45:05 +02:00
Wang Mengyang 53b357790b fix(bt): Fixed blocking during LMP packet type negotiation on ESP32-S31
In the Bluetooth connections with some smartphones, communication can possibly be blocked
during packet type negotation, when ESP32-S31 attempts to finalize the ACL-U transmission
and waits for the last Tx ACL-U packet to be transmitted, but peer device rejects the
packet with FLOW=STOP in its packet, thus causing a deadlock.

Closes https://github.com/espressif/esp-idf/issues/18797
2026-07-22 16:41:08 +08:00
wuzhenghui 09253d3f48 feat(esp_security): make esp32s31 on-demand crypto clock management optional 2026-07-22 16:32:46 +08:00
wuzhenghui a04dc898db feat(esp_security): support s31 security clock management 2026-07-22 16:32:45 +08:00
wuzhenghui c7de92feda change(hal): rename PLL_F80M to REF_80M for esp32s31 peripherals clock defination 2026-07-22 16:32:13 +08:00
wuzhenghui 90cb8a760d feat(esp_hw_support): disable all unused pll source in rtc_clk_init to save power 2026-07-22 16:32:12 +08:00
wuzhenghui 7c75525edd fix(driver): fix drivers clock management 2026-07-22 16:32:12 +08:00
wuzhenghui 11ccd4c304 feat(esp_hw_support): support esp32s31 clock tree management 2026-07-22 16:32:12 +08:00
Jiang Jiang Jian ade59336b6 Merge branch 'bugfix/fix_crash_issue_on_esptouch_v2' into 'master'
fix(wifi): added validation for password and reserved data length in ESPTouch v2

Closes WIFI-7448, WIFI-7484, WIFI-7482, and WIFI-7444

See merge request espressif/esp-idf!50110
2026-07-22 16:27:15 +08:00
morris 44247cf304 Merge branch 'refactor/extract-esp_hal_debug_assist' into 'master'
refactor(hal): extract assist_debug, debug_probe and trace into esp_hal_debug_assist

See merge request espressif/esp-idf!50968
2026-07-22 16:15:13 +08:00
wuzhenghui b697c31f40 fix(esp_hw_support): fix deepsleep deadlock if threadsafe claim is not enabled 2026-07-22 15:26:31 +08:00
liqigan 0564b09e86 fix(bt/bluedroid): Fixed use after free issue on osi_event_delete 2026-07-22 14:41:20 +08:00
liqigan 39b4b3f329 fix(bt/bluedroid): Fixed HID host reconnection bug and enabled load HID devices
Closes https://github.com/espressif/esp-idf/issues/18335
2026-07-22 14:41:20 +08:00
liqigan 540a4216df change(bt/bluedroid): Refactored HCI ACL datapath 2026-07-22 14:41:20 +08:00
liqigan db12b3c279 change(bt/bluedroid): Refactored HID host datapath 2026-07-22 14:41:18 +08:00
Wang Meng Yang bc428c91d5 Merge branch 'bugfix/bredr_critical_bugs' into 'master'
bugfix: fix issues raised from AI review

See merge request espressif/esp-idf!49755
2026-07-22 14:31:28 +08:00
Astha Verma c653c09b9e fix(nimble): Handle Read Remote Supported Features failure correctly 2026-07-22 11:58:57 +05:30
Alexey Lapshin 631ad9033c feat(build): add RISC-V ZCMP post-link workaround check
Validate linked RISC-V executables when
CONFIG_COMPILER_ENABLE_RISCV_ZCMP is enabled on affected chips.
Disassemble each function and reject mstatus.MIE clears that lack an
earlier mintthresh write of 0xff.

Handle csrrci, csrrw, and register-mask csrrc patterns while ignoring
csrrs. Add build-only coverage for valid and invalid sequences with
CMake v1 and v2.

Stop the hardware stack guard before switching stacks during restart,
and keep ZCMP disabled for TEE test apps that still require the
workaround.
2026-07-22 13:04:20 +07:00
Island 904d960cd6 Merge branch 'fix/ble-log-store-access-fault' into 'master'
fix: Ensure BLE Log Global Variables in Internal RAM

See merge request espressif/esp-idf!51024
2026-07-22 14:02:23 +08:00
Konstantin Kondrashov 35e5def13c Merge branch 'fix/bootloader_log_format_drom_vaddr' into 'master'
fix(bootloader): use correct format specifier for MMU_LL_END_DROM_ENTRY_VADDR

Closes IDFGH-17999

See merge request espressif/esp-idf!50927
2026-07-22 08:59:12 +03:00
Konstantin Kondrashov 66b5056f23 fix(bootloader): use correct format specifier for MMU_LL_END_DROM_ENTRY_VADDR 2026-07-22 08:59:11 +03:00
wuzhenghui 16a59e04fe feat(esp_pm): implement tickless idle test for WAITI mode 2026-07-22 12:55:53 +08:00
wuzhenghui 0aa75e183b feat(esp_pm): add tickless idle support in WAITI mode to reduce power consumption 2026-07-22 12:55:53 +08:00
wuzhenghui 306d54b6d5 feat(int_wdt): add pause and resume functions for cpu1 interrupt watchdog 2026-07-22 12:55:52 +08:00
wuzhenghui 412bce6544 fix(rtc_timer): disable target before setting wakeup time to avoid intermediate states 2026-07-22 12:55:52 +08:00
Chen Chen 18e4aae030 feat(mcpwm): fix mcpwm clock init failure
Closes https://github.com/espressif/esp-idf/issues/18666
Closes https://github.com/espressif/esp-idf/issues/18777
2026-07-22 11:41:26 +08:00
zhuanghang bdd962c685 feat(phy): update phy lib for esp32s31 & esp32c6 for track 2026-07-22 11:11:20 +08:00
Konstantin Kondrashov 10f8b195b0 Merge branch 'fix/log-unsigned-msec-format' into 'master'
fix(log): use unsigned format specifier for esp_log_system_timestamp msec

See merge request espressif/esp-idf!50989
2026-07-21 18:32:49 +03:00
Konstantin Kondrashov 95bba8e982 Merge branch 'fix/heap-trace-calloc' into 'master'
fix(heap): trace heap_caps_calloc allocations in standalone heap tracing

Closes IDF-15995

See merge request espressif/esp-idf!50990
2026-07-21 17:55:53 +03:00
yi chen 62e507ab8e fix(log): fix out-of-bounds reads in binary log for buffer log apis
- Fix MAX(len,2) reading beyond buffer when len=1
- Fix buffer_len=0 ambiguity with strlen fallback
- Add BUFFER_LEN_NOT_SET sentinel (-1)
- Read exactly len bytes, not forced minimum

Merges https://github.com/espressif/esp-idf/pull/18825
2026-07-21 16:47:50 +03:00
Konstantin Kondrashov 268a9b071f Merge branch 'fix/esp-event-security-fixes' into 'master'
fix(esp_event): multiple security and stability fixes

Closes SEC-064, SEC-219, SEC-220, SEC-221, SEC-222, and IDFGH-17955

See merge request espressif/esp-idf!50442
2026-07-21 16:27:51 +03:00
Konstantin Kondrashov 82e6c831e7 fix(esp_event): free queued legacy cleanup ctx on loop delete
When a loop is deleted while an internal legacy "cleanup" event is still
queued (posted by a deferred self-unregistration from within a handler),
esp_event_loop_delete() drained the queue but only freed the post payload,
leaking the heap copy of the handler context allocated for the legacy path.

Free ctx->handler_ctx for queued legacy cleanup events while draining the
queue, mirroring the cleanup done in esp_event_loop_run().

Add a regression test that leaves a legacy cleanup event queued and asserts
no memory is leaked on loop deletion.
2026-07-21 15:33:47 +03:00
Konstantin Kondrashov e8ffb477a0 fix(esp_event): clear running_task before releasing mutex on tick timeout
When esp_event_loop_run() exited via the ticks-expired break path,
loop->running_task was left pointing to the current task handle.
Any subsequent trylock in esp_event_handler_unregister_with_internal()
would see a stale non-NULL running_task and take the wrong code path.
2026-07-21 15:25:58 +03:00
Konstantin Kondrashov 9d2d32524b fix(esp_event): prevent UAF race between post and loop delete (SEC-222)
esp_event_post_to() could access loop->queue / loop->mutex after
esp_event_loop_delete() freed them when both ran concurrently.

Introduce esp_event_loop_state_t with:
- posts_in_flight: reference-count incremented atomically (under
  state.lock spinlock) before touching any loop resources, decremented
  on every exit path via goto on_err.
- deleting: atomic_bool set by esp_event_loop_delete() to block new
  posts from entering the critical section.

esp_event_loop_delete() sets deleting=true, then busy-waits (releasing
and re-acquiring loop->mutex each tick) until posts_in_flight reaches
zero before proceeding with teardown.

esp_event_isr_post_to() performs a lock-free atomic_load of deleting as
a best-effort guard; ISR context cannot participate in the spinlock
protocol but the window is documented and accepted.
2026-07-21 15:25:58 +03:00
Konstantin Kondrashov 736275e562 fix(esp_event): skip dispatch for internal cleanup events (SEC-221)
After processing an esp_event_handler_cleanup sentinel, execution fell
through into the regular dispatch block. Every loop-level (ANY_BASE/
ANY_ID) handler was invoked with base="cleanup" and event_data pointing
at the internal esp_event_remove_handler_context_t struct.

Consequences:
- Information disclosure: internal handler addresses and loop instance
  pointer are exposed to every loop-level handler.
- UAF: if a handler stores event_data for later use, post_instance_delete
  frees the ctx, turning the stored pointer into a dangling reference.
- Logic corruption: handlers that switch on base with a default branch
  misbehave on every unregister anywhere in the system.

Fix: wrap the regular dispatch block in an else clause so it is skipped
entirely for cleanup events. post_instance_delete, ticks accounting, and
xSemaphoreGiveRecursive remain in the shared tail executed for both paths.

Closes SEC_221
2026-07-21 15:25:57 +03:00
Konstantin Kondrashov 4ab4d5b894 fix(esp_event): use recursive mutex API in handler unregister (SEC-220)
1) loop->mutex is created with xSemaphoreCreateRecursiveMutex(). FreeRTOS
requires that recursive mutexes are only acquired and released with
xSemaphoreTakeRecursive / xSemaphoreGiveRecursive.

esp_event_handler_unregister_with_internal() used the non-recursive
xSemaphoreTake(loop->mutex, 0) / xSemaphoreGive(loop->mutex) in the fast
path. The non-recursive Take bypasses uxRecursiveCallCount bookkeeping;
if the same task subsequently takes the mutex recursively (e.g. re-entry
from a handler or a follow-up register), the call count drifts. The
non-recursive Give then unconditionally drops the holder, allowing another
task to acquire the mutex while the original task still believes it holds
the lock — a full lock violation on the handler list leading to UAF and
potential RCE on attacker-driven event floods.

Fix: replace xSemaphoreTake/xSemaphoreGive with the Recursive variants in
the fast (try-take with timeout 0) path of unregister_with_internal.

2) avoid use-after-free when unregistering handler from a callback

The recursive try-lock introduced in SEC-220 succeeds re-entrantly when a
handler unregisters itself from within its own callback, causing the handler
node to be freed immediately while the dispatch loop still writes profiling
counters to it after the callback returns. Route the in-callback case to the
deferred cleanup path and only free directly once no dispatch is active.

Closes SEC_220
2026-07-21 15:25:57 +03:00
Konstantin Kondrashov 2c935ea861 fix(esp_event): protect is_handler_registered traversal with mutex (SEC-219)
esp_event_is_handler_registered() walked loop_nodes, base_nodes, id_nodes
and handler lists with no lock held, then released an unowned mutex at the
'out:' label via xSemaphoreGive().

Concurrent register/unregister/delete operations can free handler nodes
during the unlocked walk (SLIST UAF). The xSemaphoreGive on an unowned
recursive mutex corrupts the recursive call-count of any task that
legitimately holds the mutex.

Fix:
- Take loop->mutex with xSemaphoreTakeRecursive before the traversal.
- Replace xSemaphoreGive at the 'out:' label with xSemaphoreGiveRecursive
  so every exit path holds the mutex for exactly one balanced take/give.

Closes SEC_219
2026-07-21 15:25:57 +03:00
zwx d60495d8e8 fix(ieee802154): skip receive_at when rx window already expired 2026-07-21 12:21:42 +00:00
Adam Múdry 7961a7a65f fix(sdmmc): BDL calculate sectors cast fix
Closes https://github.com/espressif/esp-idf/issues/18875
2026-07-21 14:06:56 +02:00
Jin Cheng 1336f62653 change(bt/bluedroid): increased port low watermark of RFCOMM
When PORT_RX_BUF_LOW_WM is too low, RFCOMM replenishes credits only
after receiving a relatively large number of packets, which may cause
the peer to exhaust its credits and enter a stop-and-wait state.
Increase the low watermark to replenish credits more promptly and
reduce the likelihood of the peer stalling while waiting for additional
credits.
2026-07-21 19:29:08 +08:00
Zhou Xiao 2fa434eb50 fix(bt): keep BLE log ISR state in internal RAM 2026-07-21 16:27:39 +08:00
luoxu aa9b565a6d fix(bt): fix BLE log compression build on Windows
The BLE log compression feature (CONFIG_BT_LOG_CRITICAL_ONLY ->
BLE_COMPRESSED_LOG_ENABLE) failed to build on Windows while working
correctly on Linux, due to two shell/platform-specific issues in the
compression script.

1. Module/source argument quoting. CMakeLists.txt passes the
   semicolon-separated module and source lists wrapped in single quotes
   ("'${MODULES}'") to protect ';' from POSIX shells, which strip them.
   cmd.exe does not treat single quotes as quoting characters, so on
   Windows the quotes reached the script literally and
   args.module.split(';') produced "'BLE_MESH" / "BLE_HOST'" instead of
   the clean names. These never matched the YAML module keys, every
   module was skipped ("Skipping module ... - config not found"), the
   compressed sources were never generated, and the build failed. Strip
   surrounding quote characters before splitting; this is a no-op on
   Linux/macOS where the shell already removed them.

2. CRLF line endings. With core.autocrlf=true the IDF sources are
   checked out as CRLF on Windows. The generated *_log_index.h macros
   use backslash-newline line-continuation; a backslash followed by
   '\r\n' is not a valid continuation in C, producing floods of syntax
   errors when the header is compiled. Write generated headers with
   newline='' to force LF, and normalize source content to LF right
   after reading so '\r' embedded inside multi-line argument expressions
   is also handled. Byte offsets stay consistent because both tree-sitter
   parsing and tag replacement operate on the normalized content.

Verified by full clean builds of examples/bluetooth/esp_ble_mesh/
vendor_models/vendor_client (esp32c6, bluedroid + mesh) from both
cmd.exe and PowerShell; both produce an identical vendor_client.bin.
2026-07-21 15:56:17 +08:00
Chen Ji Chang 0bae8d1e27 Merge branch 'change/remove_lcd_restart_for_p4_s31' into 'master'
remove(lcd): remove restart support for p4 and s31

Closes IDF-15849 and IDF-15960

See merge request espressif/esp-idf!50892
2026-07-21 15:41:27 +08:00
Chen Jichang 294f35cb03 test(dma): add psram ecc test for supported targets 2026-07-21 14:50:23 +08:00
zhangyanjiao a3fa56db51 fix(wifi): fixed the buffer overflow issues
1. Added validation for password and reserved data length in ESPTouch v2
2. Added bound check for data index in ESPTouch v1 HT40
3. prevent buffer overflow when parsing MBSSID beacon
2026-07-21 14:09:35 +08:00
morris 26a22512eb refactor(hal): extract assist_debug, debug_probe and trace into esp_hal_debug_assist
Move the following modules from the hal component into a new dedicated
esp_hal_debug_assist component, following the esp_hal_timg pattern:

- assist_debug (hal + target-specific LL headers)
- debug_probe (types + target-specific LL headers)
- riscv_trace (hal + types + source + target-specific LL headers)
- trace_ll (esp32/esp32s2/esp32s3 target-specific LL headers)

Update the following components to depend on esp_hal_debug_assist:
esp_system, riscv, bootloader_support, esp_hw_support, esp_riscv_trace

Remove riscv_trace_hal.c from the hal component.
2026-07-21 11:28:11 +08:00
morris e8a5192a18 Merge branch 'ci/fix_the_parlio_rx_spi_test_case' into 'master'
ci(parlio_rx): fixed the parlio rx spi test case

Closes IDF-9806

See merge request espressif/esp-idf!43536
2026-07-21 10:54:05 +08:00
Jiang Jiang Jian e41650a966 Merge branch 'bugfix/remove_phy_lib_librfate' into 'master'
fix(phy): removed all librfate logic from cmake

Closes IDFCI-13345

See merge request espressif/esp-idf!50940
2026-07-21 10:49:48 +08:00
morris 3af71b792e refactor(isp): read DMA input directly from flash
Avoid the PSRAM copy for unencrypted flash
2026-07-21 10:46:04 +08:00