Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1637797

Re: [PATCH] FS: fix stack-out-of-bounds wanning

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] FS: fix stack-out-of-bounds wanning
Date 2017-05-09 02:30 +0200
Message-ID <tF1cl-2Da-7@gated-at.bofh.it> (permalink)
References <tF0zD-28N-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, May 08, 2017 at 04:42:50PM -0700, Shaohua Li wrote:
> I'm seeing below with lastet upstream. Commit
> 5ecda13(generic_file_read_iter(): make use of iov_iter_revert())
> directly pass iter to ->direct_IO(), ->direct_io already advances count
> bytes but return -EIOCBQUEUED. In this case, count is bigger than
> iov_iter_count(iter). We really want to revert count -
> iov_iter_count(iter) instead of the opposite.

Already discussed; the patch in my tree is that braino fix + sanity check
in iov_iter_revert(), to prevent anything similar in the future.

The reason it wasn't caught in tests (without KASAN, that is) is that
to get really obvious breakage out of that, you need a short read from
->direct_IO() *and* fallback to cached read after it.  -EIOCBQUEUED
obviously excludes the latter, so the bug is almost certain to remain quiet.
There is a non-zero chance of actually running into unmapped memory while
doing that iov_iter_revert(), but it's fairly low.  Unfortunately, since
that allowed the damn thing to remain unnoticed...

Will be in tonight's pull request.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] FS: fix stack-out-of-bounds wanning Shaohua Li <shli@fb.com> - 2017-05-09 01:50 +0200
  Re: [PATCH] FS: fix stack-out-of-bounds wanning Al Viro <viro@ZenIV.linux.org.uk> - 2017-05-09 02:30 +0200

csiph-web