From: Dave Chinner <david@fromorbit.com>
To: Dale Stephenson <dalestephenson@mac.com>
Cc: xfs@oss.sgi.com
Subject: Re: Possible memory corruption in xfs_buf_iomove()
Date: Tue, 1 Feb 2011 09:51:31 +1100 [thread overview]
Message-ID: <20110131225131.GK11040@dastard> (raw)
In-Reply-To: <86FBE6A1-CDCD-4FA3-B389-8D8C75A67CAB@mac.com>
On Mon, Jan 31, 2011 at 04:29:16PM -0500, Dale Stephenson wrote:
> At Snap Appliance, we were running into appeared to be random oops
> when setting/reading large attributes. Trevor Heathorn was able to
> trace the problem down to the function xfs_buf_iomove() in
> linux-2.6-xfs/xfs_buf.c. The size of the copy within the loop is
> calculated as a minimum of the page size and bp->b_count_desired,
> minus the applicable offsets. This can result in a copy size
> greater than the remaining size of the data length, which in the
> case of a read caused whatever else is in the buffer to be written
> past the end of the data area we had allocated. He found that this
> fix prevented the oops:
Good catch! Do you have a test case that reproduced the problem? If
so, can you post that, too, so we can push it into xfstests as a
regression test?
[ As an aside, if you've got other regression tests that you'd like
to have run regularly during mainline developement and can be
integrated into xfstests, we can help make that happen. ]
> --- xfs_buf.c 17 Sep 2009 00:19:49 -0000 1.4
> +++ xfs_buf.c 31 Jan 2011 20:22:59 -0000 1.5
> @@ -1313,6 +1313,7 @@
> PAGE_CACHE_SIZE-cpoff, bp->b_count_desired-boff);
>
> ASSERT(((csize + cpoff) <= PAGE_CACHE_SIZE));
> + csize = min(csize, (bend - boff));
>
> switch (mode) {
> case XBRW_ZERO:
Yup, definitely needed. Can you add a Signed-off-by tag to this with
an appropriate commit message (pretty much what you've already
included with this report), we can get this fix into mainline
quickly.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2011-01-31 22:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-31 21:29 Possible memory corruption in xfs_buf_iomove() Dale Stephenson
2011-01-31 22:51 ` Dave Chinner [this message]
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=20110131225131.GK11040@dastard \
--to=david@fromorbit.com \
--cc=dalestephenson@mac.com \
--cc=xfs@oss.sgi.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