Commit graph

62030 commits

Author SHA1 Message Date
raiden00pl
096e8d7e59 !arm/stm32f7: standardize public API prefix to stm32_
BREAKING CHANGE: Public STM32F7 APIs were renamed from stm32f7_*
and stm32f7x9_* forms to canonical stm32_* names.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-23 09:45:36 +08:00
Jukka Laitinen
d4a5db49c2 drivers/mtd: Make compile time check for sane mtd isbad/markbad configuration
This removes the DEBUGASSERT in ftl_initialize_by_path. Instead, check
compile time that FTL is enabled in case some of the drivers implement
the isbad and markbad functions.

Also select the FTL_BBM for those drivers as they require it.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-17 23:14:58 +08:00
Abhishek Mishra
fec3c5bc07 Documentation/sched: Add POSIX user identity transition docs
Adds comprehensive documentation for the POSIX three-tier user identity
model (real, effective, saved-set IDs) enabled by CONFIG_SCHED_USER_IDENTITY.

* Updates sched/Kconfig with detailed help text explaining the config.
* Adds user_identity.rst to formally document credential inheritance
  and the privilege transition rules for setuid(), seteuid(), setgid(),
  and setegid().
* Updates tasks_vs_threads.rst to list credentials as a shared task
  group resource.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-06-17 17:13:57 +08:00
Abhishek Mishra
370d89a012 sched/group: implement POSIX saved-set-UID/GID semantics
Adds tg_suid and tg_sgid fields to task_group_s to complete the
POSIX three-field identity model (real, effective, saved-set).

Updates group_inherit_identity() to propagate the new fields from
parent to child task group on task creation.

Fixes setuid(), setgid(), seteuid(), and setegid() to implement
correct POSIX privilege transition logic:
- Root (euid==0): may set any value; all three IDs updated by setuid/setgid
- Non-root: may only set effective ID to real or saved value; else EPERM

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-06-17 17:13:57 +08:00
Catalin Visinescu
d33e20fa1c drivers/contactless/pn532: Fix Stack Overflow in PN532 Contactless Driver
When calling Set RF Configuration command, a compromised user
process can trigger memory corruption in the kernel. This can
lead to a system crash or potentially arbitrary code execution
in the kernel.

It addresses an earlier incomplete fix.

Tested locally.

Signed-off-by: Your Name <catalin_visinescu@yahoo.com>
2026-06-17 17:13:32 +08:00
Catalin Visinescu
269cc0dc15 drivers/can/ctucanfd_pci: Stack Overflow When Malformed CAN Data Is Received
A malformed packet can trigger memory corruption in the kernel leading to a
system crash or potentially arbitrary code execution in the kernel.

The CAN driver for the CTU CAN FD IP Core connected to the NuttX device
via a PCI / PCI Express (PCIe) bus shows a lack of consideration for
malformed data, assuming the CAN frames are always correct.

Ensure `frame->fmt.rwcnt` is 21 or less before it is used in the `for` loop.

A similar change was done in ctucanfd_sock_recv().

Tested locally, builds fine.

Signed-off-by: Catalin Visinescu <catalin_visinescu@yahoo.com>
2026-06-17 17:12:22 +08:00
Eren Terzioglu
79d80e4918 Docs/platforms: Add missing defconfig docs for esp32[-c3|-c6|-h2]
Add missing defconfig docs for risc-v based Espressif devices
2026-06-17 17:12:14 +08:00
hanzhijian
be8fe68ff7 Documentation/applications/system/conntrack: add conntrack man page
Add comprehensive documentation for the conntrack command including
dump and event monitoring options.

Signed-off-by: hanzhijian <hanzhijian@zepp.com>
2026-06-17 17:12:14 +08:00
hanzhijian
a147b4d6dd Documentation/applications/system/conntrack: add conntrack man page
Add documentation for the conntrack command including usage, options,
output format, and examples for listing and monitoring connection
tracking entries.

