Re: [PATCH] /dev/mem: Bail out upon SIGKILL when reading memory.

From: Linus Torvalds
Date: Thu Aug 22 2019 - 17:29:40 EST


On Tue, Aug 20, 2019 at 3:07 PM Tetsuo Handa
<penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
>
> - while (count > 0) {
> + while (count > 0 && !fatal_signal_pending(current)) {

Please just use the normal pattern of doing

if (fatal_signal_pending(current))
return -EINTR;

inside the loop instead.

(Ok, in this case I think it wants

err = -EINTR;
if (fatal_signal_pending(current))
break;

instead, but the point is to make it look like signal handling, just
with the special "fatal signals can sometimes be handled even when
regular signals might not make it through".

Linus