search for: nbd_set_strict_mode

Displaying 10 results from an estimated 10 matches for "nbd_set_strict_mode".

2020 Sep 04
0
[libnbd PATCH 2/2] api: Add STRICT_BOUNDS to nbd_set_strict_mode
...ors.c +++ b/tests/errors.c @@ -206,7 +206,25 @@ main (int argc, char *argv[]) } check (EINVAL, "nbd_aio_command_completed: "); - /* Read from an invalid offset */ + /* Read from an invalid offset, client-side */ + strict = nbd_get_strict_mode (nbd) | LIBNBD_STRICT_BOUNDS; + if (nbd_set_strict_mode (nbd, strict) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_pread (nbd, NULL, 0, -1, 0) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_pread did not fail with bogus offset\n", + ar...
2020 Sep 11
0
[libnbd PATCH v2 5/5] api: Add STRICT_BOUNDS/ZERO_SIZE to nbd_set_strict_mode
...ors.c +++ b/tests/errors.c @@ -235,7 +235,25 @@ main (int argc, char *argv[]) } check (EINVAL, "nbd_aio_command_completed: "); - /* Read from an invalid offset */ + /* Read from an invalid offset, client-side */ + strict = nbd_get_strict_mode (nbd) | LIBNBD_STRICT_BOUNDS; + if (nbd_set_strict_mode (nbd, strict) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_pread (nbd, buf, 1, -1, 0) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_pread did not fail with bogus offset\n", + arg...
2020 Sep 04
0
[libnbd PATCH 1/2] api: Add nbd_set_strict_mode
...+ uint32_t strict; progname = argv[0]; @@ -214,7 +215,25 @@ main (int argc, char *argv[]) } check (EINVAL, "nbd_pread: "); - /* Use unknown command flags */ + /* Use unknown command flags, client-side */ + strict = nbd_get_strict_mode (nbd) | LIBNBD_STRICT_COMMANDS; + if (nbd_set_strict_mode (nbd, strict) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_pread (nbd, NULL, 0, 0, -1) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_pread did not fail with bogus flags\n", + arg...
2020 Sep 11
0
[libnbd PATCH v2 3/5] api: Add nbd_set_strict_mode
...02,6 +102,13 @@ and link = | ExternalLink of string * int | URLLink of string +let strict_call_description = "\n +By default, libnbd will reject attempts to use this function with +parameters that are likely to result in server failure, such as +requesting an unknown command flag. The L<nbd_set_strict_mode(3)> +function can be used to alter which scenarios should await a server +reply rather than failing fast." + let non_blocking_test_call_description = "\n This call does not block, because it returns data that is saved in the handle from the NBD protocol handshake." @@ -171,7 +1...
2020 Sep 04
4
[RFC libnbd PATCH 0/2] Add knobs for client- vs. server-side validation
...for block-size validation would also make sense, especially given the recent addition of support for querying server minimum block size constraints (although I'd like to finish my work on getting nbdkit to advertise block constraints to make that easier to test...). Eric Blake (2): api: Add nbd_set_strict_mode api: Add STRICT_BOUNDS to nbd_set_strict_mode lib/internal.h | 3 + generator/API.ml | 67 ++++++++++- lib/disconnect.c | 18 +-- lib/handle.c | 16 +++ lib/rw.c | 289 ++++++++++++++++++++++++++++++----------------- tests/errors.c | 61 +++++++++- 6 files changed, 340 ins...
2020 Sep 11
0
[libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...script, NULL }; uint32_t strict; @@ -244,7 +244,25 @@ main (int argc, char *argv[]) } check (EINVAL, "nbd_pread: "); - /* Use unknown command flags */ + /* Use unknown command flags, client-side */ + strict = nbd_get_strict_mode (nbd) | LIBNBD_STRICT_FLAGS; + if (nbd_set_strict_mode (nbd, strict) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_pread (nbd, buf, 1, 0, LIBNBD_CMD_FLAG_MASK + 1) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_pread did not fail with bogus flags\n&quo...
2023 Jul 17
0
LIBNBD SECURITY: Assertion failure with unexpected block status
...test for the vulnerability. The patch includes instructions for reproducing the crash by modifying nbdkit to behave as a non-typical server. Workarounds ----------- By default, libnbd strives to avoid violating the NBD protocol; this particular crash can only be triggered when specifically using nbd_set_strict_mode(3) to bypass libnbd's default protections, and use of this API is not recommended except when doing integration tests of a server's error handling behaviors. Likewise, the crash depends on a server responding to a client error differently than recommended by NBD protocol; it is always a wi...
2020 Sep 11
10
[libnbd PATCH v2 0/5] Add knobs for client- vs. server-side validation
...stead of two: STRICT_FLAGS is new (patch 4), and STRICT_BOUNDS is separate from STRICT_ZERO_SIZE (patch 5) - various refactorings for more shared code and less duplication Eric Blake (5): api: Add xxx_MASK constant for each Flags type generator: Refactor filtering of accepted OFlags api: Add nbd_set_strict_mode api: Add STRICT_FLAGS to set_strict_mode api: Add STRICT_BOUNDS/ZERO_SIZE to nbd_set_strict_mode docs/libnbd.pod | 7 + lib/internal.h | 6 +- generator/API.ml | 291 ++++++++++++++---- generator/API...
2020 Sep 17
2
Re: [libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...; > > @@ -244,7 +244,25 @@ main (int argc, char *argv[]) > } > check (EINVAL, "nbd_pread: "); > > - /* Use unknown command flags */ > + /* Use unknown command flags, client-side */ > + strict = nbd_get_strict_mode (nbd) | LIBNBD_STRICT_FLAGS; > + if (nbd_set_strict_mode (nbd, strict) == -1) { > + fprintf (stderr, "%s\n", nbd_get_error ()); > + exit (EXIT_FAILURE); > + } > + if (nbd_pread (nbd, buf, 1, 0, LIBNBD_CMD_FLAG_MASK + 1) != -1) { > + fprintf (stderr, "%s: test failed: " > + "nbd_pread did n...
2023 May 30
2
[libnbd PATCH v3 04/22] states: Prepare to send 64-bit requests
...f (stderr, "%s: test failed: " > > + "nbd_get_strict_mode did not have expected flag set\n", > > + argv[0]); > > + exit (EXIT_FAILURE); > > + } > > Not sure if I understand this check. Per > <https://libguestfs.org/nbd_set_strict_mode.3.html>, I take it that > LIBNBD_STRICT_FLAGS should be "on" by default. Are you enforcing that? > And if so: is it your intent that, *even with* LIBNBD_STRICT_FLAGS, an > invalid PAYLOAD_LEN is not rejected (as seen by the libnbd client app), > but fixed up silently? Rath...