All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Chuck Ebbert <cebbert.lkml@gmail.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: fs: out of bounds on stack in iov_iter_advance
Date: Wed, 19 Aug 2015 06:46:50 +0100	[thread overview]
Message-ID: <20150819054650.GD18890@ZenIV.linux.org.uk> (raw)
In-Reply-To: <55D1A6D4.3080605@gmail.com>

On Mon, Aug 17, 2015 at 12:18:12PM +0300, Andrey Ryabinin wrote:

> This bug is similar to recently found bug in 9p: http://thread.gmane.org/gmane.linux.kernel/1931799/focus=1936542

Ow.  For those who'd missed that fun: the bug in question had turned out to
be caused by improper reuse of request ids, _not_ in the call chain of
the triggering syscall.

> 	if (!retval) {
> 		struct iov_iter data = *iter;
> 		retval = mapping->a_ops->direct_IO(iocb, &data, pos);
> 	}
> 
> 	if (retval > 0) {
> 		*ppos = pos + retval;
> 		iov_iter_advance(iter, retval);
> 
> 
> So either filemap_write_and_wait_range()
	Shouldn't - it's supposed to return 0 or -E...

> or mapping->a_ops->direct_IO() returned more
> than 'count'.

	Was there DAX involved?  ->direct_IO() in there is blkdev_direct_IO(),
which takes rather different paths in those cases...

> > Also too the file and line number
> > (lib/iov_iter.c:511) are completely useless because of inlining,
> > though that's not kasan's fault.

Might make sense to slap
	if (WARN_ON(size > iov_iter_count(i)))
		print size and *i
and see if it triggers...

  reply	other threads:[~2015-08-19  5:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 14:13 fs: out of bounds on stack in iov_iter_advance Sasha Levin
2015-08-15 20:13 ` Chuck Ebbert
2015-08-17  9:18   ` Andrey Ryabinin
2015-08-19  5:46     ` Al Viro [this message]
2015-09-02 20:00       ` Sasha Levin
2015-09-18  2:24       ` Sasha Levin
2015-09-30 21:30         ` Sasha Levin
2015-10-17 19:22           ` Sasha Levin
2015-10-18  4:17             ` Ross Zwisler
2015-10-19 23:34               ` Sasha Levin
2015-11-06  1:34           ` Al Viro
2015-11-06  2:19             ` Al Viro
2015-11-06  3:38               ` Linus Torvalds
2015-11-06 16:06                 ` Jens Axboe
2015-11-11  2:21                 ` Linus Torvalds
2015-11-11  2:25                   ` Jens Axboe
2015-11-11  2:31                     ` Linus Torvalds
2015-11-11  2:40                       ` Jens Axboe
2015-11-11  2:41                         ` Jens Axboe
2015-11-11  2:44                           ` Jens Axboe
2015-11-11  3:06                             ` Al Viro
2015-11-11  3:07                               ` Jens Axboe
2015-11-11  3:20                       ` Sasha Levin
2015-11-11  2:56                   ` Al Viro
2015-11-11  3:30                     ` Al Viro
2015-11-11  4:36                       ` Linus Torvalds
2015-11-11  7:43                         ` Al Viro
2015-11-11  8:16                           ` Stephen Rothwell
2015-11-11 10:19                             ` Al Viro
2015-11-11 10:28                               ` Stephen Rothwell
2015-11-11 16:25                                 ` Mike Marshall
2015-11-11 16:36                                   ` Al Viro
2015-11-11 16:56                                     ` Mike Marshall
2015-11-11 16:33                               ` Al Viro
2015-11-11 21:47                                 ` Stephen Rothwell

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=20150819054650.GD18890@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=cebbert.lkml@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=sasha.levin@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.