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:	Sat, 31 May 2014 12:39:34 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	mnipxh <mnipxh@...il.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	Al Viro <viro@...iv.linux.org.uk>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Yanmin Zhang <yanmin_zhang@...ux.intel.com>,
	shuox.liu@...el.com
Subject: Re: [PATCH] fs/buffer.c: grow_buffers: fix the uncorrect check

On Sat, May 31, 2014 at 11:12 AM, mnipxh <mnipxh@...il.com> wrote:
> When pgoff_t index is 32bit, sector_t block is 64bit, need check if block number is too big.
> If block is bigger than (4Gb * PAGE_SIZE), index becomes a wrong value.
> Commit e5657933863f43cc6bb76a54d659303dafaa9e58 wants to do this. But it gives an uncorrect check.
> I think block != index << sizebits is correct. And it can detect such issue above.

I don't understand why you think the current check is incorrect.

It is testing that the calculation hasn't overflowed. It is correct.
It *should* use the same calculation, to (a) make it more obvious that
it's double-checking the earlier calculation in a different type, and
(b) to make it easier for the compiler to optimize it away if sector_t
and pgoff_t are the same size.

So the current code is correct, afaik. Note that "index" is "pgoff_t",
but "block >> sizebits" is "sector_t".

               Linus
--
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