This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/24963] deadlock between freopen and fclose
- From: "yisheng dot xys at alibaba-inc dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 24 Sep 2019 13:21:14 +0000
- Subject: [Bug libc/24963] deadlock between freopen and fclose
- Auto-submitted: auto-generated
- References: <bug-24963-131@http.sourceware.org/bugzilla/>
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.