xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Keir Fraser <keir@xen.org>,
	Ian.Campbell@citrix.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Allen M Kay <allen.m.kay@intel.com>,
	david.vrabel@citrix.com
Subject: Re: problems I encountered using xen-4.1-testing and xen-unstable
Date: Thu, 5 Jan 2012 16:24:25 -0500	[thread overview]
Message-ID: <20120105212425.GA5180@phenom.dumpdata.com> (raw)
In-Reply-To: <4F0566E2020000780006A89C@nat28.tlf.novell.com>

On Thu, Jan 05, 2012 at 08:01:22AM +0000, Jan Beulich wrote:
> >>> On 05.01.12 at 00:35, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> > On Wed, Jan 04, 2012 at 10:07:29PM +0000, Kay, Allen M wrote:
> >> 2)      Xen-unstable:  I get ext4 file system corruption when booting xen 
> > with the latest upstream Linux kernel.
> > 
> > 
> > That I hadn't seen. Is this with dom0 or domU? There is one bug in the 
> > 2.6.18 kernel in blkback if you are using that version.
> 
> Which one are you referring to?

The fix you posted some time ago. Not all distros have picked it up.

# HG changeset patch
From: Jan Beulich <jbeulich@novell.com>
# Date 1306409621 -3600
# Node ID 876a5aaac0264cf38cae6581e5714b93ec380aaa
# Parent  aedb712c05cf065e943e15d0f38597c2e80f7982
Subject: xen/blkback: don't fail empty barrier requests

The sector number on empty barrier requests may (will?) be
uninitialized (neither bio_init() nor rq_init() set the respective
fields), which allows for exceeding the actual (virtual) disk's size.

Inspired by Konrad's "When writting barriers set the sector number to
zero...", but instead of zapping the sector number (which is wrong for
non-empty ones) just ignore the sector number when the sector count is
zero.

While at it also add overflow checking to the math in vbd_translate().

Signed-off-by: Jan Beulich <jbeulich@novell.com>

diff -r aedb712c05cf -r 876a5aaac026 drivers/xen/blkback/vbd.c
--- a/drivers/xen/blkback/vbd.c	Thu May 26 08:09:04 2011 +0100
+++ b/drivers/xen/blkback/vbd.c	Thu May 26 12:33:41 2011 +0100
@@ -108,8 +108,14 @@ int vbd_translate(struct phys_req *req, 
 	if ((operation != READ) && vbd->readonly)
 		goto out;
 
-	if (unlikely((req->sector_number + req->nr_sects) > vbd_sz(vbd)))
-		goto out;
+	if (likely(req->nr_sects)) {
+		blkif_sector_t end = req->sector_number + req->nr_sects;
+
+		if (unlikely(end < req->sector_number))
+			goto out;
+		if (unlikely(end > vbd_sz(vbd)))
+			goto out;
+	}
 
 	req->dev  = vbd->pdevice;
 	req->bdev = vbd->bdev;

> 
> Jan

  reply	other threads:[~2012-01-05 21:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 22:07 problems I encountered using xen-4.1-testing and xen-unstable Kay, Allen M
2012-01-04 23:35 ` Konrad Rzeszutek Wilk
2012-01-05  8:01   ` Jan Beulich
2012-01-05 21:24     ` Konrad Rzeszutek Wilk [this message]
2012-01-06  7:53       ` Jan Beulich
2012-01-06 15:02         ` Konrad Rzeszutek Wilk
2012-01-05  8:05   ` Ian Campbell
2012-01-05 21:25     ` Konrad Rzeszutek Wilk

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=20120105212425.GA5180@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=allen.m.kay@intel.com \
    --cc=david.vrabel@citrix.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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).