From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13550 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: sem_wait and EINTR Date: Fri, 14 Dec 2018 14:45:16 -0500 Message-ID: <20181214194516.GA23599@brightrain.aerifal.cx> References: <20181206024340.202e0fc4@orivej.orivej.org> <20181206031756.GZ23599@brightrain.aerifal.cx> <20181206155756.GB32233@voyager> <20181206162336.GB23599@brightrain.aerifal.cx> <20181206170359.GC32233@voyager> <20181206173337.GD32233@voyager> <20181209025140.GL23599@brightrain.aerifal.cx> <20181209065033.GB2554@voyager> <20181212003238.GP23599@brightrain.aerifal.cx> <20181212051559.GA3315@voyager> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1544816607 20752 195.159.176.226 (14 Dec 2018 19:43:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 14 Dec 2018 19:43:27 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-13566-gllmg-musl=m.gmane.org@lists.openwall.com Fri Dec 14 20:43:23 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1gXtMp-0005JT-LT for gllmg-musl@m.gmane.org; Fri, 14 Dec 2018 20:43:23 +0100 Original-Received: (qmail 7313 invoked by uid 550); 14 Dec 2018 19:45:29 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7294 invoked from network); 14 Dec 2018 19:45:29 -0000 Content-Disposition: inline In-Reply-To: <20181212051559.GA3315@voyager> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:13550 Archived-At: On Wed, Dec 12, 2018 at 06:15:59AM +0100, Markus Wichmann wrote: > On Tue, Dec 11, 2018 at 07:32:38PM -0500, Rich Felker wrote: > > One other thought: would it be preferable for the EINTR suppression in > > the absence of interruptible signal handlers to be in __timedwait > > rather than sem_timedwait? Then any code using __timedwait would > > benefit from it. I'm not sure if there are other callers where it > > would help but it wouldn't hurt either. > > Nope, that would not help. I had a look at all users of SYS_futex that Perhaps help was the wrong word; I think you're right that there's nowhere else it matters and that all other callers already ignore EINTR unconditionally because they're supposed to. The only plausible improvement is avoiding spurious dec/inc cycle on the waiter count in some places. On the other hand it might be a nicer factorization (less ugly and linux-bug-specific logic in high level code, i.e. sem_timedwait) if the workaround were buried in low-level stuff (__timedwait). x> might be impacted by the kernel bug you mentioned (and followed them > back to the public interfaces that use them). Only __timedwait does > anything with the return value at all, and of all the users of > __timedwait(), sem_timedwait() is the only function even specified to > return EINTR. All others are specified to *never* return EINTR. At least > according to the manpages I have here (manpages-posix). > > So only sem_timedwait() needs this patch. For the other users it would > hurt conformance. I don't see how it could hurt conformance. Rich