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 #8 from Yisheng Xie <yisheng.xys@alibaba-inc.com> ---
(In reply to Szabolcs Nagy from comment #6)
> 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).

As list_all_lock is static variable in genops.c, do
you mean we should move it to a more common place?
Is this harder to fix?

> 
> 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)

why cannot we let fflush follow this order too?

> 
> (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]