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
42       The following parameters must not be NULL: "h".  For more information
43       see "Non-NULL parameters" in libnbd(3).
44

VERSION

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

SEE ALSO

54       nbd_aio_pread(3), nbd_aio_pread_structured(3), nbd_create(3),
55       nbd_get_pread_initialize(3), nbd_pread(3), nbd_pread_structured(3),
56       nbd_set_strict_mode(3), libnbd(3).
57

AUTHORS

59       Eric Blake
60
61       Richard W.M. Jones
62
64       Copyright (C) 2019-2021 Red Hat Inc.
65

LICENSE

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