freebsd-dev/cddl/contrib/opensolaris/cmd
Toomas Soome a14844e0d6 MFOpenZFS: Add basic zfs ioc input nvpair validation
We want newer versions of libzfs_core to run against an existing
zfs kernel module (i.e. a deferred reboot or module reload after
an update).

Programmatically document, via a zfs_ioc_key_t, the valid arguments
for the ioc commands that rely on nvpair input arguments (i.e. non
legacy commands from libzfs_core). Automatically verify the expected
pairs before dispatching a command.

This initial phase focuses on the non-legacy ioctls. A follow-on
change can address the legacy ioctl input from the zfs_cmd_t.

The zfs_ioc_key_t for zfs_keys_channel_program looks like:

static const zfs_ioc_key_t zfs_keys_channel_program[] = {
       {"program",     DATA_TYPE_STRING,               0},
       {"arg",         DATA_TYPE_UNKNOWN,              0},
       {"sync",        DATA_TYPE_BOOLEAN_VALUE,        ZK_OPTIONAL},
       {"instrlimit",  DATA_TYPE_UINT64,               ZK_OPTIONAL},
       {"memlimit",    DATA_TYPE_UINT64,               ZK_OPTIONAL},
};

Introduce four input errors to identify specific input failures
(in addition to generic argument value errors like EINVAL, ERANGE,
EBADF, and E2BIG).

ZFS_ERR_IOC_CMD_UNAVAIL the ioctl number is not supported by kernel
ZFS_ERR_IOC_ARG_UNAVAIL an input argument is not supported by kernel
ZFS_ERR_IOC_ARG_REQUIRED a required input argument is missing
ZFS_ERR_IOC_ARG_BADTYPE an input argument has an invalid type

Reviewed by:	allanjude
Obtained from:	OpenZFS
Sponsored by:	Netflix, Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25393
2020-06-23 06:42:39 +00:00
..
dtrace Add HISTORY sections to ZFS and dtrace manpage 2020-06-14 05:50:28 +00:00
lockstat Add HISTORY sections to ZFS and dtrace manpage 2020-06-14 05:50:28 +00:00
mdb/tools/common Mechanically convert cddl sun #ifdef's to illumos 2015-01-17 14:44:59 +00:00
plockstat Fix the build for non-amd64. 2015-12-02 02:11:38 +00:00
pyzfs
stat/common
zdb Add HISTORY sections to ZFS and dtrace manpage 2020-06-14 05:50:28 +00:00
zfs MFOpenZFS: Add basic zfs ioc input nvpair validation 2020-06-23 06:42:39 +00:00
zhack MFV r354378,r354379,r354386: 10499 Multi-modifier protection (MMP) 2019-11-18 09:38:35 +00:00
zinject MFV r296505: 6531 Provide mechanism to artificially limit disk performance 2016-03-08 17:27:13 +00:00
zlook
zpool ZFS: Allow setting checksum=skein on boot pools 2020-06-19 17:59:55 +00:00
zstreamdump Add HISTORY sections to ZFS and dtrace manpage 2020-06-14 05:50:28 +00:00
ztest MFOpenZFS: make zil max block size tunable 2020-03-19 01:05:54 +00:00