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

Corinna Vinschen <[email protected]> Thu, 4 Dec 2025 10:39:59 +0100
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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 <[email protected]>
> Reviewed-by: Corinna Vinschen <[email protected]>, Sebastian Huber <[email protected]>
> Signed-off-by: Takashi Yano <[email protected]>
> ---
>  newlib/libc/stdlib/__call_atexit.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)

Thanks, please push.

Corinna