On Fri, Nov 13, 2026 at 04:34:50PM -0600, Eric Blake wrote: > The NBD spec allows a server that has negotiated structured replies to > respond in any order among its various reply chunks. Although most > known servers happen to give replies in sequential order, QEMU must be > prepared for a server that intentionally returns out-of-order read > chunks (a malicious server could exploit that in an effort to attempt > to convince QEMU to expose uninitialized memory to a guest that is > using the NBD client as storage). Although this patch does not > actually add any new validation of the server's response chunks, it > does make it easier for the next patch to do so by providing a > centralized location in the code. Now, in > nbd_co_receive_cmdread_reply(), payload contains a host-endian > offset+length after either the nbd_co_receive_one_chunk for > OFFSET_DATA or the nbd_parse_offset_hole_payload() for OFFSET_HOLE. > > Signed-off-by: Eric Blake <[email protected]> > --- > block/nbd.c | 45 +++++++++++++++++++++++++++++++++++---------- > 1 file changed, 35 insertions(+), 10 deletions(-)
Reviewed-by: Stefan Hajnoczi <[email protected]>
