Commit graph

62005 commits

Author SHA1 Message Date
Jukka Laitinen
40bbf67bd3 sched/misc/assert: Add CONFIG_SCHED_DUMP_TASKS and CONFIG_SCHED_DUMP_STACK
Add more refined options for sched/misc/assert to control how verbose
crash dumps are printed out:

- SCHED_DUMP_TASKS
- SCHED_DUMP_STACK

These default to y unless DEFAULT_SMALL is defined. The options can
be undefined to save flash space on a small system.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-09 08:04:54 -04:00
Jukka Laitinen
5844ff5abb sched/misc/assert: Small flash-saving fixes
- Use shared string for "stack pointer out of range" to avoid duplicate in flash
- Re-use already calculated stack_used instead of calling up_check_tcbstack again

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-09 08:04:54 -04:00
nicolasWDC
065da307f5 include/cxx/cmath: Define FLT_EVAL_METHOD from compiler builtin
Some GCC-based external toolchains define **FLT_EVAL_METHOD** but do not
leave the standard FLT_EVAL_METHOD macro visible when the NuttX cmath shim
evaluates its guards.

As a result, C math symbols such as log and pow are declared by NuttX
math.h, but are not imported into namespace std by include/cxx/cmath.

Define FLT_EVAL_METHOD locally from **FLT_EVAL_METHOD** when needed in the
non-CONFIG_LIBM_TOOLCHAIN path.

This fixes compilation of valid C++ code using std::log and std::pow with
arm-none-eabi-g++.

Signed-off-by: nicolasWDC <nicolasWDC@users.noreply.github.com>
2026-06-08 15:31:31 -03:00
Abhishek Mishra
fa7f85632c fs/vfs: enforce pseudoFS permissions on mutation operations
Add pseudoFS permission enforcement for unlink(), mkdir(), and rename() VFS mutation operations.

This change validates parent-directory permissions before modifying pseudoFS inode topology and returns -EACCES for unauthorized operations.

The implementation preserves mountpoint filesystem behavior and fixes multiple inode lifetime/search-state issues in the rename path.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-06-09 01:40:17 +08:00
Shoji Tokunaga
59a66fa17d tools: Enable Rust sim builds on Intel Macs
Add support for building Rust apps on the NuttX simulator running on
Intel (x86_64) macOS.

- Add tools/x86_64-unknown-nuttx-macho.json, a Mach-O Rust target for
  the macOS sim.
- Rust.defs: select the new x86_64 macho target for sim on macOS.
- boards/sim/.../Make.defs: keep the default PIC/PIE-compatible code
  generation on macOS by not adding -fno-pic/-mcmodel=medium.
- sethost.sh: enable CONFIG_HOST_X86_64 for non-arm64 hosts.

Signed-off-by: Shoji Tokunaga <toku@mac.com>
2026-06-08 21:22:45 +08:00
hanzj
3c8621cb89 Documentation: document sensortest command
Add documentation for the sensortest system tool which reads data
from sensor drivers via the uORB topic interface.

Signed-off-by: hanzj <hanzj@xiaomi.com>
2026-06-08 10:04:48 +02:00
leisiji
8121b88666 cmake/elf: Fix ELF entry point from __start to _start
__start is the kernel boot entry for each chip, while _start (defined
in crt0.c) is the correct C runtime entry point for ELF executables.

Signed-off-by: leisiji <2265215145@qq.com>
2026-06-08 16:03:21 +08:00
leisiji
ace40bfbfc build/fix: remove nonexistent target in cmake
nuttx_apps_mksymtab is nonexistent in nuttx,
which produce error when build with CONFIG_MODULES

Signed-off-by: leisiji <2265215145@qq.com>
2026-06-08 16:03:21 +08:00
leisiji
14e434c3f0 mm/kasan: Fix compile options applied to wrong target in SPLIT build
In SPLIT build mode, nuttx_add_kernel_library(mm SPLIT) creates two
targets: mm (system library) and kmm (kernel library). The compile
options were being applied to the mm target via
target_compile_options(mm ...), but the kasan instrumentation is
compiled as part of the kmm target.

Change target_compile_options(mm ...) to target_compile_options(kmm
...) so that FLAGS (including -fno-builtin and NO_LTO) are correctly
applied to the kernel target where kasan code is compiled.

