#
4d846d26 |
|
10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
|
#
5916ae1f |
|
06-Dec-2021 |
Robert Wing <rew@FreeBSD.org> |
libnv: read entire datagram in nvlist_recv() When SOCK_DGRAM is used, a portion of the datagram is discarded during the initial recv() when getting the nvlist_header. To workaround this, use MSG_PEEK for the initial recv() when using a datagram socket. Add tests for SOCK_DGRAM with nvlist_send()/nvlist_recv(). Differential Revision: https://reviews.freebsd.org/D32722
|
#
db158b99 |
|
06-Dec-2021 |
Robert Wing <rew@FreeBSD.org> |
libnv: let nvlist_recv() pass flags to recv() Differential Revision: https://reviews.freebsd.org/D32721
|
#
89d5cbb8 |
|
11-Jun-2021 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
libnv: optimize nvlist size calculation If we had a multiple nvlist, during nvlist_pack, we calculated the size of every nvlist separately. For example, if we had a nvlist with three nodes each containing another (A contains B, and B contains C), we first calculated the size of nvlist A (which contains B, C), then we calculate the size of B (which contains C, notice that we already did the calculation of B, when we calculate A), and finally C. This means that this calculation was O(N!). This was done because each time we pack nvlist, we have to put its size in the header (the separate header for A, B, and C). To not break the ABI and to reduce the complexity of nvlist_size, instead of calculating the nvlist size when requested, we track the size of each nvlist. Reported by: pjd, kp Tested by: kp
|
#
431c5bb8 |
|
10-Apr-2019 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
The nvlist_report_missing is also used by the cnvlist. It can't be a static one. Reported by: jenkins MFC after: 2 weeks
|
#
dab22642 |
|
10-Apr-2019 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
libnv: fix compilation warnings When building libnv without a debug those arguments are no longer used because assertions will be changed to NOP. Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org> MFC after: 2 weeks
|
#
b5d787d9 |
|
10-Feb-2019 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
libnv: fix memory leaks nvpair_create_stringv: free the temporary string; this fix affects nvlist_add_stringf() and nvlist_add_stringv(). nvpair_remove_nvlist_array (NV_TYPE_NVLIST_ARRAY case): free the chain of nvpairs (as resetting it prevents nvlist_destroy() from freeing it). Note: freeing the chain in nvlist_destroy() is not sufficient, because it would still leak through nvlist_take_nvlist_array(). This affects all nvlist_*_nvlist_array() use Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org> Reported by: clang/gcc ASAN MFC after: 2 weeks
|
#
24881c06 |
|
18-Jun-2018 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
libnv: Add nvlist_append_*_array() family of functions. The nvlist_append_{bool,number,string,nvlist,descriptor}_array() functions allows to dynamically extend array stored in the nvlist. Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org>
|
#
1acf3485 |
|
26-Jan-2018 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Add SPDX tags for nv(9). MFC after: 2 weeks
|
#
9a8ce256 |
|
26-Oct-2017 |
Jilles Tjoelker <jilles@FreeBSD.org> |
libnv: Fix strict-aliasing violation with cookie In rS323851, some casts were adjusted in calls to nvlist_next() and nvlist_get_pararr() in order to make scan-build happy. I think these changes just confused scan-build into not reporting the strict-aliasing violation. For example, nvlist_xdescriptors() is causing nvlist_next() to write to its local variable nvp of type nvpair_t * using the lvalue *cookiep of type void *, which is not allowed. Given the APIs of nvlist_next(), nvlist_get_parent() and nvlist_get_pararr(), one possible fix is to create a local void *cookie in nvlist_xdescriptors() and other places, and to convert the value to nvpair_t * when necessary. This patch implements that fix. Reviewed by: oshogbo MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D12760
|
#
a3c485d3 |
|
21-Sep-2017 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Make the code consistent by always using 'fail' label. Submitted by: pjd@ and oshogbo@ MFC after: 1 month Sponsored by: Wheel Systems
|
#
1dacabe1 |
|
21-Sep-2017 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
The 'while (array != NULL) { }' suggests scan-build that array may be initially NULL, which is not possible. Change the loop to 'do {} while (array != NULL)' to satisfy scan-build and assert that array really cannot be NULL just in case. Submitted by: pjd@ Found by: scan-build MFC after: 1 month Sponsored by: Wheel Systems
|
#
08016b31 |
|
21-Sep-2017 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Remove redundant initialization. Don't use variable - just return the value. Make scan-build happy by casting to 'void *' instead of 'void **'. Submitted by: pjd@ MFC after: 1 month Found by: scan-build and cppcheck Sponsored by: Wheel Systems
|
#
5ef231f6 |
|
27-Aug-2016 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Add cnv API. cnv API is a set of functions for managing name/value pairs by cookie. The cookie can be obtained by nvlist_next(), nvlist_get_parent() or nvlist_get_pararr() function. This patch also includes unit tests. Submitted by: Adam Starak <starak.adam@gmail.com>
|
#
999c1fd6 |
|
29-Jul-2016 |
Baptiste Daroussin <bapt@FreeBSD.org> |
Remove usage of _WITH_DPRINTF
|
#
1b550329 |
|
17-Jul-2016 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Fix nvlist array memory leak. When we change nvl_array_next to NULL it means that we want to destroy or take nvlist_array. The nvpair, which stores next nvlist of nvlist_array element is no longer needed and can be freed. Submitted by: Adam Starak <starak.adam@gmail.com> MFC after: 1 week
|
#
347a39b4 |
|
15-Aug-2015 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Add support for the arrays in nvlist library. - Add nvlist_{add,get,take,move,exists,free}_{number,bool,string,nvlist, descriptor} functions. - Add support for (un)packing arrays. - Add the nvl_array_next field to the nvlist structure. If an array is added by the nvlist_{move,add}_nvlist_array function this field will contains next element in the array. - Add the nitems field to the nvpair and nvpair_header structure. This field contains number of elements in the array. - Add special flag (NV_FLAG_IN_ARRAY) which is set if nvlist is a part of an array. - Add special type (NV_TYPE_NVLIST_ARRAY_NEXT).This type is used only on packing/unpacking. - Add new API for traversing arrays (nvlist_get_array_next). - Add the nvlist_get_pararr function which combines the nvlist_get_array_next and nvlist_get_parent functions. If nvlist is in the array it will return next element from array. If nvlist is last element in array or it isn't in array it will return his container (parent). This function should simplify traveling over nvlist. - Add tests for new features. - Add documentation for new functions. - Add my copyright. - Regenerate the sys/cddl/compat/opensolaris/sys/nvpair.h file. PR: 191083 Reviewed by: allanjude (doc) Approved by: pjd (mentor)
|
#
c68f8061 |
|
11-Aug-2015 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
If any function fail (the ptr variable will be equal to NULL), we shouldn't return buffer. Instead we should free it and return NULL. Approved by: pjd (mentor)
|
#
30740f45 |
|
11-Aug-2015 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
The nvlist_move_nvpair() function can fail in two cases, if: - the nvlist error is set, or - the nvlist case ignore flag is not set and there is attend to add element with duplicated name. In both cases the nvlist_move_nvpair() function free nvpair structure. If library will try to unpack a binary blob which contains duplicated names it will end up with using memory after free. To prevent that, the nvlist_move_nvpair() function interface is changed to report about failure and checks are added to the nvpair_xunpack() function. Discovered thanks to the american fuzzy lop. Approved by: pjd (mentor)
|
#
51dae13f |
|
11-Aug-2015 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Don't set parent if the unpack operation fail. In some case this could crash the library, because of the NULL pointer references. Discovered thanks to american fuzzy lop. Approved by: pjd (mentor)
|
#
89ca10c6 |
|
11-Aug-2015 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Make the nvlist_next(9) function handle NULL pointer variable. This simplifies removing the first element from nvlist. Reviewed by: AllanJude Approved by: pjd (mentor)
|
#
54f98da9 |
|
04-Jul-2015 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Move the nvlist source and private includes from sys/kern to seperate directory sys/contrib/libnv. The goal of this operation is to NOT install header files which shouldn't be used outside the nvlist library. Approved by: pjd (mentor)
|