All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Matthew Wilcox <willy@infradead.org>
Cc: dsterba@suse.cz, linux-fsdevel@vger.kernel.org, ericvh@gmail.com,
	lucho@ionkov.net, viro@zeniv.linux.org.uk, jlayton@kernel.org,
	idryomov@gmail.com, mark@fasheh.com, jlbec@evilplan.org,
	joseph.qi@linux.alibaba.com,
	v9fs-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org,
	ocfs2-devel@oss.oracle.com, linux-btrfs@vger.kernel.org,
	clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
	stable@vger.kernel.org
Subject: Re: [PATCH 6/7] btrfs: Promote to unsigned long long before shifting
Date: Mon, 26 Oct 2020 18:03:54 +0100	[thread overview]
Message-ID: <20201026170354.GR6756@twin.jikos.cz> (raw)
In-Reply-To: <20201026164442.GU20115@casper.infradead.org>

On Mon, Oct 26, 2020 at 04:44:42PM +0000, Matthew Wilcox wrote:
> On Mon, Oct 26, 2020 at 05:35:46PM +0100, David Sterba wrote:
> > On Sun, Oct 04, 2020 at 07:04:27PM +0100, Matthew Wilcox (Oracle) wrote:
> > > On 32-bit systems, this shift will overflow for files larger than 4GB.
> > > 
> > > Cc: stable@vger.kernel.org
> > > Fixes: 53b381b3abeb ("Btrfs: RAID5 and RAID6")
> > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> > > ---
> > >  fs/btrfs/raid56.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> > > index 255490f42b5d..5ee0a53301bd 100644
> > > --- a/fs/btrfs/raid56.c
> > > +++ b/fs/btrfs/raid56.c
> > > @@ -1089,7 +1089,7 @@ static int rbio_add_io_page(struct btrfs_raid_bio *rbio,
> > >  	u64 disk_start;
> > >  
> > >  	stripe = &rbio->bbio->stripes[stripe_nr];
> > > -	disk_start = stripe->physical + (page_index << PAGE_SHIFT);
> > > +	disk_start = stripe->physical + ((loff_t)page_index << PAGE_SHIFT);
> > 
> > It seems that this patch is mechanical replacement. If you check the
> > callers, the page_index is passed from an int that iterates over bits
> > set in an unsigned long (bitmap). The result won't overflow.
> 
> Not mechanical, but I clearly made mistakes.  Will you pick up the
> patches which actually fix bugs?

Yes, I just replied to the first patch, that does fix an overflow.

WARNING: multiple messages have this Message-ID (diff)
From: David Sterba <dsterba@suse.cz>
To: Matthew Wilcox <willy@infradead.org>
Cc: dsterba@suse.cz, linux-fsdevel@vger.kernel.org, ericvh@gmail.com,
	lucho@ionkov.net, viro@zeniv.linux.org.uk, jlayton@kernel.org,
	idryomov@gmail.com, mark@fasheh.com, jlbec@evilplan.org,
	joseph.qi@linux.alibaba.com,
	v9fs-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org,
	ocfs2-devel@oss.oracle.com, linux-btrfs@vger.kernel.org,
	clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
	stable@vger.kernel.org
Subject: [Ocfs2-devel] [PATCH 6/7] btrfs: Promote to unsigned long long before shifting
Date: Mon, 26 Oct 2020 18:03:54 +0100	[thread overview]
Message-ID: <20201026170354.GR6756@twin.jikos.cz> (raw)
In-Reply-To: <20201026164442.GU20115@casper.infradead.org>

On Mon, Oct 26, 2020 at 04:44:42PM +0000, Matthew Wilcox wrote:
> On Mon, Oct 26, 2020 at 05:35:46PM +0100, David Sterba wrote:
> > On Sun, Oct 04, 2020 at 07:04:27PM +0100, Matthew Wilcox (Oracle) wrote:
> > > On 32-bit systems, this shift will overflow for files larger than 4GB.
> > > 
> > > Cc: stable at vger.kernel.org
> > > Fixes: 53b381b3abeb ("Btrfs: RAID5 and RAID6")
> > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> > > ---
> > >  fs/btrfs/raid56.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> > > index 255490f42b5d..5ee0a53301bd 100644
> > > --- a/fs/btrfs/raid56.c
> > > +++ b/fs/btrfs/raid56.c
> > > @@ -1089,7 +1089,7 @@ static int rbio_add_io_page(struct btrfs_raid_bio *rbio,
> > >  	u64 disk_start;
> > >  
> > >  	stripe = &rbio->bbio->stripes[stripe_nr];
> > > -	disk_start = stripe->physical + (page_index << PAGE_SHIFT);
> > > +	disk_start = stripe->physical + ((loff_t)page_index << PAGE_SHIFT);
> > 
> > It seems that this patch is mechanical replacement. If you check the
> > callers, the page_index is passed from an int that iterates over bits
> > set in an unsigned long (bitmap). The result won't overflow.
> 
> Not mechanical, but I clearly made mistakes.  Will you pick up the
> patches which actually fix bugs?

Yes, I just replied to the first patch, that does fix an overflow.

  reply	other threads:[~2020-10-26 17:06 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 18:04 [PATCH 0/7] Fix a pile of 4GB file problems on 32-bit Matthew Wilcox (Oracle)
2020-10-04 18:04 ` [Ocfs2-devel] " Matthew Wilcox
2020-10-04 18:04 ` [PATCH 1/7] 9P: Cast to loff_t before multiplying Matthew Wilcox (Oracle)
2020-10-04 18:04   ` [Ocfs2-devel] " Matthew Wilcox
2020-10-07  5:48   ` Christoph Hellwig
2020-10-07  5:48     ` [Ocfs2-devel] " Christoph Hellwig
2020-10-07 18:47     ` Matthew Wilcox
2020-10-07 18:47       ` [Ocfs2-devel] " Matthew Wilcox
2020-10-26 17:14   ` Dominique Martinet
2020-10-26 17:14     ` [Ocfs2-devel] " Dominique Martinet
2020-10-04 18:04 ` [PATCH 2/7] buffer: Promote to unsigned long long before shifting Matthew Wilcox (Oracle)
2020-10-04 18:04   ` [Ocfs2-devel] " Matthew Wilcox
2020-10-04 18:04 ` [PATCH 3/7] ceph: " Matthew Wilcox (Oracle)
2020-10-04 18:04   ` [Ocfs2-devel] " Matthew Wilcox
2020-10-06 11:29   ` Jeff Layton
2020-10-06 11:29     ` [Ocfs2-devel] " Jeff Layton
2020-10-06 17:20   ` Jeff Layton
2020-10-06 17:20     ` [Ocfs2-devel] " Jeff Layton
2020-10-04 18:04 ` [PATCH 4/7] ocfs2: " Matthew Wilcox (Oracle)
2020-10-04 18:04   ` [Ocfs2-devel] " Matthew Wilcox
2020-10-04 18:04 ` [PATCH 5/7] btrfs: " Matthew Wilcox (Oracle)
2020-10-04 18:04   ` [Ocfs2-devel] " Matthew Wilcox
2020-10-09 14:18   ` Josef Bacik
2020-10-09 14:18     ` [Ocfs2-devel] " Josef Bacik
2020-10-26 17:02   ` David Sterba
2020-10-26 17:02     ` [Ocfs2-devel] " David Sterba
2020-10-04 18:04 ` [PATCH 6/7] " Matthew Wilcox (Oracle)
2020-10-04 18:04   ` [Ocfs2-devel] " Matthew Wilcox
2020-10-09 14:18   ` Josef Bacik
2020-10-09 14:18     ` [Ocfs2-devel] " Josef Bacik
2020-10-26 16:35   ` David Sterba
2020-10-26 16:35     ` [Ocfs2-devel] " David Sterba
2020-10-26 16:44     ` Matthew Wilcox
2020-10-26 16:44       ` [Ocfs2-devel] " Matthew Wilcox
2020-10-26 17:03       ` David Sterba [this message]
2020-10-26 17:03         ` David Sterba
2020-10-04 18:04 ` [PATCH 7/7] btrfs: Promote to unsigned long long before multiplying Matthew Wilcox (Oracle)
2020-10-04 18:04   ` [Ocfs2-devel] " Matthew Wilcox
2020-10-26 16:21   ` David Sterba
2020-10-26 16:21     ` [Ocfs2-devel] " David Sterba

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=20201026170354.GR6756@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=ceph-devel@vger.kernel.org \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=ericvh@gmail.com \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=jlbec@evilplan.org \
    --cc=josef@toxicpanda.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=stable@vger.kernel.org \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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.