Signed-off-by: hanzhijian <hanzhijian@zepp.com>
2026-06-17 17:12:14 +08:00
hanzhijian
56e3e5b354 Documentation/applications/system/critmon: add critmon man page
Add documentation for the critmon command including:
- critmon (one-shot dump)
- critmon_start (start daemon)
- critmon_stop (stop daemon)
- Output format explanation
- Configuration options

Signed-off-by: hanzhijian <hanzhijian@zepp.com>
2026-06-17 17:12:14 +08:00
raiden00pl
49eaa7b860 Documentation: update references to nrfjprog
nrfjprog is no longer maintained. Change all nrfjprog commands
to equivalent nrfutil commands

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:12:14 +08:00
hanzj
81ff8a31ca 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-17 17:12:14 +08:00
yushuailong
8538e1423f arch/risc-v/esp32c3-legacy: Fix non-atomic clock read in up_rtc_rdalarm.
up_rtc_rdalarm() computed tv_sec and tv_nsec from two separate
evaluations of rt_timer_time_us() + offset + deadline. The RT timer
advances between the two calls, so a read that straddles a second
boundary yields an inconsistent timespec.

Compute the microsecond value once into a local variable and derive
both fields from that single snapshot.

Signed-off-by: yushuailong <yyyusl@qq.com>
2026-06-17 17:12:04 +08:00
yushuailong
a23a7b45c3 arch/risc-v/espressif: Fix non-atomic clock read in esp_rtc_rdalarm.
esp_rtc_rdalarm() computed tv_sec and tv_nsec from two separate
evaluations of esp_hr_timer_time_us() + offset + deadline. The
high-resolution timer advances between the two calls, so a read that
straddles a second boundary yields an inconsistent timespec.

Compute the microsecond value once into a local variable and derive
both fields from that single snapshot.

Signed-off-by: yushuailong <yyyusl@qq.com>
2026-06-17 17:12:04 +08:00
yushuailong
fb2f117ec2 arch/xtensa/espressif: Fix non-atomic clock read in esp_rtc_rdalarm.
esp_rtc_rdalarm() computed tv_sec and tv_nsec from two separate
evaluations of esp_hr_timer_time_us() + offset + deadline. The
high-resolution timer advances between the two calls, so a read that
straddles a second boundary yields an inconsistent timespec.

Compute the microsecond value once into a local variable and derive
both fields from that single snapshot.

Signed-off-by: yushuailong <yyyusl@qq.com>
2026-06-17 17:12:04 +08:00
yushuailong
fb4ffa4ae7 drivers/timers: Fix non-atomic clock read in up_timer_gettime.
up_timer_gettime() computed tv_sec and tv_nsec from two separate calls
to current_usec(), which returns a free-running microsecond counter.
The counter advances between the two calls, so a read that straddles a
second boundary yields an inconsistent (possibly backwards) timespec.

Read current_usec() once into a local variable and derive both fields
from that single snapshot.

Signed-off-by: yushuailong <yyyusl@qq.com>
2026-06-17 17:12:04 +08:00
Michal Lenc
a6c2cd73b5 fs/vfs/fs_lock.c: support flock for SHM driver
We can apply file lock on SHM inode as well. Ensure file_lock_get_path
function passes and doesn't return EBADF errno.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2026-06-17 17:11:35 +08:00
Michal Lenc
e5199c94ac fs/vfs/fs_lock.c: fix flock behavior for more threads and fds
We need to use gettid instead of getpid, otherwise flocks applied
from different threads are considered as single thread lock and are
ignored (or updated).

Also fix the behavior if process opens the file multiple times
Linux/BSD manual states multiple file descriptors opened by a single
process shall be treated independently. Therefore we also need to
compare struct file pointer to determine whether the lock applies
to the same descriptor or not.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2026-06-17 17:11:35 +08:00
Jukka Laitinen
361e7e29ae arch, sched/signal: Fix compilation with ENABLE_PARTIAL_SIGNALS=y
Correct build errors when CONFIG_ENABLE_ALL_SIGNALS is not defined

