layout: page released: true apache: true title: 12.0.0 date: 2023-01-16 summary: > Release v12.0.0
artifact-root: “https://www.apache.org/dyn/closer.lua/nuttx/12.0.0” checksum-root: “https://downloads.apache.org/nuttx/12.0.0” key-file: “https://downloads.apache.org/nuttx/KEYS”
source-os-dist: - “apache-nuttx-12.0.0.tar.gz” source-app-dist: - “apache-nuttx-apps-12.0.0.tar.gz”
{% include JB/setup %}
#7493 sched: clock: adjust clock function to support tick
#7200 sched: clock: Rename g_system_timer to g_system_ticks
#6936 sched: cpuload: fix cpuload error
#7318 sched: env: Skip the envirnment variable duplication of kernel thread
#7490 sched: getprioritymax: handle invaild policy as posix style
#7563 sched: group_setupidlefiles: fall back to /dev/null if /dev/console is disabled
#7235 sched: irq: Refactor irq_spinlock.c
#7469 sched: mutex: NXMUTEX_INITIALIZER should enable priority inheritance
#7095 sched: mqueue: fix resource leak in mq_timedsend()
#7088 sched: msgq: add support of System V message queue
#7838 sched: nx_bringup: Set the initial stack size in kernel build as well
#7492 sched: posix/timer: handle invaild timerid correctly
#6905 sched: prctl: Replace strncpy with strlcpy for safety
#7267 sched: sem: don't clear waitobj when do sem recover
#6967 sched: semaphore: add sem_count temporary variable to improve performance
#6318 sched: semaphore: fix priority boost restoration for priority inheritance
#7456 sched: semaphore: add the wdog judge before cancel
#7583 sched: signal: fix sigtimedwait error handling
#7327 sched: spawn: Add the dummy task_spawnattr_xxxstackyyy in the kernel mode
#7485 sched: spawn: Rename task_spawnattr_[get|set]stack[size|addr] to posix_spawnattr_[get|set]stack[size|addr]
#7597 sched: task: task_getpid: getpid should return process id not thread id
#7018 sched: wqueue: change single queue to double queue to improve speed
#6996 sched: wqueue: fix visual studio Compiler Error C2059
#7477 sched: change the type of tg_joinlock, mm_lock and md_lock from sem_t to mutex_t
#7019 sched: fix corner case wd_cancel assert crash
#7062 sched: fix kasan report error when open CONFIG_DEBUG_MM
#6948 sched: fix macro “SCHED_NOTE_PRINTF” requires 3 argumnets, but only 1 given
#7322 sched: fix runtime error UBSan(division by zero)
#7792 sched: Improve UBSan configuraion
#7159 sched: merge waitsem and msgwaitq
#7791 sched: move _assert to kernel space.
#7837 sched: move sched_note.c to drivers/note
#7810 sched: pthread_mutex_timedlock never returns EINTR
#7816 sched: Remove intr and EINTR from pthread mutex
#7276 sched: Minor fix backtrace config
#7459 sched: use pid to check idle task
#7196 sched: Optimize sched_note_begin/end
#7471 sched: Remove the unnecessary (FAR sem_t *) cast
#6862 sched: Remove the unnecessary weak_function
#6958 sched: Remove volatile from the task list
#7808 sched: move common assert logic together.
#6987 sched: semaphore and mqueue task list optimize
#7339 sched: Simplify HAVE_GROUP_MEMBERS logic
#6866 sched: Simplify the cpuload process
#7511 sched: remove sched_continue, merge code
#7599 sched: remove nxsched_remove_blocked from up_unblock_task
#7364 sched: Support the stack size and address for posix_spawn and kernel mode
#7415 sched: Pass idle thread envionment variables to the child task through copy
#7454 sched: remove the unused function nx_wait and nx_waitid
#7605 sched: mqueue: make mqueue and mqueue sysv can disable separately
#7656 sched: merge up_block_task and up_unblock_task
#7065 sched: wqueue: fix race-condition on work_queue
#7815 mm: iob: reserved bytes should be updated after each iteration
#7714 mm: iob: new function iob_reserve() to adjust headroom offset
#6836 mm: iob: Remove iob_user_e enum and related code
#6834 mm: iob: modify iob to support header padding and alignment features
#7066 mm: kasan: use init value to avoid kasan used before bss clear
#7509 mm: kasan: fix kasan race-condition #
#6804 mm: mempool: support mempool and show mempool info in procfs
#7450 mm: mempool: support multiple-mempool and enhance mempool
#7581 mm: mm_heap: Change TCB_FLAG_HEAPCHECK to TCB_FLAG_HEAP_CHECK
#7449 mm: mm_heap: optimize MM_XX_SHIFT define
#7495 mm: mm_heap: add debug assert to check the alignment problem
#6928 mm: mm_heap: Avoid assertion violation in case of kmm_free(NULL)
#7662 mm: mm_size2ndx: using flsl to calculate the ndx
#7618 mm: shm: Implement a generic utility API for creating / destroying shm mappings
#7607 mm: shm: Implement shmem drivers for risc-v target
#7134 mm: ubsan: UBSan option should be turned on if SIM_UBSAN enabled
#7301 mm: ubsan: Ubsan
#7285 mm: ubsan: Fixed undefined behavior in UBSan.
#6986 mm: ubsan: Allow custom the sanitizer in Kconfig
#6881 mm: ubsan: debug: Introduce portion of UBSan
#6979 mm: umm_heap: Do not register Umem if CONFIG_BUILD_KERNEL=y
#6995 mm: Check the function result with suitable macro.
#7457 mm: Check for memory leaks in tasks
#6999 mm: fix runtime error by UBSan #
#7536 mm: Refine mm Kconfig
#7551 mm: Remove the unused macro MM_IS_ALLOCATED
#7540 mm: Restore the return type of mm_lock from bool to int
#7424 libc: Add %T and %R conversion specifiers to strftime(3)
#7025 libc: Add check in roundx() functions for infinite or NaN cases
#7724 libc: Add Hexadecimal parsing for strtof
#7661 libc: Add libc_stubs functions
#6898 libc: add lib_dump utils
#7198 libc: add obstack
#7003 libc: add timingsafe_bcmp to libc #
#6861 libc: Add some missing functions to libc.csv
#7345 libc: Added flush of the read buffers when a file is reopened.
#7224 libc: allow to enable LIBC_NETDB directly from menuconfig
#7545 libc: atexit: correct return value of exitfunc lock
#7175 libc: arm: use builtin routines instead of aliases of __aeabi_mem*
#6856 libc: crc: Add full suffix to avoid the the penitential symbol collision
#6841 libc: dns_client: directly initialize g_dns_servers and remove dns_initialize directly
#7117 libc: Ensure key returned from ftok is unique
#7567 libc: fine tune mutex/sem_t implementation
#6959 libc: Fix wrong report by UBSan
#6991 libc: Fixed pow() for negative bases.
#6952 libc: fixes in strtod parser.
#7349 libc: gmtimer: Fixed range of tm_yday.
#7774 libc: hex2bin: Remove the unused declaration
#6806 libc: Implement memfd on top of tmpfs
#7688 libc: include: unified stream read and write interface
#7677 libc: lib_libvsprintf: fix the float point print bug
#6868 libc: libc.csv: Add new found missing functions
#7343 libc: libfread: Fixed error flag when reading a write-only file.
#6783 libc: localtime: fix some issues and update to consistent with mainline
#7657 libc: machine: xtensa: make longjmp safe against context switch
#7681 libc: Minor stream interface improvement
#7700 libc: Minor fix for vsprintf and stream
#6840 libc: move crc8.h, crc16.h and crc32.h from include to include/nuttx
#7372 libc: move param check to sem_xx level
#7185 libc: Move queue.h from include to include/nuttx
#7820 libc: netdb: add proto.c
#7289 libc: newlib/impure: declare thread specific file only if NEWLIB is defined
#7281 libc: newlib/impure: sync with newlib(4.2.0) reent update
#7667 libc: obstack, mm/circbuf: Fix non-standard usage of void* arithmetics
#7716 libc: optimize the code of the printf
#6954 libc: Port strtod fixes to strtof, strtold and improve comments
#7565 libc: pthread_barrier:don't destroy when barrier used
#7644 libc: pthread: Change stacksize type from long to size_t
#7005 libc: pthread: fix typo with CONFIG_PTHREAD_MUTEX_DEFAULT_PRIO_INHERIT
#6805 libc: Remove CONFIG_LIBC_ERR
#7116 libc: Remove LIBC_ERR from libs/libc/misc/Kconfig
#7151 libc: Remove the reference of _stext/_etext from lib_cxx_initialize.c
#5070 libc: semaphore: sem_init change defult protocol
#7710 libc: signal: correct the return values
#7499 libc: spawn: Always build lib_psa_[get|set]stacksize.c
#6152 libc: stdio: Add stdio file locking functions
#7770 libc: stdio: add total_len back
#7310 libc: stdio: fix ungetc operation
#7715 libc: stream: add putc interface for mtd/blk stream.
#7694 libc: stream: Remove \n special handle from syslogstream_putc
#7772 libc: stream: Rename lib_stream_ to lib_stream_
#7348 libc: strftime: Added support for the %w format specifier.
#7455 libc: time: fix regression in clock_calendar2utc
#7440 libc: time: mktime normalize struct tm
#7819 openamp: don't depend on pen-amp.zip and libmetal.zip in the git mode
#7534 openamp: update openmap lib version to 2022.10.0
#7279 openamp: libmetal: support other arch sim host
#7444 openamp: fix rptun don't wait issue when get tx patyload buffer
#6910 syscall: fix task_testcancel header file
#7557 syscall: prctl syscall is present unconditionally
#6824 syscall: remove directory related function declaration since it become normal libc api after #6803
#7735 Add linux-like panic notifier.
#6994 binfmt: Check return pointer.
#7498 binfmt: elf_addrenv_free select addrenv before up_addrenv_destroy
#7473 Call nxsem_destroy or nxmutex_destry in the error path
#6983 compiler.h: Rename inline_function to always_inline_function
#7561 crypto: random_pool:add a new api arc4random
#7516 fix a mistake about nxmutex & sem
#6961 Fixed format specifier in various prints.
#7532 hwspinlock: add hwspinlock driver for multi CPU
#7472 Initialize global mutext/sem by NXMUTEX_INITIALIZER and SEM_INITIALIZER
#6926 list.h: Change inline function to macro as much as possbile
#7517 nxmutex: minor fix for mutex lock mismatch
#6965 nxmutex: replace nxsem when used as a lock
#6966 queue: Change some queue function to macro
#6906 Replace all strncpy with strlcpy for safety
#7590 sys: boardctl: Add more reset causes to enum
#7033 timer: add arch_alarm tick interface
#7115 time: Typedef time_t to uint64_t if CONFIG_SYSTEM_TIME64 is defined
#6981 up_nputs: fix AddressSanitizer: global-buffer-overflow problem
#7420 Update errno to match asm-generic
Default Semaphore Protocol Changed
When NuttX is built with priority inheritance (CONFIG_PRIORITY_INHERITANCE), priority inheritance can be enabled or disabled per semaphore and care must be taken to make the correct choice based on how each semaphore is used.
When a semaphore is used as a mutual exclusion lock (“locking semaphore”), a thread that needs exclusive access to a resource waits on the semaphore, uses the resource, and then posts the semaphore. In this case, priority inheritance should be enabled for the semaphore (sem_setprotocol(sem, SEM_PRIO_INHERIT)) to mitigate priority inversion which could occur when multiple threads with different priorities compete for various resources.
In contrast, when a semaphore is used to signal an event from one thread to another (“signaling semaphore”), one thread waits on the semaphore and another thread posts it when the anticipated event occurs. In this case, since the thread that posts the semaphore is different than the one that waits on it, priority inheritance must not be enabled for the semaphore (sem_setprotocol(sem, SEM_PRIO_NONE)).
In earlier releases, priority inheritance was enabled by default for all semaphores whenever NuttX was built with CONFIG_PRIORITY_INHERITANCE. If a semaphore was used for signaling across threads, the non-standard API sem_setprotocol(sem, SEM_PRIO_NONE) had to be used to selectively disable priority inheritance for that semaphore.
Starting with this release, the default is changed: priority inheritance is disabled by default for all semaphores. To enable priority inheritance for a semaphore, first NuttX needs to be built with CONFIG_PRIORITY_INHERITANCE, then priority inheritance needs to be enabled for the semaphore in question with sem_setprotocol(sem, SEM_PRIO_INHERIT).
The benefit of this change is easier porting and maintenance of standards-compliant applications to NuttX by eliminating the need for 3rd party applications to call the non-standard API sem_setprotocol().
In addition, this is a safer default: Having priority inheritance inadvertently enabled for a signaling semaphore can cause incorrect behavior, while the impact of having it inadvertently disabled for a locking semaphore is limited to reduced performance.
This change was introduced in PR # 5070 https://github.com/apache/nuttx/pull/5070, git commits 4e1d967bcd0031bd07a6a46f022c75216cf98404, e5fbbd416d5f1e74e3f705677b2e99b0b8c544d3, 9a4b66fbb306d388e2ce431807a139848604a9f0, and 125de66b63b316a2c2a2912dd408f4bac2fc85c3.
All semaphore uses within the NuttX repositories have been updated; those used for locking have been replaced with mutexes (mutex_t instead of sem_t). See PR # 6965, git commits
ef3919e4eb75b1ab854a21c98124d7e90e5c5e14, 590e0d5666c47dcb91ccd35faa57681ca26d4b1d, and 5db565c78d7c009eaea8517f01a2d138ab5f0028.
Downstream users need to call sem_setprotocol(sem, SEM_PRIO_INHERIT) when setting up each semaphore used for mutual exclusion locking. In addition, they may optionally remove calls to sem_setprotocol(sem, SEM_PRIO_NONE) for signaling semaphores.