lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 15 Oct 2010 00:47:56 -0400
From:	Chris Frey <cdfrey@...rsquare.net>
To:	Tejun Heo <htejun@...il.com>
Cc:	Jens Axboe <jaxboe@...ionio.com>,
	Richard Weinberger <richard@....at>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"jdike@...toit.com" <jdike@...toit.com>,
	"user-mode-linux-devel@...ts.sourceforge.net" 
	<user-mode-linux-devel@...ts.sourceforge.net>,
	"user-mode-linux-user@...ts.sourceforge.net" 
	<user-mode-linux-user@...ts.sourceforge.net>,
	"janjaap@....nl" <janjaap@....nl>,
	"geert@...ux-m68k.org" <geert@...ux-m68k.org>,
	"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
	"adobriyan@...il.com" <adobriyan@...il.com>,
	"syzop@...nscan.org" <syzop@...nscan.org>
Subject: Re: [PATCH 1/1] um: ubd: Fix data corruption

On Thu, Oct 14, 2010 at 03:14:28PM +0200, Tejun Heo wrote:
> Hello,
> 
> Can you please try this one then?  It seems to work here but I can't
> reproduce the original problem reliably so I'm not really sure.
> 
> Thanks.
> 
> diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
> index 1bcd208..9734994 100644
> --- a/arch/um/drivers/ubd_kern.c
> +++ b/arch/um/drivers/ubd_kern.c
> @@ -163,6 +163,7 @@ struct ubd {
>  	struct scatterlist sg[MAX_SG];
>  	struct request *request;
>  	int start_sg, end_sg;
> +	sector_t rq_pos;
>  };
> 
>  #define DEFAULT_COW { \
> @@ -187,6 +188,7 @@ struct ubd {
>  	.request =		NULL, \
>  	.start_sg =		0, \
>  	.end_sg =		0, \
> +	.rq_pos =		0, \
>  }
> 
>  /* Protected by ubd_lock */
> @@ -1228,7 +1230,6 @@ static void do_ubd_request(struct request_queue *q)
>  {
>  	struct io_thread_req *io_req;
>  	struct request *req;
> -	sector_t sector;
>  	int n;
> 
>  	while(1){
> @@ -1239,12 +1240,12 @@ static void do_ubd_request(struct request_queue *q)
>  				return;
> 
>  			dev->request = req;
> +			dev->rq_pos = blk_rq_pos(req);
>  			dev->start_sg = 0;
>  			dev->end_sg = blk_rq_map_sg(q, req, dev->sg);
>  		}
> 
>  		req = dev->request;
> -		sector = blk_rq_pos(req);
>  		while(dev->start_sg < dev->end_sg){
>  			struct scatterlist *sg = &dev->sg[dev->start_sg];
> 
> @@ -1256,10 +1257,9 @@ static void do_ubd_request(struct request_queue *q)
>  				return;
>  			}
>  			prepare_request(req, io_req,
> -					(unsigned long long)sector << 9,
> +					(unsigned long long)dev->rq_pos << 9,
>  					sg->offset, sg->length, sg_page(sg));
> 
> -			sector += sg->length >> 9;
>  			n = os_write_file(thread_fd, &io_req,
>  					  sizeof(struct io_thread_req *));
>  			if(n != sizeof(struct io_thread_req *)){
> @@ -1272,6 +1272,7 @@ static void do_ubd_request(struct request_queue *q)
>  				return;
>  			}
> 
> +			dev->rq_pos += sg->length >> 9;
>  			dev->start_sg++;
>  		}
>  		dev->end_sg = 0;



I tested this patch, on 2.6.35.5, as heavily as I could today, and
was unable to reproduce the filesystem corruption.

Seems to be fixed. :-)

Thanks!
- Chris

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