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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121129212931.GD3490@shiny>
Date:	Thu, 29 Nov 2012 16:29:31 -0500
From:	Chris Mason <chris.mason@...ionio.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
CC:	Chris Mason <clmason@...ionio.com>,
	Mikulas Patocka <mpatocka@...hat.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	Jens Axboe <axboe@...nel.dk>,
	Jeff Chua <jeff.chua.linux@...il.com>,
	Lai Jiangshan <laijs@...fujitsu.com>, Jan Kara <jack@...e.cz>,
	lkml <linux-kernel@...r.kernel.org>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH v2] Do a proper locking for mmap and block size change

On Thu, Nov 29, 2012 at 01:52:22PM -0700, Linus Torvalds wrote:
> On Thu, Nov 29, 2012 at 11:48 AM, Chris Mason <chris.mason@...ionio.com> wrote:
> >
> > It was all a trick to get you to say the AIO code was sane.
> 
> It's only sane compared to the DIO code.
> 
> That said, I hate AIO much less these days that we've largely merged
> the code with the regular IO. It's still a horrible interface, but at
> least it is no longer a really disgusting separate implementation in
> the kernel of that horrible interface.
> 
> So yeah, I guess AIO really is pretty sane these days.
> 
> > It looks like we could use the private copy of i_blkbits that DIO is
> > already recording.
> 
> Yes. But that didn't fix the blkdev_get_blocks() mess you pointed out.
> 
> I've pushed out two more commits to the 'block-dev' branch at
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux block-dev
> 
> in case anybody wants to take a look.
> 
> It is - as usual - entirely untested. It compiles, and I *think* that
> blkdev_get_blocks() makes a whole lot more sense this way - as you
> said, it should be byte-based (although it actually does the block
> number conversion because I worried about overflow - probably
> unnecessarily).
> 
> Comments?

Your blkdev_get_blocks emails were great reading while at the dentist,
thanks for helping me pass the time.

Just reading the new blkdev_get_blocks, it looks like we're mixing
shifts.  In direct-io.c map_bh->b_size is how much we'd like to map, and
it has no relation at all to the actual block size of the device.  The
interface is abusing b_size to ask for as large a mapping as possible.

Most importantly, it has no relation to the fs_startblk that we pass in,
which is based on inode->i_blkbits.

So your new check in blkdev_get_blocks:

               if (iblock >= end_block) {

Is wrong because iblock and end_block are based on different sizes.  I
think we have to do the eof checks inside fs/direct-io.c or change the
get_blocks interface completely.

I really thought fs/direct-io.c was already doing eof checks, but I'm
reading harder.

-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