[PATCH] newlib: copy args for atexit()'ed function before unlock the mutex

Corinna Vinschen vinschen@redhat.com
Thu Dec 4 09:39:59 GMT 2025


On Dec  3 17:57, Takashi Yano wrote:
> The commit a2a8bc771f2f has a problem that __atexit which includes
> args for atexit()'ed function may be touched by another thread
> since the mutex is unlocked while calling the function.
> With this path, the args, etc. are copyed to local variable to
> prevent this problem.
> 
> Fixes: a2a8bc771f2f ("newlib: Unlock the mutex while calling atexit()'ed functions")
> Suggested-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
> Reviewed-by: Corinna Vinschen <corinna@vinschen.de>, Sebastian Huber <sebastian.huber@embedded-brains.de>
> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
> ---
>  newlib/libc/stdlib/__call_atexit.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)

Thanks, please push.

Corinna



More information about the Newlib mailing list