[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgJuiASyuFSBR9GgN2iPSL7Ep7G_GR1kKsGTL=qhDTDUg@mail.gmail.com>
Date: Sat, 20 Feb 2021 16:45:40 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: syzbot <syzbot+3d2c27c2b7dc2a94814d@...kaller.appspotmail.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
snovitoll@...il.com,
syzkaller-bugs <syzkaller-bugs@...glegroups.com>
Subject: Re: WARNING in iov_iter_revert (2)
[ Let's see how long this lasts, but I've got a generator for the
laptop, and hopefully I'll be able to start doing pulls tonight, and
get "real" power tomorrow ]
On Sat, Feb 20, 2021 at 11:30 AM Al Viro <viro@...iv.linux.org.uk> wrote:
>
> IOW, it's not iov_iter_revert() being weird or do_tty_write() misuing it -
> it's tpk_write() playing silly buggers.
Ok, that's actually not as bad I was was afraid it might be.
> Do we want to preserve that weirdness of /dev/ttyprintk writes?
> That's orthogonal to the iov_iter uses in there.
I don't think the ttyprintk weirdness was intentional. I'd fix that,
but in the meantime clearly we should make do_tty_write() protect
against this insanity, and do something like
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -961,6 +961,9 @@ static inline ssize_t do_tty_write(
ret = write(tty, file, tty->write_buf, size);
if (ret <= 0)
break;
+ /* ttyprintk historical oddity */
+ if (ret > size)
+ break;
/* FIXME! Have Al check this! */
if (ret != size)
in there. Because right now we clearly do strange and not-so-wonderful
things if the write routine returns a bigger value than it was
passed.. Not limited to that iov_iter_revert() thing, but the whole
loop.
Comments?
Linus
Powered by blists - more mailing lists