Re: [PATCH] mm/gup: Let __get_user_pages_locked() return -EINTR for fatal signal

From: Linus Torvalds
Date: Wed Apr 08 2020 - 13:32:38 EST


On Wed, Apr 8, 2020 at 10:27 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > - if (fatal_signal_pending(current))
> > + if (fatal_signal_pending(current)) {
> > + if (!pages_done)
> > + pages_done = -EINTR;
>
> Why -EINTR here and -ERESTARTSYS at the other site?

I'd prefer EINTR for all fatal signals.

Not because it should matter (it's fatal, after all, the thread should
die before it ever sees it), but because I think it's less confusing.

If something is fatal, it sure as hell isn't going to restart any system calls.

But interrupting things because of fatal signals sounds sane (even if
the error code makes it to user space it's interrupting the flow of
code).

So I'd say that the other place should probably be EINTR too. But it
would obviously be a good idea to verify that no caller cares..

Linus

Linus