[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgR=moYe2Jx8wobx9Vzxj55DGPwU9VEjZ+7gUrVYySMzQ@mail.gmail.com>
Date: Sun, 25 Aug 2019 09:54:28 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Cc: Ingo Molnar <mingo@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
syzbot <syzbot+8ab2d0f39fb79fe6ca40@...kaller.appspotmail.com>
Subject: Re: [PATCH] /dev/mem: Bail out upon SIGKILL when reading memory.
On Sat, Aug 24, 2019 at 10:50 PM Tetsuo Handa
<penguin-kernel@...ove.sakura.ne.jp> wrote:
>
> @@ -142,7 +144,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
> sz = size_inside_page(p, count);
> cond_resched();
> err = -EINTR;
> - if (fatal_signal_pending(current))
> + if (signal_pending(current))
> goto failed;
>
> err = -EPERM;
So from a "likelihood of breaking" standpoint, I'd really like to make
sure that the "signal_pending()" checks come at the *end* of the loop.
That way, if somebody is doing a 4-byte read from MMIO, he'll never see -EINTR.
I'm specifically thinking of tools like user-space 'lspci' etc, which
I wouldn't be surprised could happen.
Also, just in case things break, I do agree with Ingo that this should
be split up into several patches.
Linus
Powered by blists - more mailing lists