Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752630AbdLCCZK (ORCPT ); Sat, 2 Dec 2017 21:25:10 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:59201 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751878AbdLCCZI (ORCPT ); Sat, 2 Dec 2017 21:25:08 -0500 Date: Sat, 2 Dec 2017 18:25:04 -0800 From: Matthew Wilcox To: Keno Fischer Cc: linux-man@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, mtk.manpages@gmail.com, tuomas@tuxera.com Subject: Re: [PATCH RFC] stat.2: Document that stat can fail with EINTR Message-ID: <20171203022504.GA14505@bombadil.infradead.org> References: <20171203002359.GA17037@juliacomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171203002359.GA17037@juliacomputing.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1505 Lines: 29 On Sat, Dec 02, 2017 at 07:23:59PM -0500, Keno Fischer wrote: > The catalyst for this patch was me experiencing EINTR errors when > using the 9p file system. In linux commit 9523feac, the 9p file > system was changed to use wait_event_killable instead of > wait_event_interruptible, which does indeed address my problem, > but also makes me a bit unhappy, because uninterruptable waits > prevents things like ^C'ing the execution and some debugging > tools which depend on being able to cancel long-running operations > by sending signals. Wait, wait, wait. killable is not uninterruptible. It's "can accept a signal if the signal is fatal". ie userspace will never see it. So, no, it doesn't prevent ^C. It does prevent the debugging tool you're talking about from working, because it's handling the signal, so it's not fatal. > I realize I'm probably 20 years too late here, but it feels like > clarificaion on what to expect from the kernel would still go a long > way here. A change to user-visible behaviour has to be opt-in. So here's an idea -- a prctl() (or whatever) that says "I can handle EINTR on any syscall". It would effectively change the *_killable logic to return EINTR on any signal, not just fatal ones. Best of luck auditing every syscall your application makes ... and every library it uses ... maybe dlopen()ed like PAM modules ... But we could do it! And it's more sensible than "I want to change individual syscalls one at a time as I notice each one is a problem".