- sched makefiles: Move pending-signal helpers from the ENABLE_ALL_SIGNALS-only
  list to the !DISABLE_ALL_SIGNALS list so signal dispatch is available in
  PARTIAL builds sched: make SIG_PREALLOC_ACTIONS, SIG_ALLOC_ACTIONS and
  SIG_DEFAULT depend on ENABLE_ALL_SIGNALS
- sched: fix ifdefs around pending-signal queue access and signal-mask for
  PARTIAL/DISABLE modes
- arch: gate SYS_signal_handler / _return calls and SYSCALL_LOOKUP(signal)
  with ENABLE_ALL_SIGNALS

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-17 17:11:26 +08:00
Jukka Laitinen
8c1ac9c093 drivers/input/button_upper.c: Fix compilation with CONFIG_DISABLE_ALL_SIGNALS
The optional signal delivery should be disabled when signals support is
disabled for the board.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-17 17:11:26 +08:00
Jukka Laitinen
fb9a7dc1ce boards/nucleo-f302r8 : Set CONFIG_DISABLE_ALL_SIGNALS=y for ihm07m1_f32
This small board doesn't use the signals, so it is safe to disable them to save flash.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-17 17:11:26 +08:00
Jukka Laitinen
ce4e167ea7 libs/libc/pthread/pthread_mutex: Fix robust mutex initialization
This fixes an issue where ostest robust mutex test gets stuck.

In CONFIG_PTHREAD_MUTEX_ROBUST mode, every NORMAL mutex is robust by
definition, so the robust flag must be set to allow the mutex to be tracked
in the holder's mutex list.

Otherwise, pthread_mutex_add() will not record the mutex and
pthread_mutex_inconsistent() will not be able to mark it as inconsistent or
wake waiters when the holder thread terminates.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-17 17:11:14 +08:00
Abhishek Mishra
72192fc8bc fs/binfmt: Enforce POSIX execute permissions prior to binary load
Adds a pre-load permission check in exec_internal() to verify the
calling task has the required execute (x) bits for the target file.
Properly evaluates root (euid == 0), owner, group, and other permissions.

This ensures POSIX compliance and cleanly rejects unauthorized files
with -EACCES before they reach the ELF loader, preventing unnecessary
memory allocation and downstream hardware execution faults.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-06-17 17:11:07 +08:00
nicolasWDC
2cddf4e638 include/pthread : initialize wait_count in PTHREAD_COND_INITIALIZER
struct pthread_cond_s contains three fields: sem, clockid, and
wait_count. However, PTHREAD_COND_INITIALIZER only initialized the first
two fields, which triggers -Wmissing-field-initializers when a condition
variable is statically initialized.

Initialize wait_count explicitly to zero so the macro matches the structure
definition and remains warning-free with strict compiler flags.

Validated with a minimal compile test using:

pthread_cond_t cond = PTHREAD_COND_INITIALIZER;

