From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13499 Path: news.gmane.org!.POSTED!not-for-mail From: Orivej Desh Newsgroups: gmane.linux.lib.musl.general Subject: sem_wait and EINTR Date: Wed, 5 Dec 2018 19:16:05 +0000 Message-ID: <20181205191605.72492698@orivej.orivej.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1544037259 20043 195.159.176.226 (5 Dec 2018 19:14:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 5 Dec 2018 19:14:19 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-13515-gllmg-musl=m.gmane.org@lists.openwall.com Wed Dec 05 20:14:14 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 1gUcce-00051m-Ac for gllmg-musl@m.gmane.org; Wed, 05 Dec 2018 20:14:12 +0100 Original-Received: (qmail 30227 invoked by uid 550); 5 Dec 2018 19:16:20 -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 30195 invoked from network); 5 Dec 2018 19:16:20 -0000 X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Provags-ID: V03:K1:jRp44RN6+oK5nOelZsNquNgCT5ore23DbLosCQVKNMff8jxHqPV RJOL2W19HyUCzgjHrw1hJANEg/Wn98xcO8ksaWsc4b80wQmYgdOQ8SVaCC9nWd2mgcXUZTS 7HzGrNyuwLBZtV59XKAa4DqrIK6DvupuvwF2EQQjvjtY8q5xFlGngWNUoqL7y3HzusukiZZ QpXSJXzINglvuRYTi28LA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Z6EbqhuWoaM=:s5QTIEBTpIToDxqAl4FHKA Ut7CqWx9r77hAhAPfTZC/gM1EOxGvApAEOV4A+xvNExqZcZxTlIgETmYUdZuPm2MN4aT+nvks fMQskoZFv5NlltlVDf4cioWSg02ZIG+hIcQRF2b+h7tIJRnbk/Xq8037IWe06km0z5RGPZwaU 4F0CEx5/ScUnxMmxrlvqckJlVuWSMmsxAOGtib2mZ4+iaLPLqNgDH9D3dw/V0zwMROpW/qPrh mXVvDDTT9EoftzeI/UVvkJSMWmJiS4J9s5S/0qtNcOkCa1P85Dxm7x0EhHvE0FNqLlPXilehK y4Y+fjT4xQlsgw0vSVu3AB72aKaC1Zax32K/CbZK0XaKgbipXpLv8nydcgVohPEoqFN/5zGKn PfnzA+motZpkz3NqifZkV1GZ5tzvXLl2i4PPGutV6Mnje9fDtTyOkFMj0Z5rUJYnJTfjGKTZV B7VKBFJcBjQ/CYG5u52nPv1j9TR4eRbYzlbP1cwIWBNCEjndrxHpEO6Kw/dsjcE1nU7LB56U9 WBaYZQStZ1hfS4h4zOjCkfZ+B3znN8PCQv9H8XKOr2PzRpEjbElou2GsVS7CZHdTk9uxmz6tm toQ1v3zGKmBo4PTCdoefQb86VGOVQEPoGLJOLZ+mraBEVNPEc5XGy93D0uLATIxMY+JIPtRiH tNDEY+Zfv8ddhhDRQN00sVsROkxjtpWU8Tewwsi3vwY05va5LolHkUhGHCWUpc1Ako+4/pLyc XABmqINXKSRfjcmlb2z26ZwdXrVH/CU/Pfe/IBVYghlRDz5dc9k/pJEXzw/CjQVwSEIYpGll Xref: news.gmane.org gmane.linux.lib.musl.general:13499 Archived-At: Hi, musl differs from glibc in that it does not return from sem_wait() on EINTR. This mail [1] explains that this is useful to safeguard the software that does not check sem_wait() return code. However, since glibc does return EINTR, such bugs in the open source software seem to be eventually noticed and fixed. The musl behaviour has a disadvantage in that it makes sem_wait() difficult to interrupt (and delays the return from sem_timedwait() until the timeout), which is relied upon in particular by multithreaded fuse for breaking out of the main thread waiting loop [2]. IMHO the fuse implementation is sensible, since it looks better than the alternatives I could imagine, and I'm inclined to patch musl like this [3] to meet its expectations. Am I missing some implications? Would you reconsider returning from sem_wait() on EINTR? Could you suggest a good fix for fuse that does not change musl? [1] https://www.openwall.com/lists/musl/2018/02/24/3 [2] https://github.com/libfuse/libfuse/blob/fuse-3.3.0/lib/fuse_loop_mt.c#L332 [3] https://github.com/orivej/musl/commit/c4c38aaab4fc55c23669f7b81386b615609cc3e1