[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/15] qemu-io: Allow larger write zeroes under no fallback
From: |
Eric Blake |
Subject: |
[PULL 15/15] qemu-io: Allow larger write zeroes under no fallback |
Date: |
Mon, 7 Mar 2022 19:44:19 -0600 |
When writing zeroes can fall back to a slow write, permitting an
overly large request can become an amplification denial of service
attack in triggering a large amount of work from a small request. But
the whole point of the no fallback flag is to quickly determine if
writing an entire device to zero can be done quickly (such as when it
is already known that the device started with zero contents); in those
cases, artificially capping things at 2G in qemu-io itself doesn't
help us.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20211203231539.3900865-4-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
qemu-io-cmds.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 954955c12fb9..45a957093369 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -603,10 +603,6 @@ static int do_co_pwrite_zeroes(BlockBackend *blk, int64_t
offset,
.done = false,
};
- if (bytes > INT_MAX) {
- return -ERANGE;
- }
-
co = qemu_coroutine_create(co_pwrite_zeroes_entry, &data);
bdrv_coroutine_enter(blk_bs(blk), co);
while (!data.done) {
@@ -1160,8 +1156,9 @@ static int write_f(BlockBackend *blk, int argc, char
**argv)
if (count < 0) {
print_cvtnum_err(count, argv[optind]);
return count;
- } else if (count > BDRV_REQUEST_MAX_BYTES) {
- printf("length cannot exceed %" PRIu64 ", given %s\n",
+ } else if (count > BDRV_REQUEST_MAX_BYTES &&
+ !(flags & BDRV_REQ_NO_FALLBACK)) {
+ printf("length cannot exceed %" PRIu64 " without -n, given %s\n",
(uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]);
return -EINVAL;
}
--
2.35.1
- [PULL 04/15] qemu-nbd: add --tls-hostname option for TLS certificate validation, (continued)
- [PULL 04/15] qemu-nbd: add --tls-hostname option for TLS certificate validation, Eric Blake, 2022/03/07
- [PULL 06/15] tests/qemu-iotests: add QEMU_IOTESTS_REGEN=1 to update reference file, Eric Blake, 2022/03/07
- [PULL 07/15] tests/qemu-iotests: expand _filter_nbd rules, Eric Blake, 2022/03/07
- [PULL 12/15] tests/qemu-iotests: validate NBD TLS with UNIX sockets and PSK, Eric Blake, 2022/03/07
- [PULL 10/15] tests/qemu-iotests: validate NBD TLS with hostname mismatch, Eric Blake, 2022/03/07
- [PULL 09/15] tests/qemu-iotests: convert NBD TLS test to use standard filters, Eric Blake, 2022/03/07
- [PULL 08/15] tests/qemu-iotests: introduce filter for qemu-nbd export list, Eric Blake, 2022/03/07
- [PULL 11/15] tests/qemu-iotests: validate NBD TLS with UNIX sockets, Eric Blake, 2022/03/07
- [PULL 14/15] qemu-io: Utilize 64-bit status during map, Eric Blake, 2022/03/07
- [PULL 13/15] nbd/server: Minor cleanups, Eric Blake, 2022/03/07
- [PULL 15/15] qemu-io: Allow larger write zeroes under no fallback,
Eric Blake <=
- Re: [PULL 00/15] NBD patches for 7.0-rc0, Peter Maydell, 2022/03/09