From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5B4E33857C69; Wed, 13 Mar 2024 10:23:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B4E33857C69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1710325404; bh=vV1I4cnRE2std3fS+FpGhmsDPTUG/RxuaLfu0Ow6+Lk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Huf/EjSTxsic8Cx4F8JQIGg62jeqYlu2GWJTpHwJwIWaVk84l9xyvwATmbmnZcjv6 UDLJWMtfE9WFKhfZ9rf0cUSSMP06lqRkRnNDZuWmLAgVXE8768yxpkzZpdC2LYMKRR ZXLGAi8BFYUgQlEAOZ5YTGdrhrxes5DmkwF1HYT4= From: "fweimer at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug stdio/15142] Missing locking in _IO_cleanup Date: Wed, 13 Mar 2024 10:23:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Version: 2.3.4 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fweimer at redhat dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: 2.38 X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D15142 --- Comment #7 from Florian Weimer --- (In reply to Dmitry Vyukov from comment #6) > We started getting hangs on the following program: >=20 > https://github.com/llvm/llvm-project/blob/ > 995d1d114e4e4ff708a03cdb0a975209c6197f9f/compiler-rt/test/tsan/ > getline_nohang.cpp#L28 >=20 > Basically just calls a blocking getline in one thread and another thread > tries to exit. It's blocking on this: FILE *stream =3D fdopen(fd[0], "r"); while (1) { volatile int res =3D getline(&line, &size, stream); (void)res; } It's not a writable stream, so we could avoid the blocking with a more comp= lex handshake between stdio streams and exit. I'm not sure if it's worth doing that. We could perhaps add another flag to fopen/fdopen that indicates that the stream should not participate in fflush (NULL) or exit flushing. For streams which are blocked in writing, POSIX does not really give us a w= ay to make forward progress because we have to flush the unwritten data before exiting. --=20 You are receiving this mail because: You are on the CC list for the bug.=