1nbd_set_pread_initialize(3)         LIBNBD         nbd_set_pread_initialize(3)
2
3
4

NAME

6       nbd_set_pread_initialize - control whether libnbd pre-initializes read
7       buffers
8

SYNOPSIS

10        #include <libnbd.h>
11
12        int nbd_set_pread_initialize (struct nbd_handle *h,
13                                      bool request);
14

DESCRIPTION

16       By default, libnbd will pre-initialize the contents of a buffer passed
17       to calls such as nbd_pread(3) to all zeroes prior to checking for any
18       other errors, so that even if a client application passed in an
19       uninitialized buffer but fails to check for errors, it will not result
20       in a potential security risk caused by an accidental leak of prior heap
21       contents (see CVE-2022-0485 in libnbd-security(3) for an example of a
22       security hole in an application built against an earlier version of
23       libnbd that lacked consistent pre-initialization).  However, for a
24       client application that has audited that an uninitialized buffer is
25       never dereferenced, or which performs its own pre-initialization,
26       libnbd's sanitization efforts merely pessimize performance (although
27       the time spent in pre-initialization may pale in comparison to time
28       spent waiting on network packets).
29
30       Calling this function with "request" set to false tells libnbd to skip
31       the buffer initialization step in read commands.
32

RETURN VALUE

34       If the call is successful the function returns 0.
35

ERRORS

37       On error "-1" is returned.
38
39       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
40       of the error.
41

VERSION

43       This function first appeared in libnbd 1.12.
44
45       If you need to test if this function is available at compile time check
46       if the following macro is defined:
47
48        #define LIBNBD_HAVE_NBD_SET_PREAD_INITIALIZE 1
49

SEE ALSO

51       nbd_aio_pread(3), nbd_aio_pread_structured(3), nbd_create(3),
52       nbd_get_pread_initialize(3), nbd_pread(3), nbd_pread_structured(3),
53       nbd_set_strict_mode(3), libnbd(3).
54

AUTHORS

56       Eric Blake
57
58       Richard W.M. Jones
59
61       Copyright (C) 2019-2021 Red Hat Inc.
62

LICENSE

64       This library is free software; you can redistribute it and/or modify it
65       under the terms of the GNU Lesser General Public License as published
66       by the Free Software Foundation; either version 2 of the License, or
67       (at your option) any later version.
68
69       This library is distributed in the hope that it will be useful, but
70       WITHOUT ANY WARRANTY; without even the implied warranty of
71       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
72       Lesser General Public License for more details.
73
74       You should have received a copy of the GNU Lesser General Public
75       License along with this library; if not, write to the Free Software
76       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
77       02110-1301 USA
78
79
80
81libnbd-1.12.5                     2022-07-10       nbd_set_pread_initialize(3)
Impressum