Signed-off-by: nicolasWDC <nicolasWDC@users.noreply.github.com>
2026-06-17 17:10:49 +08:00
raiden00pl
7f479a7e84 arch/arm/src/stm32f7: remove duplicated stm32_exti_alarm.c source
stm32_exti_alarm.c was added twice in Make.defs and CMakeLists.txt.
Drop the duplicate block

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:35 +08:00
raiden00pl
e23af454f1 !arch/stm32n6: unify non-standard hardware definition prefixes
BREAKING CHANGE: STM32N6 non-standard hardware definition macros
(IRQ, peripheral-count, SRAM and related) were renamed to the common
STM32_* prefix. Out-of-tree code must update the affected references.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:28 +08:00
raiden00pl
8e3710d0d7 !arch/stm32wl5: unify non-standard hardware definition prefixes
BREAKING CHANGE: STM32WL5 non-standard hardware definition macros
(IRQ, peripheral-count, SRAM and related) were renamed to the common
STM32_* prefix. Out-of-tree code must update the affected references.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:28 +08:00
raiden00pl
62751f772c !arch/stm32wb: unify non-standard hardware definition prefixes
BREAKING CHANGE: STM32WB non-standard hardware definition macros
(IRQ, peripheral-count, SRAM and related) were renamed to the common
STM32_* prefix. Out-of-tree code must update the affected references.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:28 +08:00
raiden00pl
a3acb2bf13 !arch/stm32u5: unify non-standard hardware definition prefixes
BREAKING CHANGE: STM32U5 non-standard hardware definition macros
(IRQ, peripheral-count, SRAM and related) were renamed to the common
STM32_* prefix. Out-of-tree code must update the affected references.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:28 +08:00
raiden00pl
813af2e506 !arch/stm32l5: unify non-standard hardware definition prefixes
BREAKING CHANGE: STM32L5 non-standard hardware definition macros
(IRQ, peripheral-count, SRAM and related) were renamed to the common
STM32_* prefix. Out-of-tree code must update the affected references.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:28 +08:00
raiden00pl
6d489b66b1 !arch/stm32l4: unify non-standard hardware definition prefixes
BREAKING CHANGE: STM32L4 non-standard hardware definition macros
(IRQ, peripheral-count, SRAM and related) were renamed to the common
STM32_* prefix. Out-of-tree code must update the affected references.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:28 +08:00
raiden00pl
1e0a014b40 !arch/stm32h7: unify non-standard hardware definition prefixes
BREAKING CHANGE: STM32H7 non-standard hardware definition macros
(IRQ, peripheral-count, SRAM and related) were renamed to the common
STM32_* prefix. Out-of-tree code must update the affected references.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:28 +08:00
raiden00pl
8c4f15d670 !arch/stm32h5: unify non-standard hardware definition prefixes
BREAKING CHANGE: STM32H5 non-standard hardware definition macros
(IRQ, peripheral-count, SRAM and related) were renamed to the common
STM32_* prefix. Out-of-tree code must update the affected references.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:28 +08:00
raiden00pl
69de43b347 !arch/stm32f7: unify non-standard hardware definition prefixes
BREAKING CHANGE: STM32F7 non-standard hardware definition macros
(IRQ, peripheral-count, SRAM and related) were renamed to the common
STM32_* prefix. Out-of-tree code must update the affected references.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-17 17:10:28 +08:00
Kerogit
8ad4f90b72 arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function
NuttX builtin up_udelay function uses BOARD_LOOPSPERMSEC configuration
value to determine how many loops need to be done to cause requested
delay. This does not match well with AVR DA/DB microcontrollers
because the CPU clock frequency is configurable.

A board configuration could therefore provide BOARD_LOOPSPERMSEC
valid for one frequency but for other frequencies, the user would
be required to calibrate the value and would still get incorrect
result when changing the clock speed during runtime.

This patch therefore implements dynamic architecture-specific
up_udelay function which determines current clock settings
and infers required loop count from that.

New function was tested by simple application that used up_udelay
to put delays between printf calls.

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2026-06-17 17:10:02 +08:00
Kerogit
8eb5c85e72 arch/avr/src/avrdx: add support for reading CPU clock from other sources
This patch adds support for reading CPU clock frequency when the MCU
is driven by clock source other than high frequency oscillator.

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2026-06-17 17:10:02 +08:00
Kerogit
eb41209a07 sched/clock/clock_delay: added config flag to remove weak up_udelay
While attempting to create architecture-specific implementation
of up_udelay, it was discovered that the overriding function is not
included in the final binary, the weak implementation was used instead.

Further investigation and experimentation showed that the linker
only overrides the weak implementation with the custom one if
the custom one is present in a .c source file that contains at least
one other function that is called from somewhere. Some additional
testing revealed that at least one other already present up_udelay
override (rv32m1-vega:nsh) is affected by this.