Signed-off-by: leisiji <2265215145@qq.com>
2026-06-08 16:03:21 +08:00
Jukka Laitinen
9c10bbd04a drivers/mtd: Remove bad block management in FTL for devices not needing it
Bad block management and the logical->physical mapping is only needed
with raw NAND type memories, so we can compile that in conditionally,
saving ~600 bytes of flash on a 32-bit arm when NAND is not used.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-08 10:00:07 +02:00
Matteo Golin
9e9926317d drivers/contactless/pn532: Fix potential overflow
Fixes a potential overflow where more than 16 bytes are written to the
cmd_buffer.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-06-08 14:05:29 +08:00
hanzj
7922011b72 Documentation: document tcpdump command.
Add documentation for the tcpdump system command, covering
command-line options (-i, -w, -s), Kconfig configuration,
usage examples, and notes on pcap output format compatibility.

Signed-off-by: hanzj <hanzjian@zepp.com>
2026-06-07 22:55:03 +08:00
Martin Vajnar
41381edb31 video/fb: Handle case of multiple displays where some do not require update
It can happen that multiple display configuration is used in which some
displays require explicit update while others do not.

If the updatearea() is NULL, simply skip the update instead of erroring out.

Signed-off-by: Martin Vajnar <martin.vajnar@gmail.com>
2026-06-07 10:01:05 -03:00
hanzj
80f133504a boards/sim/sim/sim/nsh: enable CONFIG_RTC so date command shows host time
The default sim:nsh config has no RTC, causing NSH_DISABLE_DATE to be
auto-enabled (default: DEFAULT_SMALL || !RTC). This means the date
command is not compiled in, and the system time defaults to a hardcoded
value instead of syncing with the host.

Enable CONFIG_RTC, CONFIG_RTC_DRIVER, and CONFIG_RTC_ARCH in the
sim:nsh defconfig so the date command is available and shows the
correct host time out of the box.

Signed-off-by: hanzj <hanzjian@zepp.com>
2026-06-06 15:08:15 -03:00
Martin Vajnar
155805c2e6 video/fb: Trigger updatearea() if CONFIG_FB_UPDATE is defined
When CONFIG_FB_UPDATE is defined the missing updatearea() trigger caused
the splashscreen to not be displayed.

Signed-off-by: Martin Vajnar <martin.vajnar@gmail.com>
2026-06-06 15:54:51 +08:00
raiden00pl
af371bbaa5 arch/nrf91: add more ioctl calls for modem socket
add support for these ioctl:

- LTE_CMDID_RADIOON
- LTE_CMDID_RADIOOFF
- LTE_CMDID_ACTPDN

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-06 15:54:16 +08:00
raiden00pl
2cb1511602 arch/nrf91: fix broken modem initialization
fix broken modem initialization for nrf91

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-06 15:53:50 +08:00
shichunma
207fa5b0e2 include/nuttx/semaphore.h: parenthesize NXSEM helper args
Wrap the NXSEM_COUNT() and NXSEM_MHOLDER() macro arguments in an extra pair of parentheses before member access.

This makes the helpers safer for complex expressions passed as the macro argument and aligns them with common macro style.

Signed-off-by: Jerry Ma <shichunma@bestechnic.com>
2026-06-05 10:35:46 -04:00
Shoji Tokunaga
e4fe1134bf arch/sim: Add dependencies for Rust cargo in make builds
Add `EXTRA_LIB_DEPS` to the simulator nuttx target prerequisites.

This lets Make notice when an extra application library, such as a Rust
static library rebuilt by Cargo, has changed and ensures the final
simulator binary is relinked.

