svn commit: r340442 - head/usr.sbin/mountd
Author: sef Date: Wed Nov 14 19:06:43 2018 New Revision: 340442 URL: https://svnweb.freebsd.org/changeset/base/340442 Log: mountd has no way to configure the listen queue depth; rather than add a new option, we pass -1 down to listen, which causes it to use the kern.ipc.soacceptqueue sysctl. Approved by: mav MFC after:2 weeks Sponsored by: iXsystems Inc Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c == --- head/usr.sbin/mountd/mountd.c Wed Nov 14 18:45:33 2018 (r340441) +++ head/usr.sbin/mountd/mountd.c Wed Nov 14 19:06:43 2018 (r340442) @@ -908,8 +908,12 @@ complete_service(struct netconfig *nconf, char *port_s if (fd < 0) continue; + /* +* Using -1 tells listen(2) to use +* kern.ipc.soacceptqueue for the backlog. +*/ if (nconf->nc_semantics != NC_TPI_CLTS) - listen(fd, SOMAXCONN); + listen(fd, -1); if (nconf->nc_semantics == NC_TPI_CLTS ) transp = svc_dg_create(fd, 0, 0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r336017 - in head: include/rpcsvc lib/libutil libexec/rpc.rquotad sys/cddl/contrib/opensolaris/uts/common/fs/zfs usr.bin/quota
Author: sef Date: Thu Jul 5 22:56:13 2018 New Revision: 336017 URL: https://svnweb.freebsd.org/changeset/base/336017 Log: This exposes ZFS user and group quotas via the normal quatactl(2) mechanism. (Read-only at this point, however.) In particular, this is to allow rpc.rquotad query quotas for NFS mounts, allowing users to see their quotas on the hosts using the datasets. The changes specifically: * Add new RPC entry points for querying quotas. * Changes the library routines to allow non-UFS quotas. * Changes rquotad to check for quotas on mounted filesystems, rather than being limited to entries in /etc/fstab * Lastly, adds a VFS entry-point for ZFS to query quotas. Note that this makes one unavoidable behavioural change: if quotas are enabled, then they can be queried, as opposed to the current method of checking for quotas being specified in fstab. (With ZFS, if there are user or group quotas, they're used, always.) Reviewed by: delphij, mav Approved by: mav Sponsored by: iXsystems Inc Differential Revision:https://reviews.freebsd.org/D15886 Modified: head/include/rpcsvc/rquota.x head/lib/libutil/quotafile.c head/libexec/rpc.rquotad/rquotad.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/usr.bin/quota/quota.c Modified: head/include/rpcsvc/rquota.x == --- head/include/rpcsvc/rquota.xThu Jul 5 21:38:54 2018 (r336016) +++ head/include/rpcsvc/rquota.xThu Jul 5 22:56:13 2018 (r336017) @@ -1,24 +1,55 @@ +/* @(#)rquota.x2.1 88/08/01 4.0 RPCSRC */ +/* @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro */ + /* * Remote quota protocol * Requires unix authentication */ #ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ %#include %__FBSDID("$FreeBSD$"); #endif const RQ_PATHLEN = 1024; +struct sq_dqblk { + unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */ + unsigned int rq_bsoftlimit; /* preferred limit on disk blks */ + unsigned int rq_curblocks; /* current block count */ + unsigned int rq_fhardlimit; /* absolute limit on allocated files */ + unsigned int rq_fsoftlimit; /* preferred file limit */ + unsigned int rq_curfiles; /* current # allocated files */ + unsigned int rq_btimeleft; /* time left for excessive disk use */ + unsigned int rq_ftimeleft; /* time left for excessive files */ +}; + struct getquota_args { string gqa_pathp; /* path to filesystem of interest */ - int gqa_uid;/* inquire about quota for uid */ + int gqa_uid;/* Inquire about quota for uid */ }; +struct setquota_args { + int sqa_qcmd; + string sqa_pathp; /* path to filesystem of interest */ + int sqa_id; /* Set quota for uid */ + sq_dqblk sqa_dqblk; +}; + +struct ext_getquota_args { + string gqa_pathp; /* path to filesystem of interest */ + int gqa_type; /* Type of quota info is needed about */ + int gqa_id; /* Inquire about quota for id */ +}; + +struct ext_setquota_args { + int sqa_qcmd; + string sqa_pathp; /* path to filesystem of interest */ + int sqa_id; /* Set quota for id */ + int sqa_type; /* Type of quota to set */ + sq_dqblk sqa_dqblk; +}; + /* * remote quota structure */ @@ -37,7 +68,7 @@ struct rquota { enum gqr_status { Q_OK = 1, /* quota returned */ - Q_NOQUOTA = 2, /* noquota for uid */ + Q_NOQUOTA = 2, /* noquota for uid */ Q_EPERM = 3 /* no permission to access quota */ }; @@ -50,6 +81,15 @@ case Q_EPERM: void; }; +union setquota_rslt switch (gqr_status status) { +case Q_OK: + rquota sqr_rquota; /* valid if status == Q_OK */ +case Q_NOQUOTA: + void; +case Q_EPERM: + void; +}; + program RQUOTAPROG { version RQUOTAVERS { /* @@ -63,5 +103,42 @@ program RQUOTAPROG { */ getquota_rslt RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2; + + /* +* Set all quotas +*/ + setquota_rslt + RQUOTAPROC_SETQUOTA(setquota_args) = 3; + + /* +* Get active quotas only +*/ + setquota_rslt + RQUOTAPROC_SETACTIVEQUOTA(setquota_args) = 4; } = 1; + version EXT_RQUOTAVERS { + /* +* Get all quotas +*/ + getquota_rslt +
svn commit: r336180 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: sef Date: Tue Jul 10 20:11:32 2018 New Revision: 336180 URL: https://svnweb.freebsd.org/changeset/base/336180 Log: Fix up some missed and mis-merges from the sequential scan code (r334844). Most of the changes involve moving some code around to reduce conflicts with future merges. One of the missing changes included a notification on scrub cancellation. Approved by: mav Sponsored by: iXsystems Inc Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Tue Jul 10 19:37:52 2018(r336179) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Tue Jul 10 20:11:32 2018(r336180) @@ -739,14 +739,15 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) /* got scrub start cmd, resume paused scrub */ int err = dsl_scrub_set_pause_resume(scn->scn_dp, POOL_SCRUB_NORMAL); - if (err == 0) + if (err == 0) { + spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_RESUME); return (ECANCELED); - + } return (SET_ERROR(err)); } return (dsl_sync_task(spa_name(spa), dsl_scan_setup_check, - dsl_scan_setup_sync, &func, 0, ZFS_SPACE_CHECK_NONE)); + dsl_scan_setup_sync, &func, 0, ZFS_SPACE_CHECK_EXTRA_RESERVED)); } /* ARGSUSED */ @@ -2110,7 +2111,6 @@ dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_ { dsl_pool_t *dp = scn->scn_dp; dsl_dataset_t *ds; - objset_t *os; VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds)); @@ -2154,9 +2154,6 @@ dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_ goto out; } - if (dmu_objset_from_ds(ds, &os)) - goto out; - /* * Only the ZIL in the head (non-snapshot) is valid. Even though * snapshots can have ZIL block pointers (which may be the same @@ -2166,8 +2163,14 @@ dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_ * rather than in scan_recurse(), because the regular snapshot * block-sharing rules don't apply to it. */ - if (!ds->ds_is_snapshot) + if (DSL_SCAN_IS_SCRUB_RESILVER(scn) && !dsl_dataset_is_snapshot(ds) && + ds->ds_dir != dp->dp_origin_snap->ds_dir) { + objset_t *os; + if (dmu_objset_from_ds(ds, &os) != 0) { + goto out; + } dsl_scan_zil(dp, &os->os_zil_header); + } /* * Iterate over the bps in this ds. @@ -2878,22 +2881,6 @@ dsl_scan_free_block_cb(void *arg, const blkptr_t *bp, return (0); } -static int -dsl_scan_obsolete_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) -{ - dsl_scan_t *scn = arg; - const dva_t *dva = &bp->blk_dva[0]; - - if (dsl_scan_async_block_should_pause(scn)) - return (SET_ERROR(ERESTART)); - - spa_vdev_indirect_mark_obsolete(scn->scn_dp->dp_spa, - DVA_GET_VDEV(dva), DVA_GET_OFFSET(dva), - DVA_GET_ASIZE(dva), tx); - scn->scn_visited_this_txg++; - return (0); -} - static void dsl_scan_update_stats(dsl_scan_t *scn) { @@ -2929,6 +2916,22 @@ dsl_scan_update_stats(dsl_scan_t *scn) scn->scn_zios_this_txg = zio_count_total; } +static int +dsl_scan_obsolete_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + dsl_scan_t *scn = arg; + const dva_t *dva = &bp->blk_dva[0]; + + if (dsl_scan_async_block_should_pause(scn)) + return (SET_ERROR(ERESTART)); + + spa_vdev_indirect_mark_obsolete(scn->scn_dp->dp_spa, + DVA_GET_VDEV(dva), DVA_GET_OFFSET(dva), + DVA_GET_ASIZE(dva), tx); + scn->scn_visited_this_txg++; + return (0); +} + boolean_t dsl_scan_active(dsl_scan_t *scn) { @@ -2950,12 +2953,51 @@ dsl_scan_active(dsl_scan_t *scn) return (used != 0); } +static boolean_t +dsl_scan_need_resilver(spa_t *spa, const dva_t *dva, size_t psize, +uint64_t phys_birth) +{ + vdev_t *vd; + + if (DVA_GET_GANG(dva)) { + /* +* Gang members may be spread across multiple +* vdevs, so the best estimate we have is the +* scrub range, which has already been checked. +* XXX -- it would be better to change our +* allocation policy to ensure that all +* gang members reside on the same vdev. +*/ + return (B_TRUE); + } + + vd = vdev_lookup_top(spa, DVA_GET_VDEV(dva)); + + /* +* Check if the txg falls within the range which must be +* resilvered. DVAs outside this range ca
svn commit: r336458 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: sef Date: Wed Jul 18 16:03:40 2018 New Revision: 336458 URL: https://svnweb.freebsd.org/changeset/base/336458 Log: Fix a couple of typos in r334844 noticed by Richard Kojedzinszky. Submitted by: Richard Kojedzinszky Reviewed by: sef Approved by: mav Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 18 13:04:03 2018(r336457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jul 18 16:03:40 2018(r336458) @@ -1398,10 +1398,10 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, mfu_ghost_data_esize, SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2c_only_size, CTLFLAG_RD, &ARC_l2c_only.arcs_size.rc_count, 0, "size of mru state"); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, arc_min_prfetch_ms, CTLFLAG_RW, +SYSCTL_UINT(_vfs_zfs, OID_AUTO, arc_min_prefetch_ms, CTLFLAG_RW, &zfs_arc_min_prefetch_ms, 0, "Min life of prefetch block in ms"); SYSCTL_UINT(_vfs_zfs, OID_AUTO, arc_min_prescient_prefetch_ms, CTLFLAG_RW, -&zfs_arc_min_prescient_prefetch_ms, 0, "Min life oof prescient prefetched block in ms"); +&zfs_arc_min_prescient_prefetch_ms, 0, "Min life of prescient prefetched block in ms"); /* * L2ARC Internals ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r343623 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: sef Date: Thu Jan 31 22:06:46 2019 New Revision: 343623 URL: https://svnweb.freebsd.org/changeset/base/343623 Log: MFC r342928: Change ZFS quotas to return EINVAL when not present (matches man page). Approved by: mav Reviewed by: markj PR: 234413 Sponsored by: iXsystems Inc Reported by: Emrion Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c == --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 31 21:53:03 2019(r343622) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 31 22:06:46 2019(r343623) @@ -144,7 +144,7 @@ zfs_getquota(zfsvfs_t *zfsvfs, uid_t id, int isgroup, quotaobj = isgroup ? zfsvfs->z_groupquota_obj : zfsvfs->z_userquota_obj; if (quotaobj == 0 || zfsvfs->z_replay) { - error = ENOENT; + error = EINVAL; goto done; } (void)sprintf(buf, "%llx", (longlong_t)id); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r343624 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: sef Date: Thu Jan 31 22:08:02 2019 New Revision: 343624 URL: https://svnweb.freebsd.org/changeset/base/343624 Log: MFC r342928: Change ZFS quotas to return EINVAL when not present (matches man page). Approved by: mav Reviewed by: markj PR: 234413 Sponsored by: iXsystems Inc Reported by: Emrion Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c == --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 31 22:06:46 2019(r343623) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 31 22:08:02 2019(r343624) @@ -140,7 +140,7 @@ zfs_getquota(zfsvfs_t *zfsvfs, uid_t id, int isgroup, quotaobj = isgroup ? zfsvfs->z_groupquota_obj : zfsvfs->z_userquota_obj; if (quotaobj == 0 || zfsvfs->z_replay) { - error = ENOENT; + error = EINVAL; goto done; } (void)sprintf(buf, "%llx", (longlong_t)id); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r343881 - head/lib/libutil
Author: sef Date: Thu Feb 7 21:51:39 2019 New Revision: 343881 URL: https://svnweb.freebsd.org/changeset/base/343881 Log: r339008 broke repquota for UFS. This rectifies that. Refactor the function calls and tests so that, on UFS, the proper fields are filled out. PR: 233849 Reported by: Andre Albsmeier Reviewed by: mav, delphij MFC after:1 month Sponsored by: iXsystems Inc Differential Revision:https://reviews.freebsd.org/D18785 Modified: head/lib/libutil/quotafile.c Modified: head/lib/libutil/quotafile.c == --- head/lib/libutil/quotafile.cThu Feb 7 21:41:27 2019 (r343880) +++ head/lib/libutil/quotafile.cThu Feb 7 21:51:39 2019 (r343881) @@ -119,6 +119,7 @@ quota_open(struct fstab *fs, int quotatype, int openfl struct group *grp; struct stat st; int qcmd, serrno; + int ufs; if ((qf = calloc(1, sizeof(*qf))) == NULL) return (NULL); @@ -129,15 +130,21 @@ quota_open(struct fstab *fs, int quotatype, int openfl goto error; qf->dev = st.st_dev; qcmd = QCMD(Q_GETQUOTASIZE, quotatype); + ufs = strcmp(fs->fs_vfstype, "ufs") == 0; + /* +* On UFS, hasquota() fills in qf->qfname. But we only care about +* this for UFS. So we need to call hasquota() for UFS, first. +*/ + if (ufs) { + serrno = hasquota(fs, quotatype, qf->qfname, + sizeof(qf->qfname)); + } if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0) return (qf); - /* We only check the quota file for ufs */ - if (strcmp(fs->fs_vfstype, "ufs")) { + if (!ufs) { errno = 0; goto error; - } - serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname)); - if (serrno == 0) { + } else if (serrno == 0) { errno = EOPNOTSUPP; goto error; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r343882 - head/lib/libutil
Author: sef Date: Thu Feb 7 22:10:20 2019 New Revision: 343882 URL: https://svnweb.freebsd.org/changeset/base/343882 Log: r343881 had an uninitialized error. This fixes that. PR: 233849 Reported by:Andre Albsmeier MFC after: 1 month Sponsored by: iXsystems Inc Differential Revision: https://reviews.freebsd.org/D18785 Modified: head/lib/libutil/quotafile.c Modified: head/lib/libutil/quotafile.c == --- head/lib/libutil/quotafile.cThu Feb 7 21:51:39 2019 (r343881) +++ head/lib/libutil/quotafile.cThu Feb 7 22:10:20 2019 (r343882) @@ -118,7 +118,7 @@ quota_open(struct fstab *fs, int quotatype, int openfl struct dqhdr64 dqh; struct group *grp; struct stat st; - int qcmd, serrno; + int qcmd, serrno = 0; int ufs; if ((qf = calloc(1, sizeof(*qf))) == NULL) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344140 - in head/sys: conf modules/crypto opencrypto
+ ctx->authDataCount >= ctx->authDataLength) { + /* +* We're done with this block, so we +* xor staging_block with block, and then +* encrypt it. +*/ + xor_and_encrypt(ctx, ctx->staging_block, ctx->block); + bzero(ctx->staging_block, sizeof(ctx->staging_block)); + ctx->blockIndex = 0; + } + } + return (0); + } + /* +* If we're here, then we're encoding payload data. +* This is marginally easier, except that _Update can +* be called with non-aligned update lengths. As a result, +* we still need to use the staging block. +*/ + KASSERT((length + ctx->cryptDataCount) <= ctx->cryptDataLength, + ("More encryption data than allowed")); + + while (length) { + uint8_t *ptr; + + copy_amt = MIN(sizeof(ctx->staging_block) - ctx->blockIndex, + length); + ptr = ctx->staging_block + ctx->blockIndex; + bcopy(data, ptr, copy_amt); + data += copy_amt; + ctx->blockIndex += copy_amt; + ctx->cryptDataCount += copy_amt; + length -= copy_amt; + if (ctx->blockIndex == sizeof(ctx->staging_block)) { + /* We've got a full block */ + xor_and_encrypt(ctx, ctx->staging_block, ctx->block); + ctx->blockIndex = 0; + bzero(ctx->staging_block, sizeof(ctx->staging_block)); + } + } + return (0); +} + +void +AES_CBC_MAC_Final(uint8_t *buf, struct aes_cbc_mac_ctx *ctx) +{ + uint8_t s0[CCM_CBC_BLOCK_LEN]; + + /* +* We first need to check to see if we've got any data +* left over to encrypt. +*/ + if (ctx->blockIndex != 0) { + xor_and_encrypt(ctx, ctx->staging_block, ctx->block); + ctx->cryptDataCount += ctx->blockIndex; + ctx->blockIndex = 0; + explicit_bzero(ctx->staging_block, sizeof(ctx->staging_block)); + } + bzero(s0, sizeof(s0)); + s0[0] = (15 - ctx->nonceLength) - 1; + bcopy(ctx->nonce, s0 + 1, ctx->nonceLength); + rijndaelEncrypt(ctx->keysched, ctx->rounds, s0, s0); + for (size_t indx = 0; indx < AES_CBC_MAC_HASH_LEN; indx++) + buf[indx] = ctx->block[indx] ^ s0[indx]; + explicit_bzero(s0, sizeof(s0)); +} Added: head/sys/opencrypto/cbc_mac.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/opencrypto/cbc_mac.h Fri Feb 15 03:46:39 2019 (r344140) @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014 The FreeBSD Foundation + * Copyright (c) 2018, iXsystems Inc. + * All rights reserved. + * + * This software was developed by Sean Eric Fagan, with lots of references + * to existing AES-CCM (gmac) code. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#ifndef _CBC_CCM_H +# define _CBC_CCM_H + +# include +# include + +# define CCM_CBC_BLOCK_LEN 16 /* 128 bits */ +# define CCM_CBC_MAX_DIGEST_LEN16 +# define CCM_CBC_MIN_DIGEST_LEN4 + +/* + * This is the aut
svn commit: r344141 - in head: sys/opencrypto tools/tools/crypto
Author: sef Date: Fri Feb 15 03:53:03 2019 New Revision: 344141 URL: https://svnweb.freebsd.org/changeset/base/344141 Log: Add AES-CCM encryption, and plumb into OCF. This commit essentially has three parts: * Add the AES-CCM encryption hooks. This is in and of itself fairly small, as there is only a small difference between CCM and the other ICM-based algorithms. * Hook the code into the OpenCrypto framework. This is the bulk of the changes, as the algorithm type has to be checked for, and the differences between it and GCM dealt with. * Update the cryptocheck tool to be aware of it. This is invaluable for confirming that the code works. This is a software-only implementation, meaning that the performance is very low. Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D19090 Modified: head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/xform_aes_icm.c head/sys/opencrypto/xform_auth.h head/sys/opencrypto/xform_enc.h head/tools/tools/crypto/cryptocheck.c Modified: head/sys/opencrypto/cryptodev.c == --- head/sys/opencrypto/cryptodev.c Fri Feb 15 03:46:39 2019 (r344140) +++ head/sys/opencrypto/cryptodev.c Fri Feb 15 03:53:03 2019 (r344141) @@ -444,6 +444,9 @@ cryptof_ioctl( case CRYPTO_CHACHA20: txform = &enc_xform_chacha20; break; + case CRYPTO_AES_CCM_16: + txform = &enc_xform_ccm; + break; default: CRYPTDEB("invalid cipher"); @@ -488,6 +491,25 @@ cryptof_ioctl( thash = &auth_hash_nist_gmac_aes_256; break; + case CRYPTO_AES_CCM_CBC_MAC: + switch (sop->keylen) { + case 16: + thash = &auth_hash_ccm_cbc_mac_128; + break; + case 24: + thash = &auth_hash_ccm_cbc_mac_192; + break; + case 32: + thash = &auth_hash_ccm_cbc_mac_256; + break; + default: + CRYPTDEB("Invalid CBC MAC key size %d", + sop->keylen); + SDT_PROBE1(opencrypto, dev, ioctl, + error, __LINE__); + return (EINVAL); + } + break; #ifdef notdef case CRYPTO_MD5: thash = &auth_hash_md5; @@ -1003,12 +1025,13 @@ cryptodev_aead( } /* -* For GCM, crd_len covers only the AAD. For other ciphers +* For GCM/CCM, crd_len covers only the AAD. For other ciphers * chained with an HMAC, crd_len covers both the AAD and the * cipher text. */ crda->crd_skip = 0; - if (cse->cipher == CRYPTO_AES_NIST_GCM_16) + if (cse->cipher == CRYPTO_AES_NIST_GCM_16 || + cse->cipher == CRYPTO_AES_CCM_16) crda->crd_len = caead->aadlen; else crda->crd_len = caead->aadlen + caead->len; Modified: head/sys/opencrypto/cryptodev.h == --- head/sys/opencrypto/cryptodev.h Fri Feb 15 03:46:39 2019 (r344140) +++ head/sys/opencrypto/cryptodev.h Fri Feb 15 03:53:03 2019 (r344141) @@ -133,6 +133,7 @@ #defineARC4_IV_LEN 1 #defineAES_GCM_IV_LEN 12 +#defineAES_CCM_IV_LEN 12 #defineAES_XTS_IV_LEN 8 #defineAES_XTS_ALPHA 0x87/* GF(2^128) generator polynomial */ @@ -204,7 +205,8 @@ #defineCRYPTO_SHA2_512 37 #defineCRYPTO_POLY1305 38 #defineCRYPTO_AES_CCM_CBC_MAC 39 /* auth side */ -#defineCRYPTO_ALGORITHM_MAX39 /* Keep updated - see below */ +#defineCRYPTO_AES_CCM_16 40 /* cipher side */ +#defineCRYPTO_ALGORITHM_MAX40 /* Keep updated - see below */ #defineCRYPTO_ALGO_VALID(x)((x) >= CRYPTO_ALGORITHM_MIN && \ (x) <= CRYPTO_ALGORITHM_MAX) Modified: head/sys/opencrypto/cryptosoft.c == --- head/sys/opencrypto/cryptosoft.cFri Feb 15 03:46:39 2019 (r344140) +++ head/sys/opencrypto/cryptosoft.cFri Feb 15 03:53:03 2019 (r344141) @@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include "cryptodev_if.h" +_Static_assert(AES_CCM_IV_LEN ==
svn commit: r344142 - head/sys/opencrypto
Author: sef Date: Fri Feb 15 04:01:59 2019 New Revision: 344142 URL: https://svnweb.freebsd.org/changeset/base/344142 Log: Pasting in a source control line missed the last quote. Fixed. Modified: head/sys/opencrypto/cbc_mac.c Modified: head/sys/opencrypto/cbc_mac.c == --- head/sys/opencrypto/cbc_mac.c Fri Feb 15 03:53:03 2019 (r344141) +++ head/sys/opencrypto/cbc_mac.c Fri Feb 15 04:01:59 2019 (r344142) @@ -23,7 +23,7 @@ */ #include -__FBSDID("$FreeBSD$); +__FBSDID("$FreeBSD$"); #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344143 - head/sys/opencrypto
Author: sef Date: Fri Feb 15 04:15:43 2019 New Revision: 344143 URL: https://svnweb.freebsd.org/changeset/base/344143 Log: Fix another issue from r344141, having to do with size of a shift amount. This did not show up in my testing. Differential Revision:https://reviews.freebsd.org/D18592 Modified: head/sys/opencrypto/cbc_mac.c Modified: head/sys/opencrypto/cbc_mac.c == --- head/sys/opencrypto/cbc_mac.c Fri Feb 15 04:01:59 2019 (r344142) +++ head/sys/opencrypto/cbc_mac.c Fri Feb 15 04:15:43 2019 (r344143) @@ -128,7 +128,7 @@ AES_CBC_MAC_Reinit(struct aes_cbc_mac_ctx *ctx, const uint16_t sizeVal = htobe16(ctx->authDataLength); bcopy(&sizeVal, ctx->staging_block, sizeof(sizeVal)); ctx->blockIndex = sizeof(sizeVal); - } else if (ctx->authDataLength < (1UL<<32)) { + } else if (ctx->authDataLength < (1ULL<<32)) { uint32_t sizeVal = htobe32(ctx->authDataLength); ctx->staging_block[0] = 0xff; ctx->staging_block[1] = 0xfe; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344192 - in head: libexec/rc/rc.d usr.sbin/nfsd
Author: sef Date: Sat Feb 16 00:15:54 2019 New Revision: 344192 URL: https://svnweb.freebsd.org/changeset/base/344192 Log: Add support for a virtual hostname to nfsd Specifically, this allows (via "-V vhostname") telling nfsd what principal to use, instead of the hostname. This is used at iXsystems for fail-over in HA systems. Reviewed by: macklem Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D19191 Modified: head/libexec/rc/rc.d/nfsd head/usr.sbin/nfsd/nfsd.8 head/usr.sbin/nfsd/nfsd.c Modified: head/libexec/rc/rc.d/nfsd == --- head/libexec/rc/rc.d/nfsd Sat Feb 16 00:15:02 2019(r344191) +++ head/libexec/rc/rc.d/nfsd Sat Feb 16 00:15:54 2019(r344192) @@ -13,6 +13,7 @@ name="nfsd" desc="Remote NFS server" rcvar="nfs_server_enable" command="/usr/sbin/${name}" +nfs_server_vhost="" load_rc_config $name start_precmd="nfsd_precmd" @@ -20,6 +21,7 @@ sig_stop="USR1" nfsd_precmd() { + local _vhost rc_flags="${nfs_server_flags}" # Load the modules now, so that the vfs.nfsd sysctl @@ -46,6 +48,9 @@ nfsd_precmd() force_depend rpcbind || return 1 force_depend mountd || return 1 + if [ -n "${nfs_server_vhost}" ]; then + command_args="-V \"${nfs_server_vhost}\"" + fi } run_rc_command "$1" Modified: head/usr.sbin/nfsd/nfsd.8 == --- head/usr.sbin/nfsd/nfsd.8 Sat Feb 16 00:15:02 2019(r344191) +++ head/usr.sbin/nfsd/nfsd.8 Sat Feb 16 00:15:54 2019(r344192) @@ -28,7 +28,7 @@ .\"@(#)nfsd.8 8.4 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd August 5, 2018 +.Dd February 14, 2019 .Dt NFSD 8 .Os .Sh NAME @@ -43,6 +43,7 @@ server .Op Fl h Ar bindip .Op Fl p Ar pnfs_setup .Op Fl m Ar mirror_level +.Op Fl V Ar virtual_hostname .Op Fl Fl maxthreads Ar max_threads .Op Fl Fl minthreads Ar min_threads .Sh DESCRIPTION @@ -78,6 +79,9 @@ Unregister the service with .Xr rpcbind 8 without creating any servers. +.It Fl V Ar virtual_hostname +Specifies a hostname to be used as a principal name, instead of +the default hostname. .It Fl n Ar threads Specifies how many servers to create. This option is equivalent to specifying .Fl Fl maxthreads Modified: head/usr.sbin/nfsd/nfsd.c == --- head/usr.sbin/nfsd/nfsd.c Sat Feb 16 00:15:02 2019(r344191) +++ head/usr.sbin/nfsd/nfsd.c Sat Feb 16 00:15:54 2019(r344192) @@ -122,7 +122,7 @@ static void nonfs(int); static voidreapchild(int); static int setbindhost(struct addrinfo **ia, const char *bindhost, struct addrinfo hints); -static voidstart_server(int, struct nfsd_nfsd_args *); +static voidstart_server(int, struct nfsd_nfsd_args *, const char *vhost); static voidunregistration(void); static voidusage(void); static voidopen_stable(int *, int *); @@ -176,6 +176,7 @@ main(int argc, char **argv) char **bindhost = NULL; pid_t pid; struct nfsd_nfsd_args nfsdargs; + const char *vhostname = NULL; nfsdargs.mirrorcnt = 1; nfsdargs.addr = NULL; @@ -183,16 +184,24 @@ main(int argc, char **argv) nfsdcnt = DEFNFSDCNT; unregister = reregister = tcpflag = maxsock = 0; bindanyflag = udpflag = connect_type_cnt = bindhostc = 0; - getopt_shortopts = "ah:n:rdtuep:m:"; + getopt_shortopts = "ah:n:rdtuep:m:V:"; getopt_usage = "usage:\n" " nfsd [-ardtue] [-h bindip]\n" " [-n numservers] [--minthreads #] [--maxthreads #]\n" - " [-p/--pnfs dsserver0:/dsserver0-mounted-on-dir,...," - "dsserverN:/dsserverN-mounted-on-dir] [-m mirrorlevel]\n"; + " [-p/--pnfs dsserver0:/dsserver0-mounted-on-dir,...,\n" + " [-V virtual_hostname]\n" + " dsserverN:/dsserverN-mounted-on-dir] [-m mirrorlevel]\n"; while ((ch = getopt_long(argc, argv, getopt_shortopts, longopts, &longindex)) != -1) switch (ch) { + case 'V': + if (strlen(optarg) <= MAXHOSTNAMELEN) + vhostname = optarg; + else + warnx("Virtual host name (%s) is too long", + optarg); + break; case 'a': bindanyflag = 1; break; @@ -473,7 +482,7 @@ main(int argc, char **argv) } else { (void)signal(SIGUSR1, child_cleanup); setproctitle("server"); - start_server(0, &nfsdargs); + start_server(0, &nfs
svn commit: r344294 - head/lib/libc/posix1e
Author: sef Date: Tue Feb 19 19:15:15 2019 New Revision: 344294 URL: https://svnweb.freebsd.org/changeset/base/344294 Log: Remove some redundant code in _posix1e_acl_strip_np This was discovered through examination -- acl_copy_entry() copies the tag type and permset fields. Reviewed by: trasz, pfg Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D19240 Modified: head/lib/libc/posix1e/acl_strip.c Modified: head/lib/libc/posix1e/acl_strip.c == --- head/lib/libc/posix1e/acl_strip.c Tue Feb 19 19:13:48 2019 (r344293) +++ head/lib/libc/posix1e/acl_strip.c Tue Feb 19 19:15:15 2019 (r344294) @@ -70,7 +70,6 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculat { acl_t acl_new, acl_old; acl_entry_t entry, entry_new; - acl_permset_t perm; acl_tag_t tag; int entry_id, have_mask_entry; @@ -104,15 +103,7 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculat case ACL_USER_OBJ: case ACL_GROUP_OBJ: case ACL_OTHER: - if (acl_get_tag_type(entry, &tag) == -1) - goto fail; - if (acl_get_permset(entry, &perm) == -1) - goto fail; if (acl_create_entry(&acl_new, &entry_new) == -1) - goto fail; - if (acl_set_tag_type(entry_new, tag) == -1) - goto fail; - if (acl_set_permset(entry_new, perm) == -1) goto fail; if (acl_copy_entry(entry_new, entry) == -1) goto fail; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344388 - head/tools/tools/crypto
Author: sef Date: Wed Feb 20 21:24:56 2019 New Revision: 344388 URL: https://svnweb.freebsd.org/changeset/base/344388 Log: It turns out that setting the IV length is necessary with CCM in OpenSSL. This adds that back. Reviewed by: cem Modified: head/tools/tools/crypto/cryptocheck.c Modified: head/tools/tools/crypto/cryptocheck.c == --- head/tools/tools/crypto/cryptocheck.c Wed Feb 20 21:07:09 2019 (r344387) +++ head/tools/tools/crypto/cryptocheck.c Wed Feb 20 21:24:56 2019 (r344388) @@ -1185,6 +1185,9 @@ openssl_ccm_encrypt(struct alg *alg, const EVP_CIPHER if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1) errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_IVLEN, iv_len, NULL) != 1) + errx(1, "OpenSSL %s (%zu) setting iv length failed: %s", alg->name, + size, ERR_error_string(ERR_get_error(), NULL)); if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, AES_CBC_MAC_HASH_LEN, NULL) != 1) errx(1, "OpenSSL %s (%zu) setting tag length failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344402 - in head: sys/kgssapi usr.sbin/gssd
Author: sef Date: Thu Feb 21 01:30:37 2019 New Revision: 344402 URL: https://svnweb.freebsd.org/changeset/base/344402 Log: * Handle SIGPIPE in gssd We've got some cases where the other end of gssd's AF_LOCAL socket gets closed, resulting in an error (and SIGPIPE) when it tries to do I/O to it. Closing without cleaning up means the next time nfsd starts up, it hangs, unkillably; this allows gssd to handle that particular error. * Limit the retry cound in gssd_syscall to 5. The default is INT_MAX, which effectively means forever. And it's an uninterruptable RPC call, so it will never stop. The two changes mitigate the problem. Reviewed by: macklem MFC after:2 weeks Sponsored by: iXsystems Inc. Differential Revision:https://reviews.freebsd.org/D19153 Modified: head/sys/kgssapi/gss_impl.c head/usr.sbin/gssd/gssd.c Modified: head/sys/kgssapi/gss_impl.c == --- head/sys/kgssapi/gss_impl.c Thu Feb 21 00:44:26 2019(r344401) +++ head/sys/kgssapi/gss_impl.c Thu Feb 21 01:30:37 2019(r344402) @@ -112,6 +112,15 @@ sys_gssd_syscall(struct thread *td, struct gssd_syscal cl = clnt_reconnect_create(nconf, (struct sockaddr *) &sun, GSSD, GSSDVERS, RPC_MAXDATASIZE, RPC_MAXDATASIZE); + /* +* The number of retries defaults to INT_MAX, which effectively +* means an infinite, uninterruptable loop. Limiting it to +* five retries keeps it from running forever. +*/ + if (cl != NULL) { + int retry_count = 5; + CLNT_CONTROL(cl, CLSET_RETRIES, &retry_count); + } } else cl = NULL; Modified: head/usr.sbin/gssd/gssd.c == --- head/usr.sbin/gssd/gssd.c Thu Feb 21 00:44:26 2019(r344401) +++ head/usr.sbin/gssd/gssd.c Thu Feb 21 01:30:37 2019(r344402) @@ -202,6 +202,7 @@ main(int argc, char **argv) signal(SIGHUP, SIG_IGN); } signal(SIGTERM, gssd_terminate); + signal(SIGPIPE, gssd_terminate); memset(&sun, 0, sizeof sun); sun.sun_family = AF_LOCAL; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344451 - head/usr.sbin/nfsd
Author: sef Date: Thu Feb 21 22:49:39 2019 New Revision: 344451 URL: https://svnweb.freebsd.org/changeset/base/344451 Log: Fix the usage error I introduced in r344192. Specifically, I put the new option line in the wrong place, and then fixed up the rest without realizing it. This puts the usage statement back to what it was, with an additional line for the new -V option. Reported by: mav Sponsored by: iXsystems Inc. Modified: head/usr.sbin/nfsd/nfsd.c Modified: head/usr.sbin/nfsd/nfsd.c == --- head/usr.sbin/nfsd/nfsd.c Thu Feb 21 22:49:21 2019(r344450) +++ head/usr.sbin/nfsd/nfsd.c Thu Feb 21 22:49:39 2019(r344451) @@ -189,9 +189,9 @@ main(int argc, char **argv) "usage:\n" " nfsd [-ardtue] [-h bindip]\n" " [-n numservers] [--minthreads #] [--maxthreads #]\n" - " [-p/--pnfs dsserver0:/dsserver0-mounted-on-dir,...,\n" - " [-V virtual_hostname]\n" - " dsserverN:/dsserverN-mounted-on-dir] [-m mirrorlevel]\n"; + " [-p/--pnfs dsserver0:/dsserver0-mounted-on-dir,...," + "dsserverN:/dsserverN-mounted-on-dir] [-m mirrorlevel]\n" + " [-V virtual_hostname]\n"; while ((ch = getopt_long(argc, argv, getopt_shortopts, longopts, &longindex)) != -1) switch (ch) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344547 - head/sys/opencrypto
Author: sef Date: Mon Feb 25 19:14:16 2019 New Revision: 344547 URL: https://svnweb.freebsd.org/changeset/base/344547 Log: Fix another bug introduced during the review process of r344140: the tag wasn't being computed properly due to chaning a >= comparison to an == comparison. Specifically: CBC-MAC encodes the length of the authorization data into the the stream to be encrypted/hashed. For short data, this is two bytes (big-endian 16 bit value); for larger data, it's 6 bytes (a prefix of 0xff, 0xfe, followed by a 32-bit big-endian length). And there's a larger size, which is 10 bytes. These extra bytes weren't being accounted for with the post-review code. The other bit that then came into play was that OCF only calls the Update code with blksiz=16, which meant that I had to ignore the length variable. (It also means that it can't be called with a single buffer containing the AAD and payload; however, OCF doesn't do this for the software-only algorithsm.) I tested with this script: ALG=aes-ccm DEV=soft for aad in 0 1 2 3 4 14 16 24 30 32 34 36 1020 do for dln in 16 32 1024 2048 10240 do echo "Testing AAD length ${aad} data length ${dln}" /root/cryptocheck -A ${aad} -a ${ALG} -d ${DEV} ${dln} done done Reviewed by: cem Sponsored by: iXsystems Inc. Modified: head/sys/opencrypto/cbc_mac.c Modified: head/sys/opencrypto/cbc_mac.c == --- head/sys/opencrypto/cbc_mac.c Mon Feb 25 19:07:52 2019 (r344546) +++ head/sys/opencrypto/cbc_mac.c Mon Feb 25 19:14:16 2019 (r344547) @@ -124,23 +124,31 @@ AES_CBC_MAC_Reinit(struct aes_cbc_mac_ctx *ctx, const rijndaelEncrypt(ctx->keysched, ctx->rounds, b0, ctx->block); /* If there is auth data, we need to set up the staging block */ if (ctx->authDataLength) { + size_t addLength; if (ctx->authDataLength < ((1<<16) - (1<<8))) { uint16_t sizeVal = htobe16(ctx->authDataLength); bcopy(&sizeVal, ctx->staging_block, sizeof(sizeVal)); - ctx->blockIndex = sizeof(sizeVal); + addLength = sizeof(sizeVal); } else if (ctx->authDataLength < (1ULL<<32)) { uint32_t sizeVal = htobe32(ctx->authDataLength); ctx->staging_block[0] = 0xff; ctx->staging_block[1] = 0xfe; bcopy(&sizeVal, ctx->staging_block+2, sizeof(sizeVal)); - ctx->blockIndex = 2 + sizeof(sizeVal); + addLength = 2 + sizeof(sizeVal); } else { uint64_t sizeVal = htobe64(ctx->authDataLength); ctx->staging_block[0] = 0xff; ctx->staging_block[1] = 0xff; bcopy(&sizeVal, ctx->staging_block+2, sizeof(sizeVal)); - ctx->blockIndex = 2 + sizeof(sizeVal); + addLength = 2 + sizeof(sizeVal); } + ctx->blockIndex = addLength; + /* +* The length descriptor goes into the AAD buffer, so we +* need to account for it. +*/ + ctx->authDataLength += addLength; + ctx->authDataCount = addLength; } } @@ -181,10 +189,9 @@ AES_CBC_MAC_Update(struct aes_cbc_mac_ctx *ctx, const ctx->authDataCount += copy_amt; ctx->blockIndex += copy_amt; ctx->blockIndex %= sizeof(ctx->staging_block); - if (ctx->authDataCount == ctx->authDataLength) - length = 0; + if (ctx->blockIndex == 0 || - ctx->authDataCount >= ctx->authDataLength) { + ctx->authDataCount == ctx->authDataLength) { /* * We're done with this block, so we * xor staging_block with block, and then @@ -193,8 +200,17 @@ AES_CBC_MAC_Update(struct aes_cbc_mac_ctx *ctx, const xor_and_encrypt(ctx, ctx->staging_block, ctx->block); bzero(ctx->staging_block, sizeof(ctx->staging_block)); ctx->blockIndex = 0; + if (ctx->authDataCount >= ctx->authDataLength) + break; } } + /* +* We'd like to be able to check length == 0 and return +* here, but the way OCF calls us, length is always +* blksize (16, in this case). So we have to count on +* the
svn commit: r348268 - in head/sys: conf crypto/aesni modules/aesni
Author: sef Date: Sat May 25 07:26:30 2019 New Revision: 348268 URL: https://svnweb.freebsd.org/changeset/base/348268 Log: Add an AESNI-optimized version of the CCM/CBC cryptographic and authentication code. The primary client of this is probably going to be ZFS encryption. Reviewed by: jhb, cem Sponsored by: iXsystems Inc, Kithrup Enterprises Differential Revision:https://reviews.freebsd.org/D19298 Added: head/sys/crypto/aesni/aesni_ccm.c (contents, props changed) Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/crypto/aesni/aesni.c head/sys/crypto/aesni/aesni.h head/sys/crypto/aesni/aesni_wrap.c head/sys/modules/aesni/Makefile Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Sat May 25 04:56:06 2019(r348267) +++ head/sys/conf/files.amd64 Sat May 25 07:26:30 2019(r348268) @@ -175,6 +175,11 @@ aesni_ghash.o optional aesni \ compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ no-implicit-rule\ clean "aesni_ghash.o" +aesni_ccm.ooptional aesni \ + dependency "$S/crypto/aesni/aesni_ccm.c" \ + compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ + no-implicit-rule\ + clean "aesni_ccm.o" aesni_wrap.o optional aesni \ dependency "$S/crypto/aesni/aesni_wrap.c" \ compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes ${.IMPSRC}" \ Modified: head/sys/conf/files.i386 == --- head/sys/conf/files.i386Sat May 25 04:56:06 2019(r348267) +++ head/sys/conf/files.i386Sat May 25 07:26:30 2019(r348268) @@ -127,6 +127,11 @@ aesni_ghash.o optional aesni \ compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ no-implicit-rule\ clean "aesni_ghash.o" +aesni_ccm.ooptional aesni \ + dependency "$S/crypto/aesni/aesni_ccm.c" \ + compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ + no-implicit-rule\ + clean "aesni_ccm.o" aesni_wrap.o optional aesni \ dependency "$S/crypto/aesni/aesni_wrap.c" \ compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes ${.IMPSRC}" \ Modified: head/sys/crypto/aesni/aesni.c == --- head/sys/crypto/aesni/aesni.c Sat May 25 04:56:06 2019 (r348267) +++ head/sys/crypto/aesni/aesni.c Sat May 25 07:26:30 2019 (r348268) @@ -132,9 +132,10 @@ aesni_probe(device_t dev) return (EINVAL); } else if (has_aes && has_sha) device_set_desc(dev, - "AES-CBC,AES-XTS,AES-GCM,AES-ICM,SHA1,SHA256"); + "AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS,SHA1,SHA256"); else if (has_aes) - device_set_desc(dev, "AES-CBC,AES-XTS,AES-GCM,AES-ICM"); + device_set_desc(dev, + "AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS"); else device_set_desc(dev, "SHA1,SHA256"); @@ -194,6 +195,8 @@ aesni_attach(device_t dev) crypto_register(sc->cid, CRYPTO_AES_192_NIST_GMAC, 0, 0); crypto_register(sc->cid, CRYPTO_AES_256_NIST_GMAC, 0, 0); crypto_register(sc->cid, CRYPTO_AES_XTS, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_CCM_16, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_CCM_CBC_MAC, 0, 0); } if (sc->has_sha) { crypto_register(sc->cid, CRYPTO_SHA1, 0, 0); @@ -227,6 +230,7 @@ aesni_newsession(device_t dev, crypto_session_t cses, struct aesni_session *ses; struct cryptoini *encini, *authini; bool gcm_hash, gcm; + bool cbc_hash, ccm; int error; KASSERT(cses != NULL, ("EDOOFUS")); @@ -243,10 +
svn commit: r348664 - head/usr.bin/calendar/calendars
Author: sef Date: Tue Jun 4 19:06:33 2019 New Revision: 348664 URL: https://svnweb.freebsd.org/changeset/base/348664 Log: Add my birthday entry, per Kirk's request Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd == --- head/usr.bin/calendar/calendars/calendar.freebsdTue Jun 4 19:06:24 2019(r348663) +++ head/usr.bin/calendar/calendars/calendar.freebsdTue Jun 4 19:06:33 2019(r348664) @@ -469,6 +469,7 @@ 12/28 Soren Schmidt born in Maribo, Denmark, 1960 12/28 Ade Lovett born in London, England, 1969 12/28 Marius Strobl born in Cham, Bavaria, Germany, 1978 +12/30 Sean Eric Fagan born in Los Angeles, California, United States, 1967 12/31 Edwin Groothuis born in Geldrop, the Netherlands, 1970 12/31 Fourth quarter status reports are due on 01/15 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341170 - stable/12/usr.sbin/mountd
Author: sef Date: Thu Nov 29 01:04:24 2018 New Revision: 341170 URL: https://svnweb.freebsd.org/changeset/base/341170 Log: MFC r340442 mountd has no way to configure the listen queue depth; rather than add a new option, we pass -1 down to listen, which causes it to use the kern.ipc.soacceptqueue sysctl. Approved by: mav Sponsored by: iXsystems Inc Modified: stable/12/usr.sbin/mountd/mountd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mountd/mountd.c == --- stable/12/usr.sbin/mountd/mountd.c Thu Nov 29 01:02:52 2018 (r341169) +++ stable/12/usr.sbin/mountd/mountd.c Thu Nov 29 01:04:24 2018 (r341170) @@ -908,8 +908,12 @@ complete_service(struct netconfig *nconf, char *port_s if (fd < 0) continue; + /* +* Using -1 tells listen(2) to use +* kern.ipc.soacceptqueue for the backlog. +*/ if (nconf->nc_semantics != NC_TPI_CLTS) - listen(fd, SOMAXCONN); + listen(fd, -1); if (nconf->nc_semantics == NC_TPI_CLTS ) transp = svc_dg_create(fd, 0, 0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341171 - stable/11/usr.sbin/mountd
Author: sef Date: Thu Nov 29 01:05:21 2018 New Revision: 341171 URL: https://svnweb.freebsd.org/changeset/base/341171 Log: MFC r340442 mountd has no way to configure the listen queue depth; rather than add a new option, we pass -1 down to listen, which causes it to use the kern.ipc.soacceptqueue sysctl. Approved by: mav Sponsored by: iXsystems Inc Modified: stable/11/usr.sbin/mountd/mountd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mountd/mountd.c == --- stable/11/usr.sbin/mountd/mountd.c Thu Nov 29 01:04:24 2018 (r341170) +++ stable/11/usr.sbin/mountd/mountd.c Thu Nov 29 01:05:21 2018 (r341171) @@ -906,8 +906,12 @@ complete_service(struct netconfig *nconf, char *port_s if (fd < 0) continue; + /* +* Using -1 tells listen(2) to use +* kern.ipc.soacceptqueue for the backlog. +*/ if (nconf->nc_semantics != NC_TPI_CLTS) - listen(fd, SOMAXCONN); + listen(fd, -1); if (nconf->nc_semantics == NC_TPI_CLTS ) transp = svc_dg_create(fd, 0, 0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341641 - head/usr.sbin/mountd
Author: sef Date: Thu Dec 6 18:21:48 2018 New Revision: 341641 URL: https://svnweb.freebsd.org/changeset/base/341641 Log: Reduce number of DNS queries in mountd. As reported by a FreeNAS user (see https://redmine.ixsystems.com/issues/55728), mountd does more calls to getnameinfo() than it needs to; this changes it to only call it for the RPC calls it needs the name information for. Reported by: Dave Flowers Reviewed by: imp, mav Approved by: mav (mentor) MFC after:2 weeks Sponsored by: iXsystems Inc Differential Revision:https://reviews.freebsd.org/D18430 Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c == --- head/usr.sbin/mountd/mountd.c Thu Dec 6 18:12:50 2018 (r341640) +++ head/usr.sbin/mountd/mountd.c Thu Dec 6 18:21:48 2018 (r341641) @@ -1026,8 +1026,13 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp) syslog(LOG_ERR, "request from unknown address family"); return; } - lookup_failed = getnameinfo(saddr, saddr->sa_len, host, sizeof host, - NULL, 0, 0); + switch (rqstp->rq_proc) { + case MOUNTPROC_MNT: + case MOUNTPROC_UMNT: + case MOUNTPROC_UMNTALL: + lookup_failed = getnameinfo(saddr, saddr->sa_len, host, + sizeof host, NULL, 0, 0); + } getnameinfo(saddr, saddr->sa_len, numerichost, sizeof numerichost, NULL, 0, NI_NUMERICHOST); switch (rqstp->rq_proc) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342841 - stable/12/usr.sbin/mountd
Author: sef Date: Mon Jan 7 05:58:55 2019 New Revision: 342841 URL: https://svnweb.freebsd.org/changeset/base/342841 Log: MFC r341641: Reduce number of DNS queries in mountd. Approved by: mav Sponsored by: iXsystems Inc. Modified: stable/12/usr.sbin/mountd/mountd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mountd/mountd.c == --- stable/12/usr.sbin/mountd/mountd.c Mon Jan 7 05:49:27 2019 (r342840) +++ stable/12/usr.sbin/mountd/mountd.c Mon Jan 7 05:58:55 2019 (r342841) @@ -1026,8 +1026,13 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp) syslog(LOG_ERR, "request from unknown address family"); return; } - lookup_failed = getnameinfo(saddr, saddr->sa_len, host, sizeof host, - NULL, 0, 0); + switch (rqstp->rq_proc) { + case MOUNTPROC_MNT: + case MOUNTPROC_UMNT: + case MOUNTPROC_UMNTALL: + lookup_failed = getnameinfo(saddr, saddr->sa_len, host, + sizeof host, NULL, 0, 0); + } getnameinfo(saddr, saddr->sa_len, numerichost, sizeof numerichost, NULL, 0, NI_NUMERICHOST); switch (rqstp->rq_proc) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r342928 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: sef Date: Fri Jan 11 02:53:46 2019 New Revision: 342928 URL: https://svnweb.freebsd.org/changeset/base/342928 Log: Change ZFS quotas to return EINVAL when not present (matches man page). UFS will return EINVAL when quotas are not enabled on a filesystem; ZFS' equivalent involves not having quotas (there is not way to enable or disable quotas as such). My initial implementation had it return ENOENT, but quotactl(2) indicates EINVAL is more appropriate. MFC after:2 weeks Approved by: mav Reviewed by: markj Reported by: Emrion Sponsored by: iXsystems Inc PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234413 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cFri Jan 11 02:09:48 2019(r342927) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cFri Jan 11 02:53:46 2019(r342928) @@ -144,7 +144,7 @@ zfs_getquota(zfsvfs_t *zfsvfs, uid_t id, int isgroup, quotaobj = isgroup ? zfsvfs->z_groupquota_obj : zfsvfs->z_userquota_obj; if (quotaobj == 0 || zfsvfs->z_replay) { - error = ENOENT; + error = EINVAL; goto done; } (void)sprintf(buf, "%llx", (longlong_t)id); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338953 - head/sys/opencrypto
Author: sef Date: Wed Sep 26 20:23:12 2018 New Revision: 338953 URL: https://svnweb.freebsd.org/changeset/base/338953 Log: Add per-session locking to cryptosoft (swcr). As part of ZFS Crypto, I started getting a series of panics when I did not have AESNI loaded. Adding locking fixed it, and I concluded that the Reinit function altered the AES key schedule. This locking is not as fine-grained as it could be (AESNI uses per-cpu locking), but it's minimally invasive. Sponsored by: iXsystems Inc Reviewed by: cem, mav Approved by: re (gjb), mav (mentor) Differential Revision: https://reviews.freebsd.org/D17307 Modified: head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/cryptosoft.h Modified: head/sys/opencrypto/cryptosoft.c == --- head/sys/opencrypto/cryptosoft.cWed Sep 26 19:41:06 2018 (r338952) +++ head/sys/opencrypto/cryptosoft.cWed Sep 26 20:23:12 2018 (r338953) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -765,6 +766,7 @@ swcr_newsession(device_t dev, crypto_session_t cses, s return EINVAL; ses = crypto_get_driver_session(cses); + mtx_init(&ses->swcr_lock, "swcr session lock", NULL, MTX_DEF); for (i = 0; cri != NULL && i < nitems(ses->swcr_algorithms); i++) { swd = &ses->swcr_algorithms[i]; @@ -1022,6 +1024,7 @@ swcr_freesession(device_t dev, crypto_session_t cses) ses = crypto_get_driver_session(cses); + mtx_destroy(&ses->swcr_lock); for (i = 0; i < nitems(ses->swcr_algorithms); i++) { swd = &ses->swcr_algorithms[i]; @@ -1109,7 +1112,7 @@ swcr_freesession(device_t dev, crypto_session_t cses) static int swcr_process(device_t dev, struct cryptop *crp, int hint) { - struct swcr_session *ses; + struct swcr_session *ses = NULL; struct cryptodesc *crd; struct swcr_data *sw; size_t i; @@ -1124,6 +1127,7 @@ swcr_process(device_t dev, struct cryptop *crp, int hi } ses = crypto_get_driver_session(crp->crp_session); + mtx_lock(&ses->swcr_lock); /* Go through crypto descriptors, processing as we go */ for (crd = crp->crp_desc; crd; crd = crd->crd_next) { @@ -1213,6 +1217,8 @@ swcr_process(device_t dev, struct cryptop *crp, int hi } done: + if (ses) + mtx_unlock(&ses->swcr_lock); crypto_done(crp); return 0; } Modified: head/sys/opencrypto/cryptosoft.h == --- head/sys/opencrypto/cryptosoft.hWed Sep 26 19:41:06 2018 (r338952) +++ head/sys/opencrypto/cryptosoft.hWed Sep 26 20:23:12 2018 (r338953) @@ -58,6 +58,7 @@ struct swcr_data { }; struct swcr_session { + struct mtx swcr_lock; struct swcr_data swcr_algorithms[2]; unsigned swcr_nalgs; }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r339008 - in stable/11: include/rpcsvc lib/libutil libexec/rpc.rquotad sys/cddl/contrib/opensolaris/uts/common/fs/zfs usr.bin/quota
Author: sef Date: Sat Sep 29 00:44:23 2018 New Revision: 339008 URL: https://svnweb.freebsd.org/changeset/base/339008 Log: MFC r336017,r338799 r336017 This exposes ZFS user and group quotas via the normal quatactl(2) mechanism. (Read-only at this point, however.) In particular, this is to allow rpc.rquotad query quotas for NFS mounts, allowing users to see their quotas on the hosts using the datasets. The changes specifically: * Add new RPC entry points for querying quotas. * Changes the library routines to allow non-UFS quotas. * Changes rquotad to check for quotas on mounted filesystems, rather than being limited to entries in /etc/fstab * Lastly, adds a VFS entry-point for ZFS to query quotas. Note that this makes one unavoidable behavioural change: if quotas are enabled, then they can be queried, as opposed to the current method of checking for quotas being specified in fstab. (With ZFS, if there are user or group quotas, they're used, always.) r338799 Author: kib Fix ZFS VFS op quotactl to follow busy protocol. Approved by: mav Sponsored by: iXsystems, inc Modified: stable/11/include/rpcsvc/rquota.x stable/11/lib/libutil/quotafile.c stable/11/libexec/rpc.rquotad/rquotad.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/11/usr.bin/quota/quota.c Directory Properties: stable/11/ (props changed) Modified: stable/11/include/rpcsvc/rquota.x == --- stable/11/include/rpcsvc/rquota.x Sat Sep 29 00:35:36 2018 (r339007) +++ stable/11/include/rpcsvc/rquota.x Sat Sep 29 00:44:23 2018 (r339008) @@ -1,24 +1,55 @@ +/* @(#)rquota.x2.1 88/08/01 4.0 RPCSRC */ +/* @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro */ + /* * Remote quota protocol * Requires unix authentication */ #ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ %#include %__FBSDID("$FreeBSD$"); #endif const RQ_PATHLEN = 1024; +struct sq_dqblk { + unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */ + unsigned int rq_bsoftlimit; /* preferred limit on disk blks */ + unsigned int rq_curblocks; /* current block count */ + unsigned int rq_fhardlimit; /* absolute limit on allocated files */ + unsigned int rq_fsoftlimit; /* preferred file limit */ + unsigned int rq_curfiles; /* current # allocated files */ + unsigned int rq_btimeleft; /* time left for excessive disk use */ + unsigned int rq_ftimeleft; /* time left for excessive files */ +}; + struct getquota_args { string gqa_pathp; /* path to filesystem of interest */ - int gqa_uid;/* inquire about quota for uid */ + int gqa_uid;/* Inquire about quota for uid */ }; +struct setquota_args { + int sqa_qcmd; + string sqa_pathp; /* path to filesystem of interest */ + int sqa_id; /* Set quota for uid */ + sq_dqblk sqa_dqblk; +}; + +struct ext_getquota_args { + string gqa_pathp; /* path to filesystem of interest */ + int gqa_type; /* Type of quota info is needed about */ + int gqa_id; /* Inquire about quota for id */ +}; + +struct ext_setquota_args { + int sqa_qcmd; + string sqa_pathp; /* path to filesystem of interest */ + int sqa_id; /* Set quota for id */ + int sqa_type; /* Type of quota to set */ + sq_dqblk sqa_dqblk; +}; + /* * remote quota structure */ @@ -37,7 +68,7 @@ struct rquota { enum gqr_status { Q_OK = 1, /* quota returned */ - Q_NOQUOTA = 2, /* noquota for uid */ + Q_NOQUOTA = 2, /* noquota for uid */ Q_EPERM = 3 /* no permission to access quota */ }; @@ -50,6 +81,15 @@ case Q_EPERM: void; }; +union setquota_rslt switch (gqr_status status) { +case Q_OK: + rquota sqr_rquota; /* valid if status == Q_OK */ +case Q_NOQUOTA: + void; +case Q_EPERM: + void; +}; + program RQUOTAPROG { version RQUOTAVERS { /* @@ -63,5 +103,42 @@ program RQUOTAPROG { */ getquota_rslt RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2; + + /* +* Set all quotas +*/ + setquota_rslt + RQUOTAPROC_SETQUOTA(setquota_args) = 3; + + /* +* Get active quotas only +*/ + setquota_rslt + RQU
svn commit: r339034 - in stable/11: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/op...
Author: sef Date: Mon Oct 1 04:08:47 2018 New Revision: 339034 URL: https://svnweb.freebsd.org/changeset/base/339034 Log: MFC r334844, r336180, r336458 r334844 This originated from ZFS On Linux, as https://github.com/zfsonlinux/zfs/commit/d4a72f23863382bdf6d0ae33196f5b5decbc48fd During scans (scrubs or resilvers), it sorts the blocks in each transaction group by block offset; the result can be a significant improvement. (On my test system just now, which I put some effort to introduce fragmentation into the pool since I set it up yesterday, a scrub went from 1h2m to 33.5m with the changes.) I've seen similar rations on production systems. r336180 Fix up some missed and mis-merges from the sequential scan code (r334844). Most of the changes involve moving some code around to reduce conflicts with future merges. One of the missing changes included a notification on scrub cancellation. r336458 Fix a couple of typos in r334844 noticed by Richard Kojedzinszky Approved by: mav Sponsored by: iXsystems, Inc Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/11/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c stable/11/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/11/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c == --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Oct 1 04:02:00 2018(r339033) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Oct 1 04:08:47 2018(r339034) @@ -2281,14 +2281,14 @@ dump_dir(objset_t *os) object_count++; } - ASSERT3U(object_count, ==, usedobjs); - (void) printf("\n"); if (error != ESRCH) { (void) fprintf(stderr, "dmu_object_next() = %d\n", error); abort(); } + + ASSERT3U(object_count, ==, usedobjs); } static void @@ -2788,6 +2788,7 @@ zdb_blkptr_done(zio_t *zio) mutex_enter(&spa->spa_scrub_lock); spa->spa_scrub_inflight--; + spa->spa_load_verify_ios--; cv_broadcast(&spa->spa_scrub_io_cv); if (ioerr && !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { @@ -2859,9 +2860,10 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr f
svn commit: r334844 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensol...
Author: sef Date: Fri Jun 8 17:38:28 2018 New Revision: 334844 URL: https://svnweb.freebsd.org/changeset/base/334844 Log: This originated from ZFS On Linux, as https://github.com/zfsonlinux/zfs/commit/d4a72f23863382bdf6d0ae33196f5b5decbc48fd During scans (scrubs or resilvers), it sorts the blocks in each transaction group by block offset; the result can be a significant improvement. (On my test system just now, which I put some effort to introduce fragmentation into the pool since I set it up yesterday, a scrub went from 1h2m to 33.5m with the changes.) I've seen similar rations on production systems. Approved by: Alexander Motin Obtained from:ZFS On Linux Relnotes: Yes (improved scrub performance, with tunables) Differential Revision:https://reviews.freebsd.org/D15562 Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c == --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Jun 8 17:37:49 2018 (r334843) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Jun 8 17:38:28 2018 (r334844) @@ -2281,14 +2281,14 @@ dump_dir(objset_t *os) object_count++; } - ASSERT3U(object_count, ==, usedobjs); - (void) printf("\n"); if (error != ESRCH) { (void) fprintf(stderr, "dmu_object_next() = %d\n", error); abort(); } + + ASSERT3U(object_count, ==, usedobjs); } static void @@ -2788,6 +2788,7 @@ zdb_blkptr_done(zio_t *zio) mutex_enter(&spa->spa_scrub_lock); spa->spa_scrub_inflight--; + spa->spa_load_verify_ios--; cv_broadcast(&spa->spa_scrub_io_cv); if (ioerr && !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { @@ -2859,9 +2860,10 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr flags |= ZIO_FLAG_SPECULATIVE; mutex_enter(&spa->spa_scrub_lock); - while (spa->spa_scrub_inflight > max_inflight) + while (spa->spa_load_verify_ios > max_inflight) cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock); spa->spa_scrub_inflight++; + spa->spa_load_verify_ios++; mutex_exit(&spa->spa_scrub_lock); zio_nowait(zio_read(NULL, spa, bp, abd, size, Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ===
svn commit: r351730 - stable/11/lib/libutil
Author: sef Date: Tue Sep 3 04:50:39 2019 New Revision: 351730 URL: https://svnweb.freebsd.org/changeset/base/351730 Log: MFC r343881, r343882 r339008 broke repquota for UFS. This rectifies that. PR: 233849 Modified: stable/11/lib/libutil/quotafile.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libutil/quotafile.c == --- stable/11/lib/libutil/quotafile.c Tue Sep 3 04:16:30 2019 (r351729) +++ stable/11/lib/libutil/quotafile.c Tue Sep 3 04:50:39 2019 (r351730) @@ -116,7 +116,8 @@ quota_open(struct fstab *fs, int quotatype, int openfl struct dqhdr64 dqh; struct group *grp; struct stat st; - int qcmd, serrno; + int qcmd, serrno = 0; + int ufs; if ((qf = calloc(1, sizeof(*qf))) == NULL) return (NULL); @@ -127,15 +128,21 @@ quota_open(struct fstab *fs, int quotatype, int openfl goto error; qf->dev = st.st_dev; qcmd = QCMD(Q_GETQUOTASIZE, quotatype); + ufs = strcmp(fs->fs_vfstype, "ufs") == 0; + /* +* On UFS, hasquota() fills in qf->qfname. But we only care about +* this for UFS. So we need to call hasquota() for UFS, first. +*/ + if (ufs) { + serrno = hasquota(fs, quotatype, qf->qfname, + sizeof(qf->qfname)); + } if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0) return (qf); - /* We only check the quota file for ufs */ - if (strcmp(fs->fs_vfstype, "ufs")) { + if (!ufs) { errno = 0; goto error; - } - serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname)); - if (serrno == 0) { + } else if (serrno == 0) { errno = EOPNOTSUPP; goto error; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344601 - in head/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common
Author: sef Date: Tue Feb 26 19:23:22 2019 New Revision: 344601 URL: https://svnweb.freebsd.org/changeset/base/344601 Log: Set process title during zfs send. This adds a '-V' option to 'zfs send', which sets the process title once a second to the progress information. This code has been in FreeNAS for a long time now; this is just upstreaming it here. It was originially written by delphij. Reviewed by: mav Obtained from:iXsystems, Inc Sponsored by: iXsystems, Inc Differential Revision:https://reviews.freebsd.org/D19184 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 == --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Feb 26 18:30:51 2019 (r344600) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Feb 26 19:23:22 2019 (r344601) @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 11, 2018 +.Dd February 15, 2018 .Dt ZFS 8 .Os .Sh NAME @@ -184,7 +184,7 @@ .Ar bookmark .Nm .Cm send -.Op Fl DLPRcenpv +.Op Fl DLPRVcenpv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm @@ -194,7 +194,7 @@ .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm .Cm send -.Op Fl Penv +.Op Fl PVenv .Fl t Ar receive_resume_token .Nm .Cm receive Ns | Ns Cm recv @@ -2607,7 +2607,7 @@ feature. .It Xo .Nm .Cm send -.Op Fl DLPRcenpv +.Op Fl DLPRVcenpv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Xc @@ -2753,6 +2753,8 @@ Print machine-parsable verbose information about the s .It Fl v, -verbose Print verbose information about the stream package generated. This information includes a per-second report of how much data has been sent. +.It Fl V +Set the process title to a per-second report of how much data has been sent. .El .Pp The format of the stream is committed. You will be able to receive your streams Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c == --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cTue Feb 26 18:30:51 2019(r344600) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cTue Feb 26 19:23:22 2019(r344601) @@ -3813,7 +3813,7 @@ zfs_do_send(int argc, char **argv) }; /* check options */ - while ((c = getopt_long(argc, argv, ":i:I:RbDpvnPLet:c", long_options, + while ((c = getopt_long(argc, argv, ":i:I:RbDpVvnPLet:c", long_options, NULL)) != -1) { switch (c) { case 'i': @@ -3836,6 +3836,10 @@ zfs_do_send(int argc, char **argv) case 'P': flags.parsable = B_TRUE; flags.verbose = B_TRUE; + break; + case 'V': + flags.progress = B_TRUE; + flags.progressastitle = B_TRUE; break; case 'v': if (flags.verbose) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h == --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hTue Feb 26 18:30:51 2019(r344600) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hTue Feb 26 19:23:22 2019(r344601) @@ -651,6 +651,9 @@ typedef struct sendflags { /* compressed WRITE records are permitted */ boolean_t compress; + + /* show progress as process title(ie. -V) */ + boolean_t progressastitle; } sendflags_t; typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c == --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Feb 26 18:30:51 2019(r344600) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Feb 26 19:23:22 2019(r344601) @@ -85,6 +85,8 @@ typedef struct progress_arg { zfs_handle_t *pa_zhp; int pa_fd; boolean_t pa_parsable; + boolean_t pa_astitle; + uint64_t pa_size; } progress_arg_t; typedef struct dataref { @@ -930,6 +932,7 @@ typedef struct send_dump_data { uint64_t prevsnap_obj; boolean_t seenfrom, seento, replicate, doall, fromorigin; boolean_t verbose, dryrun, parsable, progress, embed_data, std_out; + boolean_t progressastitle; boolean_t large_block, compress; int outfd; boolean_t err; @@ -1110,14 +1113,14 @@ send_progress_thread(void *arg) zfs_cmd_t zc = { 0 }; zfs_handle_t *zhp = pa->pa_zhp;
svn commit: r344630 - head/tools/tools/crypto
Author: sef Date: Wed Feb 27 19:27:16 2019 New Revision: 344630 URL: https://svnweb.freebsd.org/changeset/base/344630 Log: Have cryptocheck toggle kern.cryptodevallowsoft if necessary (this requires root access). Reviewed by: cem, jhb Sponsored by: iXsystems, Inc. Differential Revision:https://reviews.freebsd.org/D19372 Modified: head/tools/tools/crypto/cryptocheck.c Modified: head/tools/tools/crypto/cryptocheck.c == --- head/tools/tools/crypto/cryptocheck.c Wed Feb 27 18:13:41 2019 (r344629) +++ head/tools/tools/crypto/cryptocheck.c Wed Feb 27 19:27:16 2019 (r344630) @@ -111,6 +111,7 @@ */ #include +#include #include #include #include @@ -275,13 +276,41 @@ devcrypto(void) return (fd); } +/* + * Called on exit to change kern.cryptodevallowsoft back to 0 + */ +#define CRYPT_SOFT_ALLOW "kern.cryptodevallowsoft" + +static void +reset_user_soft(void) +{ + int off = 0; + sysctlbyname(CRYPT_SOFT_ALLOW, NULL, NULL, &off, sizeof(off)); +} + +static void +enable_user_soft(void) +{ + int curstate; + int on = 1; + size_t cursize = sizeof(curstate); + + if (sysctlbyname(CRYPT_SOFT_ALLOW, &curstate, &cursize, + &on, sizeof(on)) == 0) { + if (curstate == 0) + atexit(reset_user_soft); + } +} + static int crlookup(const char *devname) { struct crypt_find_op find; - if (strncmp(devname, "soft", 4) == 0) + if (strncmp(devname, "soft", 4) == 0) { + enable_user_soft(); return CRYPTO_FLAG_SOFTWARE; + } find.crid = -1; strlcpy(find.name, devname, sizeof(find.name)); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344997 - stable/12/lib/libutil
Author: sef Date: Mon Mar 11 03:00:33 2019 New Revision: 344997 URL: https://svnweb.freebsd.org/changeset/base/344997 Log: MFC r343881 r339008 broke repquota for UFS. This rectifies that. Refactor the function calls and tests so that, on UFS, the proper fields are filled out. PR: 233849 Modified: stable/12/lib/libutil/quotafile.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libutil/quotafile.c == --- stable/12/lib/libutil/quotafile.c Mon Mar 11 02:57:00 2019 (r344996) +++ stable/12/lib/libutil/quotafile.c Mon Mar 11 03:00:33 2019 (r344997) @@ -119,6 +119,7 @@ quota_open(struct fstab *fs, int quotatype, int openfl struct group *grp; struct stat st; int qcmd, serrno; + int ufs; if ((qf = calloc(1, sizeof(*qf))) == NULL) return (NULL); @@ -129,15 +130,21 @@ quota_open(struct fstab *fs, int quotatype, int openfl goto error; qf->dev = st.st_dev; qcmd = QCMD(Q_GETQUOTASIZE, quotatype); + ufs = strcmp(fs->fs_vfstype, "ufs") == 0; + /* +* On UFS, hasquota() fills in qf->qfname. But we only care about +* this for UFS. So we need to call hasquota() for UFS, first. +*/ + if (ufs) { + serrno = hasquota(fs, quotatype, qf->qfname, + sizeof(qf->qfname)); + } if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0) return (qf); - /* We only check the quota file for ufs */ - if (strcmp(fs->fs_vfstype, "ufs")) { + if (!ufs) { errno = 0; goto error; - } - serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname)); - if (serrno == 0) { + } else if (serrno == 0) { errno = EOPNOTSUPP; goto error; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344995 - in stable/12: sys/kgssapi usr.sbin/gssd
Author: sef Date: Mon Mar 11 02:42:49 2019 New Revision: 344995 URL: https://svnweb.freebsd.org/changeset/base/344995 Log: MFC r344402 * Handle SIGPIPE in gssd We've got some cases where the other end of gssd's AF_LOCAL socket gets closed, resulting in an error (and SIGPIPE) when it tries to do I/O to it. Closing without cleaning up means the next time nfsd starts up, it hangs, unkillably; this allows gssd to handle that particular error. * Limit the retry cound in gssd_syscall to 5. The default is INT_MAX, which effectively means forever. And it's an uninterruptable RPC call, so it will never stop. The two changes mitigate the problem. Modified: stable/12/sys/kgssapi/gss_impl.c stable/12/usr.sbin/gssd/gssd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kgssapi/gss_impl.c == --- stable/12/sys/kgssapi/gss_impl.cMon Mar 11 02:02:04 2019 (r344994) +++ stable/12/sys/kgssapi/gss_impl.cMon Mar 11 02:42:49 2019 (r344995) @@ -112,6 +112,15 @@ sys_gssd_syscall(struct thread *td, struct gssd_syscal cl = clnt_reconnect_create(nconf, (struct sockaddr *) &sun, GSSD, GSSDVERS, RPC_MAXDATASIZE, RPC_MAXDATASIZE); + /* +* The number of retries defaults to INT_MAX, which effectively +* means an infinite, uninterruptable loop. Limiting it to +* five retries keeps it from running forever. +*/ + if (cl != NULL) { + int retry_count = 5; + CLNT_CONTROL(cl, CLSET_RETRIES, &retry_count); + } } else cl = NULL; Modified: stable/12/usr.sbin/gssd/gssd.c == --- stable/12/usr.sbin/gssd/gssd.c Mon Mar 11 02:02:04 2019 (r344994) +++ stable/12/usr.sbin/gssd/gssd.c Mon Mar 11 02:42:49 2019 (r344995) @@ -202,6 +202,7 @@ main(int argc, char **argv) signal(SIGHUP, SIG_IGN); } signal(SIGTERM, gssd_terminate); + signal(SIGPIPE, gssd_terminate); memset(&sun, 0, sizeof sun); sun.sun_family = AF_LOCAL; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344998 - stable/12/lib/libutil
Author: sef Date: Mon Mar 11 03:01:58 2019 New Revision: 344998 URL: https://svnweb.freebsd.org/changeset/base/344998 Log: MFC r343882 r343881 had an uninitialized error. This fixes that. PR: 233849 Modified: stable/12/lib/libutil/quotafile.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libutil/quotafile.c == --- stable/12/lib/libutil/quotafile.c Mon Mar 11 03:00:33 2019 (r344997) +++ stable/12/lib/libutil/quotafile.c Mon Mar 11 03:01:58 2019 (r344998) @@ -118,7 +118,7 @@ quota_open(struct fstab *fs, int quotatype, int openfl struct dqhdr64 dqh; struct group *grp; struct stat st; - int qcmd, serrno; + int qcmd, serrno = 0; int ufs; if ((qf = calloc(1, sizeof(*qf))) == NULL) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r345124 - in stable/12: sys/conf sys/modules/crypto sys/opencrypto tools/tools/crypto
_block+2, sizeof(sizeVal)); - ctx->blockIndex = 2 + sizeof(sizeVal); + addLength = 2 + sizeof(sizeVal); } + ctx->blockIndex = addLength; + /* +* The length descriptor goes into the AAD buffer, so we +* need to account for it. +*/ + ctx->authDataLength += addLength; + ctx->authDataCount = addLength; } } @@ -181,10 +189,9 @@ AES_CBC_MAC_Update(struct aes_cbc_mac_ctx *ctx, const ctx->authDataCount += copy_amt; ctx->blockIndex += copy_amt; ctx->blockIndex %= sizeof(ctx->staging_block); - if (ctx->authDataCount == ctx->authDataLength) - length = 0; + if (ctx->blockIndex == 0 || - ctx->authDataCount >= ctx->authDataLength) { + ctx->authDataCount == ctx->authDataLength) { /* * We're done with this block, so we * xor staging_block with block, and then @@ -193,8 +200,17 @@ AES_CBC_MAC_Update(struct aes_cbc_mac_ctx *ctx, const xor_and_encrypt(ctx, ctx->staging_block, ctx->block); bzero(ctx->staging_block, sizeof(ctx->staging_block)); ctx->blockIndex = 0; + if (ctx->authDataCount >= ctx->authDataLength) + break; } } + /* +* We'd like to be able to check length == 0 and return +* here, but the way OCF calls us, length is always +* blksize (16, in this case). So we have to count on +* the fact that OCF calls us separately for the AAD and +* for the real data. +*/ return (0); } /* Copied: stable/12/sys/opencrypto/cbc_mac.h (from r344140, head/sys/opencrypto/cbc_mac.h) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/opencrypto/cbc_mac.h Thu Mar 14 02:46:03 2019 (r345124, copy of r344140, head/sys/opencrypto/cbc_mac.h) @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014 The FreeBSD Foundation + * Copyright (c) 2018, iXsystems Inc. + * All rights reserved. + * + * This software was developed by Sean Eric Fagan, with lots of references + * to existing AES-CCM (gmac) code. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#ifndef _CBC_CCM_H +# define _CBC_CCM_H + +# include +# include + +# define CCM_CBC_BLOCK_LEN 16 /* 128 bits */ +# define CCM_CBC_MAX_DIGEST_LEN16 +# define CCM_CBC_MIN_DIGEST_LEN4 + +/* + * This is the authentication context structure; + * the encryption one is similar. + */ +struct aes_cbc_mac_ctx { + uint64_tauthDataLength, authDataCount; + uint64_tcryptDataLength, cryptDataCount; + int blockIndex; + uint8_t staging_block[CCM_CBC_BLOCK_LEN]; + uint8_t block[CCM_CBC_BLOCK_LEN]; + const uint8_t *nonce; + int nonceLength;/* This one is in bytes, not bits! */ + /* AES state data */ + int rounds; + uint32_tkeysched[4*(RIJNDAEL_MAXNR+1)]; +}; + +void AES_CBC_MAC
svn commit: r352580 - head/cddl/contrib/opensolaris/lib/libzfs/common
Author: sef Date: Sat Sep 21 17:54:42 2019 New Revision: 352580 URL: https://svnweb.freebsd.org/changeset/base/352580 Log: Fix a regression introduced in r344601, and work properly with the -v and -n options. PR: 240640 Reported by: Andriy Gapon Reviewed by: avg MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D21709 Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c == --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Sep 21 15:38:08 2019(r352579) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Sep 21 17:54:42 2019(r352580) @@ -1289,13 +1289,11 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) fromorigin = sdd->prevsnap[0] == '\0' && (sdd->fromorigin || sdd->replicate); - if (sdd->progress && sdd->dryrun) { + if (sdd->verbose || sdd->progress) { (void) estimate_ioctl(zhp, sdd->prevsnap_obj, fromorigin, flags, &size); sdd->size += size; - } - if (sdd->verbose) { send_print_verbose(fout, zhp->zfs_name, sdd->prevsnap[0] ? sdd->prevsnap : NULL, size, sdd->parsable); @@ -1663,7 +1661,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla fromname = name; } - if (flags->progress) { + if (flags->progress || flags->verbose) { error = lzc_send_space(zhp->zfs_name, fromname, lzc_flags, &size); if (error == 0) @@ -1933,7 +1931,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons sdd.cleanup_fd = -1; sdd.snapholds = NULL; } - if (flags->progress || sdd.snapholds != NULL) { + if (flags->progress || flags->verbose || sdd.snapholds != NULL) { /* * Do a verbose no-op dry run to get all the verbose output * or to gather snapshot hold's before generating any data, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r352614 - in head: lib/libc/sys sbin/mount sys/kern sys/sys
Author: sef Date: Mon Sep 23 04:28:07 2019 New Revision: 352614 URL: https://svnweb.freebsd.org/changeset/base/352614 Log: Add two options to allow mount to avoid covering up existing mount points. The two options are * nocover/cover: Prevent/allow mounting over an existing root mountpoint. E.g., "mount -t ufs -o nocover /dev/sd1a /usr/local" will fail if /usr/local is already a mountpoint. * emptydir/noemptydir: Prevent/allow mounting on a non-empty directory. E.g., "mount -t ufs -o emptydir /dev/sd1a /usr" will fail. Neither of these options is intended to be a default, for historical and compatibility reasons. Reviewed by: allanjude, kib Differential Revision:https://reviews.freebsd.org/D21458 Modified: head/lib/libc/sys/mount.2 head/sbin/mount/mntopts.h head/sbin/mount/mount.8 head/sbin/mount/mount.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_subr.c head/sys/sys/mount.h head/sys/sys/vnode.h Modified: head/lib/libc/sys/mount.2 == --- head/lib/libc/sys/mount.2 Sun Sep 22 20:50:24 2019(r352613) +++ head/lib/libc/sys/mount.2 Mon Sep 23 04:28:07 2019(r352614) @@ -28,7 +28,7 @@ .\" @(#)mount.28.3 (Berkeley) 5/24/95 .\" $FreeBSD$ .\" -.Dd December 1, 2017 +.Dd August 28, 2019 .Dt MOUNT 2 .Os .Sh NAME @@ -157,6 +157,10 @@ mount even if some files are open for writing. Disable read clustering. .It Dv MNT_NOCLUSTERW Disable write clustering. +.It Dv MNT_NOCOVER +Do not mount over the root of another mount point. +.It Dv MNT_EMPTYDIR +Require an empty directory for the mount point directory. .El .Pp The flag @@ -260,6 +264,11 @@ is not a directory. .It Bq Er EBUSY Another process currently holds a reference to .Fa dir . +.It Bq Er EBUSY +The +.Dv MNT_NOCOVER +option was given, and the requested mount point +is already the root of another mount point. .It Bq Er EFAULT The .Fa dir @@ -280,6 +289,11 @@ The .Fa fspec argument is not a block device. +.It Bq Er ENOTEMPTY +The +.Dv MNT_EMPTYDIR +option was specified, and the requested mount point +is not an empty directory. .It Bq Er ENXIO The major device number of .Fa fspec Modified: head/sbin/mount/mntopts.h == --- head/sbin/mount/mntopts.h Sun Sep 22 20:50:24 2019(r352613) +++ head/sbin/mount/mntopts.h Mon Sep 23 04:28:07 2019(r352614) @@ -65,7 +65,8 @@ struct mntopt { #define MOPT_UPDATE{ "update", 0, MNT_UPDATE, 0 } #define MOPT_RO{ "ro", 0, MNT_RDONLY, 0 } #define MOPT_RW{ "rw", 1, MNT_RDONLY, 0 } - +#defineMOPT_NOCOVER{ "cover", 1, MNT_NOCOVER, 0 } +#defineMOPT_EMPTYDIR { "emptydir", 0, MNT_EMPTYDIR, 0 } /* This is parsed by mount(8), but is ignored by specific mount_*(8)s. */ #define MOPT_AUTO { "auto", 0, 0, 0 } @@ -95,7 +96,9 @@ struct mntopt { MOPT_ACLS, \ MOPT_NFS4ACLS, \ MOPT_AUTOMOUNTED, \ - MOPT_UNTRUSTED + MOPT_UNTRUSTED, \ + MOPT_NOCOVER, \ + MOPT_EMPTYDIR void getmntopts(const char *, const struct mntopt *, int *, int *); void rmslashes(char *, char *); Modified: head/sbin/mount/mount.8 == --- head/sbin/mount/mount.8 Sun Sep 22 20:50:24 2019(r352613) +++ head/sbin/mount/mount.8 Mon Sep 23 04:28:07 2019(r352614) @@ -28,7 +28,7 @@ .\" @(#)mount.88.8 (Berkeley) 6/16/94 .\" $FreeBSD$ .\" -.Dd March 22, 2017 +.Dd August 28, 2019 .Dt MOUNT 8 .Os .Sh NAME @@ -162,6 +162,8 @@ When used with the .Fl u flag, this is the same as specifying the options currently in effect for the mounted file system. +.It Cm emptydir +Require that the mount point directory be empty. .It Cm force The same as .Fl f ; @@ -237,6 +239,9 @@ flag. Disable read clustering. .It Cm noclusterw Disable write clustering. +.It Cm nocover +Do not mount if the requested mount point is already +the root of a mount point. .It Cm noexec Do not allow execution of any binaries on the mounted file system. This option is useful for a server that has file systems containing Modified: head/sbin/mount/mount.c == --- head/sbin/mount/mount.c Sun Sep 22 20:50:24 2019(r352613) +++ head/sbin/mount/mount.c Mon Sep 23 04:28:07 2019(r352614) @@ -119,6 +119,8 @@ static struct opt { { MNT_AUTOMOUNTED, "automounted" }, { MNT_VERIFIED, "verifi
svn commit: r352924 - stable/12/cddl/contrib/opensolaris/lib/libzfs/common
Author: sef Date: Tue Oct 1 03:35:54 2019 New Revision: 352924 URL: https://svnweb.freebsd.org/changeset/base/352924 Log: MFC r352580: Fix a regression introduced in r344601 for zfs send Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c == --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Sep 30 22:00:48 2019(r352923) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Oct 1 03:35:54 2019(r352924) @@ -1289,13 +1289,11 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) fromorigin = sdd->prevsnap[0] == '\0' && (sdd->fromorigin || sdd->replicate); - if (sdd->progress && sdd->dryrun) { + if (sdd->verbose || sdd->progress) { (void) estimate_ioctl(zhp, sdd->prevsnap_obj, fromorigin, flags, &size); sdd->size += size; - } - if (sdd->verbose) { send_print_verbose(fout, zhp->zfs_name, sdd->prevsnap[0] ? sdd->prevsnap : NULL, size, sdd->parsable); @@ -1663,7 +1661,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla fromname = name; } - if (flags->progress) { + if (flags->progress || flags->verbose) { error = lzc_send_space(zhp->zfs_name, fromname, lzc_flags, &size); if (error == 0) @@ -1933,7 +1931,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons sdd.cleanup_fd = -1; sdd.snapholds = NULL; } - if (flags->progress || sdd.snapholds != NULL) { + if (flags->progress || flags->verbose || sdd.snapholds != NULL) { /* * Do a verbose no-op dry run to get all the verbose output * or to gather snapshot hold's before generating any data, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r352932 - releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common
Author: sef Date: Tue Oct 1 18:05:51 2019 New Revision: 352932 URL: https://svnweb.freebsd.org/changeset/base/352932 Log: Fix a regression introduced in r344601, and work properly with the -v and -n options. PR: 240640 Reported by: Andriy Gapon Reviewed by: avg Differential Revision:https://reviews.freebsd.org/D21709 Approved by: re Modified: releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c == --- releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Oct 1 17:05:21 2019(r352931) +++ releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Oct 1 18:05:51 2019(r352932) @@ -1289,13 +1289,11 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) fromorigin = sdd->prevsnap[0] == '\0' && (sdd->fromorigin || sdd->replicate); - if (sdd->progress && sdd->dryrun) { + if (sdd->verbose || sdd->progress) { (void) estimate_ioctl(zhp, sdd->prevsnap_obj, fromorigin, flags, &size); sdd->size += size; - } - if (sdd->verbose) { send_print_verbose(fout, zhp->zfs_name, sdd->prevsnap[0] ? sdd->prevsnap : NULL, size, sdd->parsable); @@ -1663,7 +1661,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *fla fromname = name; } - if (flags->progress) { + if (flags->progress || flags->verbose) { error = lzc_send_space(zhp->zfs_name, fromname, lzc_flags, &size); if (error == 0) @@ -1933,7 +1931,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons sdd.cleanup_fd = -1; sdd.snapholds = NULL; } - if (flags->progress || sdd.snapholds != NULL) { + if (flags->progress || flags->verbose || sdd.snapholds != NULL) { /* * Do a verbose no-op dry run to get all the verbose output * or to gather snapshot hold's before generating any data, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"