[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 4/4] nbd/client: Deal with unaligne
Re: [Qemu-block] [Qemu-devel] [PATCH 4/4] nbd/client: Deal with unaligned size from server
Fri, 17 Aug 2018 16:57:06 +0300
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
02.08.2018 17:48, Eric Blake wrote:
When a server advertises an unaligned size but no block sizes,
the code was rounding up to a sector-aligned size (a known
limitation of bdrv_getlength()), then assuming a request_alignment
of 512 (the recommendation of the NBD spec for maximum portability).
However, this means that qemu will actually attempt to access the
padding bytes of the trailing partial sector.
An easy demonstration, using nbdkit as the server:
$ nbdkit -fv random size=1023
$ qemu-io -r -f raw -c 'r -v 0 1023' nbd://localhost:10809
read failed: Invalid argument
because the client rounded the request up to 1024 bytes, which
nbdkit then rejected as beyond the advertised size of 1023.
Note that qemu as the server refuses to send an unaligned size, as
it has already rounded the unaligned image up to sector size, and
then happily resizes the image on access (at least when serving a
POSIX file over NBD).
Reported-by: Richard W.M. Jones <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
[Qemu-block] [PATCH 3/4] iotests: Add 228 to test NBD on unaligned images, Eric Blake, 2018/08/02
[Qemu-block] [PATCH 4/4] nbd/client: Deal with unaligned size from server, Eric Blake, 2018/08/02
- Re: [Qemu-block] [Qemu-devel] [PATCH 4/4] nbd/client: Deal with unaligned size from server,
Vladimir Sementsov-Ogievskiy <=