Signed-off-by: Shoji Tokunaga <toku@mac.com>
2026-06-05 09:44:09 +08:00
dependabot[bot]
f8aa477b7a build(deps): bump starlette from 0.52.1 to 1.0.1 in /Documentation
Bumps [starlette](https://github.com/Kludex/starlette) from 0.52.1 to 1.0.1.
- [Release notes](https://github.com/Kludex/starlette/releases)
- [Changelog](https://github.com/Kludex/starlette/blob/main/docs/release-notes.md)
- [Commits](https://github.com/Kludex/starlette/compare/0.52.1...1.0.1)

---
updated-dependencies:
- dependency-name: starlette
  dependency-version: 1.0.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-04 17:01:57 -04:00
lccosy
b07c61e0cd arch/arm/gd32f4: fix NULL pointer dereference in arm_earlyserialinit.
Add NULL check for g_uart_devs[i] before accessing ->priv in
arm_earlyserialinit() loop. When a USART is not enabled in defconfig,
g_uart_devs[i] is NULL, causing a HardFault crash during early boot.

The bug occurs because the original code only checked g_uart_devs[i]->priv
without first verifying g_uart_devs[i] is not NULL. On Cortex-M4, NULL
pointer dereference reads from Flash vector table (0x00000000 maps to
0x08000000), returning a function pointer that causes BusFault when
written to.

This fix matches the existing NULL check pattern used in arm_serialinit()
at line 2835 of the same file.

Tested on mplant-gd32f450 board with only USART5 enabled in defconfig.
Before fix: HardFault at boot (IPSR=3, PC=0x080003e0)
After fix: System boots normally to NSH Shell

Signed-off-by: lccosy <1191294205@qq.com>
2026-06-04 17:00:27 -04:00
rongyichang
47e3f5013f drivers/video: add HWCURSOR related config
There is no HWCURSOR config in Kconfig, but a lot of code
use it, we need to add it back.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2026-06-05 00:01:09 +08:00
shichunma
811eb22d58 drivers/mmcsd/mmcsd_sdio.c: guard SDIO_REGISTERCALLBACK use
SDIO_REGISTERCALLBACK is only defined when both CONFIG_SCHED_WORKQUEUE and CONFIG_SCHED_HPWORK are enabled.
Guard the callback registration call in mmcsd_sdio.c so the source matches the SDIO callback API availability and avoids
build issues when HPWORK support is not configured.

Signed-off-by: Jerry Ma <shichunma@bestechnic.com>
2026-06-04 09:31:56 -03:00
shichunma
0afb8c7ad5 cmake/nuttx_toolchain.cmake: track preprocessed include deps
Make preprocess-generated outputs depend on included files by
emitting depfiles for GNU/Clang Ninja/Makefile builds.

This fixes stale generated rc.sysinit and ROMFS images when a
board-specific included fragment such as rc.sysinit.ap changes,
because the previous custom command only depended on the top-level
source file.

Signed-off-by: Jerry Ma <shichunma@bestechnic.com>
2026-06-04 17:22:43 +08:00
Jukka Laitinen
116a325763 libs/libc/time: Add configuration options for the strftime
This adds 3 configuration options for the lib_strftime, which can be
used to save flash memory when all the formatters are not needed by an
embedded application.

There is always a minimal set of formatters supported:
"%a, %b/%h, %d, %H, %m, %M, %S, %Y, %%". To add on top of that one can
specify:

- LIBC_STRFTIME_C_STANDARD_FORMATS  : All ISO-C conversion specifiers
- LIBC_STRFTIME_POSIX_FORMATS       : Additional posix formats
- LIBC_STRFTIME_NONSTANDARD_FORMATS : Additional GNU nonstandard formats

All of these are enabled by default unless building for CONFIG_DEFAULT_SMALL.
Disabling these options can save over 3KB of flash on an 32-bit
ARM system, when all the format specifiers are not needed.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-04 14:29:33 +08:00
taikoyaP
75a12b1258 Documentation/components/boards.rst: fix typo
fix a small typo in boards file
2026-06-04 09:58:42 +08:00
Lingao Meng
2a6059a206 arch/sim: walk frame-pointer chain for non-running tasks in up_backtrace
The previous up_backtrace() relied entirely on host_backtrace() (a thin
wrapper around glibc's backtrace()), which can only unwind the host
thread that calls it.  As a result, when assert / dump_tasks() walked the
task list and called sched_dumpstack() for every task, every task other
than the currently-running one returned a zero-length backtrace, and the
output was silently dropped.  In practice this meant that on sim only
the crashing task ever produced a usable trace.

Fix this by walking the frame-pointer chain ourselves whenever the
target tcb is not the running task.  Because sim's setjmp/longjmp is
provided by NuttX itself (libs/libc/machine/sim/arch_setjmp_*.S) and not
by host libc, the rbp/rsp/rip (or arm fp/sp/pc) saved in tcb->xcp.regs
are plain unmangled pointers, identical across Linux, macOS and Windows
hosts.  The frame layout ([fp]=prev fp, [fp+1]=return address) is also
shared by every host ABI sim supports (x86, x86_64, ARM, ARM64).

The walker validates that fp lies inside the task's stack and is
properly aligned, and stops when fp[0] is NULL, so a corrupted stack
cannot make us read out of bounds.  The running-task path is unchanged
and still uses host_backtrace() so DWARF unwinding through host
libraries continues to work.

Requires CONFIG_FRAME_POINTER=y so the compiler emits a usable fp link.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-06-04 09:54:08 +08:00
Serg Podtynnyi
b8cd0435b2 ci/docker: bump risc-v toolchain gcc14
Revert to latest gcc144 due libcxx incompability

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2026-06-04 08:25:40 +08:00
Lup Yuen Lee
eec015a66e drivers/segger: Download systemview from NuttX Mirror Repo
CI Builds for `stm32f429i-disco:systemview` and `nucleo-f446re:systemview` are failing, because www.segger.com is blocking our downloads for systemview. This PR updates the Segger Makefiles to download systemview from our Cached Dependency at NuttX Mirror Repo: https://github.com/NuttX/nuttx/releases/download/systemview/SystemView_Src_V356.zip

```
Configuration/Tool: nucleo-f446re/systemview,CONFIG_ARM_TOOLCHAIN_CLANG
CMake Error at /github/workspace/sources/nuttx/build/_deps/systemview-subbuild/systemview-populate-prefix/src/systemview-populate-stamp/download-systemview-populate.cmake:170 (message):
    error: downloading 'https://www.segger.com/downloads/systemview/SystemView_Src_V356.zip' failed
          status_code: 22
          status_string: "HTTP response code said error"
```

https://github.com/apache/nuttx-apps/actions/runs/26855455932/job/79197351538#step:10:1547

Signed-off-by: Lup Yuen Lee <luppy@appkaki.com>
2026-06-03 19:19:24 +08:00
Serg Podtynnyi
20a50a48c5 ci/docker: bump risc-v toolchain
Bump risc-v toolchain to 15.2.0-1

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2026-06-03 12:27:08 +02:00
hanzj
0916a88716 docs: Fix duplicate toctree references causing build warnings
Several documentation files are referenced in multiple toctrees,
causing Sphinx build warnings like:

  document is referenced in multiple toctrees: [...], selecting: [...]

Fix by narrowing glob patterns in parent toctrees to only match
subdirectory index files, and replacing a toctree directive with
a :doc: cross-reference:

- platforms/arm/index.rst: glob */* -> */index
- platforms/index.rst: glob */* -> */index
- guides/changing_systemclockconfig.rst: toctree -> :doc: ref

Fixes #14785

Signed-off-by: hanzj <hanzj@xiaomi.com>
2026-06-03 15:02:22 +08:00
simbit18
895213058b workflows/build.yml: Fix Skipping sim\windows in the MSVC job
Fix

====================================================================================
Cmake in present: sim\windows
Configuration/Tool: sim\windows
2026-06-02 12:57:35
------------------------------------------------------------------------------------
  Cleaning...
  Skipping: sim\windows
------------------------------------------------------------------------------------
End: 2026-06-02 12:57:35
====================================================================================

The "windows-latest" and “windows-2025” labels in GitHub Actions will be migrated to use Visual Studio 2026 by default. Customers needing Visual Studio 2022 must migrate to the windows-2022 image.

https://github.com/actions/runner-images/issues/14017

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-06-03 07:25:25 +08:00
Jukka Laitinen
fc69782f51 drivers/mmcsd: Remove eMMC partitions when !CONFIG_MMCSD_MMCSUPPORT
When the CONFIG_MMCSD_MMCSUPPORT is disabled, we can remove the
mmc partition support, saving ~300+ bytes of flash on a 32-bit Arm
target. These partitions don't exist on SD cards.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-02 15:14:38 -03:00
yushuailong
7e67d2d906 libs/libc/dirent: preserve errno on readdir() end-of-directory
readdir() returned NULL at end-of-directory without ensuring errno was
clean.  POSIX requires errno to be unchanged at EOF, but the underlying
read() path may leave a stale errno value.  Callers that follow the
POSIX idiom (set errno to 0 before the call, test it after a NULL
return), such as readdir_r() and scandir(), then misread this as a
readdir() failure.

Save errno on entry and restore it on the end-of-directory return so
that EOF no longer reports a spurious error, while genuine errors
(read() returning a negative value) still propagate.

Signed-off-by: yushuailong <yyyusl@qq.com>
2026-06-02 23:34:25 +08:00
Jukka Laitinen
e15672f7a4 boards/arm/stm32/nucleo: Fix BBSRAM compilation
Fix the compilation of stm32f4/7 nucleo boards with:
 CONFIG_STM32F7_BKPSRAM=y
 CONFIG_STM32F7_BBSRAM=y
 CONFIG_STM32F7_PWR=y
 CONFIG_STM32F7_SAVE_CRASHDUMP=y

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-02 12:15:17 -03:00
wangjianyu3
73c949c87e boards/lckfb-szpi-esp32s3: switch adb config to nxinit entrypoint
Replace the default nsh-based init flow on the lckfb-szpi-esp32s3 :adb
defconfig with system/nxinit so that services (sh console, adbd) are
spawned and reaped by init through /etc/init.d/init.rc.

- Enable CONFIG_SYSTEM_NXINIT and set INIT_ENTRYPOINT to init_main
  (CONFIG_EXPERIMENTAL is required by SYSTEM_NXINIT).
- Add a common init.rc under boards/xtensa/esp32s3/common/src/etc/init.d
  defining 'console' (sh) and 'adbd' services and starting both on init.
  fastbootd is wired in for completeness when configured.
- Append the new init.rc to RCSRCS only when SYSTEM_NXINIT is enabled
  so existing nsh-based configs remain unaffected.

Verified on lckfb-szpi-esp32s3 hardware: init_main spawns sh and adbd
(both with PPID=init), 'adb shell' reaches a working NuttShell.

Assisted-by: GitHubCopilot:claude-4.8-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-06-02 10:44:45 -04:00
Eren Terzioglu
78ab935db8 boards/xtensa/espressif: Fix crypto hash tests for esp32[-|-s2|-s3]
Fix crypto hash test errors due to SHA224 test which are not supported on NuttX for Xtensa based Espressif devices.

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-06-02 15:14:34 +02:00
taikoyaP
bc832b4152 Documentation/applications/audioutils/mml_parser/index.rst: fix typo
fix a small typo in index.rst.
2026-06-02 09:23:41 -03:00
Sammy Tran
3e3427d339 arch/arm/src/stm32h5/stm32_adc: Reset channel counter before conversions
Signed-off-by: Sammy Tran <sammytran@geotab.com>

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AI-Model: claude-sonnet-4.6
2026-06-02 20:09:31 +08:00
Sammy Tran
5a03e04f21 arch/arm/src/stm32h7/stm32_adc: Reset channel counter before conversions
Signed-off-by: Sammy Tran <sammytran@geotab.com>

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AI-Model: claude-sonnet-4.6
2026-06-02 20:09:31 +08:00
Lingao Meng
3a0fb4b9bf drivers/serial: bound uart_tcdrain xmit-buffer wait by caller timeout
uart_tcdrain() takes a caller-supplied timeout (e.g. 10s from the
TCDRN ioctl path), but the timeout was only applied to the final
TX-FIFO polling loop.  The earlier xmit-buffer drain loop called
nxsem_wait(&dev->xmitsem) with no timeout, so any condition that
prevents the lower half from posting xmitsem (e.g. a stuck DMA
completion path, a wedged hardware-flow-control stall) would block
tcdrain() indefinitely, regardless of the timeout the caller asked
for.  The pre-existing comment ("NOTE: There is no timeout on the
following loop. ... the caller should call tcflush() first") openly
acknowledged this hang.

Move the start timestamp before both phases and replace the bare
nxsem_wait() with nxsem_tickwait() using the remaining time, so the
total time spent in tcdrain() honors the caller's timeout regardless
of which phase stalls.  When the remaining time is already exhausted,
short-circuit to -ETIMEDOUT without calling into the scheduler.  The
existing exit path (drop critical section, skip the FIFO polling
loop, unlock the xmit mutex, leave the cancellation point) handles
the new -ETIMEDOUT propagation correctly without further changes.

Also fold the "Set up for the timeout" comment into the kludge
REVISIT comment, since the timestamp is no longer set up at that
point.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-06-02 19:50:55 +08:00
Lingao Meng
78b3b456eb drivers/serial: fix cancellation point leak on uart_tcdrain timeout
uart_tcdrain() registers a cancellation point on entry via
enter_cancellation_point() (when called with cancelable=true), and the
normal exit path calls leave_cancellation_point() before returning.

However the timeout path inside the FIFO drain loop returns -ETIMEDOUT
directly without going through the normal exit path, leaking one
cancellation point reference (tcb->cpcount is left incremented).  Over
repeated timeouts this counter will desync and prevent
pthread_cancel() / pthread_setcancelstate() from behaving correctly
for the calling thread.

Fix by calling leave_cancellation_point() before the early return,
matching the existing exit path.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-06-02 19:50:55 +08:00
Eren Terzioglu
d955fbc8f3 boards/risc-v/espressif: Fix crypto hash tests for esp32[-c3|-c6|-h2|-p4]
Fix crypto hash test errors due to SHA224 test which are not supported on NuttX for
risc-v based Espressif devices.

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-06-02 00:09:22 +08:00
Eren Terzioglu
9ef787f9de Docs/platforms/esp32[-c6|-h2]: Add BLE docs for esp32[-c6|-h2]
Add BLE docs for esp32c6 and esp32h2

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-06-02 00:08:50 +08:00
Eren Terzioglu
7083aa9777 boards/risc-v/espressif: Add BLE board support for esp32[-c6|-h2]
Add BLE board support for esp32c6 and esp32h2

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-06-02 00:08:50 +08:00
Eren Terzioglu
c188f3c934 arch/risc-v/espressif: Add BLE support for esp32[-c6|-h2]
Add BLE support for esp32c6 and esp32h2

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-06-02 00:08:50 +08:00
hanzj
94fa220650 arch/sim: Fix OOB read/write in usrsock_ioctl_handler
usrsock_ioctl_handler() copies req->arglen bytes from the request
payload into the fixed-size usrsock->out buffer without validating
that the payload fits either the received request or the destination
buffer.  This is the same class of vulnerability as the one already
fixed in nrf91_modem_sock.c (commit a43fb69283).

Add three checks before the copy:

  - len >= sizeof(*req): ensure the full request header is present.
  - copylen <= len - sizeof(*req): payload must fit the received data.
  - copylen <= SIM_USRSOCK_BUFSIZE - sizeof(*ack): payload must fit
    the destination buffer.

Signed-off-by: hanzj <hanzjian@zepp.com>
2026-06-02 00:08:22 +08:00
hanzj
1736afa145 arch/arm/nrf91: Fix OOB read/write in nrf91_usrsock_ioctl_handler
nrf91_usrsock_ioctl_handler() copies req->arglen bytes from the
request payload into the fixed-size usrsock->out buffer without
validating that the payload actually fits either the received
request or the destination buffer.  A crafted ioctl request with
an inflated arglen triggers:

  1. OOB read — memcpy reads past the end of the received request.
  2. OOB write — memcpy writes past the end of usrsock->out.

Add three checks before the copy:

  - len >= sizeof(*req): ensure the full request header is present.
  - copylen <= len - sizeof(*req): payload must fit the received data.
  - copylen <= sizeof(usrsock->out) - sizeof(*ack): payload must fit
    the destination buffer.

The recvfrom handler in the same file already performs the equivalent
buffer-size check (line 892).  Fixes #18515.

Signed-off-by: hanzj <hanzjian@zepp.com>
2026-06-01 15:39:52 +02:00
cuiziwei
f106e07f00 include/unistd: add dpopen/dpclose declarations
Add declarations for dpopen() and dpclose() to unistd.h.  These are
the descriptor-based counterparts of popen()/pclose() declared in
stdio.h.  The implementation lives in apps/system/popen/dpopen.c.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-06-01 18:20:18 +08:00
Arjav Patel
34e0663e2d tools/nxstyle: Whitelist Micro XRCE-DDS uxrCustomTransport prefix.
The Micro XRCE-DDS Client custom-transport API expects user
callbacks with prototypes of the form

  bool open_cb (struct uxrCustomTransport *transport);
  size_t read_cb(struct uxrCustomTransport *transport, ...);

The struct tag is fixed by the upstream public header
<uxr/client/profile/transport/custom/custom_transport.h> and
cannot be renamed. nxstyle currently flags every callback
signature in apps/system/microros/transport with 'Mixed case
identifier found'.

Add the 'uxrCustom' prefix to g_white_prefix, following the same
pattern used for the ROS 2 message type names added in
commit bc3a2596c8 ("tools/nxstyle: Whitelist ROS 2 message type
identifiers.").

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
2026-06-01 09:56:23 +08:00