This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/24963] deadlock between freopen and fclose


https://sourceware.org/bugzilla/show_bug.cgi?id=24963

--- Comment #6 from Szabolcs Nagy <nsz at gcc dot gnu.org> ---
lock order should be either

list_all_lock -> fp
and then list_all_lock must not be locked while
an fp is already locked, i.e. freopen should be
fixed (by taking list_all_lock before the fp lock).

or

fp -> list_all_lock
and then current _IO_un_link and fflush(0) are wrong
since they take list_all_lock first then the fp lock.
fixing this is harder (before all _IO_un_link call fp
should be locked and fflush should somehow lock all fps)

(i assumed both locks are recursive, if list_all_lock
is not recursive then fixing freopen may be trickier).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]