don't pass NV_ENCODE_NATIVE to nvlist_unpack()
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 about 1 month ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit 0d1087e85d1cd423a6cbe5358a51a160350e956e Author: Hans Rosenfeld <email@example.com> Date: 2021-06-21T15:22:01.000Z 13865 don't pass NV_ENCODE_NATIVE to nvlist_unpack() Reviewed by: Andy Fiddaman <firstname.lastname@example.org> Reviewed by: Toomas Soome <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>