In a short mailing list discussion it was determined that this
is a likely result of using static libraries during the build process
and it was suggested to introduce configuration option that will
exclude weak implementations of the function from the build altogether.
This patch does that.

This patch does not enable this configuration option for any existing
board/chip because doing so would change its behaviour and needs
to be tested by users of the hardware.

Also changed is the static assertion in sched/clock/clock_delay.c
to not prevent building the code when architecture declares that
it does not use BOARD_LOOPSPERMSEC to determine required loop count.
BOARD_LOOPSPERMSEC is made undefined in such case.

Patch was tested by building breadxavr:nsh (identical binary by SHA256),
rv32m1-vega:nsh (identical text section) and rv-virt:nsh (text section
differs because of different ordering of functions in the binary, ostest
passed though.)

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2026-06-17 17:10:02 +08:00
Kerogit
e6249b8f16 arch/avr/src/avrdx: fix Make.defs when CONFIG_ENABLE_ALL_SIGNALS unset
This patch amends commit dfd3426aa5 which added support for running
with some signals disabled to AVR architecture. AVR DA/DB architecture
was not covered by the commit and failed to build
with CONFIG_ENABLE_ALL_SIGNALS unset (which includes building
with CONFIG_ENABLE_PARTIAL_SIGNALS, the default value.)

Change is replicated from the commit and tested by a custom stress
application which spawns some always-busy threads and uses preemptive
multitasking to switch between them. Additionally, ability to sleep
in the application was tested by a simple LED blinking application.

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2026-06-17 17:10:02 +08:00
Kerogit
cd1ea28727 boards/avr/avrdx/breadxavr: provide board_late_initialize
This patch amends commit f077c0321d which is a part of series that
changed (in commit 48db502daf) default value of BOARD_LATE_INITIALIZE
to yes. With this change, the boards are required to provide
board_late_initialize function.

Commit f077c0321d added this function to many AVR boards but
not to this one, making the build with default configuration
fail. This patch rectifies that and provides an empty function.

With this patch applied, the build no longer fails.

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2026-06-17 17:10:02 +08:00
Eren Terzioglu
32f98faa62 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-11 03:23:19 +08:00
leisiji
848ab18cc0 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-11 03:23:04 +08:00
leisiji
4572dee715 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-11 03:23:04 +08:00
leisiji
b22ee5213e 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-11 03:23:04 +08:00
Jukka Laitinen
0c2cb0d7b6 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-11 03:18:31 +08:00
Martin Vajnar
039672a9fc 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-11 02:59:24 +08:00
Jukka Laitinen
88f3968d3b sched/Kconfig: Fix ETC_ROMFS dependency
When using FS_CROMFS for etc, user typically don't need FS_ROMFS,
they are completely separate filesystems. But both ETC_ROMFS and
ETC_CROMFS are needed, the first one selects that the ETC needs
to be mounted from ROM based filesystem, and ETC_CROMFS just specifies
that the backing filesystem is actually the CROMFS.

Iow; make ETC_ROMFS depend on FS_ROMFS || FS_CROMFS, so that the
user can drop FS_ROMFS when only FS_CROMFS is needed.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-06-11 02:58:02 +08:00
Matteo Golin
984ef64428 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-10 20:46:04 +02:00
raiden00pl
5fcc358305 !sensors/bme680: allow sensor configuration during registration
BREAKING CHANGE: bme680_register() takes an additional "*config" argument.
When config is NULL - driver behavior is the same as before.

With this change bme680 can be configured during registration in board logic.
This way we don't have to callibrate sensor from user-space but sensor is ready
to use after registration.

This change makes the registration the same as for bme688, which is a similar
sensor.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-06-10 20:45:31 +02:00
raiden00pl
24bb7c0461 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-10 20:45:01 +02:00
Jukka Laitinen
f10b8fed8b 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-10 22:41:16 +08:00