Project

General

Profile

Actions

Bug #13865

closed

don't pass NV_ENCODE_NATIVE to nvlist_unpack()

Added by Hans Rosenfeld about 1 month ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Category:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

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()

Actions #1

Updated by Electric Monk about 1 month ago

  • Gerrit CR set to 1543
Actions #2

Updated by Electric Monk about 1 month 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>

Actions

Also available in: Atom PDF