Bug #13865
closeddon't pass NV_ENCODE_NATIVE to nvlist_unpack()
100%
Description
There's a bunch of calls to nvlist_unpack() in gate which pass NV_ENCODE_NATIVE as last argument. The encoding of a packed nvlist is stored in the nvlist itself, nvlist_unpack() neither needs nor expects to be told about it.
The last argument of nvlist_unpack() is "kmflag", so in the kernel KM_SLEEP or KM_NOSLEEP must be passed, and in user space 0 should be passed according to nvlist_unpack(3nvpair).
The user space nvlist_unpack() will ignore its last argument so nothing break. In the one case where this is done in the kernel (usr/src/common/io/ufmtest.c) it's at least inconsistent with an earlier call to kmem_zalloc(..., KM_NOSLEEP), while NV_ENCODE_NATIVE will be understood as KM_SLEEP by the following call to nvlist_unpack()
Updated by Electric Monk almost 2 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
git commit 0d1087e85d1cd423a6cbe5358a51a160350e956e
commit 0d1087e85d1cd423a6cbe5358a51a160350e956e Author: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> Date: 2021-06-21T15:22:01.000Z 13865 don't pass NV_ENCODE_NATIVE to nvlist_unpack() Reviewed by: Andy Fiddaman <andy@omnios.org> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Dan McDonald <danmcd@joyent.com>