Fix CVE-2008-0928 - insufficient block device address range checking (Anthony Liguori)
commit71d0770c4cec9f1dc04f4dadcbf7fd6c335030a9
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 3 Mar 2009 17:37:16 +0000 (3 17:37 +0000)
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 3 Mar 2009 17:37:16 +0000 (3 17:37 +0000)
tree4009c7e0fa52a55d83d298217081d7f9afbad8e6
parentb42ec42d4306e6da1e72a32167262343025116ed
Fix CVE-2008-0928 - insufficient block device address range checking (Anthony Liguori)

Introduce a growable flag that's set by bdrv_file_open().  Block devices should
never be growable, only files that are being used by block devices.

I went through Fabrice's early comments about the patch that was first applied.
While I disagree with that patch, I also disagree with Fabrice's suggestion.

There's no good reason to do the checks in the block drivers themselves.  It
just increases the possibility that this bug could show up again.  Since we're
calling bdrv_getlength() to determine the length, we're giving the block drivers
a chance to chime in and let us know what range is valid.

Basically, this patch makes the BlockDriver API guarantee that all requests are
within 0..bdrv_getlength() which to me seems like a Good Thing.

What do others think?

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6677 c046a42c-6fe2-441c-8c8c-71466251a162
block.c
block_int.h