[PATCH] newlib: fclose: Use sfp lock while fp lock is active

Corinna Vinschen vinschen@redhat.com
Wed Jul 16 14:54:36 GMT 2025


On Jul 16 23:42, Takashi Yano via Newlib wrote:
> With the commit 656df313e08a, if a thread acquires sfp lock after
> another thread calls fclose() and fp lock is acquired, the first
> thread falls into deadlock if it trys to acquire fp lock. This can
                                   ^^^^
                                   tries

> happen if the first thread calls __sft_lock_all() while the second
                                     ^^^
                                     sfp

> thread calls fclose().
> 
> This patch reverts the changes for newlib/libc/stdio/fclose.c in
> the commit 656df313e08a.

D'uh, thanks for tracking this down.  That was an optimization attempt
at its worst.  Please push (to 3.6 branch as well, obnviously).


Thanks,
Corinna



More information about the Newlib mailing list