From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
syzbot <syzbot+8ab2d0f39fb79fe6ca40@syzkaller.appspotmail.com>
Subject: [PATCH] /dev/mem: Bail out upon SIGKILL when reading memory.
Date: Wed, 21 Aug 2019 07:06:51 +0900 [thread overview]
Message-ID: <1566338811-4464-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> (raw)
syzbot found that a thread can stall for minutes inside read_mem()
after that thread was killed by SIGKILL [1]. Reading 2GB at one read()
is legal, but delaying termination of killed thread for minutes is bad.
[ 1335.912419][T20577] read_mem: sz=4096 count=2134565632
[ 1335.943194][T20577] read_mem: sz=4096 count=2134561536
[ 1335.978280][T20577] read_mem: sz=4096 count=2134557440
[ 1336.011147][T20577] read_mem: sz=4096 count=2134553344
[ 1336.041897][T20577] read_mem: sz=4096 count=2134549248
[1] https://syzkaller.appspot.com/bug?id=a0e3436829698d5824231251fad9d8e998f94f5e
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot <syzbot+8ab2d0f39fb79fe6ca40@syzkaller.appspotmail.com>
---
drivers/char/mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index b08dc50..0f7d4c4 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -135,7 +135,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
if (!bounce)
return -ENOMEM;
- while (count > 0) {
+ while (count > 0 && !fatal_signal_pending(current)) {
unsigned long remaining;
int allowed, probe;
--
1.8.3.1
next reply other threads:[~2019-08-20 22:07 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 22:06 Tetsuo Handa [this message]
2019-08-20 22:24 ` [PATCH] /dev/mem: Bail out upon SIGKILL when reading memory Greg Kroah-Hartman
2019-08-21 0:07 ` Tetsuo Handa
2019-08-22 9:59 ` Tetsuo Handa
2019-08-22 13:35 ` Greg Kroah-Hartman
2019-08-22 14:00 ` Tetsuo Handa
2019-08-22 16:42 ` Greg Kroah-Hartman
2019-08-22 17:11 ` Dmitry Vyukov
2019-08-22 21:17 ` Tetsuo Handa
2019-08-22 23:59 ` Dmitry Vyukov
2019-08-23 8:17 ` Tetsuo Handa
2019-08-23 16:47 ` Dmitry Vyukov
2019-10-08 9:57 ` Kernel config for fuzz testing Tetsuo Handa
2019-08-22 21:29 ` [PATCH] /dev/mem: Bail out upon SIGKILL when reading memory Linus Torvalds
2019-08-22 22:08 ` Linus Torvalds
2019-08-23 9:16 ` Ingo Molnar
2019-08-23 16:39 ` Linus Torvalds
2019-08-24 16:14 ` Ingo Molnar
2019-08-24 17:40 ` Linus Torvalds
2019-08-24 20:22 ` Ingo Molnar
2019-08-24 20:56 ` Linus Torvalds
2019-08-30 9:56 ` David Laight
2019-08-25 5:49 ` Tetsuo Handa
2019-08-25 9:59 ` Ingo Molnar
2019-08-25 10:35 ` Tetsuo Handa
2019-08-25 10:48 ` Ingo Molnar
2019-08-25 16:54 ` Linus Torvalds
2019-08-26 10:40 ` Tetsuo Handa
2019-08-26 11:19 ` Ingo Molnar
2019-08-26 15:02 ` Rewriting read_kmem()/write_kmem() ? Tetsuo Handa
2019-08-23 11:46 ` [PATCH] /dev/mem: Bail out upon SIGKILL when reading memory Tetsuo Handa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1566338811-4464-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp \
--to=penguin-kernel@i-love.sakura.ne.jp \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+8ab2d0f39fb79fe6ca40@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).