This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit cffa5eedf19617fe9c6ff6194696e52261d67193 Author: anjiahao <[email protected]> AuthorDate: Mon Nov 3 17:31:14 2025 +0800 lib/backtrace:need init lock before use The dynamic pool has no init function any more, so nothing initialized the pool lock before its first use. A zeroed spinlock happens to be unlocked, but a zeroed mutex, used by the user-space libc, is not a valid mutex. Initialize the lock statically with SP_UNLOCKED or NXMUTEX_INITIALIZER. Signed-off-by: anjiahao <[email protected]> --- libs/libc/misc/lib_backtrace.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/libc/misc/lib_backtrace.c b/libs/libc/misc/lib_backtrace.c index 89094a7f8f6..d5d4664d232 100644 --- a/libs/libc/misc/lib_backtrace.c +++ b/libs/libc/misc/lib_backtrace.c @@ -87,7 +87,14 @@ struct backtrace_pool_s * Private Data ****************************************************************************/ -static struct backtrace_pool_s g_backtrace_pool; +static struct backtrace_pool_s g_backtrace_pool = +{ +#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) + .lock = SP_UNLOCKED, +#else + .lock = NXMUTEX_INITIALIZER, +#endif +}; #endif /****************************************************************************
