From owner-svn-src-stable-10@freebsd.org Sun Apr 24 03:11:53 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8A75B1151E; Sun, 24 Apr 2016 03:11:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C33B6113A; Sun, 24 Apr 2016 03:11:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3O3BqJQ030379; Sun, 24 Apr 2016 03:11:52 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3O3BqQx030375; Sun, 24 Apr 2016 03:11:52 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604240311.u3O3BqQx030375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 24 Apr 2016 03:11:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298527 - in stable/10/sys/ufs: ffs ufs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2016 03:11:54 -0000 Author: pfg Date: Sun Apr 24 03:11:52 2016 New Revision: 298527 URL: https://svnweb.freebsd.org/changeset/base/298527 Log: MFC r297791: UFS: replace 0 with NULL for pointers. While here also do late initialization of the variables we are changing. Found with devel/coccinelle. Reviewed by: mckusick Modified: stable/10/sys/ufs/ffs/ffs_alloc.c stable/10/sys/ufs/ffs/ffs_snapshot.c stable/10/sys/ufs/ffs/ffs_softdep.c stable/10/sys/ufs/ufs/ufs_lookup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_alloc.c Sun Apr 24 01:38:45 2016 (r298526) +++ stable/10/sys/ufs/ffs/ffs_alloc.c Sun Apr 24 03:11:52 2016 (r298527) @@ -259,7 +259,6 @@ ffs_realloccg(ip, lbprev, bprev, bpref, static int curfail; int64_t delta; - *bpp = 0; vp = ITOV(ip); fs = ip->i_fs; bp = NULL; @@ -319,6 +318,7 @@ retry: /* * Check for extension in the existing location. */ + *bpp = NULL; cg = dtog(fs, bprev); UFS_LOCK(ump); bno = ffs_fragextend(ip, cg, bprev, osize, nsize); @@ -508,7 +508,7 @@ ffs_reallocblks_ufs1(ap) struct inode *ip; struct vnode *vp; struct buf *sbp, *ebp; - ufs1_daddr_t *bap, *sbap, *ebap = 0; + ufs1_daddr_t *bap, *sbap, *ebap; struct cluster_save *buflist; struct ufsmount *ump; ufs_lbn_t start_lbn, end_lbn; @@ -588,6 +588,7 @@ ffs_reallocblks_ufs1(ap) /* * If the block range spans two block maps, get the second map. */ + ebap = NULL; if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) { ssize = len; } else { @@ -757,7 +758,7 @@ ffs_reallocblks_ufs2(ap) struct inode *ip; struct vnode *vp; struct buf *sbp, *ebp; - ufs2_daddr_t *bap, *sbap, *ebap = 0; + ufs2_daddr_t *bap, *sbap, *ebap; struct cluster_save *buflist; struct ufsmount *ump; ufs_lbn_t start_lbn, end_lbn; @@ -836,6 +837,7 @@ ffs_reallocblks_ufs2(ap) /* * If the block range spans two block maps, get the second map. */ + ebap = NULL; if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) { ssize = len; } else { @@ -2774,7 +2776,8 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) return (EINVAL); } vn_start_write(vp, &mp, V_WAIT); - if (mp == 0 || strncmp(mp->mnt_stat.f_fstypename, "ufs", MFSNAMELEN)) { + if (mp == NULL || + strncmp(mp->mnt_stat.f_fstypename, "ufs", MFSNAMELEN)) { vn_finished_write(mp); fdrop(fp, td); return (EINVAL); Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_snapshot.c Sun Apr 24 01:38:45 2016 (r298526) +++ stable/10/sys/ufs/ffs/ffs_snapshot.c Sun Apr 24 03:11:52 2016 (r298527) @@ -1896,7 +1896,7 @@ retry: * dopersistence sysctl-setable flag to decide on the * persistence needed for file content data. */ - if (savedcbp != 0) { + if (savedcbp != NULL) { bcopy(savedcbp->b_data, cbp->b_data, fs->fs_bsize); bawrite(cbp); if ((vtype == VDIR || dopersistence) && @@ -2388,7 +2388,7 @@ ffs_copyonwrite(devvp, bp) * dopersistence sysctl-setable flag to decide on the * persistence needed for file content data. */ - if (savedcbp != 0) { + if (savedcbp != NULL) { bcopy(savedcbp->b_data, cbp->b_data, fs->fs_bsize); bawrite(cbp); if ((devvp == bp->b_vp || bp->b_vp->v_type == VDIR || Modified: stable/10/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_softdep.c Sun Apr 24 01:38:45 2016 (r298526) +++ stable/10/sys/ufs/ffs/ffs_softdep.c Sun Apr 24 03:11:52 2016 (r298527) @@ -1868,7 +1868,7 @@ softdep_move_dependencies(oldbp, newbp) if (wk->wk_type == D_BMSAFEMAP && bmsafemap_backgroundwrite(WK_BMSAFEMAP(wk), newbp)) dirty = 1; - if (wktail == 0) + if (wktail == NULL) LIST_INSERT_HEAD(&newbp->b_dep, wk, wk_list); else LIST_INSERT_AFTER(wktail, wk, wk_list); @@ -6667,7 +6667,7 @@ softdep_journal_freeblocks(ip, cred, len } } if ((flags & IO_EXT) != 0) - while ((adp = TAILQ_FIRST(&inodedep->id_extupdt)) != 0) + while ((adp = TAILQ_FIRST(&inodedep->id_extupdt)) != NULL) cancel_allocdirect(&inodedep->id_extupdt, adp, freeblks); /* @@ -6919,14 +6919,14 @@ softdep_setup_freeblocks(ip, length, fla if (flags & IO_NORMAL) { merge_inode_lists(&inodedep->id_newinoupdt, &inodedep->id_inoupdt); - while ((adp = TAILQ_FIRST(&inodedep->id_inoupdt)) != 0) + while ((adp = TAILQ_FIRST(&inodedep->id_inoupdt)) != NULL) cancel_allocdirect(&inodedep->id_inoupdt, adp, freeblks); } if (flags & IO_EXT) { merge_inode_lists(&inodedep->id_newextupdt, &inodedep->id_extupdt); - while ((adp = TAILQ_FIRST(&inodedep->id_extupdt)) != 0) + while ((adp = TAILQ_FIRST(&inodedep->id_extupdt)) != NULL) cancel_allocdirect(&inodedep->id_extupdt, adp, freeblks); } @@ -8041,8 +8041,8 @@ indir_trunc(freework, dbn, lbn) struct fs *fs; struct indirdep *indirdep; struct ufsmount *ump; - ufs1_daddr_t *bap1 = 0; - ufs2_daddr_t nb, nnb, *bap2 = 0; + ufs1_daddr_t *bap1; + ufs2_daddr_t nb, nnb, *bap2; ufs_lbn_t lbnadd, nlbn; int i, nblocks, ufs1fmt; int freedblocks; @@ -8125,10 +8125,12 @@ indir_trunc(freework, dbn, lbn) bap1 = (ufs1_daddr_t *)bp->b_data; nb = bap1[freework->fw_off]; ufs1fmt = 1; + bap2 = NULL; } else { bap2 = (ufs2_daddr_t *)bp->b_data; nb = bap2[freework->fw_off]; ufs1fmt = 0; + bap1 = NULL; } level = lbn_level(lbn); needj = MOUNTEDSUJ(UFSTOVFS(ump)) != 0; @@ -8303,7 +8305,7 @@ setup_newdir(dap, newinum, dinum, newdir struct newblk *newblk; struct pagedep *pagedep; struct inodedep *inodedep; - struct newdirblk *newdirblk = 0; + struct newdirblk *newdirblk; struct mkdir *mkdir1, *mkdir2; struct worklist *wk; struct jaddref *jaddref; @@ -8430,7 +8432,7 @@ softdep_setup_directory_add(bp, dp, diro struct newblk *newblk; struct pagedep *pagedep; struct inodedep *inodedep; - struct newdirblk *newdirblk = 0; + struct newdirblk *newdirblk; struct mkdir *mkdir1, *mkdir2; struct jaddref *jaddref; struct ufsmount *ump; @@ -8462,6 +8464,7 @@ softdep_setup_directory_add(bp, dp, diro dap->da_state = ATTACHED; LIST_INIT(&dap->da_jwork); isindir = bp->b_lblkno >= NDADDR; + newdirblk = NULL; if (isnewblk && (isindir ? blkoff(fs, diroffset) : fragoff(fs, diroffset)) == 0) { newdirblk = malloc(sizeof(struct newdirblk), @@ -8552,7 +8555,7 @@ softdep_setup_directory_add(bp, dp, diro inodedep->id_mkdiradd = dap; } else if (inodedep->id_mkdiradd) merge_diradd(inodedep, dap); - if (newdirblk) { + if (newdirblk != NULL) { /* * There is nothing to do if we are already tracking * this block. @@ -10529,13 +10532,13 @@ cancel_indirdep(indirdep, bp, freeblks) * Pass in bp for blocks still have journal writes * pending so we can cancel them on their own. */ - while ((aip = LIST_FIRST(&indirdep->ir_deplisthd)) != 0) + while ((aip = LIST_FIRST(&indirdep->ir_deplisthd)) != NULL) cancel_allocindir(aip, bp, freeblks, 0); - while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != 0) + while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != NULL) cancel_allocindir(aip, NULL, freeblks, 0); - while ((aip = LIST_FIRST(&indirdep->ir_writehd)) != 0) + while ((aip = LIST_FIRST(&indirdep->ir_writehd)) != NULL) cancel_allocindir(aip, NULL, freeblks, 0); - while ((aip = LIST_FIRST(&indirdep->ir_completehd)) != 0) + while ((aip = LIST_FIRST(&indirdep->ir_completehd)) != NULL) cancel_allocindir(aip, NULL, freeblks, 0); /* * If there are pending partial truncations we need to keep the @@ -11565,7 +11568,7 @@ handle_written_indirdep(indirdep, bp, bp * the indirdep's pointer is not yet written. Otherwise * free them here. */ - while ((aip = LIST_FIRST(&indirdep->ir_writehd)) != 0) { + while ((aip = LIST_FIRST(&indirdep->ir_writehd)) != NULL) { LIST_REMOVE(aip, ai_next); if ((indirdep->ir_state & DEPCOMPLETE) == 0) { LIST_INSERT_HEAD(&indirdep->ir_completehd, aip, @@ -11580,7 +11583,7 @@ handle_written_indirdep(indirdep, bp, bp * the done list to the write list after updating the pointers. */ if (TAILQ_EMPTY(&indirdep->ir_trunc)) { - while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != 0) { + while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != NULL) { handle_allocindir_partdone(aip); if (aip == LIST_FIRST(&indirdep->ir_donehd)) panic("disk_write_complete: not gone"); Modified: stable/10/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- stable/10/sys/ufs/ufs/ufs_lookup.c Sun Apr 24 01:38:45 2016 (r298526) +++ stable/10/sys/ufs/ufs/ufs_lookup.c Sun Apr 24 03:11:52 2016 (r298527) @@ -1256,7 +1256,8 @@ out: * drop its snapshot reference so that it will be reclaimed * when last open reference goes away. */ - if (ip != 0 && (ip->i_flags & SF_SNAPSHOT) != 0 && ip->i_effnlink == 0) + if (ip != NULL && (ip->i_flags & SF_SNAPSHOT) != 0 && + ip->i_effnlink == 0) UFS_SNAPGONE(ip); return (error); } From owner-svn-src-stable-10@freebsd.org Sun Apr 24 03:15:11 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA19DB11710; Sun, 24 Apr 2016 03:15:11 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A56F169A; Sun, 24 Apr 2016 03:15:11 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3O3FA65032575; Sun, 24 Apr 2016 03:15:10 GMT (envelope-from wblock@FreeBSD.org) Received: (from wblock@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3O3FAwt032574; Sun, 24 Apr 2016 03:15:10 GMT (envelope-from wblock@FreeBSD.org) Message-Id: <201604240315.u3O3FAwt032574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wblock set sender to wblock@FreeBSD.org using -f From: Warren Block Date: Sun, 24 Apr 2016 03:15:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298529 - stable/10/lib/libc/stdlib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2016 03:15:11 -0000 Author: wblock (doc committer) Date: Sun Apr 24 03:15:10 2016 New Revision: 298529 URL: https://svnweb.freebsd.org/changeset/base/298529 Log: MFC r298156: Fix markup on "\n" in printf so it renders correctly. Modified: stable/10/lib/libc/stdlib/lsearch.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdlib/lsearch.3 ============================================================================== --- stable/10/lib/libc/stdlib/lsearch.3 Sun Apr 24 03:13:02 2016 (r298528) +++ stable/10/lib/libc/stdlib/lsearch.3 Sun Apr 24 03:15:10 2016 (r298529) @@ -8,7 +8,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 21, 2013 +.Dd April 17, 2016 .Dt LSEARCH 3 .Os .Sh NAME @@ -107,7 +107,7 @@ main(int argc, char **argv) printf("Enter a number: "); if (scanf("%d", &key) != 1) { - printf("Bad input\n"); + printf("Bad input\en"); return (EXIT_FAILURE); } @@ -115,9 +115,9 @@ main(int argc, char **argv) element_compare); if (element != NULL) - printf("Element found: %d\n", *(int *)element); + printf("Element found: %d\en", *(int *)element); else - printf("Element not found\n"); + printf("Element not found\en"); return (EXIT_SUCCESS); } From owner-svn-src-stable-10@freebsd.org Sun Apr 24 08:39:56 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1719B12108; Sun, 24 Apr 2016 08:39:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62A251081; Sun, 24 Apr 2016 08:39:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3O8dtox029761; Sun, 24 Apr 2016 08:39:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3O8dta4029757; Sun, 24 Apr 2016 08:39:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604240839.u3O8dta4029757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 24 Apr 2016 08:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298533 - in stable/10/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2016 08:39:56 -0000 Author: avg Date: Sun Apr 24 08:39:55 2016 New Revision: 298533 URL: https://svnweb.freebsd.org/changeset/base/298533 Log: MFC r297513: remove emulation of VFS_HOLD and VFS_RELE from opensolaris compat Modified: stable/10/sys/cddl/compat/opensolaris/sys/vfs.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/compat/opensolaris/sys/vfs.h ============================================================================== --- stable/10/sys/cddl/compat/opensolaris/sys/vfs.h Sun Apr 24 08:31:32 2016 (r298532) +++ stable/10/sys/cddl/compat/opensolaris/sys/vfs.h Sun Apr 24 08:39:55 2016 (r298533) @@ -54,17 +54,6 @@ typedef struct mount vfs_t; #define VFS_NOSETUID MNT_NOSUID #define VFS_NOEXEC MNT_NOEXEC -#define VFS_HOLD(vfsp) do { \ - MNT_ILOCK(vfsp); \ - MNT_REF(vfsp); \ - MNT_IUNLOCK(vfsp); \ -} while (0) -#define VFS_RELE(vfsp) do { \ - MNT_ILOCK(vfsp); \ - MNT_REL(vfsp); \ - MNT_IUNLOCK(vfsp); \ -} while (0) - #define fs_vscan(vp, cr, async) (0) #define VROOT VV_ROOT Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sun Apr 24 08:31:32 2016 (r298532) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sun Apr 24 08:39:55 2016 (r298533) @@ -589,7 +589,9 @@ gfs_root_create(size_t size, vfs_t *vfsp { vnode_t *vp; +#ifdef illumos VFS_HOLD(vfsp); +#endif vp = gfs_dir_create(size, NULL, vfsp, ops, entries, inode_cb, maxlen, readdir_cb, lookup_cb); /* Manually set the inode */ @@ -700,7 +702,9 @@ found: vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } else { ASSERT(vp->v_vfsp != NULL); +#ifdef illumos VFS_RELE(vp->v_vfsp); +#endif } #ifdef TODO if (vp->v_flag & V_XATTRDIR) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Apr 24 08:31:32 2016 (r298532) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Apr 24 08:39:55 2016 (r298533) @@ -1442,7 +1442,14 @@ getzfsvfs(const char *dsname, zfsvfs_t * mutex_enter(&os->os_user_ptr_lock); *zfvp = dmu_objset_get_user(os); if (*zfvp) { +#ifdef illumos VFS_HOLD((*zfvp)->z_vfs); +#else + if (vfs_busy((*zfvp)->z_vfs, 0) != 0) { + *zfvp = NULL; + error = SET_ERROR(ESRCH); + } +#endif } else { error = SET_ERROR(ESRCH); } @@ -1486,7 +1493,11 @@ zfsvfs_rele(zfsvfs_t *zfsvfs, void *tag) rrm_exit(&zfsvfs->z_teardown_lock, tag); if (zfsvfs->z_vfs) { +#ifdef illumos VFS_RELE(zfsvfs->z_vfs); +#else + vfs_unbusy(zfsvfs->z_vfs); +#endif } else { dmu_objset_disown(zfsvfs->z_os, zfsvfs); zfsvfs_free(zfsvfs); @@ -3017,11 +3028,13 @@ zfs_get_vfs(const char *resource) mtx_lock(&mountlist_mtx); TAILQ_FOREACH(vfsp, &mountlist, mnt_list) { if (strcmp(refstr_value(vfsp->vfs_resource), resource) == 0) { - VFS_HOLD(vfsp); + if (vfs_busy(vfsp, MBF_MNTLSTLOCK) != 0) + vfsp = NULL; break; } } - mtx_unlock(&mountlist_mtx); + if (vfsp == NULL) + mtx_unlock(&mountlist_mtx); return (vfsp); } @@ -3474,7 +3487,11 @@ zfs_unmount_snap(const char *snapname) ASSERT(!dsl_pool_config_held(dmu_objset_pool(zfsvfs->z_os))); err = vn_vfswlock(vfsp->vfs_vnodecovered); +#ifdef illumos VFS_RELE(vfsp); +#else + vfs_unbusy(vfsp); +#endif if (err != 0) return (SET_ERROR(err)); @@ -3720,7 +3737,11 @@ zfs_ioc_rollback(const char *fsname, nvl resume_err = zfs_resume_fs(zfsvfs, fsname); error = error ? error : resume_err; } +#ifdef illumos VFS_RELE(zfsvfs->z_vfs); +#else + vfs_unbusy(zfsvfs->z_vfs); +#endif } else { error = dsl_dataset_rollback(fsname, NULL, outnvl); } @@ -4375,7 +4396,11 @@ zfs_ioc_recv(zfs_cmd_t *zc) if (error == 0) error = zfs_resume_fs(zfsvfs, tofs); error = error ? error : end_err; +#ifdef illumos VFS_RELE(zfsvfs->z_vfs); +#else + vfs_unbusy(zfsvfs->z_vfs); +#endif } else { error = dmu_recv_end(&drc, NULL); } @@ -4924,7 +4949,11 @@ zfs_ioc_userspace_upgrade(zfs_cmd_t *zc) } if (error == 0) error = dmu_objset_userspace_upgrade(zfsvfs->z_os); +#ifdef illumos VFS_RELE(zfsvfs->z_vfs); +#else + vfs_unbusy(zfsvfs->z_vfs); +#endif } else { /* XXX kind of reading contents without owning */ error = dmu_objset_hold(zc->zc_name, FTAG, &os); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Apr 24 08:31:32 2016 (r298532) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Apr 24 08:39:55 2016 (r298533) @@ -743,7 +743,9 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_bu if (vp->v_type != VFIFO) VN_LOCK_ASHARE(vp); +#ifdef illumos VFS_HOLD(zfsvfs->z_vfs); +#endif return (zp); } @@ -1428,7 +1430,9 @@ zfs_znode_free(znode_t *zp) kmem_cache_free(znode_cache, zp); +#ifdef illumos VFS_RELE(zfsvfs->z_vfs); +#endif } void From owner-svn-src-stable-10@freebsd.org Mon Apr 25 00:51:15 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3404BB1C93C; Mon, 25 Apr 2016 00:51:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 012201984; Mon, 25 Apr 2016 00:51:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3P0pEev028201; Mon, 25 Apr 2016 00:51:14 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3P0pEmT028200; Mon, 25 Apr 2016 00:51:14 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604250051.u3P0pEmT028200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 25 Apr 2016 00:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298557 - stable/10/sys/fs/ext2fs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2016 00:51:15 -0000 Author: pfg Date: Mon Apr 25 00:51:13 2016 New Revision: 298557 URL: https://svnweb.freebsd.org/changeset/base/298557 Log: MFC r297796: ext2fs: replace 0 with NULL for pointers. While here do late initialization of ebap, similar as was done in UFS. Found with devel/coccinelle. Modified: stable/10/sys/fs/ext2fs/ext2_alloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_alloc.c Mon Apr 25 00:41:23 2016 (r298556) +++ stable/10/sys/fs/ext2fs/ext2_alloc.c Mon Apr 25 00:51:13 2016 (r298557) @@ -161,7 +161,7 @@ ext2_reallocblks(struct vop_reallocblks_ struct inode *ip; struct vnode *vp; struct buf *sbp, *ebp; - uint32_t *bap, *sbap, *ebap = 0; + uint32_t *bap, *sbap, *ebap; struct ext2mount *ump; struct cluster_save *buflist; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; @@ -231,6 +231,7 @@ ext2_reallocblks(struct vop_reallocblks_ /* * If the block range spans two block maps, get the second map. */ + ebap = NULL; if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) { ssize = len; } else { From owner-svn-src-stable-10@freebsd.org Mon Apr 25 12:25:32 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50CF6B1B6B7; Mon, 25 Apr 2016 12:25:32 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC758151B; Mon, 25 Apr 2016 12:25:31 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3PCPUfO042437; Mon, 25 Apr 2016 12:25:30 GMT (envelope-from wblock@FreeBSD.org) Received: (from wblock@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3PCPUHl042436; Mon, 25 Apr 2016 12:25:30 GMT (envelope-from wblock@FreeBSD.org) Message-Id: <201604251225.u3PCPUHl042436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wblock set sender to wblock@FreeBSD.org using -f From: Warren Block Date: Mon, 25 Apr 2016 12:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298576 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2016 12:25:32 -0000 Author: wblock (doc committer) Date: Mon Apr 25 12:25:30 2016 New Revision: 298576 URL: https://svnweb.freebsd.org/changeset/base/298576 Log: MFC r298176: Add the kern.vt.enable_bell sysctl, which was not documented previously. Minor additional punctuation and wording changes. Modified: stable/10/share/man/man4/vt.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/vt.4 ============================================================================== --- stable/10/share/man/man4/vt.4 Mon Apr 25 10:16:07 2016 (r298575) +++ stable/10/share/man/man4/vt.4 Mon Apr 25 12:25:30 2016 (r298576) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 20, 2014 +.Dd April 17, 2016 .Dt "VIRTUAL TERMINALS" 4 .Os .Sh NAME @@ -56,6 +56,7 @@ In .Cd kern.vt.kbd_reboot=1 .Cd kern.vt.kbd_debug=1 .Cd kern.vt.kbd_panic=0 +.Cd kern.vt.enable_bell=1 .Sh DESCRIPTION The .Nm @@ -122,7 +123,7 @@ driver. .Bl -tag -width MAXCONS .It Dv TERMINAL_NORM_ATTR= Ns Pa attribute .It Dv TERMINAL_KERN_ATTR= Ns Pa attribute -These options allow changing the default colors used for normal and kernel +These options change the default colors used for normal and kernel text. Available colors are defined in .In sys/terminal.h . @@ -212,14 +213,15 @@ backend. The mode is applied to all output connectors. This is currently only supported by the .Cm vt_fb -backend when it's paired with a KMS video driver. +backend when it is paired with a KMS video driver. .It Va kern.vt.fb.modes. Ns Pa connector_name Set this value to a graphic mode to override the default mode picked by the .Nm backend. This mode is applied to the output connector .Pa connector_name -only. It has precedence over +only. +It has precedence over .Va kern.vt.fb.default_mode . The names of available connector names can be found in .Xr dmesg 8 @@ -227,7 +229,7 @@ after loading the KMS driver. It will contain a list of connectors and their associated tunables. This is currently only supported by the .Cm vt_fb -backend when it's paired with a KMS video driver. +backend when it is paired with a KMS video driver. .El .Sh KEYBOARD SYSCTL TUNABLES These settings control whether certain special key combinations are enabled or @@ -255,6 +257,17 @@ Enable debug request key combination, us .It Va kern.vt.kbd_panic Enable panic key combination. .El +.Sh OTHER SYSCTL TUNABLES +These settings can be entered at the +.Xr loader 8 +prompt, set in +.Xr loader.conf 5 , +or changed at runtime with +.Xr sysctl 8 . +.Bl -tag -width indent +.It Va kern.vt.enable_bell +Enable the terminal bell. +.El .Sh FILES .Bl -tag -width /usr/share/vt/keymaps/* -compact .It Pa /dev/console From owner-svn-src-stable-10@freebsd.org Mon Apr 25 18:13:22 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6A19B1C2F8; Mon, 25 Apr 2016 18:13:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85E1816E0; Mon, 25 Apr 2016 18:13:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3PIDLSF057441; Mon, 25 Apr 2016 18:13:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3PIDLrP057440; Mon, 25 Apr 2016 18:13:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201604251813.u3PIDLrP057440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 25 Apr 2016 18:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298588 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2016 18:13:22 -0000 Author: markj Date: Mon Apr 25 18:13:21 2016 New Revision: 298588 URL: https://svnweb.freebsd.org/changeset/base/298588 Log: MFC r298173: Use a loop instead of a goto in sysctl_kern_proc_kstack(). Modified: stable/10/sys/kern/kern_proc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_proc.c ============================================================================== --- stable/10/sys/kern/kern_proc.c Mon Apr 25 18:09:36 2016 (r298587) +++ stable/10/sys/kern/kern_proc.c Mon Apr 25 18:13:21 2016 (r298588) @@ -2462,10 +2462,8 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_A st = stack_create(); lwpidarray = NULL; - numthreads = 0; PROC_LOCK(p); -repeat: - if (numthreads < p->p_numthreads) { + do { if (lwpidarray != NULL) { free(lwpidarray, M_TEMP); lwpidarray = NULL; @@ -2475,9 +2473,7 @@ repeat: lwpidarray = malloc(sizeof(*lwpidarray) * numthreads, M_TEMP, M_WAITOK | M_ZERO); PROC_LOCK(p); - goto repeat; - } - i = 0; + } while (numthreads < p->p_numthreads); /* * XXXRW: During the below loop, execve(2) and countless other sorts @@ -2488,6 +2484,7 @@ repeat: * have changed, in which case the right to extract debug info might * no longer be assured. */ + i = 0; FOREACH_THREAD_IN_PROC(p, td) { KASSERT(i < numthreads, ("sysctl_kern_proc_kstack: numthreads")); From owner-svn-src-stable-10@freebsd.org Tue Apr 26 07:40:08 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C06E6B1C8C2; Tue, 26 Apr 2016 07:40:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E0441146; Tue, 26 Apr 2016 07:40:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3Q7e7eB099561; Tue, 26 Apr 2016 07:40:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3Q7e7Ka099560; Tue, 26 Apr 2016 07:40:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604260740.u3Q7e7Ka099560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 26 Apr 2016 07:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298621 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 07:40:08 -0000 Author: avg Date: Tue Apr 26 07:40:07 2016 New Revision: 298621 URL: https://svnweb.freebsd.org/changeset/base/298621 Log: MFC r297846: [amd64] dtrace_invop handler is to be called only for kernel exceptions Modified: stable/10/sys/amd64/amd64/exception.S Modified: stable/10/sys/amd64/amd64/exception.S ============================================================================== --- stable/10/sys/amd64/amd64/exception.S Tue Apr 26 06:50:41 2016 (r298620) +++ stable/10/sys/amd64/amd64/exception.S Tue Apr 26 07:40:07 2016 (r298621) @@ -212,6 +212,8 @@ alltraps_pushregs_no_rdi: * interrupt. For all other trap types, just handle them in * the usual way. */ + testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ + jnz calltrap /* ignore userland traps */ cmpl $T_BPTFLT,TF_TRAPNO(%rsp) jne calltrap From owner-svn-src-stable-10@freebsd.org Tue Apr 26 07:47:02 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73290B1CC37; Tue, 26 Apr 2016 07:47:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 274971941; Tue, 26 Apr 2016 07:47:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3Q7l1Ru002588; Tue, 26 Apr 2016 07:47:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3Q7l1tO002587; Tue, 26 Apr 2016 07:47:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604260747.u3Q7l1tO002587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 26 Apr 2016 07:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298623 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 07:47:02 -0000 Author: avg Date: Tue Apr 26 07:47:01 2016 New Revision: 298623 URL: https://svnweb.freebsd.org/changeset/base/298623 Log: MFC r297846: [amd64] dtrace_invop handler is to be called only for kernel exceptions Fix up r298621. Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable-10@freebsd.org Tue Apr 26 11:55:30 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32016B1B9D7; Tue, 26 Apr 2016 11:55:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8ECB1CDA; Tue, 26 Apr 2016 11:55:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3QBtTUl077713; Tue, 26 Apr 2016 11:55:29 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3QBtSpt077712; Tue, 26 Apr 2016 11:55:29 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201604261155.u3QBtSpt077712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 26 Apr 2016 11:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298628 - stable/10/sbin/geom/class/part X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 11:55:30 -0000 Author: ae Date: Tue Apr 26 11:55:28 2016 New Revision: 298628 URL: https://svnweb.freebsd.org/changeset/base/298628 Log: MFC r297820: Fix the problem, when gpart(8) can't write both bootcode and partcode in one command due to wrong file size limit. Do not use bootcode size to calculate partsize limit. Also add report message about successful partcode writing. Modified: stable/10/sbin/geom/class/part/geom_part.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/10/sbin/geom/class/part/geom_part.c Tue Apr 26 11:53:37 2016 (r298627) +++ stable/10/sbin/geom/class/part/geom_part.c Tue Apr 26 11:55:28 2016 (r298628) @@ -1115,6 +1115,7 @@ gpart_write_partcode(struct ggeom *gp, i err(EXIT_FAILURE, "%s", dsf); free(buf); close(fd); + printf("partcode written to %s\n", pp->lg_name); } else errx(EXIT_FAILURE, "invalid partition index"); } @@ -1161,6 +1162,9 @@ gpart_write_partcode_vtoc8(struct ggeom } if (installed == 0) errx(EXIT_FAILURE, "%s: no partitions", gp->lg_name); + else + printf("partcode written to %s\n", + idx != 0 ? pp->lg_name: gp->lg_name); } static void @@ -1182,10 +1186,8 @@ gpart_bootcode(struct gctl_req *req, uns bootcode); if (error) errc(EXIT_FAILURE, error, "internal error"); - } else { + } else bootcode = NULL; - bootsize = 0; - } s = gctl_get_ascii(req, "class"); if (s == NULL) @@ -1209,21 +1211,23 @@ gpart_bootcode(struct gctl_req *req, uns s = find_geomcfg(gp, "scheme"); if (s == NULL) errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name); - vtoc8 = 0; if (strcmp(s, "VTOC8") == 0) vtoc8 = 1; + else + vtoc8 = 0; if (gctl_has_param(req, GPART_PARAM_PARTCODE)) { s = gctl_get_ascii(req, GPART_PARAM_PARTCODE); - partsize = vtoc8 != 0 ? VTOC_BOOTSIZE : bootsize * 1024; + if (vtoc8 != 0) + partsize = VTOC_BOOTSIZE; + else + partsize = 1024 * 1024; /* Arbitrary limit. */ partcode = gpart_bootfile_read(s, &partsize); error = gctl_delete_param(req, GPART_PARAM_PARTCODE); if (error) errc(EXIT_FAILURE, error, "internal error"); - } else { + } else partcode = NULL; - partsize = 0; - } if (gctl_has_param(req, GPART_PARAM_INDEX)) { if (partcode == NULL) From owner-svn-src-stable-10@freebsd.org Tue Apr 26 17:39:56 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC28AB1D5F4; Tue, 26 Apr 2016 17:39:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C3E718F2; Tue, 26 Apr 2016 17:39:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3QHdtjV082506; Tue, 26 Apr 2016 17:39:55 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3QHdtSd082499; Tue, 26 Apr 2016 17:39:55 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604261739.u3QHdtSd082499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 26 Apr 2016 17:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298653 - in stable/10/sys: amd64/amd64 amd64/linux amd64/linux32 compat/linux dev/cxgbe/tom i386/linux vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 17:39:57 -0000 Author: pfg Date: Tue Apr 26 17:39:54 2016 New Revision: 298653 URL: https://svnweb.freebsd.org/changeset/base/298653 Log: MFC r298482: Cleanup redundant parenthesis from existing howmany()/roundup() macro uses. Requested by: dchagin Modified: stable/10/sys/amd64/amd64/pmap.c stable/10/sys/amd64/linux/linux_sysvec.c stable/10/sys/amd64/linux32/linux32_sysvec.c stable/10/sys/compat/linux/linux_file.c stable/10/sys/dev/cxgbe/tom/t4_tom.c stable/10/sys/i386/linux/linux_sysvec.c stable/10/sys/vm/vm_radix.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c ============================================================================== --- stable/10/sys/amd64/amd64/pmap.c Tue Apr 26 16:40:04 2016 (r298652) +++ stable/10/sys/amd64/amd64/pmap.c Tue Apr 26 17:39:54 2016 (r298653) @@ -678,7 +678,7 @@ allocpages(vm_paddr_t *firstaddr, int n) CTASSERT(powerof2(NDMPML4E)); /* number of kernel PDP slots */ -#define NKPDPE(ptpgs) howmany((ptpgs), NPDEPG) +#define NKPDPE(ptpgs) howmany(ptpgs, NPDEPG) static void nkpt_init(vm_paddr_t addr) Modified: stable/10/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/10/sys/amd64/linux/linux_sysvec.c Tue Apr 26 16:40:04 2016 (r298652) +++ stable/10/sys/amd64/linux/linux_sysvec.c Tue Apr 26 17:39:54 2016 (r298653) @@ -346,7 +346,7 @@ linux_copyout_strings(struct image_param destp = (caddr_t)arginfo - SPARE_USRSPACE - roundup(sizeof(canary), sizeof(char *)) - roundup(execpath_len, sizeof(char *)) - - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); + roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); if (execpath_len != 0) { imgp->execpathp = (uintptr_t)arginfo - execpath_len; Modified: stable/10/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/10/sys/amd64/linux32/linux32_sysvec.c Tue Apr 26 16:40:04 2016 (r298652) +++ stable/10/sys/amd64/linux32/linux32_sysvec.c Tue Apr 26 17:39:54 2016 (r298653) @@ -862,7 +862,7 @@ linux_copyout_strings(struct image_param destp = (caddr_t)arginfo - SPARE_USRSPACE - roundup(sizeof(canary), sizeof(char *)) - roundup(execpath_len, sizeof(char *)) - - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); + roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); if (execpath_len != 0) { imgp->execpathp = (uintptr_t)arginfo - execpath_len; Modified: stable/10/sys/compat/linux/linux_file.c ============================================================================== --- stable/10/sys/compat/linux/linux_file.c Tue Apr 26 16:40:04 2016 (r298652) +++ stable/10/sys/compat/linux/linux_file.c Tue Apr 26 17:39:54 2016 (r298653) @@ -305,11 +305,10 @@ struct l_dirent64 { * at least glibc-2.7 requires it. That is why l_dirent is padded with 2 bytes. */ #define LINUX_RECLEN(namlen) \ - roundup((offsetof(struct l_dirent, d_name) + (namlen) + 2), \ - sizeof(l_ulong)) + roundup(offsetof(struct l_dirent, d_name) + (namlen) + 2, sizeof(l_ulong)) #define LINUX_RECLEN64(namlen) \ - roundup((offsetof(struct l_dirent64, d_name) + (namlen) + 1), \ + roundup(offsetof(struct l_dirent64, d_name) + (namlen) + 1, \ sizeof(uint64_t)) #define LINUX_MAXRECLEN max(LINUX_RECLEN(LINUX_NAME_MAX), \ Modified: stable/10/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_tom.c Tue Apr 26 16:40:04 2016 (r298652) +++ stable/10/sys/dev/cxgbe/tom/t4_tom.c Tue Apr 26 17:39:54 2016 (r298653) @@ -124,7 +124,7 @@ alloc_toepcb(struct port_info *pi, int t * units of 16 byte. Calculate the maximum work requests possible. */ txsd_total = tx_credits / - howmany((sizeof(struct fw_ofld_tx_data_wr) + 1), 16); + howmany(sizeof(struct fw_ofld_tx_data_wr) + 1, 16); if (txqid < 0) txqid = (arc4random() % pi->nofldtxq) + pi->first_ofld_txq; Modified: stable/10/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/10/sys/i386/linux/linux_sysvec.c Tue Apr 26 16:40:04 2016 (r298652) +++ stable/10/sys/i386/linux/linux_sysvec.c Tue Apr 26 17:39:54 2016 (r298653) @@ -320,7 +320,7 @@ linux_copyout_strings(struct image_param destp = (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform - roundup(sizeof(canary), sizeof(char *)) - roundup(execpath_len, sizeof(char *)) - - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); + roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); /* * install LINUX_PLATFORM Modified: stable/10/sys/vm/vm_radix.c ============================================================================== --- stable/10/sys/vm/vm_radix.c Tue Apr 26 16:40:04 2016 (r298652) +++ stable/10/sys/vm/vm_radix.c Tue Apr 26 17:39:54 2016 (r298653) @@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$"); #define VM_RADIX_COUNT (1 << VM_RADIX_WIDTH) #define VM_RADIX_MASK (VM_RADIX_COUNT - 1) #define VM_RADIX_LIMIT \ - (howmany((sizeof(vm_pindex_t) * NBBY), VM_RADIX_WIDTH) - 1) + (howmany(sizeof(vm_pindex_t) * NBBY, VM_RADIX_WIDTH) - 1) /* Flag bits stored in node pointers. */ #define VM_RADIX_ISLEAF 0x1 From owner-svn-src-stable-10@freebsd.org Tue Apr 26 18:42:06 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B632B1C77C for ; Tue, 26 Apr 2016 18:42:06 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-ob0-x231.google.com (mail-ob0-x231.google.com [IPv6:2607:f8b0:4003:c01::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED90B1796 for ; Tue, 26 Apr 2016 18:42:05 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-ob0-x231.google.com with SMTP id bg3so11410654obb.1 for ; Tue, 26 Apr 2016 11:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=2J6EJNPqfoTzXyxg3rIXgRTMHEa9BccFBkbHYrgoEFY=; b=kgoOUe24nH2lOrj0YeLT22f71qi0wufbRwP7X/mChFaAyYb1x1VWkVMFI36PAuMvfT ksYc1dsBu2n4c0xc78nSJBD5LMVCIe8DyOhLjnN5jslly6QXx+zP/5gvmyFwRzebIhR7 DIffwhclo8ZGPmWtw6X0XfOEjk3Zo0jvEdMxMMZ0lJhnd7hyFFWRYXTA+Q7DZtI1eglb C32QGfXBWpXenfb6WwmG+6KzJPZkVVfysUNr4CulCk9/5HOq/K72PFetgoDMJ8eRNEQ0 apuBOk1mXinbqm5eDaDZELy7t8ID3wF2bqMcWSqq8SqzUAabenM/JUHEXO3KR92u6A62 jEtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=2J6EJNPqfoTzXyxg3rIXgRTMHEa9BccFBkbHYrgoEFY=; b=bcxDE2hvBv01cg/adxmtbJNGXl6MbhPu5ul09GzgMo8HDwF/lmLWzn6h2ggPo/7mYo DwxnInzJraTKoE3OqYONfNOUK5DBiKIIzLu1iY9Hg4JrYpN/mhxvjIYCXT8xPxcNYWER 0UdqaOoiRB/lABHnuzWJi5IIcCXZD1RAcTOwUjmbMzH7iqKV7WREG/yTaShgZ1otySJh oxSyV8Ocpb5fkvYWjhKfaCHXlbwx5XNSJ2hPKasRjh6dXl0hG6kEiJcr2yAStO/Ebi0y MMJtcZ9tRhrbMPO/WaLGKf5VWk0264a94c/KYt+ZZLicLDY4vZK7hFHjd84rwhLblUFq lqow== X-Gm-Message-State: AOPr4FX3FEjPUkywTmVZe+2X3f1yxgeqM/Ls4CmK8QbfGOx0TI+l+miO1tRXgPJwypqiGvRFeILVztbnxfxoqoZd MIME-Version: 1.0 X-Received: by 10.182.146.37 with SMTP id sz5mr1702972obb.24.1461696125077; Tue, 26 Apr 2016 11:42:05 -0700 (PDT) Sender: sobomax@sippysoft.com Received: by 10.157.45.21 with HTTP; Tue, 26 Apr 2016 11:42:05 -0700 (PDT) In-Reply-To: <201604261739.u3QHdtSd082499@repo.freebsd.org> References: <201604261739.u3QHdtSd082499@repo.freebsd.org> Date: Tue, 26 Apr 2016 11:42:05 -0700 X-Google-Sender-Auth: mwpPaZq7usOvGvx2G5KPEzuHp0I Message-ID: Subject: Re: svn: stable/10/sys: amd64/amd64 amd64/linux amd64/linux32 compat/linux dev/cxgbe/tom i386/linux vm From: Maxim Sobolev To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 18:42:06 -0000 Given the widespread use of those two macros, maybe we need howmany.9 and roundup.9 manual pages with detailed formal description? Particularly interested in how "return" supposed to be typed. Another thing is that would be nice is some kind of automatic #error/#warning/printf/KASSERT/panic when (X < Y || Y <= 0) & defined(INVARIANTS). -Max On Tue, Apr 26, 2016 at 10:39 AM, Pedro F. Giffuni wrote: > Author: pfg > Date: Tue Apr 26 17:39:54 2016 > New Revision: 298653 > URL: https://svnweb.freebsd.org/changeset/base/298653 > > Log: > MFC r298482: > Cleanup redundant parenthesis from existing howmany()/roundup() macro > uses. > > Requested by: dchagin > > Modified: > stable/10/sys/amd64/amd64/pmap.c > stable/10/sys/amd64/linux/linux_sysvec.c > stable/10/sys/amd64/linux32/linux32_sysvec.c > stable/10/sys/compat/linux/linux_file.c > stable/10/sys/dev/cxgbe/tom/t4_tom.c > stable/10/sys/i386/linux/linux_sysvec.c > stable/10/sys/vm/vm_radix.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/sys/amd64/amd64/pmap.c > > ============================================================================== > --- stable/10/sys/amd64/amd64/pmap.c Tue Apr 26 16:40:04 2016 > (r298652) > +++ stable/10/sys/amd64/amd64/pmap.c Tue Apr 26 17:39:54 2016 > (r298653) > @@ -678,7 +678,7 @@ allocpages(vm_paddr_t *firstaddr, int n) > CTASSERT(powerof2(NDMPML4E)); > > /* number of kernel PDP slots */ > -#define NKPDPE(ptpgs) howmany((ptpgs), NPDEPG) > +#define NKPDPE(ptpgs) howmany(ptpgs, NPDEPG) > > static void > nkpt_init(vm_paddr_t addr) > > Modified: stable/10/sys/amd64/linux/linux_sysvec.c > > ============================================================================== > --- stable/10/sys/amd64/linux/linux_sysvec.c Tue Apr 26 16:40:04 2016 > (r298652) > +++ stable/10/sys/amd64/linux/linux_sysvec.c Tue Apr 26 17:39:54 2016 > (r298653) > @@ -346,7 +346,7 @@ linux_copyout_strings(struct image_param > destp = (caddr_t)arginfo - SPARE_USRSPACE - > roundup(sizeof(canary), sizeof(char *)) - > roundup(execpath_len, sizeof(char *)) - > - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); > + roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); > > if (execpath_len != 0) { > imgp->execpathp = (uintptr_t)arginfo - execpath_len; > > Modified: stable/10/sys/amd64/linux32/linux32_sysvec.c > > ============================================================================== > --- stable/10/sys/amd64/linux32/linux32_sysvec.c Tue Apr 26 > 16:40:04 2016 (r298652) > +++ stable/10/sys/amd64/linux32/linux32_sysvec.c Tue Apr 26 > 17:39:54 2016 (r298653) > @@ -862,7 +862,7 @@ linux_copyout_strings(struct image_param > destp = (caddr_t)arginfo - SPARE_USRSPACE - > roundup(sizeof(canary), sizeof(char *)) - > roundup(execpath_len, sizeof(char *)) - > - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); > + roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); > > if (execpath_len != 0) { > imgp->execpathp = (uintptr_t)arginfo - execpath_len; > > Modified: stable/10/sys/compat/linux/linux_file.c > > ============================================================================== > --- stable/10/sys/compat/linux/linux_file.c Tue Apr 26 16:40:04 2016 > (r298652) > +++ stable/10/sys/compat/linux/linux_file.c Tue Apr 26 17:39:54 2016 > (r298653) > @@ -305,11 +305,10 @@ struct l_dirent64 { > * at least glibc-2.7 requires it. That is why l_dirent is padded with 2 > bytes. > */ > #define LINUX_RECLEN(namlen) \ > - roundup((offsetof(struct l_dirent, d_name) + (namlen) + 2), > \ > - sizeof(l_ulong)) > + roundup(offsetof(struct l_dirent, d_name) + (namlen) + 2, > sizeof(l_ulong)) > > #define LINUX_RECLEN64(namlen) \ > - roundup((offsetof(struct l_dirent64, d_name) + (namlen) + 1), \ > + roundup(offsetof(struct l_dirent64, d_name) + (namlen) + 1, > \ > sizeof(uint64_t)) > > #define LINUX_MAXRECLEN max(LINUX_RECLEN(LINUX_NAME_MAX), > \ > > Modified: stable/10/sys/dev/cxgbe/tom/t4_tom.c > > ============================================================================== > --- stable/10/sys/dev/cxgbe/tom/t4_tom.c Tue Apr 26 16:40:04 2016 > (r298652) > +++ stable/10/sys/dev/cxgbe/tom/t4_tom.c Tue Apr 26 17:39:54 2016 > (r298653) > @@ -124,7 +124,7 @@ alloc_toepcb(struct port_info *pi, int t > * units of 16 byte. Calculate the maximum work requests possible. > */ > txsd_total = tx_credits / > - howmany((sizeof(struct fw_ofld_tx_data_wr) + 1), 16); > + howmany(sizeof(struct fw_ofld_tx_data_wr) + 1, 16); > > if (txqid < 0) > txqid = (arc4random() % pi->nofldtxq) + pi->first_ofld_txq; > > Modified: stable/10/sys/i386/linux/linux_sysvec.c > > ============================================================================== > --- stable/10/sys/i386/linux/linux_sysvec.c Tue Apr 26 16:40:04 2016 > (r298652) > +++ stable/10/sys/i386/linux/linux_sysvec.c Tue Apr 26 17:39:54 2016 > (r298653) > @@ -320,7 +320,7 @@ linux_copyout_strings(struct image_param > destp = (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform - > roundup(sizeof(canary), sizeof(char *)) - > roundup(execpath_len, sizeof(char *)) - > - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); > + roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); > > /* > * install LINUX_PLATFORM > > Modified: stable/10/sys/vm/vm_radix.c > > ============================================================================== > --- stable/10/sys/vm/vm_radix.c Tue Apr 26 16:40:04 2016 (r298652) > +++ stable/10/sys/vm/vm_radix.c Tue Apr 26 17:39:54 2016 (r298653) > @@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$"); > #define VM_RADIX_COUNT (1 << VM_RADIX_WIDTH) > #define VM_RADIX_MASK (VM_RADIX_COUNT - 1) > #define VM_RADIX_LIMIT > \ > - (howmany((sizeof(vm_pindex_t) * NBBY), VM_RADIX_WIDTH) - 1) > + (howmany(sizeof(vm_pindex_t) * NBBY, VM_RADIX_WIDTH) - 1) > > /* Flag bits stored in node pointers. */ > #define VM_RADIX_ISLEAF 0x1 > > From owner-svn-src-stable-10@freebsd.org Tue Apr 26 19:04:44 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AB2AB1CEAF for ; Tue, 26 Apr 2016 19:04:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm8-vm0.bullet.mail.bf1.yahoo.com (nm8-vm0.bullet.mail.bf1.yahoo.com [98.139.213.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4185D19D7 for ; Tue, 26 Apr 2016 19:04:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1461697481; bh=SK/AS5XKsUk3CVNC7iZ0jJ7EED5b0WqlutT+T+OACuo=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=IJ35yekmg6aPcDigMA4XB4uq7EsZiOkWs3s1tNxSH7n+R+X6pSIW+EzYRA+Vkkeq/ff0lXqgh3MQTEpfgi1PfrEHshSr0SBqUb9FrR2ESReo8TfF+blc+Mod2aFYPNbLsm4yKwSFqIwMvH8x4Y4mOboxWypYn5CU4D+a2losaln4HutpHAmuR/zN9RwdqU7wx/ugww+oHe01lxlGAsjVxEjq6BSLX3Z9X1gcwfaDT3w65HeYOx2gTBZbmcZY1br82phtENIRd8IDWb++t/x/4iOB0tuLXgfrGvSDBpqOqnocke1jDlr13nJCIjZ2ka0X3Sw2GUxcjv0RlH3Z+5sOhw== Received: from [66.196.81.173] by nm8.bullet.mail.bf1.yahoo.com with NNFMP; 26 Apr 2016 19:04:41 -0000 Received: from [68.142.230.72] by tm19.bullet.mail.bf1.yahoo.com with NNFMP; 26 Apr 2016 19:04:41 -0000 Received: from [127.0.0.1] by smtp229.mail.bf1.yahoo.com with NNFMP; 26 Apr 2016 19:04:41 -0000 X-Yahoo-Newman-Id: 580794.43182.bm@smtp229.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 8Oo1hMEVM1n4_WnrWksTuG2x4cTrowprsmMYJSb_NZVHmZK SFnoYOGkqROUizEZNLV_yCruVukBDJED8DHU4u9L34xgaQAId22q.A7iraMl eKSRQqev53DqLAKSrxyxB8eDgEE6OOrDff97C5HkzBhJGRx48euHDB_bM3yg QBeXEHcbXq8j4kG0sH4z39rJd79jr5Dm6QQW283m0hcnOrJ2AVfQDJXYrAo. gD72AO0Emg7rRNvoh4EazujLdH5OM6FkYQz4VNsD3xeSA4hbqA7AWOJgDmFg WyTE75t8W40qMGADuCctbj7GuPHiiBIKmf8xHxOl5UUTg_hvDiYU1K4fC6Mz apa_PsCgVgE5DznxjWLjghjrNEXjHeWXrWEX95H.gCUSltn_HrSKpii.uLuQ 9fBeWS9ikaadgduVnO_0hhPfe0CELtI0M59sqf3FTfunq13oCSQSHuLdIxRq DhI0zJMc89cO.JshB30eytiXFg4CkwFTSzYzz0FyhvewS9juw9MxlLUkYkS9 l.2jJDV.VHxECJIQif.S4ZANzgUMu1Gv3 X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn: stable/10/sys: amd64/amd64 amd64/linux amd64/linux32 compat/linux dev/cxgbe/tom i386/linux vm To: Maxim Sobolev References: <201604261739.u3QHdtSd082499@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org From: Pedro Giffuni Message-ID: <64931143-1496-56b9-8dc7-f11cbb0c06ed@FreeBSD.org> Date: Tue, 26 Apr 2016 14:04:53 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 19:04:44 -0000 Hello On 04/26/16 13:42, Maxim Sobolev wrote: > Given the widespread use of those two macros, maybe we need howmany.9 > and roundup.9 manual pages with detailed formal description? > Particularly interested in how "return" supposed to be typed. Another > thing is that would be nice is some kind of automatic > #error/#warning/printf/KASSERT/panic when (X < Y || Y <= 0) & > defined(INVARIANTS). > > -Max > I agree, we need those documented. There's also rounddown, roundup2 and rounddown2. FWIW, I am tired of these massive replacements, and will likely take a break before trying rounddown. Pedro. > On Tue, Apr 26, 2016 at 10:39 AM, Pedro F. Giffuni > wrote: > > Author: pfg > Date: Tue Apr 26 17:39:54 2016 > New Revision: 298653 > URL: https://svnweb.freebsd.org/changeset/base/298653 > > Log: > MFC r298482: > Cleanup redundant parenthesis from existing howmany()/roundup() > macro uses. > > Requested by: dchagin > > Modified: > stable/10/sys/amd64/amd64/pmap.c > stable/10/sys/amd64/linux/linux_sysvec.c > stable/10/sys/amd64/linux32/linux32_sysvec.c > stable/10/sys/compat/linux/linux_file.c > stable/10/sys/dev/cxgbe/tom/t4_tom.c > stable/10/sys/i386/linux/linux_sysvec.c > stable/10/sys/vm/vm_radix.c > Directory Properties: > stable/10/ (props changed) > From owner-svn-src-stable-10@freebsd.org Tue Apr 26 19:59:23 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 414B7B19E4E for ; Tue, 26 Apr 2016 19:59:23 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-ob0-x229.google.com (mail-ob0-x229.google.com [IPv6:2607:f8b0:4003:c01::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 170D41818 for ; Tue, 26 Apr 2016 19:59:23 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-ob0-x229.google.com with SMTP id j9so12392488obd.3 for ; Tue, 26 Apr 2016 12:59:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=bL2UAzTyeyvuZ2bDK7VqBL7gb2fOH5KlSay31nsa62I=; b=fIDrDP8wSjHP9vaJubk7weP1l4r38R33KXa3IvjwlQJETAREZMPB2JpBWFqDBVG7PH 16mfK4l4jiLn5aQt2q5XNTXXNd70Hc0hq53Aq1Aol6iKOIPo2tXSKA7nvr8d1q6zpFMO REe468B6Fza87BjTQhW5+B+2e7cR4q4/Wu+Eoum5cr4sMgvew0U/eyv4nFVpWqHwXozG VeM0rM/D+NXS1Gjd6Ux9MVn3w/qFBzspAImYstPWDJtkXtV3rxhbMyxm8w5cjBON52rR d3ytagytQVbXDm/Yz6LcBqZlakk/jSAygRwT1yeyUZ7/xZ9+VqTAH/2b4rPEDACu5TEZ C1ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=bL2UAzTyeyvuZ2bDK7VqBL7gb2fOH5KlSay31nsa62I=; b=ZbVetN+Fj+LSZer4JYvZmwC0B4/cfz5QwKsfn6IAoWXmqOwvP2MLpJTHWZVXiX7LHL fRrcwAC1IZc5+BPl9Ygff16um2lwCoOnAyodJX8BZf9E8jSy82NIcD2VU74cmCvVWV76 P3MuSTtHvDDC3VwzZ2mP+vTsyfGoe06XgxYmwi1qB/IQo1Fo8a59mw/a9Bt2wjP+cN1P 7wWo0/2q8JTrxXbSKVEQpm8su+Nh4k1fJW0L79SuEvrdFSj5mKUWeuDzt2rHMTihWdDI C/3OH2W2sDRDi5Edaw1QAPRItT/HNNVvTma6sMl2we+P6TtI1gsqia31Id/BeOwW/Bgg oMXA== X-Gm-Message-State: AOPr4FU+pIAzTlnHqH+/Y4xQZT9Q98AcDu7wzqwbqg+bD+oDuQ2EYDCKO6LVZhPAL9s/OE/AQ+hEzUPDD8uwxxb4 MIME-Version: 1.0 X-Received: by 10.60.173.210 with SMTP id bm18mr1815903oec.30.1461700762355; Tue, 26 Apr 2016 12:59:22 -0700 (PDT) Sender: sobomax@sippysoft.com Received: by 10.157.45.21 with HTTP; Tue, 26 Apr 2016 12:59:22 -0700 (PDT) In-Reply-To: <64931143-1496-56b9-8dc7-f11cbb0c06ed@FreeBSD.org> References: <201604261739.u3QHdtSd082499@repo.freebsd.org> <64931143-1496-56b9-8dc7-f11cbb0c06ed@FreeBSD.org> Date: Tue, 26 Apr 2016 12:59:22 -0700 X-Google-Sender-Auth: NQJkVt180OnsYxoZGdQtV4jkaWg Message-ID: Subject: Re: svn: stable/10/sys: amd64/amd64 amd64/linux amd64/linux32 compat/linux dev/cxgbe/tom i386/linux vm From: Maxim Sobolev To: Pedro Giffuni Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 19:59:23 -0000 Yeah, sure no rush. Another interesting mode of failure to check in howmany(X, S) is KASSERT((X % S) == 0). There might be few cases when it's intended behaviour, but for majority of them it should be indication of some kind of programmatic error (i.e. missing a cast in sizeof and getting void * size instead of the structure size). Those which rely on rounding could then be separated into howmany_rup() and howmany_rdown() or something. On Tue, Apr 26, 2016 at 12:04 PM, Pedro Giffuni wrote: > Hello > > On 04/26/16 13:42, Maxim Sobolev wrote: > >> Given the widespread use of those two macros, maybe we need howmany.9 >> and roundup.9 manual pages with detailed formal description? >> Particularly interested in how "return" supposed to be typed. Another >> thing is that would be nice is some kind of automatic >> #error/#warning/printf/KASSERT/panic when (X < Y || Y <= 0) & >> defined(INVARIANTS). >> >> -Max >> >> > I agree, we need those documented. There's also rounddown, roundup2 and > rounddown2. > > FWIW, I am tired of these massive replacements, and will likely take > a break before trying rounddown. > > Pedro. > > On Tue, Apr 26, 2016 at 10:39 AM, Pedro F. Giffuni > > wrote: >> >> Author: pfg >> Date: Tue Apr 26 17:39:54 2016 >> New Revision: 298653 >> URL: https://svnweb.freebsd.org/changeset/base/298653 >> >> Log: >> MFC r298482: >> Cleanup redundant parenthesis from existing howmany()/roundup() >> macro uses. >> >> Requested by: dchagin >> >> Modified: >> stable/10/sys/amd64/amd64/pmap.c >> stable/10/sys/amd64/linux/linux_sysvec.c >> stable/10/sys/amd64/linux32/linux32_sysvec.c >> stable/10/sys/compat/linux/linux_file.c >> stable/10/sys/dev/cxgbe/tom/t4_tom.c >> stable/10/sys/i386/linux/linux_sysvec.c >> stable/10/sys/vm/vm_radix.c >> Directory Properties: >> stable/10/ (props changed) >> >> > From owner-svn-src-stable-10@freebsd.org Tue Apr 26 21:16:08 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 640FDB1D60E for ; Tue, 26 Apr 2016 21:16:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm7.bullet.mail.bf1.yahoo.com (nm7.bullet.mail.bf1.yahoo.com [98.139.212.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C63F1EC5 for ; Tue, 26 Apr 2016 21:16:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1461705360; bh=pNchczr3H6lOqe6Y3FsiODvArGy3z5oxmB97bFcVTkc=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=Hisxg2+P6AjT5LVTUfLxoH14imyD/ql0mbb0Rmmcks+qlb4Ddws8OFYbxnidzlbMA0BfhE+lC/00CP09EUpcUYenOfJWGAnARw9MHGVN6nauxhk99i88f8Xp/YwnEtEtNo1cTCDDzdY4CApyEyJx0pXuhoCHBoe46bd8GKlD21FUkmLtsVEHkvDdtTh3PVsoMOfawxoAZxAD1CCSUAVkGHPmZml54rIETyCuhhOOZD2NfqJD2zX8uU3SNtAiAWNBLqvur3spoEm0f5IogioRFQTBV6GbuO3YRI63v/TO52Nlghoe7tDkqmHzqJeTgQUrfwJP+4eZkDQXRsTYZRm0Jg== Received: from [98.139.215.142] by nm7.bullet.mail.bf1.yahoo.com with NNFMP; 26 Apr 2016 21:16:00 -0000 Received: from [98.139.211.206] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 26 Apr 2016 21:16:00 -0000 Received: from [127.0.0.1] by smtp215.mail.bf1.yahoo.com with NNFMP; 26 Apr 2016 21:16:00 -0000 X-Yahoo-Newman-Id: 686161.49640.bm@smtp215.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: g6C0DUYVM1mqQopVA9lVAxBdXnCS9Xkaqo4CP6.4ZxVDyUT I_YnyrZIsUW6bV3DPhK602iOIkNF16jE8lTPq22Clr5FoYDcx.zMyBxmOu4p rZeN13p4yeKwpU9SBLpCaofAEi3ZxA.GeIqO5gVios.vZyk8FN0iboAgDqXw yvV3aXEOLJAzeKsLSWxEGqIa9w_H5TeLwUrAnztm0NNwRJ3QDR0cc58hRFWs 1d2mFcnybutUo.AnIR0gIvuqRY8vXfb38G.k.fOk2PIqA6GHPVZPqVSi9gD0 UhXm9s_bLAsxRG114wKiENkF5umcmj7Ff52vzsqgkBrRX99PXMJWFutmSqz0 VbM49E_PO2q309R6uUSFjS.RgwuZkoCfx7TIXcUA6SR8eOKEU5fCNo2cNYYe 5HXdGWWvrGEvuoOnyRuzTZioVvyajKIgJoNrMOfNOq0zwuT3V3ft2EIj_0zU giIqGFuAEYnft0DDdD.Vn0DdmE3hGAqU7nTbUbCIVJSVzqI9ZfEnPIc3onny xINrzb5YVoJOkHOwJHs9XHmmGr1_AyQ4i X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn: stable/10/sys: amd64/amd64 amd64/linux amd64/linux32 compat/linux dev/cxgbe/tom i386/linux vm To: Maxim Sobolev References: <201604261739.u3QHdtSd082499@repo.freebsd.org> <64931143-1496-56b9-8dc7-f11cbb0c06ed@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org From: Pedro Giffuni Message-ID: <7d17cf67-284d-0b8f-6ab7-83422e386a21@FreeBSD.org> Date: Tue, 26 Apr 2016 16:16:15 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 21:16:08 -0000 Just IMHO; It is probably too much trouble to pretend to add such checks to the macros. People using them should know to avoid division by zero and other issues that may happen. Pedro. On 04/26/16 14:59, Maxim Sobolev wrote: > Yeah, sure no rush. Another interesting mode of failure to check in > howmany(X, S) is KASSERT((X % S) == 0). There might be few cases when > it's intended behaviour, but for majority of them it should be > indication of some kind of programmatic error (i.e. missing a cast in > sizeof and getting void * size instead of the structure size). Those > which rely on rounding could then be separated into howmany_rup() > and howmany_rdown() or something. > > On Tue, Apr 26, 2016 at 12:04 PM, Pedro Giffuni > wrote: > > Hello > > On 04/26/16 13:42, Maxim Sobolev wrote: > > Given the widespread use of those two macros, maybe we need > howmany.9 > and roundup.9 manual pages with detailed formal description? > Particularly interested in how "return" supposed to be typed. > Another > thing is that would be nice is some kind of automatic > #error/#warning/printf/KASSERT/panic when (X < Y || Y <= 0) & > defined(INVARIANTS). > > -Max > > > I agree, we need those documented. There's also rounddown, roundup2 and > rounddown2. > > FWIW, I am tired of these massive replacements, and will likely take > a break before trying rounddown. > > Pedro. > > On Tue, Apr 26, 2016 at 10:39 AM, Pedro F. Giffuni > > >> wrote: > > Author: pfg > Date: Tue Apr 26 17:39:54 2016 > New Revision: 298653 > URL: https://svnweb.freebsd.org/changeset/base/298653 > > Log: > MFC r298482: > Cleanup redundant parenthesis from existing > howmany()/roundup() > macro uses. > > Requested by: dchagin > > Modified: > stable/10/sys/amd64/amd64/pmap.c > stable/10/sys/amd64/linux/linux_sysvec.c > stable/10/sys/amd64/linux32/linux32_sysvec.c > stable/10/sys/compat/linux/linux_file.c > stable/10/sys/dev/cxgbe/tom/t4_tom.c > stable/10/sys/i386/linux/linux_sysvec.c > stable/10/sys/vm/vm_radix.c > Directory Properties: > stable/10/ (props changed) > > > From owner-svn-src-stable-10@freebsd.org Wed Apr 27 15:24:35 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26484B1EC21; Wed, 27 Apr 2016 15:24:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF615164E; Wed, 27 Apr 2016 15:24:34 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RFOYxD082010; Wed, 27 Apr 2016 15:24:34 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RFOXXm082007; Wed, 27 Apr 2016 15:24:33 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201604271524.u3RFOXXm082007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 27 Apr 2016 15:24:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298699 - in stable/10: contrib/ntp contrib/ntp/html contrib/ntp/include contrib/ntp/lib/isc contrib/ntp/lib/isc/include/isc contrib/ntp/libntp contrib/ntp/ntpd contrib/ntp/ntpdate cont... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 15:24:35 -0000 Author: delphij Date: Wed Apr 27 15:24:33 2016 New Revision: 298699 URL: https://svnweb.freebsd.org/changeset/base/298699 Log: MFC r298695: MFV r298691: ntp 4.2.8p7. Security: CVE-2016-1547, CVE-2016-1548, CVE-2016-1549, CVE-2016-1550 Security: CVE-2016-1551, CVE-2016-2516, CVE-2016-2517, CVE-2016-2518 Security: CVE-2016-2519 Security: FreeBSD-SA-16:16.ntp With hat: so Added: stable/10/contrib/ntp/README.pullrequests - copied unchanged from r298695, head/contrib/ntp/README.pullrequests stable/10/contrib/ntp/lib/isc/tsmemcmp.c - copied unchanged from r298695, head/contrib/ntp/lib/isc/tsmemcmp.c stable/10/contrib/ntp/tests/libntp/run-tsafememcmp.c - copied unchanged from r298695, head/contrib/ntp/tests/libntp/run-tsafememcmp.c stable/10/contrib/ntp/tests/libntp/tsafememcmp.c - copied unchanged from r298695, head/contrib/ntp/tests/libntp/tsafememcmp.c Modified: stable/10/contrib/ntp/ChangeLog stable/10/contrib/ntp/CommitLog stable/10/contrib/ntp/Makefile.am stable/10/contrib/ntp/Makefile.in stable/10/contrib/ntp/NEWS stable/10/contrib/ntp/config.h.in stable/10/contrib/ntp/configure stable/10/contrib/ntp/configure.ac stable/10/contrib/ntp/html/authentic.html stable/10/contrib/ntp/html/monopt.html stable/10/contrib/ntp/html/xleave.html stable/10/contrib/ntp/include/ntp.h stable/10/contrib/ntp/include/ntp_keyacc.h stable/10/contrib/ntp/include/ntp_refclock.h stable/10/contrib/ntp/include/ntp_stdlib.h stable/10/contrib/ntp/include/ntp_types.h stable/10/contrib/ntp/include/ntp_worker.h stable/10/contrib/ntp/include/recvbuff.h stable/10/contrib/ntp/lib/isc/hmacmd5.c stable/10/contrib/ntp/lib/isc/hmacsha.c stable/10/contrib/ntp/lib/isc/include/isc/string.h stable/10/contrib/ntp/libntp/Makefile.am stable/10/contrib/ntp/libntp/Makefile.in stable/10/contrib/ntp/libntp/a_md5encrypt.c stable/10/contrib/ntp/libntp/authkeys.c stable/10/contrib/ntp/libntp/authreadkeys.c stable/10/contrib/ntp/libntp/is_ip_address.c stable/10/contrib/ntp/libntp/ntp_intres.c stable/10/contrib/ntp/libntp/ntp_worker.c stable/10/contrib/ntp/libntp/recvbuff.c stable/10/contrib/ntp/libntp/work_fork.c stable/10/contrib/ntp/libntp/work_thread.c stable/10/contrib/ntp/ntpd/invoke-ntp.conf.texi stable/10/contrib/ntp/ntpd/invoke-ntp.keys.texi stable/10/contrib/ntp/ntpd/invoke-ntpd.texi stable/10/contrib/ntp/ntpd/ntp.conf.5man stable/10/contrib/ntp/ntpd/ntp.conf.5mdoc stable/10/contrib/ntp/ntpd/ntp.conf.def stable/10/contrib/ntp/ntpd/ntp.conf.html stable/10/contrib/ntp/ntpd/ntp.conf.man.in stable/10/contrib/ntp/ntpd/ntp.conf.mdoc.in stable/10/contrib/ntp/ntpd/ntp.keys.5man stable/10/contrib/ntp/ntpd/ntp.keys.5mdoc stable/10/contrib/ntp/ntpd/ntp.keys.html stable/10/contrib/ntp/ntpd/ntp.keys.man.in stable/10/contrib/ntp/ntpd/ntp.keys.mdoc.in stable/10/contrib/ntp/ntpd/ntp_control.c stable/10/contrib/ntp/ntpd/ntp_io.c stable/10/contrib/ntp/ntpd/ntp_proto.c stable/10/contrib/ntp/ntpd/ntp_request.c stable/10/contrib/ntp/ntpd/ntp_timer.c stable/10/contrib/ntp/ntpd/ntpd-opts.c stable/10/contrib/ntp/ntpd/ntpd-opts.h stable/10/contrib/ntp/ntpd/ntpd.1ntpdman stable/10/contrib/ntp/ntpd/ntpd.1ntpdmdoc stable/10/contrib/ntp/ntpd/ntpd.c stable/10/contrib/ntp/ntpd/ntpd.html stable/10/contrib/ntp/ntpd/ntpd.man.in stable/10/contrib/ntp/ntpd/ntpd.mdoc.in stable/10/contrib/ntp/ntpdate/ntpdate.c stable/10/contrib/ntp/ntpdc/invoke-ntpdc.texi stable/10/contrib/ntp/ntpdc/ntpdc-opts.c stable/10/contrib/ntp/ntpdc/ntpdc-opts.h stable/10/contrib/ntp/ntpdc/ntpdc.1ntpdcman stable/10/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc stable/10/contrib/ntp/ntpdc/ntpdc.html stable/10/contrib/ntp/ntpdc/ntpdc.man.in stable/10/contrib/ntp/ntpdc/ntpdc.mdoc.in stable/10/contrib/ntp/ntpq/invoke-ntpq.texi stable/10/contrib/ntp/ntpq/ntpq-opts.c stable/10/contrib/ntp/ntpq/ntpq-opts.def stable/10/contrib/ntp/ntpq/ntpq-opts.h stable/10/contrib/ntp/ntpq/ntpq-subs.c stable/10/contrib/ntp/ntpq/ntpq.1ntpqman stable/10/contrib/ntp/ntpq/ntpq.1ntpqmdoc stable/10/contrib/ntp/ntpq/ntpq.c stable/10/contrib/ntp/ntpq/ntpq.h stable/10/contrib/ntp/ntpq/ntpq.html stable/10/contrib/ntp/ntpq/ntpq.man.in stable/10/contrib/ntp/ntpq/ntpq.mdoc.in stable/10/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi stable/10/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c stable/10/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h stable/10/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman stable/10/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc stable/10/contrib/ntp/ntpsnmpd/ntpsnmpd.html stable/10/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in stable/10/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in stable/10/contrib/ntp/packageinfo.sh stable/10/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman stable/10/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc stable/10/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html stable/10/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in stable/10/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in stable/10/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi stable/10/contrib/ntp/scripts/invoke-plot_summary.texi stable/10/contrib/ntp/scripts/invoke-summary.texi stable/10/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi stable/10/contrib/ntp/scripts/ntp-wait/ntp-wait-opts stable/10/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman stable/10/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc stable/10/contrib/ntp/scripts/ntp-wait/ntp-wait.html stable/10/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in stable/10/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in stable/10/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi stable/10/contrib/ntp/scripts/ntpsweep/ntpsweep-opts stable/10/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman stable/10/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc stable/10/contrib/ntp/scripts/ntpsweep/ntpsweep.html stable/10/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in stable/10/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in stable/10/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi stable/10/contrib/ntp/scripts/ntptrace/ntptrace-opts stable/10/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman stable/10/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc stable/10/contrib/ntp/scripts/ntptrace/ntptrace.html stable/10/contrib/ntp/scripts/ntptrace/ntptrace.man.in stable/10/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in stable/10/contrib/ntp/scripts/plot_summary-opts stable/10/contrib/ntp/scripts/plot_summary.1plot_summaryman stable/10/contrib/ntp/scripts/plot_summary.1plot_summarymdoc stable/10/contrib/ntp/scripts/plot_summary.html stable/10/contrib/ntp/scripts/plot_summary.man.in stable/10/contrib/ntp/scripts/plot_summary.mdoc.in stable/10/contrib/ntp/scripts/summary-opts stable/10/contrib/ntp/scripts/summary.1summaryman stable/10/contrib/ntp/scripts/summary.1summarymdoc stable/10/contrib/ntp/scripts/summary.html stable/10/contrib/ntp/scripts/summary.man.in stable/10/contrib/ntp/scripts/summary.mdoc.in stable/10/contrib/ntp/scripts/update-leap/invoke-update-leap.texi stable/10/contrib/ntp/scripts/update-leap/update-leap-opts stable/10/contrib/ntp/scripts/update-leap/update-leap.1update-leapman stable/10/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc stable/10/contrib/ntp/scripts/update-leap/update-leap.html stable/10/contrib/ntp/scripts/update-leap/update-leap.man.in stable/10/contrib/ntp/scripts/update-leap/update-leap.mdoc.in stable/10/contrib/ntp/sntp/config.h.in stable/10/contrib/ntp/sntp/configure stable/10/contrib/ntp/sntp/crypto.c stable/10/contrib/ntp/sntp/include/version.def stable/10/contrib/ntp/sntp/include/version.texi stable/10/contrib/ntp/sntp/invoke-sntp.texi stable/10/contrib/ntp/sntp/m4/ntp_libntp.m4 stable/10/contrib/ntp/sntp/m4/version.m4 stable/10/contrib/ntp/sntp/sntp-opts.c stable/10/contrib/ntp/sntp/sntp-opts.h stable/10/contrib/ntp/sntp/sntp.1sntpman stable/10/contrib/ntp/sntp/sntp.1sntpmdoc stable/10/contrib/ntp/sntp/sntp.html stable/10/contrib/ntp/sntp/sntp.man.in stable/10/contrib/ntp/sntp/sntp.mdoc.in stable/10/contrib/ntp/sntp/version.c stable/10/contrib/ntp/tests/libntp/Makefile.am stable/10/contrib/ntp/tests/libntp/Makefile.in stable/10/contrib/ntp/tests/libntp/lfpfunc.c stable/10/contrib/ntp/tests/libntp/run-lfpfunc.c stable/10/contrib/ntp/tests/libntp/run-timevalops.c stable/10/contrib/ntp/tests/libntp/ssl_init.c stable/10/contrib/ntp/tests/libntp/timespecops.c stable/10/contrib/ntp/tests/libntp/timevalops.c stable/10/contrib/ntp/tests/ntpq/Makefile.am stable/10/contrib/ntp/tests/ntpq/Makefile.in stable/10/contrib/ntp/util/invoke-ntp-keygen.texi stable/10/contrib/ntp/util/ntp-keygen-opts.c stable/10/contrib/ntp/util/ntp-keygen-opts.h stable/10/contrib/ntp/util/ntp-keygen.1ntp-keygenman stable/10/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc stable/10/contrib/ntp/util/ntp-keygen.html stable/10/contrib/ntp/util/ntp-keygen.man.in stable/10/contrib/ntp/util/ntp-keygen.mdoc.in stable/10/usr.sbin/ntp/config.h stable/10/usr.sbin/ntp/doc/ntp-keygen.8 stable/10/usr.sbin/ntp/doc/ntp.conf.5 stable/10/usr.sbin/ntp/doc/ntp.keys.5 stable/10/usr.sbin/ntp/doc/ntpd.8 stable/10/usr.sbin/ntp/doc/ntpdc.8 stable/10/usr.sbin/ntp/doc/ntpq.8 stable/10/usr.sbin/ntp/doc/sntp.8 stable/10/usr.sbin/ntp/libntp/Makefile stable/10/usr.sbin/ntp/scripts/mkver Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/ntp/ChangeLog ============================================================================== --- stable/10/contrib/ntp/ChangeLog Wed Apr 27 15:10:40 2016 (r298698) +++ stable/10/contrib/ntp/ChangeLog Wed Apr 27 15:24:33 2016 (r298699) @@ -1,4 +1,65 @@ --- +(4.2.8p7) 2016/04/26 Released by Harlan Stenn + +* [Sec 2901] KoD packets must have non-zero transmit timestamps. HStenn. +* [Sec 2936] Skeleton Key: Any system knowing the trusted key can serve + time. Include passive servers in this check. HStenn. +* [Sec 2945] Additional KoD packet checks. HStenn. +* [Sec 2978] Interleave can be partially triggered. HStenn. +* [Sec 3007] Validate crypto-NAKs. Danny Mayer. +* [Sec 3008] Always check the return value of ctl_getitem(). + - initial work by HStenn + - Additional cleanup of ctl_getitem by perlinger@ntp.org +* [Sec 3009] Crafted addpeer with hmode > 7 causes OOB error. perlinger@ntp.org + - added more stringent checks on packet content +* [Sec 3010] remote configuration trustedkey/requestkey values + are not properly validated. perlinger@ntp.org + - sidekick: Ignore keys that have an unsupported MAC algorithm + but are otherwise well-formed +* [Sec 3011] Duplicate IPs on unconfig directives will cause an assertion botch + - graciously accept the same IP multiple times. perlinger@ntp.org +* [Sec 3020] Refclock impersonation. HStenn. +* [Bug 2831] Segmentation Fault in DNS lookup during startup. perlinger@ntp.org + - fixed yet another race condition in the threaded resolver code. +* [Bug 2858] bool support. Use stdbool.h when available. HStenn. +* [Bug 2879] Improve NTP security against timing attacks. perlinger@ntp.org + - integrated patches by Loganaden Velvidron + with some modifications & unit tests +* [Bug 2952] Symmetric active/passive mode is broken. HStenn. +* [Bug 2960] async name resolution fixes for chroot() environments. + Reinhard Max. +* [Bug 2994] Systems with HAVE_SIGNALED_IO fail to compile. perlinger@ntp.org +* [Bug 2995] Fixes to compile on Windows +* [Bug 2999] out-of-bounds access in 'is_safe_filename()'. perlinger@ntp.org +* [Bug 3013] Fix for ssl_init.c SHA1 test. perlinger@ntp.org + - Patch provided by Ch. Weisgerber +* [Bug 3015] ntpq: config-from-file: "request contains an unprintable character" + - A change related to [Bug 2853] forbids trailing white space in + remote config commands. perlinger@ntp.org +* [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - report and patch from Aleksandr Kostikov. + - Overhaul of Windows IO completion port handling. perlinger@ntp.org +* [Bug 3022] authkeys.c should be refactored. perlinger@ntp.org + - fixed memory leak in access list (auth[read]keys.c) + - refactored handling of key access lists (auth[read]keys.c) + - reduced number of error branches (authreadkeys.c) +* [Bug 3023] ntpdate cannot correct dates in the future. perlinger@ntp.org +* [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. +* [Bug 3031] ntp broadcastclient unable to synchronize to an server + when the time of server changed. perlinger@ntp.org + - Check the initial delay calculation and reject/unpeer the broadcast + server if the delay exceeds 50ms. Retry again after the next + broadcast packet. +* [Bug 3036] autokey trips an INSIST in authistrustedip(). Harlan Stenn. +* Document ntp.key's optional IP list in authenetic.html. Harlan Stenn. +* Update html/xleave.html documentation. Harlan Stenn. +* Update ntp.conf documentation. Harlan Stenn. +* Fix some Credit: attributions in the NEWS file. Harlan Stenn. +* Fix typo in html/monopt.html. Harlan Stenn. +* Add README.pullrequests. Harlan Stenn. +* Cleanup to include/ntp.h. Harlan Stenn. + +--- (4.2.8p6) 2016/01/20 Released by Harlan Stenn * [Sec 2935] Deja Vu: Replay attack on authenticated broadcast mode. HStenn. @@ -92,6 +153,7 @@ * Update scripts/calc_tickadj/Makefile.am. Harlan Stenn. --- +(4.2.8p4) 2015/10/21 Released by Harlan Stenn * [Sec 2899] CVE-2014-9297 perlinger@ntp.org * [Sec 2901] Drop invalid packet before checking KoD. Check for all KoD's. Modified: stable/10/contrib/ntp/CommitLog ============================================================================== --- stable/10/contrib/ntp/CommitLog Wed Apr 27 15:10:40 2016 (r298698) +++ stable/10/contrib/ntp/CommitLog Wed Apr 27 15:24:33 2016 (r298699) @@ -1,3 +1,1130 @@ +ChangeSet@1.3669, 2016-04-26 20:30:51-04:00, stenn@deacon.udel.edu + NTP_4_2_8P7 + TAG: NTP_4_2_8P7 + + ChangeLog@1.1820 +1 -0 + NTP_4_2_8P7 + + ntpd/invoke-ntp.conf.texi@1.198 +38 -20 + NTP_4_2_8P7 + + ntpd/invoke-ntp.keys.texi@1.189 +1 -1 + NTP_4_2_8P7 + + ntpd/invoke-ntpd.texi@1.505 +2 -2 + NTP_4_2_8P7 + + ntpd/ntp.conf.5man@1.232 +43 -24 + NTP_4_2_8P7 + + ntpd/ntp.conf.5mdoc@1.232 +40 -18 + NTP_4_2_8P7 + + ntpd/ntp.conf.html@1.184 +34 -10 + NTP_4_2_8P7 + + ntpd/ntp.conf.man.in@1.232 +43 -24 + NTP_4_2_8P7 + + ntpd/ntp.conf.mdoc.in@1.232 +40 -18 + NTP_4_2_8P7 + + ntpd/ntp.keys.5man@1.223 +2 -2 + NTP_4_2_8P7 + + ntpd/ntp.keys.5mdoc@1.223 +2 -2 + NTP_4_2_8P7 + + ntpd/ntp.keys.html@1.185 +1 -1 + NTP_4_2_8P7 + + ntpd/ntp.keys.man.in@1.223 +2 -2 + NTP_4_2_8P7 + + ntpd/ntp.keys.mdoc.in@1.223 +2 -2 + NTP_4_2_8P7 + + ntpd/ntpd-opts.c@1.527 +7 -7 + NTP_4_2_8P7 + + ntpd/ntpd-opts.h@1.526 +3 -3 + NTP_4_2_8P7 + + ntpd/ntpd.1ntpdman@1.334 +3 -3 + NTP_4_2_8P7 + + ntpd/ntpd.1ntpdmdoc@1.334 +2 -2 + NTP_4_2_8P7 + + ntpd/ntpd.html@1.178 +2 -2 + NTP_4_2_8P7 + + ntpd/ntpd.man.in@1.334 +3 -3 + NTP_4_2_8P7 + + ntpd/ntpd.mdoc.in@1.334 +2 -2 + NTP_4_2_8P7 + + ntpdc/invoke-ntpdc.texi@1.502 +2 -2 + NTP_4_2_8P7 + + ntpdc/ntpdc-opts.c@1.520 +7 -7 + NTP_4_2_8P7 + + ntpdc/ntpdc-opts.h@1.519 +3 -3 + NTP_4_2_8P7 + + ntpdc/ntpdc.1ntpdcman@1.333 +3 -3 + NTP_4_2_8P7 + + ntpdc/ntpdc.1ntpdcmdoc@1.333 +2 -2 + NTP_4_2_8P7 + + ntpdc/ntpdc.html@1.346 +2 -2 + NTP_4_2_8P7 + + ntpdc/ntpdc.man.in@1.333 +3 -3 + NTP_4_2_8P7 + + ntpdc/ntpdc.mdoc.in@1.333 +2 -2 + NTP_4_2_8P7 + + ntpq/invoke-ntpq.texi@1.510 +2 -2 + NTP_4_2_8P7 + + ntpq/ntpq-opts.c@1.527 +7 -7 + NTP_4_2_8P7 + + ntpq/ntpq-opts.h@1.525 +3 -3 + NTP_4_2_8P7 + + ntpq/ntpq.1ntpqman@1.338 +3 -3 + NTP_4_2_8P7 + + ntpq/ntpq.1ntpqmdoc@1.338 +2 -2 + NTP_4_2_8P7 + + ntpq/ntpq.html@1.175 +36 -6 + NTP_4_2_8P7 + + ntpq/ntpq.man.in@1.338 +3 -3 + NTP_4_2_8P7 + + ntpq/ntpq.mdoc.in@1.338 +2 -2 + NTP_4_2_8P7 + + ntpsnmpd/invoke-ntpsnmpd.texi@1.504 +2 -2 + NTP_4_2_8P7 + + ntpsnmpd/ntpsnmpd-opts.c@1.522 +7 -7 + NTP_4_2_8P7 + + ntpsnmpd/ntpsnmpd-opts.h@1.521 +3 -3 + NTP_4_2_8P7 + + ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.333 +3 -3 + NTP_4_2_8P7 + + ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.333 +2 -2 + NTP_4_2_8P7 + + ntpsnmpd/ntpsnmpd.html@1.173 +1 -1 + NTP_4_2_8P7 + + ntpsnmpd/ntpsnmpd.man.in@1.333 +3 -3 + NTP_4_2_8P7 + + ntpsnmpd/ntpsnmpd.mdoc.in@1.333 +2 -2 + NTP_4_2_8P7 + + packageinfo.sh@1.526 +2 -2 + NTP_4_2_8P7 + + scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.94 +3 -3 + NTP_4_2_8P7 + + scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.95 +2 -2 + NTP_4_2_8P7 + + scripts/calc_tickadj/calc_tickadj.html@1.96 +1 -1 + NTP_4_2_8P7 + + scripts/calc_tickadj/calc_tickadj.man.in@1.93 +3 -3 + NTP_4_2_8P7 + + scripts/calc_tickadj/calc_tickadj.mdoc.in@1.95 +2 -2 + NTP_4_2_8P7 + + scripts/calc_tickadj/invoke-calc_tickadj.texi@1.98 +1 -1 + NTP_4_2_8P7 + + scripts/invoke-plot_summary.texi@1.115 +2 -2 + NTP_4_2_8P7 + + scripts/invoke-summary.texi@1.115 +2 -2 + NTP_4_2_8P7 + + scripts/ntp-wait/invoke-ntp-wait.texi@1.325 +2 -2 + NTP_4_2_8P7 + + scripts/ntp-wait/ntp-wait-opts@1.61 +2 -2 + NTP_4_2_8P7 + + scripts/ntp-wait/ntp-wait.1ntp-waitman@1.322 +3 -3 + NTP_4_2_8P7 + + scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.323 +2 -2 + NTP_4_2_8P7 + + scripts/ntp-wait/ntp-wait.html@1.342 +2 -2 + NTP_4_2_8P7 + + scripts/ntp-wait/ntp-wait.man.in@1.322 +3 -3 + NTP_4_2_8P7 + + scripts/ntp-wait/ntp-wait.mdoc.in@1.323 +2 -2 + NTP_4_2_8P7 + + scripts/ntpsweep/invoke-ntpsweep.texi@1.113 +2 -2 + NTP_4_2_8P7 + + scripts/ntpsweep/ntpsweep-opts@1.63 +2 -2 + NTP_4_2_8P7 + + scripts/ntpsweep/ntpsweep.1ntpsweepman@1.101 +3 -3 + NTP_4_2_8P7 + + scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.101 +2 -2 + NTP_4_2_8P7 + + scripts/ntpsweep/ntpsweep.html@1.114 +2 -2 + NTP_4_2_8P7 + + scripts/ntpsweep/ntpsweep.man.in@1.101 +3 -3 + NTP_4_2_8P7 + + scripts/ntpsweep/ntpsweep.mdoc.in@1.102 +2 -2 + NTP_4_2_8P7 + + scripts/ntptrace/invoke-ntptrace.texi@1.114 +2 -2 + NTP_4_2_8P7 + + scripts/ntptrace/ntptrace-opts@1.63 +2 -2 + NTP_4_2_8P7 + + scripts/ntptrace/ntptrace.1ntptraceman@1.101 +3 -3 + NTP_4_2_8P7 + + scripts/ntptrace/ntptrace.1ntptracemdoc@1.102 +2 -2 + NTP_4_2_8P7 + + scripts/ntptrace/ntptrace.html@1.115 +2 -2 + NTP_4_2_8P7 + + scripts/ntptrace/ntptrace.man.in@1.101 +3 -3 + NTP_4_2_8P7 + + scripts/ntptrace/ntptrace.mdoc.in@1.103 +2 -2 + NTP_4_2_8P7 + + scripts/plot_summary-opts@1.63 +2 -2 + NTP_4_2_8P7 + + scripts/plot_summary.1plot_summaryman@1.113 +3 -3 + NTP_4_2_8P7 + + scripts/plot_summary.1plot_summarymdoc@1.113 +2 -2 + NTP_4_2_8P7 + + scripts/plot_summary.html@1.116 +2 -2 + NTP_4_2_8P7 + + scripts/plot_summary.man.in@1.113 +3 -3 + NTP_4_2_8P7 + + scripts/plot_summary.mdoc.in@1.113 +2 -2 + NTP_4_2_8P7 + + scripts/summary-opts@1.63 +2 -2 + NTP_4_2_8P7 + + scripts/summary.1summaryman@1.113 +3 -3 + NTP_4_2_8P7 + + scripts/summary.1summarymdoc@1.113 +2 -2 + NTP_4_2_8P7 + + scripts/summary.html@1.116 +2 -2 + NTP_4_2_8P7 + + scripts/summary.man.in@1.113 +3 -3 + NTP_4_2_8P7 + + scripts/summary.mdoc.in@1.113 +2 -2 + NTP_4_2_8P7 + + scripts/update-leap/invoke-update-leap.texi@1.14 +1 -1 + NTP_4_2_8P7 + + scripts/update-leap/update-leap-opts@1.14 +2 -2 + NTP_4_2_8P7 + + scripts/update-leap/update-leap.1update-leapman@1.14 +3 -3 + NTP_4_2_8P7 + + scripts/update-leap/update-leap.1update-leapmdoc@1.14 +2 -2 + NTP_4_2_8P7 + + scripts/update-leap/update-leap.html@1.14 +1 -1 + NTP_4_2_8P7 + + scripts/update-leap/update-leap.man.in@1.14 +3 -3 + NTP_4_2_8P7 + + scripts/update-leap/update-leap.mdoc.in@1.14 +2 -2 + NTP_4_2_8P7 + + sntp/invoke-sntp.texi@1.502 +2 -2 + NTP_4_2_8P7 + + sntp/sntp-opts.c@1.521 +7 -7 + NTP_4_2_8P7 + + sntp/sntp-opts.h@1.519 +3 -3 + NTP_4_2_8P7 + + sntp/sntp.1sntpman@1.337 +3 -3 + NTP_4_2_8P7 + + sntp/sntp.1sntpmdoc@1.337 +2 -2 + NTP_4_2_8P7 + + sntp/sntp.html@1.517 +2 -2 + NTP_4_2_8P7 + + sntp/sntp.man.in@1.337 +3 -3 + NTP_4_2_8P7 + + sntp/sntp.mdoc.in@1.337 +2 -2 + NTP_4_2_8P7 + + util/invoke-ntp-keygen.texi@1.505 +2 -2 + NTP_4_2_8P7 + + util/ntp-keygen-opts.c@1.523 +7 -7 + NTP_4_2_8P7 + + util/ntp-keygen-opts.h@1.521 +3 -3 + NTP_4_2_8P7 + + util/ntp-keygen.1ntp-keygenman@1.333 +3 -3 + NTP_4_2_8P7 + + util/ntp-keygen.1ntp-keygenmdoc@1.333 +2 -2 + NTP_4_2_8P7 + + util/ntp-keygen.html@1.179 +2 -2 + NTP_4_2_8P7 + + util/ntp-keygen.man.in@1.333 +3 -3 + NTP_4_2_8P7 + + util/ntp-keygen.mdoc.in@1.333 +2 -2 + NTP_4_2_8P7 + +ChangeSet@1.3668, 2016-04-26 20:07:48-04:00, stenn@deacon.udel.edu + ntp-4.2.8p7 + + packageinfo.sh@1.525 +1 -1 + ntp-4.2.8p7 + +ChangeSet@1.3667, 2016-04-26 23:24:25+00:00, stenn@psp-deb1.ntp.org + 4.2.8p7 documentation cleanup + + ChangeLog@1.1819 +9 -9 + 4.2.8p7 documentation cleanup + + NEWS@1.169 +123 -36 + 4.2.8p7 documentation cleanup + +ChangeSet@1.3666, 2016-04-24 09:17:06+00:00, stenn@psp-deb1.ntp.org + [Bug 3036] autokey trips an INSIST in authistrustedip() + + ntpd/ntp_proto.c@1.386 +0 -1 + [Bug 3036] autokey trips an INSIST in authistrustedip() + +ChangeSet@1.3665, 2016-04-21 23:42:43+00:00, stenn@psp-deb1.ntp.org + Update 3007 + + NEWS@1.168 +1 -1 + Update 3007 + +ChangeSet@1.3664, 2016-04-21 23:29:30+00:00, stenn@psp-deb1.ntp.org + [Bug 3007] Fix bug in crypto-NAK check + + ChangeLog@1.1818 +1 -1 + [Bug 3007] Fix bug in crypto-NAK check + + ntpd/ntp_proto.c@1.385 +3 -1 + [Bug 3007] Fix bug in crypto-NAK check + +ChangeSet@1.3663, 2016-04-21 09:29:31+00:00, stenn@psp-deb1.ntp.org + [Bug 3036] autokey trips an INSIST in authistrustedip() + + NEWS@1.167 +1 -0 + [Bug 3036] autokey trips an INSIST in authistrustedip() + +ChangeSet@1.3661, 2016-04-21 09:24:12+00:00, stenn@psp-deb1.ntp.org + tweak some ntp_proto.c timestamp log messages + + ntpd/ntp_proto.c@1.383 +4 -3 + tweak some ntp_proto.c timestamp log messages + +ChangeSet@1.3630.1.17, 2016-04-21 09:11:51+00:00, stenn@psp-deb1.ntp.org + [Bug 3036] autokey trips an INSIST in authistrustedip() + + ChangeLog@1.1794.1.15 +1 -0 + [Bug 3036] autokey trips an INSIST in authistrustedip() + + ntpd/ntp_proto.c@1.373.2.7 +6 -1 + [Bug 3036] autokey trips an INSIST in authistrustedip() + +ChangeSet@1.3660, 2016-04-19 05:29:57+00:00, stenn@psp-deb1.ntp.org + Windows cleanup for Bug 2978 mitigation + + ports/winnt/include/config.h@1.114 +6 -0 + Windows cleanup for Bug 2978 mitigation + +ChangeSet@1.3659, 2016-04-18 05:38:06+00:00, stenn@psp-deb1.ntp.org + 4.2.8p7 update: [Bug 2831] Segmentation Fault in DNS lookup during startup + + NEWS@1.166 +2 -0 + 4.2.8p7 update: [Bug 2831] Segmentation Fault in DNS lookup during startup + +ChangeSet@1.3630.15.1, 2016-04-18 06:07:25+02:00, perlinger@ntp.org + [Bug 2831] Segmentation Fault in DNS lookup during startup. + - fixed yet another race condition in the threaded resolver code. + + ChangeLog@1.1794.15.1 +2 -0 + [Bug 2831] Segmentation Fault in DNS lookup during startup. + - fixed yet another race condition in the threaded resolver code. + + include/ntp_worker.h@1.7 +2 -0 + [Bug 2831] Segmentation Fault in DNS lookup during startup. + - fixed yet another race condition in the threaded resolver code: global locker prototype + + libntp/ntp_intres.c@1.100 +20 -28 + [Bug 2831] Segmentation Fault in DNS lookup during startup. + - fixed yet another race condition in the threaded resolver code: + lock global context table during access + remove dangerous wrapper + + libntp/work_fork.c@1.14.1.1 +5 -0 + [Bug 2831] Segmentation Fault in DNS lookup during startup. + - fixed yet another race condition in the threaded resolver code: global locker dummy + + libntp/work_thread.c@1.21 +23 -0 + [Bug 2831] Segmentation Fault in DNS lookup during startup. + - fixed yet another race condition in the threaded resolver code: create&handle global lock + +ChangeSet@1.3657, 2016-04-16 07:59:23+00:00, stenn@psp-deb1.ntp.org + type + + NEWS@1.165 +1 -1 + type + +ChangeSet@1.3656, 2016-04-14 09:03:11+00:00, stenn@psp-deb1.ntp.org + Update the NEWS file for 4.2.8p7 + + NEWS@1.164 +7 -0 + Update the NEWS file for 4.2.8p7 + +ChangeSet@1.3655, 2016-04-14 01:59:45+00:00, stenn@psp-deb1.ntp.org + [Sec 2978] Interleave can be partially triggered + + ChangeLog@1.1815 +1 -0 + [Sec 2978] Interleave can be partially triggered + + configure.ac@1.605 +22 -0 + [Sec 2978] Interleave can be partially triggered + + ntpd/ntp_proto.c@1.382 +11 -3 + [Sec 2978] Interleave can be partially triggered + +ChangeSet@1.3654, 2016-04-14 01:46:50+00:00, stenn@psp-deb1.ntp.org + Update the NEWS file for 4.2.8p7 + + NEWS@1.163 +168 -26 + Update the NEWS file for 4.2.8p7 + +ChangeSet@1.3653, 2016-04-12 22:29:18+00:00, stenn@psp-deb1.ntp.org + 4.2.8p7 prep + + NEWS@1.162 +105 -5 + 4.2.8p7 prep + +ChangeSet@1.3652, 2016-04-12 09:01:09+00:00, stenn@psp-deb1.ntp.org + Credit Aleksandr Kostikov on bug 3019 + + ChangeLog@1.1814 +1 -0 + Credit Aleksandr Kostikov on bug 3019 + +ChangeSet@1.3630.13.6, 2016-04-12 07:43:08+00:00, stenn@psp-deb1.ntp.org + comment tweak + + ntpd/ntp_proto.c@1.373.2.6 +1 -1 + comment tweak + +ChangeSet@1.3650, 2016-04-11 20:26:29-07:00, harlan@max.pfcs.com + [Bug 2952] Symmetric active/passive mode is broken + + ChangeLog@1.1812 +1 -0 + [Bug 2952] Symmetric active/passive mode is broken + + ntpd/ntp_proto.c@1.380 +21 -12 + [Bug 2952] Symmetric active/passive mode is broken + +ChangeSet@1.3649, 2016-04-11 19:56:06-07:00, harlan@max.pfcs.com + Cleanup to include/ntp.h + + ChangeLog@1.1811 +1 -0 + Cleanup to include/ntp.h + + include/ntp.h@1.218 +7 -0 + cleanup + +ChangeSet@1.3630.13.5, 2016-04-01 19:18:25+02:00, jnperlin@nemesis.localnet + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed + - adjust pull cycle of broadcast client to trensmission of brodcast server + + libntp/ntp_worker.c@1.7.1.1 +1 -1 + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed + - side kick: fix annoying signed/unsigned clash + + ntpd/ntp_proto.c@1.373.2.5 +1 -0 + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed + - adjust pull cycle of broadcast client to trensmission of brodcast server + +ChangeSet@1.3630.13.4, 2016-03-30 23:55:33+02:00, jnperlin@nemesis.localnet + [Bug 3031] modify deadband + + ntpd/ntp_proto.c@1.373.2.4 +13 -12 + [Bug 3031] broadcast issues + - modify deadband for first round after volley + +ChangeSet@1.3630.14.1, 2016-03-30 17:28:04+00:00, perlinger@psp-deb1.ntp.org + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed. + - Check the initial delay calculation and reject/unpeer the broadcast server if the delay exceeds + the cutoff limit. (default 50ms) + Retry again after the next broadcast packet. + + ChangeLog@1.1794.14.1 +5 -0 + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed. + + ntpd/ntp_io.c@1.414.3.1 +28 -10 + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed. + - improve/fix handling of opening broadcast sockets (-> EADDRNOTAVAIL) + + ntpd/ntp_proto.c@1.373.3.1 +23 -4 + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed. + - Check the initial delay calculation and reject/unpeer the broadcast server if the delay exceeds 50ms. + Retry again after the next broadcast packet. + - the absolute value of negative broadcastdelays is cutoff limit for peer removal. + +ChangeSet@1.3630.13.2, 2016-03-30 19:23:06+02:00, jnperlin@nemesis.localnet + [Bug 3031] + + ntpd/ntp_io.c@1.414.2.1 +28 -10 + [Bug 3031] + - improve/fix handling of opening broadcast sockets (-> EADDRNOTAVAIL) + + ntpd/ntp_proto.c@1.373.2.2 +14 -6 + [Bug 3031] + - the absolute value of negative broadcastdelays is cutoff limit for peer removal + +ChangeSet@1.3630.1.14, 2016-03-30 10:29:07+00:00, stenn@psp-deb1.ntp.org + [Bug 2960] async name resolution fixes for chroot() environments. Reinhard Max + + ChangeLog@1.1794.1.12 +2 -0 + [Bug 2960] async name resolution fixes for chroot() environments. Reinhard Max + + libntp/work_fork.c@1.15 +1 -1 + [Bug 2960] async name resolution fixes for chroot() environments. Reinhard Max + + ntpd/ntp_timer.c@1.96 +6 -0 + [Bug 2960] async name resolution fixes for chroot() environments. Reinhard Max + + ntpd/ntpd.c@1.171 +15 -0 + [Bug 2960] async name resolution fixes for chroot() environments. Reinhard Max + + sntp/m4/ntp_libntp.m4@1.33 +1 -0 + [Bug 2960] async name resolution fixes for chroot() environments. Reinhard Max + +ChangeSet@1.3630.13.1, 2016-03-29 18:22:03+02:00, perlinger@ntp.org + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed. + - Check the initial delay calculation and reject/unpeer the broadcast server if the delay exceeds 50ms. + Retry again after the next broadcast packet. + + ChangeLog@1.1794.13.1 +5 -0 + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed. + + ntpd/ntp_proto.c@1.373.2.1 +11 -0 + [Bug 3031] ntp broadcastclient unable to synchronize to an server when the time of server changed. + - Check the initial delay calculation and reject/unpeer the broadcast server if the delay exceeds 50ms. + Retry again after the next broadcast packet. + +ChangeSet@1.3630.12.1, 2016-03-27 23:59:51+02:00, jnperlin@nemesis.localnet + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - complete refurbishment of overlapped IO engine + - cleanup + + ChangeLog@1.1794.12.1 +2 -0 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - work around windows network issues, improve overlapped IO. perlinger@ntp.org + + include/ntp.h@1.216.1.1 +1 -0 + [Bug 3019] NTPD stops processing packets ERROR_HOST_UNREACHABLE + - add IOCPL registration handle to interface + + include/ntp_refclock.h@1.38 +2 -1 + [Bug 3019] NTPD stops processing packets ERROR_HOST_UNREACHABLE + - add IOCPL registration handle to RIO structure + + include/recvbuff.h@1.26 +2 -2 + [Bug 3019] NTPD stops processing packets ERROR_HOST_UNREACHABLE + - fix SOCKET vs. FD clash + - 'get_free_recv_buffer_alloc()': extended comment + + libntp/ntp_worker.c@1.8 +1 -1 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - fix signed/unsigned clash + + libntp/recvbuff.c@1.41 +15 -13 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - API cleanup: accept and silently ignore NULL pointer in 'freerecvbuf()' + - fix SOCKET vs. FD clash + + ntpd/ntp_io.c@1.414.1.1 +42 -12 + [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE + - first invalidate FDs in shared structure, then close handles + - defer free() via cooling pond when doing overlapped IO + --- + [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE + - proper wiring to IO completion ports + --- + [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE + - first invalidate FDs in shared structure, then close handles + - defer free() via cooling pond when doing overlapped IO + - proper wiring to IO completion ports + --- + [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE + - wired the needed unregistration functions for overlapped IO + + ports/winnt/include/ntp_iocompletionport.h@1.22 +17 -10 + Bug 3019 - NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - extend API to provide essential information + - added missing unregistration functions to API + + ports/winnt/include/ntp_iocplmem.h@1.1 +24 -0 + [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE + - refactored IOCPL heap into separate file + + ports/winnt/include/ntp_iocplmem.h@1.0 +0 -0 + + ports/winnt/include/ntp_iocpltypes.h@1.1 +160 -0 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - refactored helper objects (locks, PPS/device context, IO context,...) into separate file + + ports/winnt/include/ntp_iocpltypes.h@1.0 +0 -0 + + ports/winnt/ntpd/ntp_iocompletionport.c@1.73 +875 -791 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - make sure ALL operations are overlapped for sockets + - use APC queue for deferred error processing + - take extra care to deal with interfaces/clocks being removed while overlapped IO in flight + - minor WINAPI cleanups (VS2008 vs VS2013) + - extend API to provide essential information + - better context checking + - implemented the missing unregistration functions + - implemented shared locking between clocks/interfaces and IO operations + - made sure minimal locking is engaged + - fixed / locked / avoided access to global / shared values from IO thread + - made sure interfaces and clocks cannot be deleted wile accessed from worker thread + - made sure feeding the receive queue stops with deregistration + In other words, a complete refurbishment. + - further refactoring, better handling of received packets + + ports/winnt/ntpd/ntp_iocplmem.c@1.1 +123 -0 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - refactored IOCPL heap into separate file + + ports/winnt/ntpd/ntp_iocplmem.c@1.0 +0 -0 + + ports/winnt/ntpd/ntp_iocpltypes.c@1.1 +366 -0 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - refactored helper objects (locks, PPS/device context, IO context,...) into separate file + + ports/winnt/ntpd/ntp_iocpltypes.c@1.0 +0 -0 + + ports/winnt/ntpd/ntservice.c@1.30 +13 -3 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - log request from SCM in INFO level + + ports/winnt/vs2005/ntpd.vcproj@1.21 +8 -18 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - added ntp_iocpl{mem,types}.c to sources. + + ports/winnt/vs2008/ntpd/ntpd.vcproj@1.51 +16 -0 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - added ntp_iocpl{mem,types}.c to sources. + + ports/winnt/vs2013/debug-x64.props@1.2 +1 -0 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - sidekick: property sheet name + + ports/winnt/vs2013/libntp/libntp.vcxproj.filters@1.7.1.1 +3 -0 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - auto update + + ports/winnt/vs2013/ntpd/ntpd.vcxproj@1.9 +4 -0 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - added ntp_iocpl{mem,types}.c to sources. + + ports/winnt/vs2013/ntpd/ntpd.vcxproj.filters@1.6 +12 -0 + [Bug 3019] NTPD stops processing packets after hitting ERROR_HOST_UNREACHABLE + - auto update + + ports/winnt/vs2013/release-x64.props@1.2 +1 -0 + [Bug 3019] NTPD stops processing packets after ERROR_HOST_UNREACHABLE + - sidekick: property sheet name + +ChangeSet@1.3630.1.12, 2016-03-19 09:09:07+00:00, stenn@psp-deb1.ntp.org + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + tests/ntpq/Makefile.am@1.9 +1 -0 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + +ChangeSet@1.3630.1.10, 2016-03-16 09:22:31+00:00, stenn@psp-deb1.ntp.org + Add README.pullrequests. Harlan Stenn + + ChangeLog@1.1794.1.9 +1 -0 + Add README.pullrequests. Harlan Stenn + + Makefile.am@1.135 +1 -0 + Add README.pullrequests. Harlan Stenn + + README.pullrequests@1.1 +90 -0 + BitKeeper file /home/stenn/ntp-stable/README.pullrequests + + README.pullrequests@1.0 +0 -0 + +ChangeSet@1.3630.11.1, 2016-03-16 08:46:16+00:00, stenn@psp-deb1.ntp.org + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ChangeLog@1.1794.11.1 +1 -0 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/invoke-ntpq.texi@1.509 +28 -1 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq-opts.c@1.526 +108 -50 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq-opts.def@1.27 +12 -0 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq-opts.h@1.524 +21 -8 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq-subs.c@1.116.1.1 +17 -10 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq.1ntpqman@1.337 +24 -3 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq.1ntpqmdoc@1.337 +22 -2 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq.c@1.169 +53 -2 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq.h@1.32 +3 -0 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq.man.in@1.337 +24 -3 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + + ntpq/ntpq.mdoc.in@1.337 +22 -2 + [Bug 3030] ntpq needs a general way to specify refid output format. HStenn. + +ChangeSet@1.3630.10.1, 2016-03-01 08:30:22+01:00, perlinger@ntp.org + [Bug 3023] ntpdate cannot correct dates in the future. + + ChangeLog@1.1794.10.1 +1 -0 + [Bug 3023] ntpdate cannot correct dates in the future. + + ntpdate/ntpdate.c@1.98 +9 -5 + [Bug 3023] ntpdate cannot correct dates in the future. + +ChangeSet@1.3642, 2016-03-01 05:46:29+00:00, stenn@psp-deb1.ntp.org + cleanup + + ChangeLog@1.1805 +0 -1 + cleanup + +ChangeSet@1.3641, 2016-02-29 23:01:01+00:00, stenn@psp-deb1.ntp.org + [Sec 3020] Refclock impersonation. HStenn. + + ChangeLog@1.1804 +1 -0 + [Sec 3020] Refclock impersonation. HStenn. + + configure.ac@1.604 +18 -0 + [Sec 3020] Refclock impersonation. HStenn. + + ntpd/ntp_io.c@1.415 +12 -0 + [Sec 3020] Refclock impersonation. HStenn. + +ChangeSet@1.3630.9.1, 2016-02-29 20:03:59+01:00, jnperlin@hydra.localnet + [Bug 3022] authkeys.c should be refactored + + ChangeLog@1.1794.9.1 +4 -0 + [Bug 3022] authkeys.c should be refactored + + include/ntp_keyacc.h@1.2 +6 -0 + [Bug 3022] authkeys.c should be refactored + - refactoring of key access handling + + libntp/authkeys.c@1.34 +146 -85 + [Bug 3022] authkeys.c should be refactored + - refactoring of key access handling + - fixed memory leak in access list + + libntp/authreadkeys.c@1.25.1.1 +52 -44 + [Bug 3022] authkeys.c should be refactored + - refactoring of key access handling + - reduced number of error branches + +ChangeSet@1.3638.2.2, 2016-02-22 05:33:56+00:00, stenn@psp-deb1.ntp.org + [Sec 3008] Always check the return value of ctl_getitem(). HStenn. + + ChangeLog@1.1801.2.1 +1 -0 + [Sec 3008] Always check the return value of ctl_getitem(). HStenn. + + ntpd/ntp_control.c@1.206.2.1 +11 -2 + [Sec 3008] Always check the return value of ctl_getitem(). HStenn. + +ChangeSet@1.3638.2.1, 2016-02-22 05:12:39+00:00, stenn@psp-deb1.ntp.org + Update ntp.conf documentation. Harlan Stenn. + + ntpd/ntp.conf.def@1.23 +38 -16 + Update ntp.conf documentation. Harlan Stenn. + +ChangeSet@1.3638.1.3, 2016-02-22 03:39:39+00:00, stenn@psp-deb1.ntp.org + Bug 3007 cleanup + + ntpd/ntp_proto.c@1.379 +4 -1 + Bug 3007 cleanup + +ChangeSet@1.3630.8.1, 2016-02-21 15:09:37+01:00, perlinger@ntp.org + [Bug 3009] Crafted addpeer with hmode > 7 causes OOB error + + ChangeLog@1.1794.8.1 +2 -0 + [Bug 3009] Crafted addpeer with hmode > 7 causes OOB error + + ntpd/ntp_request.c@1.117.2.1 +29 -2 + [Bug 3009] Crafted addpeer with hmode > 7 causes OOB error + - added more stringent checks on packet content: + hmode <= 6 (7 is already out of range for a peer mode!) + +ChangeSet@1.3630.7.2, 2016-02-21 09:39:25+01:00, perlinger@ntp.org + Bug 3010] remote configuration trustedkey/requestkey values are not properly validated + - sidekick: Ignore keys that have an unsupported MAC algorithm but are otherwise well-formed + + ChangeLog@1.1794.7.2 +2 -0 + Bug 3010] remote configuration trustedkey/requestkey values are not properly validated + - sidekick: Ignore keys that have an unsupported MAC algorithm but are otherwise well-formed + + libntp/authreadkeys.c@1.26 +48 -26 + [Bug 3010] remote configuration trustedkey/requestkey values are not properly validated + - sidekick: Ignore keys that have an unsupported MAC algorithm but are otherwise well-formed + +ChangeSet@1.3630.7.1, 2016-02-19 22:42:25+01:00, perlinger@ntp.org + [Bug 3010] remote configuration trustedkey/requestkey values are not properly validated + + ChangeLog@1.1794.7.1 +2 -0 + [Bug 3010] remote configuration trustedkey/requestkey values are not properly validated + + ntpd/ntp_request.c@1.117.1.1 +41 -25 + [Bug 3010] remote configuration trustedkey/requestkey values are not properly validated + - make sure the new keyids are valid static key IDs and present in the key table + +ChangeSet@1.3630.6.1, 2016-02-19 19:47:31+01:00, perlinger@ntp.org + [Bug 3013] Fix for ssl_init.c SHA1 test + + ChangeLog@1.1794.6.1 +2 -0 + [Bug 3013] Fix for ssl_init.c SHA1 test + + tests/libntp/ssl_init.c@1.9 +2 -2 + [Bug 3013] Fix for ssl_init.c SHA1 test + - Require SHA1 explicitely, to avoid confusion with (deprecated) SHA0. + Patch provided by Ch. Weisgerber + +ChangeSet@1.3630.5.1, 2016-02-17 18:36:10+01:00, perlinger@ntp.org + [Bug 3015] ntpq: config-from-file: "request contains an unprintable character" + + ChangeLog@1.1794.5.1 +3 -0 + [Bug 3015] ntpq: config-from-file: "request contains an unprintable character" + + ntpq/ntpq-subs.c@1.117 +35 -16 + [Bug 3015] ntpq: config-from-file: "request contains an unprintable character" + - remove trailing whitespace in remote config command + - remove comments, too. + +ChangeSet@1.3639, 2016-02-17 09:30:05+01:00, jnperlin@hydra.localnet + [Bug 3008] ctl_getitem() return value not always checked + + ChangeLog@1.1802 +3 -0 + [Bug 3008] ctl_getitem() return value not always checked + + ntpd/ntp_control.c@1.206.1.1 +101 -58 + [Bug 3008] ctl_getitem() return value not always checked + - also some cleanup of ctl_getitem + +ChangeSet@1.3630.3.3, 2016-02-14 10:15:57+00:00, stenn@psp-deb1.ntp.org + Fix typo in html/monopt.html. Harlan Stenn. + + ChangeLog@1.1794.3.3 +1 -0 + Fix typo in html/monopt.html. Harlan Stenn. + + html/monopt.html@1.39 +2 -2 + Fix typo in html/monopt.html. Harlan Stenn. + +ChangeSet@1.3630.3.2, 2016-02-13 09:15:45+00:00, stenn@psp-deb1.ntp.org + Fix some Credit: attributions in the NEWS file. Harlan Stenn. + + ChangeLog@1.1794.3.2 +1 -0 + Fix some Credit: attributions in the NEWS file. Harlan Stenn. + + NEWS@1.161 +3 -2 + Fix some Credit: attributions in the NEWS file. Harlan Stenn. + +ChangeSet@1.3630.4.1, 2016-02-10 20:11:21+01:00, perlinger@ntp.org + [Bug 3011] Duplicate IPs on unconfig directives will cause an assertion botch + + ChangeLog@1.1794.4.1 +2 -0 + [Bug 3011] Duplicate IPs on unconfig directives will cause an assertion botch + + ntpd/ntp_request.c@1.118 +48 -78 + [Bug 3011] Duplicate IPs on unconfig directives will cause an assertion botch + - reworked 'do_unconf()' to survive the effect of having peers named multiple times + +ChangeSet@1.3630.2.3, 2016-02-09 00:46:57+00:00, mayer@psp-deb1.ntp.org *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Wed Apr 27 15:48:48 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6910BB1E3AD; Wed, 27 Apr 2016 15:48:48 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EF1A1AF6; Wed, 27 Apr 2016 15:48:48 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RFml2D088502; Wed, 27 Apr 2016 15:48:47 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RFml7L088501; Wed, 27 Apr 2016 15:48:47 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201604271548.u3RFml7L088501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Wed, 27 Apr 2016 15:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298705 - stable/10/share/man/man5 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 15:48:48 -0000 Author: bcr (doc committer) Date: Wed Apr 27 15:48:47 2016 New Revision: 298705 URL: https://svnweb.freebsd.org/changeset/base/298705 Log: MFC r298522: The default value of MINFREE is defined to be 8% in ufs/ffs/fs.h and not 10%. The newfs(8) and tunefs(8) man pages had this change already, but fs(5) did not. This change makes it consistent again. Bump Dd. PR: 204929 Submitted by: amutu@amutu.com Sponsored by: Essen Linuxhotel Hackathon 2016 Modified: stable/10/share/man/man5/fs.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man5/fs.5 ============================================================================== --- stable/10/share/man/man5/fs.5 Wed Apr 27 15:38:56 2016 (r298704) +++ stable/10/share/man/man5/fs.5 Wed Apr 27 15:48:47 2016 (r298705) @@ -32,7 +32,7 @@ .\" @(#)fs.5 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd October 31, 2006 +.Dd April 23, 2016 .Dt FS 5 .Os .Sh NAME @@ -266,7 +266,7 @@ however severe performance degradations file system is run at greater than 90% full; thus the default value of .Fa fs_minfree -is 10%. +is 8%. .Pp Empirically the best trade-off between block fragmentation and overall disk utilization at a loading of 90% comes with a @@ -278,10 +278,10 @@ The element specifies whether the file system should try to minimize the time spent allocating blocks, or if it should attempt to minimize the space fragmentation on the disk. -If the value of fs_minfree (see above) is less than 10%, +If the value of fs_minfree (see above) is less than 8%, then the file system defaults to optimizing for space to avoid running out of full sized blocks. -If the value of minfree is greater than or equal to 10%, +If the value of minfree is greater than or equal to 8%, fragmentation is unlikely to be problematical, and the file system defaults to optimizing for time. .Pp From owner-svn-src-stable-10@freebsd.org Wed Apr 27 16:23:17 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88D39B1EEDE; Wed, 27 Apr 2016 16:23:17 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 590D3179B; Wed, 27 Apr 2016 16:23:17 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RGNG9d000807; Wed, 27 Apr 2016 16:23:16 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RGNG6Q000806; Wed, 27 Apr 2016 16:23:16 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201604271623.u3RGNG6Q000806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Wed, 27 Apr 2016 16:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298706 - stable/10/usr.sbin/jexec X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 16:23:17 -0000 Author: bcr (doc committer) Date: Wed Apr 27 16:23:16 2016 New Revision: 298706 URL: https://svnweb.freebsd.org/changeset/base/298706 Log: MFC r298524: Define which of the username options (-u/-U) to jexec(8) is the default. Bump Dd. PR: 207587 Submitted by: dewayne@heuristicsystems.com.au Sponsored by: Essen Hackathon 2016 Modified: stable/10/usr.sbin/jexec/jexec.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/jexec/jexec.8 ============================================================================== --- stable/10/usr.sbin/jexec/jexec.8 Wed Apr 27 15:48:47 2016 (r298705) +++ stable/10/usr.sbin/jexec/jexec.8 Wed Apr 27 16:23:16 2016 (r298706) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jul 11, 2015 +.Dd April 24, 2016 .Dt JEXEC 8 .Os .Sh NAME @@ -59,6 +59,7 @@ and anything from the login class capabi The user name from host environment as whom the .Ar command should run. +This is the default. .It Fl U Ar username The user name from jailed environment as whom the .Ar command From owner-svn-src-stable-10@freebsd.org Wed Apr 27 19:12:50 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCFDBB1F507; Wed, 27 Apr 2016 19:12:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BCF71116; Wed, 27 Apr 2016 19:12:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RJCnDY079965; Wed, 27 Apr 2016 19:12:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RJCn1l079964; Wed, 27 Apr 2016 19:12:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604271912.u3RJCn1l079964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 27 Apr 2016 19:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298715 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 19:12:50 -0000 Author: jhb Date: Wed Apr 27 19:12:49 2016 New Revision: 298715 URL: https://svnweb.freebsd.org/changeset/base/298715 Log: MFC 297039,297374,297398,297484: Poll the IPI status while waiting constantly instead of delaying 5 microseconds between checks. This avoids inserting a minimum latency of 5 microseconds on each IPI. 297039: Check IPI status more frequently when waiting. An IPI cannot be sent via the local APIC if a previous IPI is still being delivered. Attempts to send an IPI will wait for a pending IPI to clear. Prior to r278325 these checks used a spin loop with a hardcoded maximum count which broke AP startup on some systems. However, r278325 also enforced a minimum latency of 5 microseconds if an IPI was still pending which resulted in a measurable performance hit. This change reduces that minimum latency to 1 microsecond. 297374: Calibrate the frequency of the of the native_lapic_ipi_wait() loop, and avoid a delay while waiting for IPI delivery acknowledgement in xAPIC mode. This makes the loop exit immediately after the delivery bit in APIC_ICR register is set, instead of waiting for some microseconds. We only need to ensure that some amount of time is allowed for the LAPIC to react to the command, and we need that the wait time is finite and reasonable. For that reasons, it is irrelevant if the CPU frequency or throttling decrease the speed and make the loop, calibrated for full CPU speed at boot time, execute somewhat slower. 297398: Fix several bugs in r297374: - fix UP build [1] - do not obliterate initial reading of rdtsc by the loop counter [2] - restore the meaning of the argument -1 to native_lapic_ipi_wait() as wait until LAPIC acknowledge without timeout - correct formula for calculating loop iteration count for 1us, it was inverted, and ensure that even on unlikely slow CPUs at least one check for ack is performed. 297484: Style(9), use tabs for the #define LOOPS line. Print unsigned values with %u. Make code slightly more compact by inlining loop limit. Modified: stable/10/sys/x86/x86/local_apic.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/local_apic.c ============================================================================== --- stable/10/sys/x86/x86/local_apic.c Wed Apr 27 19:09:21 2016 (r298714) +++ stable/10/sys/x86/x86/local_apic.c Wed Apr 27 19:12:49 2016 (r298715) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -158,6 +159,9 @@ volatile lapic_t *lapic; vm_paddr_t lapic_paddr; static u_long lapic_timer_divisor; static struct eventtimer lapic_et; +#ifdef SMP +static uint64_t lapic_ipi_wait_mult; +#endif static void lapic_enable(void); static void lapic_resume(struct pic *pic, bool suspend_cancelled); @@ -221,6 +225,9 @@ lvt_mode(struct lapic *la, u_int pin, ui void lapic_init(vm_paddr_t addr) { +#ifdef SMP + uint64_t r, r1, r2, rx; +#endif u_int regs[4]; int i, arat; @@ -275,6 +282,38 @@ lapic_init(vm_paddr_t addr) lapic_et.et_priv = NULL; et_register(&lapic_et); } + +#ifdef SMP +#define LOOPS 1000000 + /* + * Calibrate the busy loop waiting for IPI ack in xAPIC mode. + * lapic_ipi_wait_mult contains the number of iterations which + * approximately delay execution for 1 microsecond (the + * argument to native_lapic_ipi_wait() is in microseconds). + * + * We assume that TSC is present and already measured. + * Possible TSC frequency jumps are irrelevant to the + * calibration loop below, the CPU clock management code is + * not yet started, and we do not enter sleep states. + */ + KASSERT((cpu_feature & CPUID_TSC) != 0 && tsc_freq != 0, + ("TSC not initialized")); + r = rdtsc(); + for (rx = 0; rx < LOOPS; rx++) { + (void)lapic->icr_lo; + ia32_pause(); + } + r = rdtsc() - r; + r1 = tsc_freq * LOOPS; + r2 = r * 1000000; + lapic_ipi_wait_mult = r1 >= r2 ? r1 / r2 : 1; + if (bootverbose) { + printf("LAPIC: ipi_wait() us multiplier %ju (r %ju tsc %ju)\n", + (uintmax_t)lapic_ipi_wait_mult, (uintmax_t)r, + (uintmax_t)tsc_freq); + } +#undef LOOPS +#endif /* SMP */ } /* @@ -1381,25 +1420,20 @@ SYSINIT(apic_setup_io, SI_SUB_INTR, SI_O * private to the MD code. The public interface for the rest of the * kernel is defined in mp_machdep.c. */ + +/* + * Wait delay microseconds for IPI to be sent. If delay is -1, we + * wait forever. + */ int lapic_ipi_wait(int delay) { - int x; - - /* - * Wait delay microseconds for IPI to be sent. If delay is - * -1, we wait forever. - */ - if (delay == -1) { - while ((lapic->icr_lo & APIC_DELSTAT_MASK) != APIC_DELSTAT_IDLE) - ia32_pause(); - return (1); - } + uint64_t rx; - for (x = 0; x < delay; x += 5) { + for (rx = 0; delay == -1 || rx < lapic_ipi_wait_mult * delay; rx++) { if ((lapic->icr_lo & APIC_DELSTAT_MASK) == APIC_DELSTAT_IDLE) return (1); - DELAY(5); + ia32_pause(); } return (0); } From owner-svn-src-stable-10@freebsd.org Wed Apr 27 23:04:43 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89ED1B1FAD5; Wed, 27 Apr 2016 23:04:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 615DE12C8; Wed, 27 Apr 2016 23:04:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RN4glh076022; Wed, 27 Apr 2016 23:04:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RN4guA076020; Wed, 27 Apr 2016 23:04:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604272304.u3RN4guA076020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 27 Apr 2016 23:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298724 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 23:04:43 -0000 Author: jhb Date: Wed Apr 27 23:04:42 2016 New Revision: 298724 URL: https://svnweb.freebsd.org/changeset/base/298724 Log: MFC 297932,298295: Improvements for PCI passthru devices. 297932: Handle PBA that shares a page with MSI-X table for passthrough devices. If the PBA shares a page with the MSI-X table, map the shared page via /dev/mem and emulate accesses to the portion of the PBA in the shared page by accessing the mapped page. 298295: Always emit an error message on passthru configuration errors. Previously, many errors (such as the PCI device not being attached to the ppt(4) driver) resulted in bhyve silently exiting without starting the virtual machine. Now any errors encountered when configuring a virtual slot for a PCI passthru device should be noted on stderr. Modified: stable/10/usr.sbin/bhyve/pci_emul.h stable/10/usr.sbin/bhyve/pci_passthru.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/pci_emul.h ============================================================================== --- stable/10/usr.sbin/bhyve/pci_emul.h Wed Apr 27 21:51:24 2016 (r298723) +++ stable/10/usr.sbin/bhyve/pci_emul.h Wed Apr 27 23:04:42 2016 (r298724) @@ -142,6 +142,8 @@ struct pci_devinst { int pba_size; int function_mask; struct msix_table_entry *table; /* allocated at runtime */ + void *pba_page; + int pba_page_offset; } pi_msix; void *pi_arg; /* devemu-private data */ Modified: stable/10/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- stable/10/usr.sbin/bhyve/pci_passthru.c Wed Apr 27 21:51:24 2016 (r298723) +++ stable/10/usr.sbin/bhyve/pci_passthru.c Wed Apr 27 23:04:42 2016 (r298724) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -42,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include @@ -59,6 +60,10 @@ __FBSDID("$FreeBSD$"); #define _PATH_DEVIO "/dev/io" #endif +#ifndef _PATH_MEM +#define _PATH_MEM "/dev/mem" +#endif + #define LEGACY_SUPPORT 1 #define MSIX_TABLE_COUNT(ctrl) (((ctrl) & PCIM_MSIXCTRL_TABLE_SIZE) + 1) @@ -66,6 +71,7 @@ __FBSDID("$FreeBSD$"); static int pcifd = -1; static int iofd = -1; +static int memfd = -1; struct passthru_softc { struct pci_devinst *psc_pi; @@ -279,6 +285,35 @@ msix_table_read(struct passthru_softc *s int index; pi = sc->psc_pi; + if (offset >= pi->pi_msix.pba_offset && + offset < pi->pi_msix.pba_offset + pi->pi_msix.pba_size) { + switch(size) { + case 1: + src8 = (uint8_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); + data = *src8; + break; + case 2: + src16 = (uint16_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); + data = *src16; + break; + case 4: + src32 = (uint32_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); + data = *src32; + break; + case 8: + src64 = (uint64_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); + data = *src64; + break; + default: + return (-1); + } + return (data); + } + if (offset < pi->pi_msix.table_offset) return (-1); @@ -320,12 +355,44 @@ msix_table_write(struct vmctx *ctx, int { struct pci_devinst *pi; struct msix_table_entry *entry; - uint32_t *dest; + uint8_t *dest8; + uint16_t *dest16; + uint32_t *dest32; + uint64_t *dest64; size_t entry_offset; uint32_t vector_control; int error, index; pi = sc->psc_pi; + if (offset >= pi->pi_msix.pba_offset && + offset < pi->pi_msix.pba_offset + pi->pi_msix.pba_size) { + switch(size) { + case 1: + dest8 = (uint8_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); + *dest8 = data; + break; + case 2: + dest16 = (uint16_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); + *dest16 = data; + break; + case 4: + dest32 = (uint32_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); + *dest32 = data; + break; + case 8: + dest64 = (uint64_t *)(pi->pi_msix.pba_page + offset - + pi->pi_msix.pba_page_offset); + *dest64 = data; + break; + default: + break; + } + return; + } + if (offset < pi->pi_msix.table_offset) return; @@ -342,8 +409,8 @@ msix_table_write(struct vmctx *ctx, int assert(entry_offset % 4 == 0); vector_control = entry->vector_control; - dest = (uint32_t *)((void *)entry + entry_offset); - *dest = data; + dest32 = (uint32_t *)((void *)entry + entry_offset); + *dest32 = data; /* If MSI-X hasn't been enabled, do nothing */ if (pi->pi_msix.enabled) { /* If the entry is masked, don't set it up */ @@ -386,28 +453,44 @@ init_msix_table(struct vmctx *ctx, struc table_size += pi->pi_msix.table_count * MSIX_TABLE_ENTRY_SIZE; table_size = roundup2(table_size, 4096); + idx = pi->pi_msix.table_bar; + start = pi->pi_bar[idx].addr; + remaining = pi->pi_bar[idx].size; + if (pi->pi_msix.pba_bar == pi->pi_msix.table_bar) { pba_offset = pi->pi_msix.pba_offset; pba_size = pi->pi_msix.pba_size; if (pba_offset >= table_offset + table_size || table_offset >= pba_offset + pba_size) { /* - * The PBA can reside in the same BAR as the MSI-x - * tables as long as it does not overlap with any - * naturally aligned page occupied by the tables. + * If the PBA does not share a page with the MSI-x + * tables, no PBA emulation is required. */ + pi->pi_msix.pba_page = NULL; + pi->pi_msix.pba_page_offset = 0; } else { - /* Need to also emulate the PBA, not supported yet */ - printf("Unsupported MSI-X configuration: %d/%d/%d\n", - b, s, f); - return (-1); + /* + * The PBA overlaps with either the first or last + * page of the MSI-X table region. Map the + * appropriate page. + */ + if (pba_offset <= table_offset) + pi->pi_msix.pba_page_offset = table_offset; + else + pi->pi_msix.pba_page_offset = table_offset + + table_size - 4096; + pi->pi_msix.pba_page = mmap(NULL, 4096, PROT_READ | + PROT_WRITE, MAP_SHARED, memfd, start + + pi->pi_msix.pba_page_offset); + if (pi->pi_msix.pba_page == MAP_FAILED) { + warn( + "Failed to map PBA page for MSI-X on %d/%d/%d", + b, s, f); + return (-1); + } } } - idx = pi->pi_msix.table_bar; - start = pi->pi_bar[idx].addr; - remaining = pi->pi_bar[idx].size; - /* Map everything before the MSI-X table */ if (table_offset > 0) { len = table_offset; @@ -476,7 +559,7 @@ cfginitbar(struct vmctx *ctx, struct pas if (bartype != PCIBAR_IO) { if (((base | size) & PAGE_MASK) != 0) { - printf("passthru device %d/%d/%d BAR %d: " + warnx("passthru device %d/%d/%d BAR %d: " "base %#lx or size %#lx not page aligned\n", sc->psc_sel.pc_bus, sc->psc_sel.pc_dev, sc->psc_sel.pc_func, i, base, size); @@ -534,11 +617,17 @@ cfginit(struct vmctx *ctx, struct pci_de sc->psc_sel.pc_dev = slot; sc->psc_sel.pc_func = func; - if (cfginitmsi(sc) != 0) + if (cfginitmsi(sc) != 0) { + warnx("failed to initialize MSI for PCI %d/%d/%d", + bus, slot, func); goto done; + } - if (cfginitbar(ctx, sc) != 0) + if (cfginitbar(ctx, sc) != 0) { + warnx("failed to initialize BARs for PCI %d/%d/%d", + bus, slot, func); goto done; + } error = 0; /* success */ done: @@ -556,28 +645,45 @@ passthru_init(struct vmctx *ctx, struct memflags = vm_get_memflags(ctx); if (!(memflags & VM_MEM_F_WIRED)) { - fprintf(stderr, "passthru requires guest memory to be wired\n"); + warnx("passthru requires guest memory to be wired"); goto done; } if (pcifd < 0) { pcifd = open(_PATH_DEVPCI, O_RDWR, 0); - if (pcifd < 0) + if (pcifd < 0) { + warn("failed to open %s", _PATH_DEVPCI); goto done; + } } if (iofd < 0) { iofd = open(_PATH_DEVIO, O_RDWR, 0); - if (iofd < 0) + if (iofd < 0) { + warn("failed to open %s", _PATH_DEVIO); goto done; + } + } + + if (memfd < 0) { + memfd = open(_PATH_MEM, O_RDWR, 0); + if (memfd < 0) { + warn("failed to open %s", _PATH_MEM); + goto done; + } } if (opts == NULL || - sscanf(opts, "%d/%d/%d", &bus, &slot, &func) != 3) + sscanf(opts, "%d/%d/%d", &bus, &slot, &func) != 3) { + warnx("invalid passthru options"); goto done; + } - if (vm_assign_pptdev(ctx, bus, slot, func) != 0) + if (vm_assign_pptdev(ctx, bus, slot, func) != 0) { + warnx("PCI device at %d/%d/%d is not using the ppt(4) driver", + bus, slot, func); goto done; + } sc = calloc(1, sizeof(struct passthru_softc)); @@ -688,10 +794,8 @@ passthru_cfgwrite(struct vmctx *ctx, int sc->psc_sel.pc_dev, sc->psc_sel.pc_func, pi->pi_msi.addr, pi->pi_msi.msg_data, pi->pi_msi.maxmsgnum); - if (error != 0) { - printf("vm_setup_pptdev_msi error %d\r\n", errno); - exit(1); - } + if (error != 0) + err(1, "vm_setup_pptdev_msi"); return (0); } @@ -707,11 +811,8 @@ passthru_cfgwrite(struct vmctx *ctx, int pi->pi_msix.table[i].msg_data, pi->pi_msix.table[i].vector_control); - if (error) { - printf("vm_setup_pptdev_msix error " - "%d\r\n", errno); - exit(1); - } + if (error) + err(1, "vm_setup_pptdev_msix"); } } return (0); From owner-svn-src-stable-10@freebsd.org Thu Apr 28 01:05:42 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A6B7B1E534; Thu, 28 Apr 2016 01:05:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D07321876; Thu, 28 Apr 2016 01:05:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3S15fsv012551; Thu, 28 Apr 2016 01:05:41 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3S15fWv012550; Thu, 28 Apr 2016 01:05:41 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604280105.u3S15fWv012550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 28 Apr 2016 01:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298725 - stable/10/sys/fs/ext2fs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2016 01:05:42 -0000 Author: pfg Date: Thu Apr 28 01:05:40 2016 New Revision: 298725 URL: https://svnweb.freebsd.org/changeset/base/298725 Log: MFC r298518: ext2_htree_release(): prevent signed integer overflow in a loop. h_levels_num, as most data structs in ext2fs, is unsigned so the index that addresses it has to be unsigned as well. To get to overflow here we would probably be considering a degenerate case though. MFC after: 5 days Modified: stable/10/sys/fs/ext2fs/ext2_htree.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/ext2fs/ext2_htree.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_htree.c Wed Apr 27 23:04:42 2016 (r298724) +++ stable/10/sys/fs/ext2fs/ext2_htree.c Thu Apr 28 01:05:40 2016 (r298725) @@ -191,7 +191,7 @@ ext2_htree_set_limit(struct ext2fs_htree static void ext2_htree_release(struct ext2fs_htree_lookup_info *info) { - int i; + u_int i; for (i = 0; i < info->h_levels_num; i++) { struct buf *bp = info->h_levels[i].h_bp; From owner-svn-src-stable-10@freebsd.org Thu Apr 28 01:11:26 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 693E4B1E688; Thu, 28 Apr 2016 01:11:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39DD51B7B; Thu, 28 Apr 2016 01:11:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3S1BPdL012821; Thu, 28 Apr 2016 01:11:25 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3S1BPmX012820; Thu, 28 Apr 2016 01:11:25 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604280111.u3S1BPmX012820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 28 Apr 2016 01:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298726 - stable/10/lib/libc/regex X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2016 01:11:26 -0000 Author: pfg Date: Thu Apr 28 01:11:25 2016 New Revision: 298726 URL: https://svnweb.freebsd.org/changeset/base/298726 Log: MFC r298521; regex: prevent two improbable signed integer overflows. In matcher() we used an integer to index nsub of type size_t. In print() we used an integer to index nstates of type sopno, typedef'd long. In both cases the indexes never take negative values. Match the types to avoid any error. Modified: stable/10/lib/libc/regex/engine.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/regex/engine.c ============================================================================== --- stable/10/lib/libc/regex/engine.c Thu Apr 28 01:05:40 2016 (r298725) +++ stable/10/lib/libc/regex/engine.c Thu Apr 28 01:11:25 2016 (r298726) @@ -154,7 +154,7 @@ matcher(struct re_guts *g, int eflags) { const char *endp; - int i; + size_t i; struct match mv; struct match *m = &mv; const char *dp; @@ -1108,7 +1108,7 @@ print(struct match *m, FILE *d) { struct re_guts *g = m->g; - int i; + sopno i; int first = 1; if (!(m->eflags®_TRACE)) From owner-svn-src-stable-10@freebsd.org Thu Apr 28 01:31:08 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90805B1EE0B; Thu, 28 Apr 2016 01:31:08 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 616BD17DC; Thu, 28 Apr 2016 01:31:08 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3S1V7QF018881; Thu, 28 Apr 2016 01:31:07 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3S1V7rx018880; Thu, 28 Apr 2016 01:31:07 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201604280131.u3S1V7rx018880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Thu, 28 Apr 2016 01:31:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298728 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2016 01:31:08 -0000 Author: jamie Date: Thu Apr 28 01:31:07 2016 New Revision: 298728 URL: https://svnweb.freebsd.org/changeset/base/298728 Log: MFC r298516: Don't remove the /var/run/jail_name.id file if a jail fails to start. This messes up ezjail (and possibly others), when attempting to start a jail that already exists. PR: 208806 Reviewed by: tj Modified: stable/10/etc/rc.d/jail Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/jail ============================================================================== --- stable/10/etc/rc.d/jail Thu Apr 28 01:12:38 2016 (r298727) +++ stable/10/etc/rc.d/jail Thu Apr 28 01:31:07 2016 (r298728) @@ -471,7 +471,6 @@ jail_start() if _jid=$($jail_jls -j $_j jid); then echo "$_jid" > /var/run/jail_${_j}.id else - rm -f /var/run/jail_${_j}.id echo " cannot start jail " \ "\"${_hostname:-${_j}}\": " fi @@ -495,7 +494,6 @@ jail_start() _jid=$($jail_jls -j $_j jid) echo $_jid > /var/run/jail_${_j}.id else - rm -f /var/run/jail_${_j}.id echo " cannot start jail " \ "\"${_hostname:-${_j}}\": " cat $_tmp From owner-svn-src-stable-10@freebsd.org Thu Apr 28 01:40:48 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 785D4B1E01F; Thu, 28 Apr 2016 01:40:48 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 461041CA8; Thu, 28 Apr 2016 01:40:48 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3S1elWr022030; Thu, 28 Apr 2016 01:40:47 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3S1elDp022029; Thu, 28 Apr 2016 01:40:47 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201604280140.u3S1elDp022029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Thu, 28 Apr 2016 01:40:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298729 - stable/10/usr.sbin/jail X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2016 01:40:48 -0000 Author: jamie Date: Thu Apr 28 01:40:47 2016 New Revision: 298729 URL: https://svnweb.freebsd.org/changeset/base/298729 Log: MFC r298562: Make jail(8) interpret escape codes in fstab the same as getfsent(3). PR: 208663 Modified: stable/10/usr.sbin/jail/command.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/jail/command.c ============================================================================== --- stable/10/usr.sbin/jail/command.c Thu Apr 28 01:31:07 2016 (r298728) +++ stable/10/usr.sbin/jail/command.c Thu Apr 28 01:40:47 2016 (r298729) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "jailp.h" @@ -445,8 +446,14 @@ run_command(struct cfjail *j) strcpy(comcs, comstring->s); argc = 0; for (cs = strtok(comcs, " \t\f\v\r\n"); cs && argc < 4; - cs = strtok(NULL, " \t\f\v\r\n")) + cs = strtok(NULL, " \t\f\v\r\n")) { + if (argc <= 1 && strunvis(cs, cs) < 0) { + jail_warnx(j, "%s: %s: fstab parse error", + j->intparams[comparam]->name, comstring->s); + return -1; + } argv[argc++] = cs; + } if (argc == 0) return 0; if (argc < 3) { From owner-svn-src-stable-10@freebsd.org Fri Apr 29 02:56:04 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E279EB204C3; Fri, 29 Apr 2016 02:56:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B41BC19F9; Fri, 29 Apr 2016 02:56:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3T2u3b2087812; Fri, 29 Apr 2016 02:56:03 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3T2u3Yc087811; Fri, 29 Apr 2016 02:56:03 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604290256.u3T2u3Yc087811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 29 Apr 2016 02:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298763 - stable/10/usr.bin/patch X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 02:56:05 -0000 Author: pfg Date: Fri Apr 29 02:56:03 2016 New Revision: 298763 URL: https://svnweb.freebsd.org/changeset/base/298763 Log: MFC r298530: patch(1): avoid signed integer overflow when debugging. Integer i is used to index p_end of type LINENUM (actually long). Match the types. Modified: stable/10/usr.bin/patch/pch.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/patch/pch.c ============================================================================== --- stable/10/usr.bin/patch/pch.c Fri Apr 29 01:53:45 2016 (r298762) +++ stable/10/usr.bin/patch/pch.c Fri Apr 29 02:56:03 2016 (r298763) @@ -1142,7 +1142,7 @@ hunk_done: say("Not enough memory to swap next hunk!\n"); #ifdef DEBUGGING if (debug & 2) { - int i; + LINENUM i; char special; for (i = 0; i <= p_end; i++) { @@ -1150,7 +1150,7 @@ hunk_done: special = '^'; else special = ' '; - fprintf(stderr, "%3d %c %c %s", i, p_char[i], + fprintf(stderr, "%3ld %c %c %s", i, p_char[i], special, p_line[i]); fflush(stderr); } From owner-svn-src-stable-10@freebsd.org Fri Apr 29 03:04:57 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FEEDB2075B; Fri, 29 Apr 2016 03:04:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F2D21313; Fri, 29 Apr 2016 03:04:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3T34uVd091359; Fri, 29 Apr 2016 03:04:56 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3T34uEb091358; Fri, 29 Apr 2016 03:04:56 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604290304.u3T34uEb091358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 29 Apr 2016 03:04:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298764 - stable/10/sbin/fsck_ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 03:04:57 -0000 Author: pfg Date: Fri Apr 29 03:04:56 2016 New Revision: 298764 URL: https://svnweb.freebsd.org/changeset/base/298764 Log: MFC r298551, r298679, r298680: fsck_ffs: use uint32_t for closedisk(). fs_ncg is of type uint32_t, and we were indexing it with an int. Fixed this using an unsigned type. Reviewed by: mckusick Modified: stable/10/sbin/fsck_ffs/suj.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck_ffs/suj.c ============================================================================== --- stable/10/sbin/fsck_ffs/suj.c Fri Apr 29 02:56:03 2016 (r298763) +++ stable/10/sbin/fsck_ffs/suj.c Fri Apr 29 03:04:56 2016 (r298764) @@ -217,7 +217,7 @@ static void closedisk(const char *devnam) { struct csum *cgsum; - int i; + uint32_t i; /* * Recompute the fs summary info from correct cs summaries. From owner-svn-src-stable-10@freebsd.org Fri Apr 29 03:12:15 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4D03B20B98; Fri, 29 Apr 2016 03:12:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 869061AB2; Fri, 29 Apr 2016 03:12:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3T3CEFA094413; Fri, 29 Apr 2016 03:12:14 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3T3CEF4094412; Fri, 29 Apr 2016 03:12:14 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604290312.u3T3CEF4094412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 29 Apr 2016 03:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298766 - stable/10/bin/ed X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 03:12:15 -0000 Author: pfg Date: Fri Apr 29 03:12:14 2016 New Revision: 298766 URL: https://svnweb.freebsd.org/changeset/base/298766 Log: MFC r298640: ed(1): switch two statements so we check the index before dereferencing. Modified: stable/10/bin/ed/cbc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/ed/cbc.c ============================================================================== --- stable/10/bin/ed/cbc.c Fri Apr 29 03:06:42 2016 (r298765) +++ stable/10/bin/ed/cbc.c Fri Apr 29 03:12:14 2016 (r298766) @@ -257,7 +257,7 @@ expand_des_key(char *obuf, char *kbuf) /* * now translate it, bombing on any illegal binary digit */ - for (i = 0; kbuf[i] && i < 16; i++) + for (i = 0; i < 16 && kbuf[i]; i++) if ((nbuf[i] = hex_to_binary((int) kbuf[i], 2)) == -1) des_error("bad binary digit in key"); while (i < 64) From owner-svn-src-stable-10@freebsd.org Fri Apr 29 11:06:25 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0626B20759; Fri, 29 Apr 2016 11:06:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 531631DE3; Fri, 29 Apr 2016 11:06:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3TB6O8B036930; Fri, 29 Apr 2016 11:06:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3TB6Ow2036929; Fri, 29 Apr 2016 11:06:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604291106.u3TB6Ow2036929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 29 Apr 2016 11:06:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298773 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 11:06:25 -0000 Author: hselasky Date: Fri Apr 29 11:06:24 2016 New Revision: 298773 URL: https://svnweb.freebsd.org/changeset/base/298773 Log: MFC r297966: Add missing port_up checks. When downing a mlxen network adapter we need to check the port_up variable to ensure we don't continue to transmit data or restart timers which can reside in freed memory. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Fri Apr 29 11:01:06 2016 (r298772) +++ stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Fri Apr 29 11:06:24 2016 (r298773) @@ -458,7 +458,7 @@ void mlx4_en_tx_irq(struct mlx4_cq *mcq) struct mlx4_en_priv *priv = netdev_priv(cq->dev); struct mlx4_en_tx_ring *ring = priv->tx_ring[cq->ring]; - if (!spin_trylock(&ring->comp_lock)) + if (priv->port_up == 0 || !spin_trylock(&ring->comp_lock)) return; mlx4_en_process_tx_cq(cq->dev, cq); mod_timer(&cq->timer, jiffies + 1); @@ -474,6 +474,8 @@ void mlx4_en_poll_tx_cq(unsigned long da INC_PERF_COUNTER(priv->pstats.tx_poll); + if (priv->port_up == 0) + return; if (!spin_trylock(&ring->comp_lock)) { mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT); return; @@ -495,6 +497,9 @@ static inline void mlx4_en_xmit_poll(str struct mlx4_en_cq *cq = priv->tx_cq[tx_ind]; struct mlx4_en_tx_ring *ring = priv->tx_ring[tx_ind]; + if (priv->port_up == 0) + return; + /* If we don't have a pending timer, set one up to catch our recent post in case the interface becomes idle */ if (!timer_pending(&cq->timer)) @@ -1038,7 +1043,9 @@ mlx4_en_tx_que(void *context, int pendin priv = dev->if_softc; tx_ind = cq->ring; ring = priv->tx_ring[tx_ind]; - if (dev->if_drv_flags & IFF_DRV_RUNNING) { + + if (priv->port_up != 0 && + (dev->if_drv_flags & IFF_DRV_RUNNING) != 0) { mlx4_en_xmit_poll(priv, tx_ind); spin_lock(&ring->tx_lock); if (!drbr_empty(dev, ring->br)) @@ -1055,6 +1062,11 @@ mlx4_en_transmit(struct ifnet *dev, stru struct mlx4_en_cq *cq; int i, err = 0; + if (priv->port_up == 0) { + m_freem(m); + return (ENETDOWN); + } + /* Compute which queue to use */ if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { i = (m->m_pkthdr.flowid % 128) % priv->tx_ring_num; @@ -1088,6 +1100,9 @@ mlx4_en_qflush(struct ifnet *dev) struct mlx4_en_tx_ring *ring; struct mbuf *m; + if (priv->port_up == 0) + return; + for (int i = 0; i < priv->tx_ring_num; i++) { ring = priv->tx_ring[i]; spin_lock(&ring->tx_lock); From owner-svn-src-stable-10@freebsd.org Fri Apr 29 11:14:04 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35221B20A6A; Fri, 29 Apr 2016 11:14:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E93EB1350; Fri, 29 Apr 2016 11:14:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3TBE3RY040079; Fri, 29 Apr 2016 11:14:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3TBE32J040076; Fri, 29 Apr 2016 11:14:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604291114.u3TBE32J040076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 29 Apr 2016 11:14:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298775 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 11:14:04 -0000 Author: hselasky Date: Fri Apr 29 11:14:02 2016 New Revision: 298775 URL: https://svnweb.freebsd.org/changeset/base/298775 Log: MFC r297967: Ensure the received IP header gets 32-bits aligned. The FreeBSD's TCP/IP stack assumes that the IP-header is 32-bits aligned when decoding it. Else unaligned 32-bit memory access can happen, which not all processor architectures support. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Fri Apr 29 11:10:43 2016 (r298774) +++ stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Fri Apr 29 11:14:02 2016 (r298775) @@ -55,7 +55,7 @@ static void mlx4_en_init_rx_desc(struct int i; /* Set size and memtype fields */ - rx_desc->data[0].byte_count = cpu_to_be32(priv->rx_mb_size); + rx_desc->data[0].byte_count = cpu_to_be32(priv->rx_mb_size - MLX4_NET_IP_ALIGN); rx_desc->data[0].lkey = cpu_to_be32(priv->mdev->mr.key); /* @@ -87,7 +87,10 @@ mlx4_en_alloc_buf(struct mlx4_en_rx_ring if (unlikely(mb == NULL)) return (-ENOMEM); /* setup correct length */ - mb->m_len = ring->rx_mb_size; + mb->m_pkthdr.len = mb->m_len = ring->rx_mb_size; + + /* make sure IP header gets aligned */ + m_adj(mb, MLX4_NET_IP_ALIGN); /* load spare mbuf into BUSDMA */ err = -bus_dmamap_load_mbuf_sg(ring->dma_tag, ring->spare.dma_map, @@ -117,7 +120,10 @@ mlx4_en_alloc_buf(struct mlx4_en_rx_ring goto use_spare; /* setup correct length */ - mb->m_len = ring->rx_mb_size; + mb->m_pkthdr.len = mb->m_len = ring->rx_mb_size; + + /* make sure IP header gets aligned */ + m_adj(mb, MLX4_NET_IP_ALIGN); err = -bus_dmamap_load_mbuf_sg(ring->dma_tag, mb_list->dma_map, mb, segs, &nsegs, BUS_DMA_NOWAIT); @@ -249,7 +255,8 @@ static void mlx4_en_free_rx_buf(struct m void mlx4_en_calc_rx_buf(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); - int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; + int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN + + MLX4_NET_IP_ALIGN; if (eff_mtu > MJUM16BYTES) { en_err(priv, "MTU(%d) is too big\n", (int)dev->if_mtu); Modified: stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Fri Apr 29 11:10:43 2016 (r298774) +++ stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Fri Apr 29 11:14:02 2016 (r298775) @@ -69,6 +69,7 @@ #define MLX4_EN_PAGE_SHIFT 12 #define MLX4_EN_PAGE_SIZE (1 << MLX4_EN_PAGE_SHIFT) +#define MLX4_NET_IP_ALIGN 2 /* bytes */ #define DEF_RX_RINGS 16 #define MAX_RX_RINGS 128 #define MIN_RX_RINGS 4 From owner-svn-src-stable-10@freebsd.org Fri Apr 29 11:18:50 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5326BB20CE4; Fri, 29 Apr 2016 11:18:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 091061AC8; Fri, 29 Apr 2016 11:18:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3TBInG7040398; Fri, 29 Apr 2016 11:18:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3TBIn8a040395; Fri, 29 Apr 2016 11:18:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604291118.u3TBIn8a040395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 29 Apr 2016 11:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298778 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 11:18:50 -0000 Author: hselasky Date: Fri Apr 29 11:18:48 2016 New Revision: 298778 URL: https://svnweb.freebsd.org/changeset/base/298778 Log: MFC r297968: Remove some unused fields. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c stable/10/sys/ofed/drivers/net/mlx4/en_rx.c stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Apr 29 11:17:25 2016 (r298777) +++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Apr 29 11:18:48 2016 (r298778) @@ -1244,10 +1244,6 @@ int mlx4_en_start_port(struct net_device /* Calculate Rx buf size */ dev->if_mtu = min(dev->if_mtu, priv->max_mtu); mlx4_en_calc_rx_buf(dev); - priv->rx_alloc_size = max_t(int, 2 * roundup_pow_of_two(priv->rx_mb_size), - PAGE_SIZE); - priv->rx_alloc_order = get_order(priv->rx_alloc_size); - priv->rx_buf_size = roundup_pow_of_two(priv->rx_mb_size); en_dbg(DRV, priv, "Rx buf size:%d\n", priv->rx_mb_size); /* Configure rx cq's and rings */ Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Fri Apr 29 11:17:25 2016 (r298777) +++ stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Fri Apr 29 11:18:48 2016 (r298778) @@ -391,9 +391,6 @@ int mlx4_en_activate_rx_rings(struct mlx ring->cons = 0; ring->actual_size = 0; ring->cqn = priv->rx_cq[ring_ind]->mcq.cqn; - ring->rx_alloc_order = priv->rx_alloc_order; - ring->rx_alloc_size = priv->rx_alloc_size; - ring->rx_buf_size = priv->rx_buf_size; ring->rx_mb_size = priv->rx_mb_size; ring->stride = stride; Modified: stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Fri Apr 29 11:17:25 2016 (r298777) +++ stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Fri Apr 29 11:18:48 2016 (r298778) @@ -316,9 +316,6 @@ struct mlx4_en_rx_ring { u32 cons; u32 buf_size; u8 fcs_del; - u16 rx_alloc_order; - u32 rx_alloc_size; - u32 rx_buf_size; u32 rx_mb_size; int qpn; u8 *buf; @@ -557,9 +554,6 @@ struct mlx4_en_priv { u32 tx_ring_num; u32 rx_ring_num; u32 rx_mb_size; - u16 rx_alloc_order; - u32 rx_alloc_size; - u32 rx_buf_size; struct mlx4_en_tx_ring **tx_ring; struct mlx4_en_rx_ring *rx_ring[MAX_RX_RINGS]; From owner-svn-src-stable-10@freebsd.org Fri Apr 29 11:29:54 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38CECB20271; Fri, 29 Apr 2016 11:29:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F177C143A; Fri, 29 Apr 2016 11:29:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3TBTrv2043412; Fri, 29 Apr 2016 11:29:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3TBTr7t043411; Fri, 29 Apr 2016 11:29:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604291129.u3TBTr7t043411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 29 Apr 2016 11:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298779 - stable/10/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 11:29:54 -0000 Author: hselasky Date: Fri Apr 29 11:29:52 2016 New Revision: 298779 URL: https://svnweb.freebsd.org/changeset/base/298779 Log: MFC r298458: Add missing set of the current VNET when inputting IP packets in IPoIB. This fixes a kernel panic when using IPoIB with VIMAGE and infiniband. PR: 208957 Sponsored by: Mellanox Technologies Tested by: Justin Clift Modified: stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Fri Apr 29 11:18:48 2016 (r298778) +++ stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Fri Apr 29 11:29:52 2016 (r298779) @@ -481,6 +481,8 @@ void ipoib_cm_handle_rx_wc(struct ipoib_ int has_srq; u_short proto; + CURVNET_SET_QUIET(dev->if_vnet); + ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n", wr_id, wc->status); @@ -496,7 +498,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_ } else ipoib_warn(priv, "cm recv completion event with wrid %d (> %d)\n", wr_id, ipoib_recvq_size); - return; + goto done; } p = wc->qp->qp_context; @@ -520,7 +522,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_ queue_work(ipoib_workqueue, &priv->cm.rx_reap_task); spin_unlock(&priv->lock); } - return; + goto done; } } @@ -579,6 +581,9 @@ repost: "for buf %d\n", wr_id); } } +done: + CURVNET_RESTORE(); + return; } static inline int post_send(struct ipoib_dev_priv *priv, From owner-svn-src-stable-10@freebsd.org Fri Apr 29 11:37:08 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26527B20517; Fri, 29 Apr 2016 11:37:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C512C1AF7; Fri, 29 Apr 2016 11:37:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3TBb6JH046386; Fri, 29 Apr 2016 11:37:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3TBb6gO046384; Fri, 29 Apr 2016 11:37:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201604291137.u3TBb6gO046384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 29 Apr 2016 11:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298781 - in stable/10/sys/dev/usb: . quirk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 11:37:08 -0000 Author: hselasky Date: Fri Apr 29 11:37:06 2016 New Revision: 298781 URL: https://svnweb.freebsd.org/changeset/base/298781 Log: MFC r297696 and r298424: Add new USB quirks. Submitted by: AJ PR: 208623 Submitted by: Naram Qashat PR: 208642 Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c stable/10/sys/dev/usb/usbdevs Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/10/sys/dev/usb/quirk/usb_quirk.c Fri Apr 29 11:31:27 2016 (r298780) +++ stable/10/sys/dev/usb/quirk/usb_quirk.c Fri Apr 29 11:37:06 2016 (r298781) @@ -136,6 +136,8 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(CORSAIR, K60, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), /* Quirk for Corsair Vengeance K70 keyboard */ USB_QUIRK(CORSAIR, K70, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), + /* Quirk for Corsair STRAFE Gaming keyboard */ + USB_QUIRK(CORSAIR, STRAFE, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), /* umodem(4) device quirks */ USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA), USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA), @@ -529,6 +531,9 @@ static struct usb_quirk_entry usb_quirks /* DYMO LabelManager Pnp */ USB_QUIRK(DYMO, LABELMANAGERPNP, 0x0000, 0xffff, UQ_MSC_DYMO_EJECT), + + /* Holtek USB gaming keyboard */ + USB_QUIRK(HOLTEK, F85, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), }; #undef USB_QUIRK_VP #undef USB_QUIRK Modified: stable/10/sys/dev/usb/usbdevs ============================================================================== --- stable/10/sys/dev/usb/usbdevs Fri Apr 29 11:31:27 2016 (r298780) +++ stable/10/sys/dev/usb/usbdevs Fri Apr 29 11:37:06 2016 (r298781) @@ -1509,6 +1509,7 @@ product COREGA FETHER_USB_TXC 0x9601 FEt /* Corsair products */ product CORSAIR K60 0x0a60 Corsair Vengeance K60 keyboard product CORSAIR K70 0x1b09 Corsair Vengeance K70 keyboard +product CORSAIR STRAFE 0x1b15 Cossair STRAFE Gaming keyboard /* Creative products */ product CREATIVE NOMAD_II 0x1002 Nomad II MP3 player @@ -2266,6 +2267,9 @@ product HIDGLOBAL CM6020 0x1784 Omnikey product HITACHI DVDCAM_DZ_MV100A 0x0004 DVD-CAM DZ-MV100A Camcorder product HITACHI DVDCAM_USB 0x001e DVDCAM USB HS Interface +/* Holtek products */ +product HOLTEK F85 0xa030 Holtek USB gaming keyboard + /* HP products */ product HP 895C 0x0004 DeskJet 895C product HP 4100C 0x0101 Scanjet 4100C From owner-svn-src-stable-10@freebsd.org Fri Apr 29 20:19:42 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA930B2130A; Fri, 29 Apr 2016 20:19:42 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75D9B1B66; Fri, 29 Apr 2016 20:19:42 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3TKJfdt007071; Fri, 29 Apr 2016 20:19:41 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3TKJfi3007069; Fri, 29 Apr 2016 20:19:41 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201604292019.u3TKJfi3007069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 29 Apr 2016 20:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298799 - stable/10/sys/fs/msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 20:19:42 -0000 Author: kp Date: Fri Apr 29 20:19:41 2016 New Revision: 298799 URL: https://svnweb.freebsd.org/changeset/base/298799 Log: MFC r298664 msdosfs: Prevent buffer overflow when expanding win95 names In win2unixfn() we expand Windows 95 style long names. In some cases that requires moving the data in the nbp->nb_buf buffer backwards to make room. That code failed to check for overflows, leading to a stack overflow in win2unixfn(). We now check for this event, and mark the entire conversion as failed in that case. This means we present the 8 character, dos style, name instead. PR: 204643 Differential Revision: https://reviews.freebsd.org/D6015 Modified: stable/10/sys/fs/msdosfs/direntry.h stable/10/sys/fs/msdosfs/msdosfs_conv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/msdosfs/direntry.h ============================================================================== --- stable/10/sys/fs/msdosfs/direntry.h Fri Apr 29 20:13:35 2016 (r298798) +++ stable/10/sys/fs/msdosfs/direntry.h Fri Apr 29 20:19:41 2016 (r298799) @@ -145,7 +145,7 @@ struct msdosfsmount; char *mbnambuf_flush(struct mbnambuf *nbp, struct dirent *dp); void mbnambuf_init(struct mbnambuf *nbp); -void mbnambuf_write(struct mbnambuf *nbp, char *name, int id); +int mbnambuf_write(struct mbnambuf *nbp, char *name, int id); int dos2unixfn(u_char dn[11], u_char *un, int lower, struct msdosfsmount *pmp); int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen, Modified: stable/10/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_conv.c Fri Apr 29 20:13:35 2016 (r298798) +++ stable/10/sys/fs/msdosfs/msdosfs_conv.c Fri Apr 29 20:19:41 2016 (r298799) @@ -678,7 +678,9 @@ win2unixfn(nbp, wep, chksum, pmp) switch (code) { case 0: *np = '\0'; - mbnambuf_write(nbp, name, (wep->weCnt & WIN_CNT) - 1); + if (mbnambuf_write(nbp, name, + (wep->weCnt & WIN_CNT) - 1) != 0) + return -1; return chksum; case '/': *np = '\0'; @@ -696,7 +698,9 @@ win2unixfn(nbp, wep, chksum, pmp) switch (code) { case 0: *np = '\0'; - mbnambuf_write(nbp, name, (wep->weCnt & WIN_CNT) - 1); + if (mbnambuf_write(nbp, name, + (wep->weCnt & WIN_CNT) - 1) != 0) + return -1; return chksum; case '/': *np = '\0'; @@ -714,7 +718,9 @@ win2unixfn(nbp, wep, chksum, pmp) switch (code) { case 0: *np = '\0'; - mbnambuf_write(nbp, name, (wep->weCnt & WIN_CNT) - 1); + if (mbnambuf_write(nbp, name, + (wep->weCnt & WIN_CNT) - 1) != 0) + return -1; return chksum; case '/': *np = '\0'; @@ -728,7 +734,8 @@ win2unixfn(nbp, wep, chksum, pmp) cp += 2; } *np = '\0'; - mbnambuf_write(nbp, name, (wep->weCnt & WIN_CNT) - 1); + if (mbnambuf_write(nbp, name, (wep->weCnt & WIN_CNT) - 1) != 0) + return -1; return chksum; } @@ -1030,7 +1037,7 @@ mbnambuf_init(struct mbnambuf *nbp) * This only penalizes portions of substrings that contain more than * WIN_CHARS bytes when they are first encountered. */ -void +int mbnambuf_write(struct mbnambuf *nbp, char *name, int id) { char *slot; @@ -1041,7 +1048,7 @@ mbnambuf_write(struct mbnambuf *nbp, cha printf("msdosfs: non-decreasing id: id %d, last id %d\n", id, nbp->nb_last_id); #endif - return; + return (EINVAL); } /* Will store this substring in a WIN_CHARS-aligned slot. */ @@ -1052,17 +1059,24 @@ mbnambuf_write(struct mbnambuf *nbp, cha #ifdef MSDOSFS_DEBUG printf("msdosfs: file name length %zu too large\n", newlen); #endif - return; + return (ENAMETOOLONG); } /* Shift suffix upwards by the amount length exceeds WIN_CHARS. */ - if (count > WIN_CHARS && nbp->nb_len != 0) + if (count > WIN_CHARS && nbp->nb_len != 0) { + if ((id * WIN_CHARS + count + nbp->nb_len) > + sizeof(nbp->nb_buf)) + return (ENAMETOOLONG); + bcopy(slot + WIN_CHARS, slot + count, nbp->nb_len); + } /* Copy in the substring to its slot and update length so far. */ bcopy(name, slot, count); nbp->nb_len = newlen; nbp->nb_last_id = id; + + return (0); } /* From owner-svn-src-stable-10@freebsd.org Sat Apr 30 03:05:38 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 494B0B20F27; Sat, 30 Apr 2016 03:05:38 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F37FD1387; Sat, 30 Apr 2016 03:05:37 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3U35bjW036209; Sat, 30 Apr 2016 03:05:37 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3U35bov036207; Sat, 30 Apr 2016 03:05:37 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201604300305.u3U35bov036207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Sat, 30 Apr 2016 03:05:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298832 - in stable/10/sys: kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2016 03:05:38 -0000 Author: jamie Date: Sat Apr 30 03:05:36 2016 New Revision: 298832 URL: https://svnweb.freebsd.org/changeset/base/298832 Log: MFC r298564: Remove the PR_REMOVE flag, which was meant as a temporary marker for a jail that might be seen mid-removal. It hasn't been doing the right thing since at least the ability to resurrect dying jails, and such resurrection also makes it unnecessary. Modified: stable/10/sys/kern/kern_jail.c stable/10/sys/sys/jail.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_jail.c ============================================================================== --- stable/10/sys/kern/kern_jail.c Sat Apr 30 02:47:41 2016 (r298831) +++ stable/10/sys/kern/kern_jail.c Sat Apr 30 03:05:36 2016 (r298832) @@ -1234,7 +1234,7 @@ kern_jail_set(struct thread *td, struct } created = 1; mtx_lock(&ppr->pr_mtx); - if (ppr->pr_ref == 0 || (ppr->pr_flags & PR_REMOVE)) { + if (ppr->pr_ref == 0) { mtx_unlock(&ppr->pr_mtx); error = ENOENT; vfs_opterror(opts, "parent jail went away!"); @@ -2290,7 +2290,6 @@ sys_jail_remove(struct thread *td, struc /* Remove all descendants of this prison, then remove this prison. */ pr->pr_ref++; - pr->pr_flags |= PR_REMOVE; if (!LIST_EMPTY(&pr->pr_children)) { mtx_unlock(&pr->pr_mtx); lpr = NULL; @@ -2299,7 +2298,6 @@ sys_jail_remove(struct thread *td, struc if (cpr->pr_ref > 0) { tpr = cpr; cpr->pr_ref++; - cpr->pr_flags |= PR_REMOVE; } else { /* Already removed - do not do it again. */ tpr = NULL; Modified: stable/10/sys/sys/jail.h ============================================================================== --- stable/10/sys/sys/jail.h Sat Apr 30 02:47:41 2016 (r298831) +++ stable/10/sys/sys/jail.h Sat Apr 30 03:05:36 2016 (r298832) @@ -212,7 +212,6 @@ struct prison_racct { /* primary jail address. */ /* Internal flag bits */ -#define PR_REMOVE 0x01000000 /* In process of being removed */ #define PR_IP4 0x02000000 /* IPv4 restricted or disabled */ /* by this jail or an ancestor */ #define PR_IP6 0x04000000 /* IPv6 restricted or disabled */ From owner-svn-src-stable-10@freebsd.org Sat Apr 30 03:19:08 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B33CB21164; Sat, 30 Apr 2016 03:19:08 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 656321A0F; Sat, 30 Apr 2016 03:19:08 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3U3J7Z7039613; Sat, 30 Apr 2016 03:19:07 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3U3J7QH039611; Sat, 30 Apr 2016 03:19:07 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201604300319.u3U3J7QH039611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Sat, 30 Apr 2016 03:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298833 - in stable/10/sys: kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2016 03:19:08 -0000 Author: jamie Date: Sat Apr 30 03:19:07 2016 New Revision: 298833 URL: https://svnweb.freebsd.org/changeset/base/298833 Log: MFC r298565: Add a new jail OSD method, PR_METHOD_REMOVE. It's called when a jail is removed from the user perspective, i.e. when the last pr_uref goes away, even though the jail mail still exist in the dying state. It will also be called if either PR_METHOD_CREATE or PR_METHOD_SET fail. MFC r298683: Delay removing the last jail reference in prison_proc_free, and instead put it off into the pr_task. This is similar to prison_free, and in fact uses the same task even though they do something slightly different. MFC r298566: Pass the current/new jail to PR_METHOD_CHECK, which pushes the call until after the jail is found or created. This requires unlocking the jail for the call and re-locking it afterward, but that works because nothing in the jail has been changed yet, and other processes won't change the important fields as long as allprison_lock remains held. Keep better track of name vs namelc in kern_jail_set. Name should always be the hierarchical name (relative to the caller), and namelc the last component. MFC r298668: Use crcopysafe in jail_attach. PR: 48471 Modified: stable/10/sys/kern/kern_jail.c stable/10/sys/sys/jail.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_jail.c ============================================================================== --- stable/10/sys/kern/kern_jail.c Sat Apr 30 03:05:36 2016 (r298832) +++ stable/10/sys/kern/kern_jail.c Sat Apr 30 03:19:07 2016 (r298833) @@ -560,8 +560,9 @@ kern_jail_set(struct thread *td, struct void *op; #endif unsigned long hid; - size_t namelen, onamelen; - int created, cuflags, descend, enforce, error, errmsg_len, errmsg_pos; + size_t namelen, onamelen, pnamelen; + int born, created, cuflags, descend, enforce; + int error, errmsg_len, errmsg_pos; int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel; int fi, jid, jsys, len, level; int childmax, osreldt, rsnum, slevel; @@ -584,7 +585,7 @@ kern_jail_set(struct thread *td, struct error = priv_check(td, PRIV_JAIL_ATTACH); if (error) return (error); - mypr = ppr = td->td_ucred->cr_prison; + mypr = td->td_ucred->cr_prison; if ((flags & JAIL_CREATE) && mypr->pr_childmax == 0) return (EPERM); if (flags & ~JAIL_SET_MASK) @@ -611,6 +612,13 @@ kern_jail_set(struct thread *td, struct #endif g_path = NULL; + cuflags = flags & (JAIL_CREATE | JAIL_UPDATE); + if (!cuflags) { + error = EINVAL; + vfs_opterror(opts, "no valid operation (create or update)"); + goto done_errmsg; + } + error = vfs_copyopt(opts, "jid", &jid, sizeof(jid)); if (error == ENOENT) jid = 0; @@ -1020,42 +1028,18 @@ kern_jail_set(struct thread *td, struct } /* - * Grab the allprison lock before letting modules check their - * parameters. Once we have it, do not let go so we'll have a - * consistent view of the OSD list. - */ - sx_xlock(&allprison_lock); - error = osd_jail_call(NULL, PR_METHOD_CHECK, opts); - if (error) - goto done_unlock_list; - - /* By now, all parameters should have been noted. */ - TAILQ_FOREACH(opt, opts, link) { - if (!opt->seen && strcmp(opt->name, "errmsg")) { - error = EINVAL; - vfs_opterror(opts, "unknown parameter: %s", opt->name); - goto done_unlock_list; - } - } - - /* - * See if we are creating a new record or updating an existing one. + * Find the specified jail, or at least its parent. * This abuses the file error codes ENOENT and EEXIST. */ - cuflags = flags & (JAIL_CREATE | JAIL_UPDATE); - if (!cuflags) { - error = EINVAL; - vfs_opterror(opts, "no valid operation (create or update)"); - goto done_unlock_list; - } pr = NULL; - namelc = NULL; + ppr = mypr; if (cuflags == JAIL_CREATE && jid == 0 && name != NULL) { namelc = strrchr(name, '.'); jid = strtoul(namelc != NULL ? namelc + 1 : name, &p, 10); if (*p != '\0') jid = 0; } + sx_xlock(&allprison_lock); if (jid != 0) { /* * See if a requested jid already exists. There is an @@ -1121,6 +1105,7 @@ kern_jail_set(struct thread *td, struct * and updates keyed by the name itself (where the name must exist * because that is the jail being updated). */ + namelc = NULL; if (name != NULL) { namelc = strrchr(name, '.'); if (namelc == NULL) @@ -1131,7 +1116,6 @@ kern_jail_set(struct thread *td, struct * parent and child names, and make sure the parent * exists or matches an already found jail. */ - *namelc = '\0'; if (pr != NULL) { if (strncmp(name, ppr->pr_name, namelc - name) || ppr->pr_name[namelc - name] != '\0') { @@ -1142,6 +1126,7 @@ kern_jail_set(struct thread *td, struct goto done_unlock_list; } } else { + *namelc = '\0'; ppr = prison_find_name(mypr, name); if (ppr == NULL) { error = ENOENT; @@ -1150,17 +1135,18 @@ kern_jail_set(struct thread *td, struct goto done_unlock_list; } mtx_unlock(&ppr->pr_mtx); + *namelc = '.'; } - name = ++namelc; + namelc++; } - if (name[0] != '\0') { - namelen = + if (namelc[0] != '\0') { + pnamelen = (ppr == &prison0) ? 0 : strlen(ppr->pr_name) + 1; name_again: deadpr = NULL; FOREACH_PRISON_CHILD(ppr, tpr) { if (tpr != pr && tpr->pr_ref > 0 && - !strcmp(tpr->pr_name + namelen, name)) { + !strcmp(tpr->pr_name + pnamelen, namelc)) { if (pr == NULL && cuflags != JAIL_CREATE) { mtx_lock(&tpr->pr_mtx); @@ -1237,7 +1223,8 @@ kern_jail_set(struct thread *td, struct if (ppr->pr_ref == 0) { mtx_unlock(&ppr->pr_mtx); error = ENOENT; - vfs_opterror(opts, "parent jail went away!"); + vfs_opterror(opts, "jail \"%s\" not found", + prison_name(mypr, ppr)); goto done_unlock_list; } ppr->pr_ref++; @@ -1291,8 +1278,8 @@ kern_jail_set(struct thread *td, struct pr->pr_id = jid; /* Set some default values, and inherit some from the parent. */ - if (name == NULL) - name = ""; + if (namelc == NULL) + namelc = ""; if (path == NULL) { path = "/"; root = mypr->pr_root; @@ -1355,6 +1342,7 @@ kern_jail_set(struct thread *td, struct LIST_INIT(&pr->pr_children); mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK); + TASK_INIT(&pr->pr_task, 0, prison_complete, pr); #ifdef VIMAGE /* Allocate a new vnet if specified. */ @@ -1374,7 +1362,7 @@ kern_jail_set(struct thread *td, struct mtx_lock(&pr->pr_mtx); /* * New prisons do not yet have a reference, because we do not - * want other to see the incomplete prison once the + * want others to see the incomplete prison once the * allprison_lock is downgraded. */ } else { @@ -1588,13 +1576,13 @@ kern_jail_set(struct thread *td, struct } #endif onamelen = namelen = 0; - if (name != NULL) { + if (namelc != NULL) { /* Give a default name of the jid. Also allow the name to be * explicitly the jid - but not any other number, and only in * normal form (no leading zero/etc). */ - if (name[0] == '\0') - snprintf(name = numbuf, sizeof(numbuf), "%d", jid); + if (namelc[0] == '\0') + snprintf(namelc = numbuf, sizeof(numbuf), "%d", jid); else if ((strtoul(namelc, &p, 10) != jid || namelc[0] < '1' || namelc[0] > '9') && *p == '\0') { error = EINVAL; @@ -1606,9 +1594,10 @@ kern_jail_set(struct thread *td, struct * Make sure the name isn't too long for the prison or its * children. */ - onamelen = strlen(pr->pr_name); - namelen = strlen(name); - if (strlen(ppr->pr_name) + namelen + 2 > sizeof(pr->pr_name)) { + pnamelen = (ppr == &prison0) ? 0 : strlen(ppr->pr_name) + 1; + onamelen = strlen(pr->pr_name + pnamelen); + namelen = strlen(namelc); + if (pnamelen + namelen + 1 > sizeof(pr->pr_name)) { error = ENAMETOOLONG; goto done_deref_locked; } @@ -1625,6 +1614,30 @@ kern_jail_set(struct thread *td, struct goto done_deref_locked; } + /* + * Let modules check their parameters. This requires unlocking and + * then re-locking the prison, but this is still a valid state as long + * as allprison_lock remains xlocked. + */ + mtx_unlock(&pr->pr_mtx); + error = osd_jail_call(pr, PR_METHOD_CHECK, opts); + if (error != 0) { + prison_deref(pr, created + ? PD_LIST_XLOCKED + : PD_DEREF | PD_LIST_XLOCKED); + goto done_releroot; + } + mtx_lock(&pr->pr_mtx); + + /* At this point, all valid parameters should have been noted. */ + TAILQ_FOREACH(opt, opts, link) { + if (!opt->seen && strcmp(opt->name, "errmsg")) { + error = EINVAL; + vfs_opterror(opts, "unknown parameter: %s", opt->name); + goto done_deref_locked; + } + } + /* Set the parameters of the prison. */ #ifdef INET redo_ip4 = 0; @@ -1698,12 +1711,12 @@ kern_jail_set(struct thread *td, struct FOREACH_PRISON_DESCENDANT_LOCKED(pr, tpr, descend) tpr->pr_devfs_rsnum = rsnum; } - if (name != NULL) { + if (namelc != NULL) { if (ppr == &prison0) - strlcpy(pr->pr_name, name, sizeof(pr->pr_name)); + strlcpy(pr->pr_name, namelc, sizeof(pr->pr_name)); else snprintf(pr->pr_name, sizeof(pr->pr_name), "%s.%s", - ppr->pr_name, name); + ppr->pr_name, namelc); /* Change this component of child names. */ FOREACH_PRISON_DESCENDANT_LOCKED(pr, tpr, descend) { bcopy(tpr->pr_name + onamelen, tpr->pr_name + namelen, @@ -1781,6 +1794,7 @@ kern_jail_set(struct thread *td, struct * for now, so new ones will remain unseen until after the module * handlers have completed. */ + born = pr->pr_uref == 0; if (!created && (ch_flags & PR_PERSIST & (pr_flags ^ pr->pr_flags))) { if (pr_flags & PR_PERSIST) { pr->pr_ref++; @@ -1850,15 +1864,20 @@ kern_jail_set(struct thread *td, struct /* Let the modules do their work. */ sx_downgrade(&allprison_lock); - if (created) { + if (born) { error = osd_jail_call(pr, PR_METHOD_CREATE, opts); if (error) { - prison_deref(pr, PD_LIST_SLOCKED); + (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); + prison_deref(pr, created + ? PD_LIST_SLOCKED + : PD_DEREF | PD_LIST_SLOCKED); goto done_errmsg; } } error = osd_jail_call(pr, PR_METHOD_SET, opts); if (error) { + if (born) + (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); prison_deref(pr, created ? PD_LIST_SLOCKED : PD_DEREF | PD_LIST_SLOCKED); @@ -1910,7 +1929,7 @@ kern_jail_set(struct thread *td, struct sx_sunlock(&allprison_lock); } - goto done_errmsg; + goto done_free; done_deref_locked: prison_deref(pr, created @@ -2404,7 +2423,6 @@ sys_jail_attach(struct thread *td, struc static int do_jail_attach(struct thread *td, struct prison *pr) { - struct prison *ppr; struct proc *p; struct ucred *newcred, *oldcred; int error; @@ -2432,7 +2450,6 @@ do_jail_attach(struct thread *td, struct /* * Reparent the newly attached process to this jail. */ - ppr = td->td_ucred->cr_prison; p = td->td_proc; error = cpuset_setproc_update_set(p, pr->pr_cpuset); if (error) @@ -2451,23 +2468,23 @@ do_jail_attach(struct thread *td, struct newcred = crget(); PROC_LOCK(p); - oldcred = p->p_ucred; - setsugid(p); - crcopy(newcred, oldcred); + oldcred = crcopysafe(p, newcred); newcred->cr_prison = pr; p->p_ucred = newcred; + setsugid(p); PROC_UNLOCK(p); #ifdef RACCT racct_proc_ucred_changed(p, oldcred, newcred); #endif + prison_deref(oldcred->cr_prison, PD_DEREF | PD_DEUREF); crfree(oldcred); - prison_deref(ppr, PD_DEREF | PD_DEUREF); return (0); + e_unlock: VOP_UNLOCK(pr->pr_root, 0); e_revert_osd: /* Tell modules this thread is still in its old jail after all. */ - (void)osd_jail_call(ppr, PR_METHOD_ATTACH, td); + (void)osd_jail_call(td->td_ucred->cr_prison, PR_METHOD_ATTACH, td); prison_deref(pr, PD_DEREF | PD_DEUREF); return (error); } @@ -2576,16 +2593,13 @@ prison_allow(struct ucred *cred, unsigne void prison_free_locked(struct prison *pr) { + int ref; mtx_assert(&pr->pr_mtx, MA_OWNED); - pr->pr_ref--; - if (pr->pr_ref == 0) { - mtx_unlock(&pr->pr_mtx); - TASK_INIT(&pr->pr_task, 0, prison_complete, pr); - taskqueue_enqueue(taskqueue_thread, &pr->pr_task); - return; - } + ref = --pr->pr_ref; mtx_unlock(&pr->pr_mtx); + if (ref == 0) + taskqueue_enqueue(taskqueue_thread, &pr->pr_task); } void @@ -2596,11 +2610,17 @@ prison_free(struct prison *pr) prison_free_locked(pr); } +/* + * Complete a call to either prison_free or prison_proc_free. + */ static void prison_complete(void *context, int pending) { + struct prison *pr = context; - prison_deref((struct prison *)context, 0); + mtx_lock(&pr->pr_mtx); + prison_deref(pr, pr->pr_uref + ? PD_DEREF | PD_DEUREF | PD_LOCKED : PD_LOCKED); } /* @@ -2613,19 +2633,53 @@ static void prison_deref(struct prison *pr, int flags) { struct prison *ppr, *tpr; + int ref, lasturef; if (!(flags & PD_LOCKED)) mtx_lock(&pr->pr_mtx); for (;;) { if (flags & PD_DEUREF) { + KASSERT(pr->pr_uref > 0, + ("prison_deref PD_DEUREF on a dead prison (jid=%d)", + pr->pr_id)); pr->pr_uref--; + lasturef = pr->pr_uref == 0; + if (lasturef) + pr->pr_ref++; KASSERT(prison0.pr_uref != 0, ("prison0 pr_uref=0")); - } - if (flags & PD_DEREF) + } else + lasturef = 0; + if (flags & PD_DEREF) { + KASSERT(pr->pr_ref > 0, + ("prison_deref PD_DEREF on a dead prison (jid=%d)", + pr->pr_id)); pr->pr_ref--; - /* If the prison still has references, nothing else to do. */ - if (pr->pr_ref > 0) { + } + ref = pr->pr_ref; + mtx_unlock(&pr->pr_mtx); + + /* + * Tell the modules if the last user reference was removed + * (even it sticks around in dying state). + */ + if (lasturef) { + if (!(flags & (PD_LIST_SLOCKED | PD_LIST_XLOCKED))) { + if (ref > 1) { + sx_slock(&allprison_lock); + flags |= PD_LIST_SLOCKED; + } else { + sx_xlock(&allprison_lock); + flags |= PD_LIST_XLOCKED; + } + } + (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); + mtx_lock(&pr->pr_mtx); + ref = --pr->pr_ref; mtx_unlock(&pr->pr_mtx); + } + + /* If the prison still has references, nothing else to do. */ + if (ref > 0) { if (flags & PD_LIST_SLOCKED) sx_sunlock(&allprison_lock); else if (flags & PD_LIST_XLOCKED) @@ -2633,7 +2687,6 @@ prison_deref(struct prison *pr, int flag return; } - mtx_unlock(&pr->pr_mtx); if (flags & PD_LIST_SLOCKED) { if (!sx_try_upgrade(&allprison_lock)) { sx_sunlock(&allprison_lock); @@ -2715,7 +2768,20 @@ prison_proc_free(struct prison *pr) mtx_lock(&pr->pr_mtx); KASSERT(pr->pr_uref > 0, ("Trying to kill a process in a dead prison (jid=%d)", pr->pr_id)); - prison_deref(pr, PD_DEUREF | PD_LOCKED); + if (pr->pr_uref > 1) + pr->pr_uref--; + else { + /* + * Don't remove the last user reference in this context, which + * is expected to be a process that is not only locked, but + * also half dead. + */ + pr->pr_ref++; + mtx_unlock(&pr->pr_mtx); + taskqueue_enqueue(taskqueue_thread, &pr->pr_task); + return; + } + mtx_unlock(&pr->pr_mtx); } Modified: stable/10/sys/sys/jail.h ============================================================================== --- stable/10/sys/sys/jail.h Sat Apr 30 03:05:36 2016 (r298832) +++ stable/10/sys/sys/jail.h Sat Apr 30 03:19:07 2016 (r298833) @@ -149,7 +149,6 @@ struct prison_racct; * (p) locked by pr_mtx * (c) set only during creation before the structure is shared, no mutex * required to read - * (d) set only during destruction of jail, no mutex needed */ struct prison { TAILQ_ENTRY(prison) pr_list; /* (a) all prisons */ @@ -161,7 +160,7 @@ struct prison { LIST_ENTRY(prison) pr_sibling; /* (a) next in parent's list */ struct prison *pr_parent; /* (c) containing jail */ struct mtx pr_mtx; - struct task pr_task; /* (d) destroy task */ + struct task pr_task; /* (c) destroy task */ struct osd pr_osd; /* (p) additional data */ struct cpuset *pr_cpuset; /* (p) cpuset */ struct vnet *pr_vnet; /* (c) network stack */ @@ -243,7 +242,8 @@ struct prison_racct { #define PR_METHOD_SET 2 #define PR_METHOD_CHECK 3 #define PR_METHOD_ATTACH 4 -#define PR_MAXMETHOD 5 +#define PR_METHOD_REMOVE 5 +#define PR_MAXMETHOD 6 /* * Lock/unlock a prison. From owner-svn-src-stable-10@freebsd.org Sat Apr 30 04:01:24 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C6E9B218D7; Sat, 30 Apr 2016 04:01:24 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 070071B9F; Sat, 30 Apr 2016 04:01:23 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3U41NQA053234; Sat, 30 Apr 2016 04:01:23 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3U41NwW053231; Sat, 30 Apr 2016 04:01:23 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201604300401.u3U41NwW053231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Sat, 30 Apr 2016 04:01:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298834 - in stable/10: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2016 04:01:24 -0000 Author: jamie Date: Sat Apr 30 04:01:22 2016 New Revision: 298834 URL: https://svnweb.freebsd.org/changeset/base/298834 Log: MFC r297367: Move the various per-type arrays of OSD data into a single structure array. MFC r297422: Add osd_reserve() and osd_set_reserved(), which allow M_WAITOK allocation of an OSD array. Modified: stable/10/share/man/man9/osd.9 stable/10/sys/kern/kern_osd.c stable/10/sys/sys/osd.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/osd.9 ============================================================================== --- stable/10/share/man/man9/osd.9 Sat Apr 30 03:19:07 2016 (r298833) +++ stable/10/share/man/man9/osd.9 Sat Apr 30 04:01:22 2016 (r298834) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 5, 2011 +.Dd March 30, 2016 .Dt OSD 9 .Os .Sh NAME @@ -33,6 +33,9 @@ .Nm osd_register , .Nm osd_deregister , .Nm osd_set , +.Nm osd_reserve , +.Nm osd_set_reserved , +.Nm osd_free_reserved , .Nm osd_get , .Nm osd_del , .Nm osd_call , @@ -63,6 +66,22 @@ .Fa "void *value" .Fc .Ft void * +.Fo osd_reserve +.Fa "u_int slot" +.Fc +.Ft int +.Fo osd_set_reserved +.Fa "u_int type" +.Fa "struct osd *osd" +.Fa "u_int slot" +.Fa "void *rsv" +.Fa "void *value" +.Fc +.Ft void +.Fo osd_free_reserved +.Fa "void *rsv" +.Fc +.Ft void * .Fo osd_get .Fa "u_int type" .Fa "struct osd *osd" @@ -198,6 +217,15 @@ argument points to a data object to asso .Fa osd . .Pp The +.Fn osd_set_reserved +function does the same as +.Fn osd_set , +but with an extra argument +.Fa rsv +that is internal-use memory previously allocated via +.Fn osd_reserve . +.Pp +The .Fn osd_get function returns the data pointer associated with a kernel data structure's .Vt struct osd @@ -324,6 +352,24 @@ will proceed without any .Xr realloc 9 calls. .Pp +It is possible for +.Fn osd_set +to fail to allocate this array. To ensure that such allocation succeeds, +.Fn osd_reserve +may be called (in a non-blocking context), and it will pre-allocate the +memory via +.Xr malloc 9 +with M_WAITOK. +Then this pre-allocated memory is passed to +.Fn osd_set_reserved , +which will use it if necessary or otherwise discard it. +The memory may also be explicitly discarded by calling +.Fn osd_free_reserved . +As this method always allocates memory whether or not it is ultimately needed, +it should be used only rarely, such as in the unlikely event that +.Fn osd_set +fails. +.Pp The .Nm API is geared towards slot identifiers storing pointers to the same underlying @@ -359,15 +405,27 @@ the kernel including most fast paths. returns the slot identifier for the newly registered data type. .Pp .Fn osd_set -returns zero on success or ENOMEM if the specified type/slot identifier pair +and +.Fn osd_set_reserved +return zero on success or ENOMEM if the specified type/slot identifier pair triggered an internal .Xr realloc 9 -which failed. +which failed +.Fn ( osd_set_reserved +will always succeed when +.Fa rsv +is non-NULL). .Pp .Fn osd_get returns the data pointer for the specified type/slot identifier pair, or NULL if the slot has not been initialised yet. .Pp +.Fn osd_reserve +returns a pointer suitable for passing to +.Fn osd_set_reserved +or +.Fn osd_free_reserved . +.Pp .Fn osd_call returns zero if no method is run or the method for each slot runs successfully. If a method for a slot returns non-zero, Modified: stable/10/sys/kern/kern_osd.c ============================================================================== --- stable/10/sys/kern/kern_osd.c Sat Apr 30 03:19:07 2016 (r298833) +++ stable/10/sys/kern/kern_osd.c Sat Apr 30 04:01:22 2016 (r298834) @@ -44,6 +44,23 @@ __FBSDID("$FreeBSD$"); /* OSD (Object Specific Data) */ +/* + * Lock key: + * (m) osd_module_lock + * (o) osd_object_lock + * (l) osd_list_lock + */ +struct osd_master { + struct sx osd_module_lock; + struct rmlock osd_object_lock; + struct mtx osd_list_lock; + LIST_HEAD(, osd) osd_list; /* (l) */ + osd_destructor_t *osd_destructors; /* (o) */ + osd_method_t *osd_methods; /* (m) */ + u_int osd_ntslots; /* (m) */ + const u_int osd_nmethods; +}; + static MALLOC_DEFINE(M_OSD, "osd", "Object Specific Data"); static int osd_debug = 0; @@ -62,25 +79,12 @@ static void do_osd_del(u_int type, struc int list_locked); /* - * Lists of objects with OSD. - * - * Lock key: - * (m) osd_module_lock - * (o) osd_object_lock - * (l) osd_list_lock + * List of objects with OSD. */ -static LIST_HEAD(, osd) osd_list[OSD_LAST + 1]; /* (m) */ -static osd_method_t *osd_methods[OSD_LAST + 1]; /* (m) */ -static u_int osd_nslots[OSD_LAST + 1]; /* (m) */ -static osd_destructor_t *osd_destructors[OSD_LAST + 1]; /* (o) */ -static const u_int osd_nmethods[OSD_LAST + 1] = { - [OSD_JAIL] = PR_MAXMETHOD, +struct osd_master osdm[OSD_LAST + 1] = { + [OSD_JAIL] = { .osd_nmethods = PR_MAXMETHOD }, }; -static struct sx osd_module_lock[OSD_LAST + 1]; -static struct rmlock osd_object_lock[OSD_LAST + 1]; -static struct mtx osd_list_lock[OSD_LAST + 1]; - static void osd_default_destructor(void *value __unused) { @@ -102,12 +106,12 @@ osd_register(u_int type, osd_destructor_ if (destructor == NULL) destructor = osd_default_destructor; - sx_xlock(&osd_module_lock[type]); + sx_xlock(&osdm[type].osd_module_lock); /* * First, we try to find unused slot. */ - for (i = 0; i < osd_nslots[type]; i++) { - if (osd_destructors[type][i] == NULL) { + for (i = 0; i < osdm[type].osd_ntslots; i++) { + if (osdm[type].osd_destructors[i] == NULL) { OSD_DEBUG("Unused slot found (type=%u, slot=%u).", type, i); break; @@ -116,31 +120,31 @@ osd_register(u_int type, osd_destructor_ /* * If no unused slot was found, allocate one. */ - if (i == osd_nslots[type]) { - osd_nslots[type]++; - if (osd_nmethods[type] != 0) - osd_methods[type] = realloc(osd_methods[type], - sizeof(osd_method_t) * osd_nslots[type] * - osd_nmethods[type], M_OSD, M_WAITOK); - newptr = malloc(sizeof(osd_destructor_t) * osd_nslots[type], - M_OSD, M_WAITOK); - rm_wlock(&osd_object_lock[type]); - bcopy(osd_destructors[type], newptr, + if (i == osdm[type].osd_ntslots) { + osdm[type].osd_ntslots++; + if (osdm[type].osd_nmethods != 0) + osdm[type].osd_methods = realloc(osdm[type].osd_methods, + sizeof(osd_method_t) * osdm[type].osd_ntslots * + osdm[type].osd_nmethods, M_OSD, M_WAITOK); + newptr = malloc(sizeof(osd_destructor_t) * + osdm[type].osd_ntslots, M_OSD, M_WAITOK); + rm_wlock(&osdm[type].osd_object_lock); + bcopy(osdm[type].osd_destructors, newptr, sizeof(osd_destructor_t) * i); - free(osd_destructors[type], M_OSD); - osd_destructors[type] = newptr; - rm_wunlock(&osd_object_lock[type]); + free(osdm[type].osd_destructors, M_OSD); + osdm[type].osd_destructors = newptr; + rm_wunlock(&osdm[type].osd_object_lock); OSD_DEBUG("New slot allocated (type=%u, slot=%u).", type, i + 1); } - osd_destructors[type][i] = destructor; - if (osd_nmethods[type] != 0) { - for (m = 0; m < osd_nmethods[type]; m++) - osd_methods[type][i * osd_nmethods[type] + m] = - methods != NULL ? methods[m] : NULL; + osdm[type].osd_destructors[i] = destructor; + if (osdm[type].osd_nmethods != 0) { + for (m = 0; m < osdm[type].osd_nmethods; m++) + osdm[type].osd_methods[i * osdm[type].osd_nmethods + m] + = methods != NULL ? methods[m] : NULL; } - sx_xunlock(&osd_module_lock[type]); + sx_xunlock(&osdm[type].osd_module_lock); return (i + 1); } @@ -151,105 +155,142 @@ osd_deregister(u_int type, u_int slot) KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type.")); KASSERT(slot > 0, ("Invalid slot.")); - KASSERT(osd_destructors[type][slot - 1] != NULL, ("Unused slot.")); + KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); - sx_xlock(&osd_module_lock[type]); - rm_wlock(&osd_object_lock[type]); + sx_xlock(&osdm[type].osd_module_lock); + rm_wlock(&osdm[type].osd_object_lock); /* * Free all OSD for the given slot. */ - mtx_lock(&osd_list_lock[type]); - LIST_FOREACH_SAFE(osd, &osd_list[type], osd_next, tosd) + mtx_lock(&osdm[type].osd_list_lock); + LIST_FOREACH_SAFE(osd, &osdm[type].osd_list, osd_next, tosd) do_osd_del(type, osd, slot, 1); - mtx_unlock(&osd_list_lock[type]); + mtx_unlock(&osdm[type].osd_list_lock); /* * Set destructor to NULL to free the slot. */ - osd_destructors[type][slot - 1] = NULL; - if (slot == osd_nslots[type]) { - osd_nslots[type]--; - osd_destructors[type] = realloc(osd_destructors[type], - sizeof(osd_destructor_t) * osd_nslots[type], M_OSD, + osdm[type].osd_destructors[slot - 1] = NULL; + if (slot == osdm[type].osd_ntslots) { + osdm[type].osd_ntslots--; + osdm[type].osd_destructors = realloc(osdm[type].osd_destructors, + sizeof(osd_destructor_t) * osdm[type].osd_ntslots, M_OSD, M_NOWAIT | M_ZERO); - if (osd_nmethods[type] != 0) - osd_methods[type] = realloc(osd_methods[type], - sizeof(osd_method_t) * osd_nslots[type] * - osd_nmethods[type], M_OSD, M_NOWAIT | M_ZERO); + if (osdm[type].osd_nmethods != 0) + osdm[type].osd_methods = realloc(osdm[type].osd_methods, + sizeof(osd_method_t) * osdm[type].osd_ntslots * + osdm[type].osd_nmethods, M_OSD, M_NOWAIT | M_ZERO); /* * We always reallocate to smaller size, so we assume it will * always succeed. */ - KASSERT(osd_destructors[type] != NULL && - (osd_nmethods[type] == 0 || osd_methods[type] != NULL), - ("realloc() failed")); + KASSERT(osdm[type].osd_destructors != NULL && + (osdm[type].osd_nmethods == 0 || + osdm[type].osd_methods != NULL), ("realloc() failed")); OSD_DEBUG("Deregistration of the last slot (type=%u, slot=%u).", type, slot); } else { OSD_DEBUG("Slot deregistration (type=%u, slot=%u).", type, slot); } - rm_wunlock(&osd_object_lock[type]); - sx_xunlock(&osd_module_lock[type]); + rm_wunlock(&osdm[type].osd_object_lock); + sx_xunlock(&osdm[type].osd_module_lock); } int osd_set(u_int type, struct osd *osd, u_int slot, void *value) { + + return (osd_set_reserved(type, osd, slot, NULL, value)); +} + +void * +osd_reserve(u_int slot) +{ + + KASSERT(slot > 0, ("Invalid slot.")); + + OSD_DEBUG("Reserving slot array (slot=%u).", slot); + return (malloc(sizeof(void *) * slot, M_OSD, M_WAITOK | M_ZERO)); +} + +int +osd_set_reserved(u_int type, struct osd *osd, u_int slot, void *rsv, + void *value) +{ struct rm_priotracker tracker; KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type.")); KASSERT(slot > 0, ("Invalid slot.")); - KASSERT(osd_destructors[type][slot - 1] != NULL, ("Unused slot.")); + KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); - rm_rlock(&osd_object_lock[type], &tracker); + rm_rlock(&osdm[type].osd_object_lock, &tracker); if (slot > osd->osd_nslots) { + void *newptr; + if (value == NULL) { OSD_DEBUG( "Not allocating null slot (type=%u, slot=%u).", type, slot); - rm_runlock(&osd_object_lock[type], &tracker); + rm_runlock(&osdm[type].osd_object_lock, &tracker); + if (rsv) + osd_free_reserved(rsv); return (0); - } else if (osd->osd_nslots == 0) { + } + + /* + * Too few slots allocated here, so we need to extend or create + * the array. + */ + if (rsv) { /* - * First OSD for this object, so we need to allocate - * space and put it onto the list. + * Use the reserve passed in (assumed to be + * the right size). */ - osd->osd_slots = malloc(sizeof(void *) * slot, M_OSD, - M_NOWAIT | M_ZERO); - if (osd->osd_slots == NULL) { - rm_runlock(&osd_object_lock[type], &tracker); - return (ENOMEM); + newptr = rsv; + if (osd->osd_nslots != 0) { + memcpy(newptr, osd->osd_slots, + sizeof(void *) * osd->osd_nslots); + free(osd->osd_slots, M_OSD); } - osd->osd_nslots = slot; - mtx_lock(&osd_list_lock[type]); - LIST_INSERT_HEAD(&osd_list[type], osd, osd_next); - mtx_unlock(&osd_list_lock[type]); - OSD_DEBUG("Setting first slot (type=%u).", type); } else { - void *newptr; - - /* - * Too few slots allocated here, needs to extend - * the array. - */ newptr = realloc(osd->osd_slots, sizeof(void *) * slot, M_OSD, M_NOWAIT | M_ZERO); if (newptr == NULL) { - rm_runlock(&osd_object_lock[type], &tracker); + rm_runlock(&osdm[type].osd_object_lock, + &tracker); return (ENOMEM); } - osd->osd_slots = newptr; - osd->osd_nslots = slot; - OSD_DEBUG("Growing slots array (type=%u).", type); } - } + if (osd->osd_nslots == 0) { + /* + * First OSD for this object, so we need to put it + * onto the list. + */ + mtx_lock(&osdm[type].osd_list_lock); + LIST_INSERT_HEAD(&osdm[type].osd_list, osd, osd_next); + mtx_unlock(&osdm[type].osd_list_lock); + OSD_DEBUG("Setting first slot (type=%u).", type); + } else + OSD_DEBUG("Growing slots array (type=%u).", type); + osd->osd_slots = newptr; + osd->osd_nslots = slot; + } else if (rsv) + osd_free_reserved(rsv); OSD_DEBUG("Setting slot value (type=%u, slot=%u, value=%p).", type, slot, value); osd->osd_slots[slot - 1] = value; - rm_runlock(&osd_object_lock[type], &tracker); + rm_runlock(&osdm[type].osd_object_lock, &tracker); return (0); } +void +osd_free_reserved(void *rsv) +{ + + OSD_DEBUG("Discarding reserved slot array."); + free(rsv, M_OSD); +} + void * osd_get(u_int type, struct osd *osd, u_int slot) { @@ -258,9 +299,9 @@ osd_get(u_int type, struct osd *osd, u_i KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type.")); KASSERT(slot > 0, ("Invalid slot.")); - KASSERT(osd_destructors[type][slot - 1] != NULL, ("Unused slot.")); + KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); - rm_rlock(&osd_object_lock[type], &tracker); + rm_rlock(&osdm[type].osd_object_lock, &tracker); if (slot > osd->osd_nslots) { value = NULL; OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot); @@ -269,7 +310,7 @@ osd_get(u_int type, struct osd *osd, u_i OSD_DEBUG("Returning slot value (type=%u, slot=%u, value=%p).", type, slot, value); } - rm_runlock(&osd_object_lock[type], &tracker); + rm_runlock(&osdm[type].osd_object_lock, &tracker); return (value); } @@ -278,9 +319,9 @@ osd_del(u_int type, struct osd *osd, u_i { struct rm_priotracker tracker; - rm_rlock(&osd_object_lock[type], &tracker); + rm_rlock(&osdm[type].osd_object_lock, &tracker); do_osd_del(type, osd, slot, 0); - rm_runlock(&osd_object_lock[type], &tracker); + rm_runlock(&osdm[type].osd_object_lock, &tracker); } static void @@ -290,7 +331,7 @@ do_osd_del(u_int type, struct osd *osd, KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type.")); KASSERT(slot > 0, ("Invalid slot.")); - KASSERT(osd_destructors[type][slot - 1] != NULL, ("Unused slot.")); + KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); OSD_DEBUG("Deleting slot (type=%u, slot=%u).", type, slot); @@ -299,7 +340,7 @@ do_osd_del(u_int type, struct osd *osd, return; } if (osd->osd_slots[slot - 1] != NULL) { - osd_destructors[type][slot - 1](osd->osd_slots[slot - 1]); + osdm[type].osd_destructors[slot - 1](osd->osd_slots[slot - 1]); osd->osd_slots[slot - 1] = NULL; } for (i = osd->osd_nslots - 1; i >= 0; i--) { @@ -313,10 +354,10 @@ do_osd_del(u_int type, struct osd *osd, /* No values left for this object. */ OSD_DEBUG("No more slots left (type=%u).", type); if (!list_locked) - mtx_lock(&osd_list_lock[type]); + mtx_lock(&osdm[type].osd_list_lock); LIST_REMOVE(osd, osd_next); if (!list_locked) - mtx_unlock(&osd_list_lock[type]); + mtx_unlock(&osdm[type].osd_list_lock); free(osd->osd_slots, M_OSD); osd->osd_slots = NULL; osd->osd_nslots = 0; @@ -342,21 +383,21 @@ osd_call(u_int type, u_int method, void int error, i; KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type.")); - KASSERT(method < osd_nmethods[type], ("Invalid method.")); + KASSERT(method < osdm[type].osd_nmethods, ("Invalid method.")); /* * Call this method for every slot that defines it, stopping if an * error is encountered. */ error = 0; - sx_slock(&osd_module_lock[type]); - for (i = 0; i < osd_nslots[type]; i++) { - methodfun = - osd_methods[type][i * osd_nmethods[type] + method]; + sx_slock(&osdm[type].osd_module_lock); + for (i = 0; i < osdm[type].osd_ntslots; i++) { + methodfun = osdm[type].osd_methods[i * osdm[type].osd_nmethods + + method]; if (methodfun != NULL && (error = methodfun(obj, data)) != 0) break; } - sx_sunlock(&osd_module_lock[type]); + sx_sunlock(&osdm[type].osd_module_lock); return (error); } @@ -374,14 +415,14 @@ osd_exit(u_int type, struct osd *osd) return; } - rm_rlock(&osd_object_lock[type], &tracker); + rm_rlock(&osdm[type].osd_object_lock, &tracker); for (i = 1; i <= osd->osd_nslots; i++) { - if (osd_destructors[type][i - 1] != NULL) + if (osdm[type].osd_destructors[i - 1] != NULL) do_osd_del(type, osd, i, 0); else OSD_DEBUG("Unused slot (type=%u, slot=%u).", type, i); } - rm_runlock(&osd_object_lock[type], &tracker); + rm_runlock(&osdm[type].osd_object_lock, &tracker); OSD_DEBUG("Object exit (type=%u).", type); } @@ -391,13 +432,13 @@ osd_init(void *arg __unused) u_int i; for (i = OSD_FIRST; i <= OSD_LAST; i++) { - osd_nslots[i] = 0; - LIST_INIT(&osd_list[i]); - sx_init(&osd_module_lock[i], "osd_module"); - rm_init(&osd_object_lock[i], "osd_object"); - mtx_init(&osd_list_lock[i], "osd_list", NULL, MTX_DEF); - osd_destructors[i] = NULL; - osd_methods[i] = NULL; + sx_init(&osdm[i].osd_module_lock, "osd_module"); + rm_init(&osdm[i].osd_object_lock, "osd_object"); + mtx_init(&osdm[i].osd_list_lock, "osd_list", NULL, MTX_DEF); + LIST_INIT(&osdm[i].osd_list); + osdm[i].osd_destructors = NULL; + osdm[i].osd_ntslots = 0; + osdm[i].osd_methods = NULL; } } SYSINIT(osd, SI_SUB_LOCK, SI_ORDER_ANY, osd_init, NULL); Modified: stable/10/sys/sys/osd.h ============================================================================== --- stable/10/sys/sys/osd.h Sat Apr 30 03:19:07 2016 (r298833) +++ stable/10/sys/sys/osd.h Sat Apr 30 04:01:22 2016 (r298834) @@ -59,6 +59,10 @@ int osd_register(u_int type, osd_destruc void osd_deregister(u_int type, u_int slot); int osd_set(u_int type, struct osd *osd, u_int slot, void *value); +void *osd_reserve(u_int slot); +int osd_set_reserved(u_int type, struct osd *osd, u_int slot, void *rsv, + void *value); +void osd_free_reserved(void *rsv); void *osd_get(u_int type, struct osd *osd, u_int slot); void osd_del(u_int type, struct osd *osd, u_int slot); int osd_call(u_int type, u_int method, void *obj, void *data); @@ -71,6 +75,8 @@ void osd_exit(u_int type, struct osd *os osd_deregister(OSD_THREAD, (slot)) #define osd_thread_set(td, slot, value) \ osd_set(OSD_THREAD, &(td)->td_osd, (slot), (value)) +#define osd_thread_set_reserved(td, slot, rsv, value) \ + osd_set_reserved(OSD_THREAD, &(td)->td_osd, (slot), (rsv), (value)) #define osd_thread_get(td, slot) \ osd_get(OSD_THREAD, &(td)->td_osd, (slot)) #define osd_thread_del(td, slot) do { \ @@ -88,6 +94,8 @@ void osd_exit(u_int type, struct osd *os osd_deregister(OSD_JAIL, (slot)) #define osd_jail_set(pr, slot, value) \ osd_set(OSD_JAIL, &(pr)->pr_osd, (slot), (value)) +#define osd_jail_set_reserved(pr, slot, rsv, value) \ + osd_set_reserved(OSD_JAIL, &(pr)->pr_osd, (slot), (rsv), (value)) #define osd_jail_get(pr, slot) \ osd_get(OSD_JAIL, &(pr)->pr_osd, (slot)) #define osd_jail_del(pr, slot) \ From owner-svn-src-stable-10@freebsd.org Sat Apr 30 04:02:34 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3A6CB21A0F; Sat, 30 Apr 2016 04:02:33 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7A081DF9; Sat, 30 Apr 2016 04:02:33 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3U42WoV056087; Sat, 30 Apr 2016 04:02:32 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3U42WBM056084; Sat, 30 Apr 2016 04:02:32 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201604300402.u3U42WBM056084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Sat, 30 Apr 2016 04:02:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298835 - in stable/10: sys/kern usr.sbin/jail X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2016 04:02:34 -0000 Author: jamie Date: Sat Apr 30 04:02:32 2016 New Revision: 298835 URL: https://svnweb.freebsd.org/changeset/base/298835 Log: MFC r298584: Note the existence of module-specific jail paramters, starting with the linux.* parameters when linux emulation is loaded. MFC r298585: Encapsulate SYSV IPC objects in jails. Define per-module parameters sysvmsg, sysvsem, and sysvshm, with the following bahavior: inherit: allow full access to the IPC primitives. This is the same as the current setup with allow.sysvipc is on. Jails and the base system can see (and moduly) each other's objects, which is generally considered a bad thing (though may be useful in some circumstances). disable: all no access, same as the current setup with allow.sysvipc off. new: A jail may see use the IPC objects that it has created. It also gets its own IPC key namespace, so different jails may have their own objects using the same key value. The parent jail (or base system) can see the jail's IPC objects, but not its keys. PR: 48471 Modified: stable/10/sys/kern/sysv_msg.c stable/10/sys/kern/sysv_sem.c stable/10/sys/kern/sysv_shm.c stable/10/usr.sbin/jail/jail.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sysv_msg.c ============================================================================== --- stable/10/sys/kern/sysv_msg.c Sat Apr 30 04:01:22 2016 (r298834) +++ stable/10/sys/kern/sysv_msg.c Sat Apr 30 04:02:32 2016 (r298835) @@ -62,8 +62,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -80,6 +82,14 @@ static MALLOC_DEFINE(M_MSG, "msg", "SVID static int msginit(void); static int msgunload(void); static int sysvmsg_modload(struct module *, int, void *); +static void msq_remove(struct msqid_kernel *); +static struct prison *msg_find_prison(struct ucred *); +static int msq_prison_cansee(struct prison *, struct msqid_kernel *); +static int msg_prison_check(void *, void *); +static int msg_prison_set(void *, void *); +static int msg_prison_get(void *, void *); +static int msg_prison_remove(void *, void *); +static void msg_prison_cleanup(struct prison *); #ifdef MSG_DEBUG @@ -155,6 +165,7 @@ static struct msgmap *msgmaps; /* MSGSEG static struct msg *msghdrs; /* MSGTQL msg headers */ static struct msqid_kernel *msqids; /* MSGMNI msqid_kernel struct's */ static struct mtx msq_mtx; /* global mutex for message queues. */ +static unsigned msg_prison_slot;/* prison OSD slot */ static struct syscall_helper_data msg_syscalls[] = { SYSCALL_INIT_HELPER(msgctl), @@ -194,7 +205,15 @@ static struct syscall_helper_data msg32_ static int msginit() { + struct prison *pr; + void *rsv; int i, error; + osd_method_t methods[PR_MAXMETHOD] = { + [PR_METHOD_CHECK] = msg_prison_check, + [PR_METHOD_SET] = msg_prison_set, + [PR_METHOD_GET] = msg_prison_get, + [PR_METHOD_REMOVE] = msg_prison_remove, + }; TUNABLE_INT_FETCH("kern.ipc.msgseg", &msginfo.msgseg); TUNABLE_INT_FETCH("kern.ipc.msgssz", &msginfo.msgssz); @@ -258,6 +277,29 @@ msginit() } mtx_init(&msq_mtx, "msq", NULL, MTX_DEF); + /* Set current prisons according to their allow.sysvipc. */ + msg_prison_slot = osd_jail_register(NULL, methods); + rsv = osd_reserve(msg_prison_slot); + prison_lock(&prison0); + (void)osd_jail_set_reserved(&prison0, msg_prison_slot, rsv, &prison0); + prison_unlock(&prison0); + rsv = NULL; + sx_slock(&allprison_lock); + TAILQ_FOREACH(pr, &allprison, pr_list) { + if (rsv == NULL) + rsv = osd_reserve(msg_prison_slot); + prison_lock(pr); + if ((pr->pr_allow & PR_ALLOW_SYSVIPC) && pr->pr_ref > 0) { + (void)osd_jail_set_reserved(pr, msg_prison_slot, rsv, + &prison0); + rsv = NULL; + } + prison_unlock(pr); + } + if (rsv != NULL) + osd_free_reserved(rsv); + sx_sunlock(&allprison_lock); + error = syscall_helper_register(msg_syscalls); if (error != 0) return (error); @@ -298,6 +340,8 @@ msgunload() if (msqid != msginfo.msgmni) return (EBUSY); + if (msg_prison_slot != 0) + osd_jail_deregister(msg_prison_slot); #ifdef MAC for (i = 0; i < msginfo.msgtql; i++) mac_sysvmsg_destroy(&msghdrs[i]); @@ -372,6 +416,67 @@ msg_freehdr(msghdr) #endif } +static void +msq_remove(struct msqid_kernel *msqkptr) +{ + struct msg *msghdr; + + racct_sub_cred(msqkptr->cred, RACCT_NMSGQ, 1); + racct_sub_cred(msqkptr->cred, RACCT_MSGQQUEUED, msqkptr->u.msg_qnum); + racct_sub_cred(msqkptr->cred, RACCT_MSGQSIZE, msqkptr->u.msg_cbytes); + crfree(msqkptr->cred); + msqkptr->cred = NULL; + + /* Free the message headers */ + msghdr = msqkptr->u.msg_first; + while (msghdr != NULL) { + struct msg *msghdr_tmp; + + /* Free the segments of each message */ + msqkptr->u.msg_cbytes -= msghdr->msg_ts; + msqkptr->u.msg_qnum--; + msghdr_tmp = msghdr; + msghdr = msghdr->msg_next; + msg_freehdr(msghdr_tmp); + } + + if (msqkptr->u.msg_cbytes != 0) + panic("msg_cbytes is screwed up"); + if (msqkptr->u.msg_qnum != 0) + panic("msg_qnum is screwed up"); + + msqkptr->u.msg_qbytes = 0; /* Mark it as free */ + +#ifdef MAC + mac_sysvmsq_cleanup(msqkptr); +#endif + + wakeup(msqkptr); +} + +static struct prison * +msg_find_prison(struct ucred *cred) +{ + struct prison *pr, *rpr; + + pr = cred->cr_prison; + prison_lock(pr); + rpr = osd_jail_get(pr, msg_prison_slot); + prison_unlock(pr); + return rpr; +} + +static int +msq_prison_cansee(struct prison *rpr, struct msqid_kernel *msqkptr) +{ + + if (msqkptr->cred == NULL || + !(rpr == msqkptr->cred->cr_prison || + prison_ischild(rpr, msqkptr->cred->cr_prison))) + return (EINVAL); + return (0); +} + #ifndef _SYS_SYSPROTO_H_ struct msgctl_args { int msqid; @@ -408,8 +513,10 @@ kern_msgctl(td, msqid, cmd, msqbuf) { int rval, error, msqix; register struct msqid_kernel *msqkptr; + struct prison *rpr; - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + rpr = msg_find_prison(td->td_ucred); + if (rpr == NULL) return (ENOSYS); msqix = IPCID_TO_IX(msqid); @@ -433,6 +540,13 @@ kern_msgctl(td, msqid, cmd, msqbuf) error = EINVAL; goto done2; } + + error = msq_prison_cansee(rpr, msqkptr); + if (error != 0) { + DPRINTF(("requester can't see prison\n")); + goto done2; + } + #ifdef MAC error = mac_sysvmsq_check_msqctl(td->td_ucred, msqkptr, cmd); if (error != 0) @@ -446,7 +560,9 @@ kern_msgctl(td, msqid, cmd, msqbuf) case IPC_RMID: { +#ifdef MAC struct msg *msghdr; +#endif if ((error = ipcperm(td, &msqkptr->u.msg_perm, IPC_M))) goto done2; @@ -468,37 +584,7 @@ kern_msgctl(td, msqid, cmd, msqbuf) } #endif - racct_sub_cred(msqkptr->cred, RACCT_NMSGQ, 1); - racct_sub_cred(msqkptr->cred, RACCT_MSGQQUEUED, msqkptr->u.msg_qnum); - racct_sub_cred(msqkptr->cred, RACCT_MSGQSIZE, msqkptr->u.msg_cbytes); - crfree(msqkptr->cred); - msqkptr->cred = NULL; - - /* Free the message headers */ - msghdr = msqkptr->u.msg_first; - while (msghdr != NULL) { - struct msg *msghdr_tmp; - - /* Free the segments of each message */ - msqkptr->u.msg_cbytes -= msghdr->msg_ts; - msqkptr->u.msg_qnum--; - msghdr_tmp = msghdr; - msghdr = msghdr->msg_next; - msg_freehdr(msghdr_tmp); - } - - if (msqkptr->u.msg_cbytes != 0) - panic("msg_cbytes is screwed up"); - if (msqkptr->u.msg_qnum != 0) - panic("msg_qnum is screwed up"); - - msqkptr->u.msg_qbytes = 0; /* Mark it as free */ - -#ifdef MAC - mac_sysvmsq_cleanup(msqkptr); -#endif - - wakeup(msqkptr); + msq_remove(msqkptr); } break; @@ -535,6 +621,8 @@ kern_msgctl(td, msqid, cmd, msqbuf) goto done2; } *msqbuf = msqkptr->u; + if (td->td_ucred->cr_prison != msqkptr->cred->cr_prison) + msqbuf->msg_perm.key = IPC_PRIVATE; break; default: @@ -570,7 +658,7 @@ sys_msgget(td, uap) DPRINTF(("msgget(0x%x, 0%o)\n", key, msgflg)); - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + if (msg_find_prison(cred) == NULL) return (ENOSYS); mtx_lock(&msq_mtx); @@ -578,6 +666,8 @@ sys_msgget(td, uap) for (msqid = 0; msqid < msginfo.msgmni; msqid++) { msqkptr = &msqids[msqid]; if (msqkptr->u.msg_qbytes != 0 && + msqkptr->cred != NULL && + msqkptr->cred->cr_prison == cred->cr_prison && msqkptr->u.msg_perm.key == key) break; } @@ -690,12 +780,14 @@ kern_msgsnd(td, msqid, msgp, msgsz, msgf int msqix, segs_needed, error = 0; register struct msqid_kernel *msqkptr; register struct msg *msghdr; + struct prison *rpr; short next; #ifdef RACCT size_t saved_msgsz; #endif - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + rpr = msg_find_prison(td->td_ucred); + if (rpr == NULL) return (ENOSYS); mtx_lock(&msq_mtx); @@ -720,6 +812,11 @@ kern_msgsnd(td, msqid, msgp, msgsz, msgf goto done2; } + if ((error = msq_prison_cansee(rpr, msqkptr))) { + DPRINTF(("requester can't see prison\n")); + goto done2; + } + if ((error = ipcperm(td, &msqkptr->u.msg_perm, IPC_W))) { DPRINTF(("requester doesn't have write access\n")); goto done2; @@ -1058,10 +1155,12 @@ kern_msgrcv(td, msqid, msgp, msgsz, msgt size_t len; register struct msqid_kernel *msqkptr; register struct msg *msghdr; + struct prison *rpr; int msqix, error = 0; short next; - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + rpr = msg_find_prison(td->td_ucred); + if (rpr == NULL) return (ENOSYS); msqix = IPCID_TO_IX(msqid); @@ -1085,6 +1184,11 @@ kern_msgrcv(td, msqid, msgp, msgsz, msgt goto done2; } + if ((error = msq_prison_cansee(rpr, msqkptr))) { + DPRINTF(("requester can't see prison\n")); + goto done2; + } + if ((error = ipcperm(td, &msqkptr->u.msg_perm, IPC_R))) { DPRINTF(("requester doesn't have read access\n")); goto done2; @@ -1324,9 +1428,29 @@ sys_msgrcv(td, uap) static int sysctl_msqids(SYSCTL_HANDLER_ARGS) { + struct msqid_kernel tmsqk; + struct prison *pr, *rpr; + int error, i; - return (SYSCTL_OUT(req, msqids, - sizeof(struct msqid_kernel) * msginfo.msgmni)); + pr = req->td->td_ucred->cr_prison; + rpr = msg_find_prison(req->td->td_ucred); + error = 0; + for (i = 0; i < msginfo.msgmni; i++) { + mtx_lock(&msq_mtx); + if (msqids[i].u.msg_qbytes == 0 || rpr == NULL || + msq_prison_cansee(rpr, &msqids[i]) != 0) + bzero(&tmsqk, sizeof(tmsqk)); + else { + tmsqk = msqids[i]; + if (tmsqk.cred->cr_prison != pr) + tmsqk.u.msg_perm.key = IPC_PRIVATE; + } + mtx_unlock(&msq_mtx); + error = SYSCTL_OUT(req, &tmsqk, sizeof(tmsqk)); + if (error != 0) + break; + } + return (error); } SYSCTL_INT(_kern_ipc, OID_AUTO, msgmax, CTLFLAG_RD, &msginfo.msgmax, 0, @@ -1341,9 +1465,185 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, msgssz, "Size of a message segment"); SYSCTL_INT(_kern_ipc, OID_AUTO, msgseg, CTLFLAG_RDTUN, &msginfo.msgseg, 0, "Number of message segments"); -SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLTYPE_OPAQUE | CTLFLAG_RD, +SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_msqids, "", "Message queue IDs"); +static int +msg_prison_check(void *obj, void *data) +{ + struct prison *pr = obj; + struct prison *prpr; + struct vfsoptlist *opts = data; + int error, jsys; + + /* + * sysvmsg is a jailsys integer. + * It must be "disable" if the parent jail is disabled. + */ + error = vfs_copyopt(opts, "sysvmsg", &jsys, sizeof(jsys)); + if (error != ENOENT) { + if (error != 0) + return (error); + switch (jsys) { + case JAIL_SYS_DISABLE: + break; + case JAIL_SYS_NEW: + case JAIL_SYS_INHERIT: + prison_lock(pr->pr_parent); + prpr = osd_jail_get(pr->pr_parent, msg_prison_slot); + prison_unlock(pr->pr_parent); + if (prpr == NULL) + return (EPERM); + break; + default: + return (EINVAL); + } + } + + return (0); +} + +static int +msg_prison_set(void *obj, void *data) +{ + struct prison *pr = obj; + struct prison *tpr, *orpr, *nrpr, *trpr; + struct vfsoptlist *opts = data; + void *rsv; + int jsys, descend; + + /* + * sysvmsg controls which jail is the root of the associated msgs (this + * jail or same as the parent), or if the feature is available at all. + */ + if (vfs_copyopt(opts, "sysvmsg", &jsys, sizeof(jsys)) == ENOENT) + jsys = vfs_flagopt(opts, "allow.sysvipc", NULL, 0) + ? JAIL_SYS_INHERIT + : vfs_flagopt(opts, "allow.nosysvipc", NULL, 0) + ? JAIL_SYS_DISABLE + : -1; + if (jsys == JAIL_SYS_DISABLE) { + prison_lock(pr); + orpr = osd_jail_get(pr, msg_prison_slot); + if (orpr != NULL) + osd_jail_del(pr, msg_prison_slot); + prison_unlock(pr); + if (orpr != NULL) { + if (orpr == pr) + msg_prison_cleanup(pr); + /* Disable all child jails as well. */ + FOREACH_PRISON_DESCENDANT(pr, tpr, descend) { + prison_lock(tpr); + trpr = osd_jail_get(tpr, msg_prison_slot); + if (trpr != NULL) { + osd_jail_del(tpr, msg_prison_slot); + prison_unlock(tpr); + if (trpr == tpr) + msg_prison_cleanup(tpr); + } else { + prison_unlock(tpr); + descend = 0; + } + } + } + } else if (jsys != -1) { + if (jsys == JAIL_SYS_NEW) + nrpr = pr; + else { + prison_lock(pr->pr_parent); + nrpr = osd_jail_get(pr->pr_parent, msg_prison_slot); + prison_unlock(pr->pr_parent); + } + rsv = osd_reserve(msg_prison_slot); + prison_lock(pr); + orpr = osd_jail_get(pr, msg_prison_slot); + if (orpr != nrpr) + (void)osd_jail_set_reserved(pr, msg_prison_slot, rsv, + nrpr); + else + osd_free_reserved(rsv); + prison_unlock(pr); + if (orpr != nrpr) { + if (orpr == pr) + msg_prison_cleanup(pr); + if (orpr != NULL) { + /* Change child jails matching the old root, */ + FOREACH_PRISON_DESCENDANT(pr, tpr, descend) { + prison_lock(tpr); + trpr = osd_jail_get(tpr, + msg_prison_slot); + if (trpr == orpr) { + (void)osd_jail_set(tpr, + msg_prison_slot, nrpr); + prison_unlock(tpr); + if (trpr == tpr) + msg_prison_cleanup(tpr); + } else { + prison_unlock(tpr); + descend = 0; + } + } + } + } + } + + return (0); +} + +static int +msg_prison_get(void *obj, void *data) +{ + struct prison *pr = obj; + struct prison *rpr; + struct vfsoptlist *opts = data; + int error, jsys; + + /* Set sysvmsg based on the jail's root prison. */ + prison_lock(pr); + rpr = osd_jail_get(pr, msg_prison_slot); + prison_unlock(pr); + jsys = rpr == NULL ? JAIL_SYS_DISABLE + : rpr == pr ? JAIL_SYS_NEW : JAIL_SYS_INHERIT; + error = vfs_setopt(opts, "sysvmsg", &jsys, sizeof(jsys)); + if (error == ENOENT) + error = 0; + return (error); +} + +static int +msg_prison_remove(void *obj, void *data __unused) +{ + struct prison *pr = obj; + struct prison *rpr; + + prison_lock(pr); + rpr = osd_jail_get(pr, msg_prison_slot); + prison_unlock(pr); + if (rpr == pr) + msg_prison_cleanup(pr); + return (0); +} + +static void +msg_prison_cleanup(struct prison *pr) +{ + struct msqid_kernel *msqkptr; + int i; + + /* Remove any msqs that belong to this jail. */ + mtx_lock(&msq_mtx); + for (i = 0; i < msginfo.msgmni; i++) { + msqkptr = &msqids[i]; + if (msqkptr->u.msg_qbytes != 0 && + msqkptr->cred != NULL && msqkptr->cred->cr_prison == pr) + msq_remove(msqkptr); + } + mtx_unlock(&msq_mtx); +} + +SYSCTL_JAIL_PARAM_SYS_NODE(sysvmsg, CTLFLAG_RW, "SYSV message queues"); + #ifdef COMPAT_FREEBSD32 int freebsd32_msgsys(struct thread *td, struct freebsd32_msgsys_args *uap) @@ -1522,8 +1822,6 @@ sys_msgsys(td, uap) { int error; - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) - return (ENOSYS); if (uap->which < 0 || uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) return (EINVAL); Modified: stable/10/sys/kern/sysv_sem.c ============================================================================== --- stable/10/sys/kern/sysv_sem.c Sat Apr 30 04:01:22 2016 (r298834) +++ stable/10/sys/kern/sysv_sem.c Sat Apr 30 04:02:32 2016 (r298835) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -78,7 +79,16 @@ static int sysvsem_modload(struct module static int semunload(void); static void semexit_myhook(void *arg, struct proc *p); static int sysctl_sema(SYSCTL_HANDLER_ARGS); -static int semvalid(int semid, struct semid_kernel *semakptr); +static int semvalid(int semid, struct prison *rpr, + struct semid_kernel *semakptr); +static void sem_remove(int semidx, struct ucred *cred); +static struct prison *sem_find_prison(struct ucred *); +static int sem_prison_cansee(struct prison *, struct semid_kernel *); +static int sem_prison_check(void *, void *); +static int sem_prison_set(void *, void *); +static int sem_prison_get(void *, void *); +static int sem_prison_remove(void *, void *); +static void sem_prison_cleanup(struct prison *); #ifndef _SYS_SYSPROTO_H_ struct __semctl_args; @@ -104,6 +114,7 @@ LIST_HEAD(, sem_undo) semu_list; /* list LIST_HEAD(, sem_undo) semu_free_list; /* list of free undo structures */ static int *semu; /* undo structure pool */ static eventhandler_tag semexit_tag; +static unsigned sem_prison_slot; /* prison OSD slot */ #define SEMUNDO_MTX sem_undo_mtx #define SEMUNDO_LOCK() mtx_lock(&SEMUNDO_MTX); @@ -208,7 +219,8 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, semvmx, "Semaphore maximum value"); SYSCTL_INT(_kern_ipc, OID_AUTO, semaem, CTLFLAG_RW, &seminfo.semaem, 0, "Adjust on exit max value"); -SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, CTLTYPE_OPAQUE | CTLFLAG_RD, +SYSCTL_PROC(_kern_ipc, OID_AUTO, sema, + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_sema, "", "Semaphore id pool"); static struct syscall_helper_data sem_syscalls[] = { @@ -247,7 +259,15 @@ static struct syscall_helper_data sem32_ static int seminit(void) { + struct prison *pr; + void *rsv; int i, error; + osd_method_t methods[PR_MAXMETHOD] = { + [PR_METHOD_CHECK] = sem_prison_check, + [PR_METHOD_SET] = sem_prison_set, + [PR_METHOD_GET] = sem_prison_get, + [PR_METHOD_REMOVE] = sem_prison_remove, + }; TUNABLE_INT_FETCH("kern.ipc.semmni", &seminfo.semmni); TUNABLE_INT_FETCH("kern.ipc.semmns", &seminfo.semmns); @@ -288,6 +308,29 @@ seminit(void) semexit_tag = EVENTHANDLER_REGISTER(process_exit, semexit_myhook, NULL, EVENTHANDLER_PRI_ANY); + /* Set current prisons according to their allow.sysvipc. */ + sem_prison_slot = osd_jail_register(NULL, methods); + rsv = osd_reserve(sem_prison_slot); + prison_lock(&prison0); + (void)osd_jail_set_reserved(&prison0, sem_prison_slot, rsv, &prison0); + prison_unlock(&prison0); + rsv = NULL; + sx_slock(&allprison_lock); + TAILQ_FOREACH(pr, &allprison, pr_list) { + if (rsv == NULL) + rsv = osd_reserve(sem_prison_slot); + prison_lock(pr); + if ((pr->pr_allow & PR_ALLOW_SYSVIPC) && pr->pr_ref > 0) { + (void)osd_jail_set_reserved(pr, sem_prison_slot, rsv, + &prison0); + rsv = NULL; + } + prison_unlock(pr); + } + if (rsv != NULL) + osd_free_reserved(rsv); + sx_sunlock(&allprison_lock); + error = syscall_helper_register(sem_syscalls); if (error != 0) return (error); @@ -313,6 +356,8 @@ semunload(void) #endif syscall_helper_unregister(sem_syscalls); EVENTHANDLER_DEREGISTER(process_exit, semexit_tag); + if (sem_prison_slot != 0) + osd_jail_deregister(sem_prison_slot); #ifdef MAC for (i = 0; i < seminfo.semmni; i++) mac_sysvsem_destroy(&sema[i]); @@ -499,11 +544,74 @@ semundo_clear(int semid, int semnum) } static int -semvalid(int semid, struct semid_kernel *semakptr) +semvalid(int semid, struct prison *rpr, struct semid_kernel *semakptr) { return ((semakptr->u.sem_perm.mode & SEM_ALLOC) == 0 || - semakptr->u.sem_perm.seq != IPCID_TO_SEQ(semid) ? EINVAL : 0); + semakptr->u.sem_perm.seq != IPCID_TO_SEQ(semid) || + sem_prison_cansee(rpr, semakptr) ? EINVAL : 0); +} + +static void +sem_remove(int semidx, struct ucred *cred) +{ + struct semid_kernel *semakptr; + int i; + + KASSERT(semidx >= 0 && semidx < seminfo.semmni, + ("semidx out of bounds")); + semakptr = &sema[semidx]; + semakptr->u.sem_perm.cuid = cred ? cred->cr_uid : 0; + semakptr->u.sem_perm.uid = cred ? cred->cr_uid : 0; + semakptr->u.sem_perm.mode = 0; + racct_sub_cred(semakptr->cred, RACCT_NSEM, semakptr->u.sem_nsems); + crfree(semakptr->cred); + semakptr->cred = NULL; + SEMUNDO_LOCK(); + semundo_clear(semidx, -1); + SEMUNDO_UNLOCK(); +#ifdef MAC + mac_sysvsem_cleanup(semakptr); +#endif + wakeup(semakptr); + for (i = 0; i < seminfo.semmni; i++) { + if ((sema[i].u.sem_perm.mode & SEM_ALLOC) && + sema[i].u.sem_base > semakptr->u.sem_base) + mtx_lock_flags(&sema_mtx[i], LOP_DUPOK); + } + for (i = semakptr->u.sem_base - sem; i < semtot; i++) + sem[i] = sem[i + semakptr->u.sem_nsems]; + for (i = 0; i < seminfo.semmni; i++) { + if ((sema[i].u.sem_perm.mode & SEM_ALLOC) && + sema[i].u.sem_base > semakptr->u.sem_base) { + sema[i].u.sem_base -= semakptr->u.sem_nsems; + mtx_unlock(&sema_mtx[i]); + } + } + semtot -= semakptr->u.sem_nsems; +} + +static struct prison * +sem_find_prison(struct ucred *cred) +{ + struct prison *pr, *rpr; + + pr = cred->cr_prison; + prison_lock(pr); + rpr = osd_jail_get(pr, sem_prison_slot); + prison_unlock(pr); + return rpr; +} + +static int +sem_prison_cansee(struct prison *rpr, struct semid_kernel *semakptr) +{ + + if (semakptr->cred == NULL || + !(rpr == semakptr->cred->cr_prison || + prison_ischild(rpr, semakptr->cred->cr_prison))) + return (EINVAL); + return (0); } /* @@ -582,6 +690,7 @@ kern_semctl(struct thread *td, int semid u_short *array; struct ucred *cred = td->td_ucred; int i, error; + struct prison *rpr; struct semid_ds *sbuf; struct semid_kernel *semakptr; struct mtx *sema_mtxp; @@ -590,7 +699,9 @@ kern_semctl(struct thread *td, int semid DPRINTF(("call to semctl(%d, %d, %d, 0x%p)\n", semid, semnum, cmd, arg)); - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + + rpr = sem_find_prison(td->td_ucred); + if (sem == NULL) return (ENOSYS); array = NULL; @@ -610,6 +721,8 @@ kern_semctl(struct thread *td, int semid error = EINVAL; goto done2; } + if ((error = sem_prison_cansee(rpr, semakptr))) + goto done2; if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_R))) goto done2; #ifdef MAC @@ -618,6 +731,8 @@ kern_semctl(struct thread *td, int semid goto done2; #endif bcopy(&semakptr->u, arg->buf, sizeof(struct semid_ds)); + if (cred->cr_prison != semakptr->cred->cr_prison) + arg->buf->sem_perm.key = IPC_PRIVATE; *rval = IXSEQ_TO_IPCID(semid, semakptr->u.sem_perm); mtx_unlock(sema_mtxp); return (0); @@ -632,6 +747,7 @@ kern_semctl(struct thread *td, int semid if (cmd == IPC_RMID) mtx_lock(&sem_mtx); mtx_lock(sema_mtxp); + #ifdef MAC error = mac_sysvsem_check_semctl(cred, semakptr, cmd); if (error != 0) @@ -643,42 +759,15 @@ kern_semctl(struct thread *td, int semid switch (cmd) { case IPC_RMID: - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_M))) goto done2; - semakptr->u.sem_perm.cuid = cred->cr_uid; - semakptr->u.sem_perm.uid = cred->cr_uid; - semakptr->u.sem_perm.mode = 0; - racct_sub_cred(semakptr->cred, RACCT_NSEM, semakptr->u.sem_nsems); - crfree(semakptr->cred); - semakptr->cred = NULL; - SEMUNDO_LOCK(); - semundo_clear(semidx, -1); - SEMUNDO_UNLOCK(); -#ifdef MAC - mac_sysvsem_cleanup(semakptr); -#endif - wakeup(semakptr); - for (i = 0; i < seminfo.semmni; i++) { - if ((sema[i].u.sem_perm.mode & SEM_ALLOC) && - sema[i].u.sem_base > semakptr->u.sem_base) - mtx_lock_flags(&sema_mtx[i], LOP_DUPOK); - } - for (i = semakptr->u.sem_base - sem; i < semtot; i++) - sem[i] = sem[i + semakptr->u.sem_nsems]; - for (i = 0; i < seminfo.semmni; i++) { - if ((sema[i].u.sem_perm.mode & SEM_ALLOC) && - sema[i].u.sem_base > semakptr->u.sem_base) { - sema[i].u.sem_base -= semakptr->u.sem_nsems; - mtx_unlock(&sema_mtx[i]); - } - } - semtot -= semakptr->u.sem_nsems; + sem_remove(semidx, cred); break; case IPC_SET: - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_M))) goto done2; @@ -691,15 +780,17 @@ kern_semctl(struct thread *td, int semid break; case IPC_STAT: - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_R))) goto done2; bcopy(&semakptr->u, arg->buf, sizeof(struct semid_ds)); + if (cred->cr_prison != semakptr->cred->cr_prison) + arg->buf->sem_perm.key = IPC_PRIVATE; break; case GETNCNT: - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_R))) goto done2; @@ -711,7 +802,7 @@ kern_semctl(struct thread *td, int semid break; case GETPID: - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_R))) goto done2; @@ -723,7 +814,7 @@ kern_semctl(struct thread *td, int semid break; case GETVAL: - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_R))) goto done2; @@ -759,7 +850,7 @@ kern_semctl(struct thread *td, int semid mtx_unlock(sema_mtxp); array = malloc(sizeof(*array) * count, M_TEMP, M_WAITOK); mtx_lock(sema_mtxp); - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; KASSERT(count == semakptr->u.sem_nsems, ("nsems changed")); if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_R))) @@ -772,7 +863,7 @@ kern_semctl(struct thread *td, int semid break; case GETZCNT: - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_R))) goto done2; @@ -784,7 +875,7 @@ kern_semctl(struct thread *td, int semid break; case SETVAL: - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_W))) goto done2; @@ -815,7 +906,7 @@ kern_semctl(struct thread *td, int semid mtx_lock(sema_mtxp); if (error) break; - if ((error = semvalid(semid, semakptr)) != 0) + if ((error = semvalid(semid, rpr, semakptr)) != 0) goto done2; KASSERT(count == semakptr->u.sem_nsems, ("nsems changed")); if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_W))) @@ -865,13 +956,16 @@ sys_semget(struct thread *td, struct sem struct ucred *cred = td->td_ucred; DPRINTF(("semget(0x%x, %d, 0%o)\n", key, nsems, semflg)); - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + + if (sem_find_prison(cred) == NULL) return (ENOSYS); mtx_lock(&sem_mtx); if (key != IPC_PRIVATE) { for (semid = 0; semid < seminfo.semmni; semid++) { if ((sema[semid].u.sem_perm.mode & SEM_ALLOC) && + sema[semid].cred != NULL && + sema[semid].cred->cr_prison == cred->cr_prison && sema[semid].u.sem_perm.key == key) break; } @@ -988,6 +1082,7 @@ sys_semop(struct thread *td, struct semo struct sembuf small_sops[SMALL_SOPS]; int semid = uap->semid; size_t nsops = uap->nsops; + struct prison *rpr; struct sembuf *sops; struct semid_kernel *semakptr; struct sembuf *sopptr = 0; @@ -1004,7 +1099,8 @@ sys_semop(struct thread *td, struct semo #endif DPRINTF(("call to semop(%d, %p, %u)\n", semid, sops, nsops)); - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + rpr = sem_find_prison(td->td_ucred); + if (sem == NULL) return (ENOSYS); semid = IPCID_TO_IX(semid); /* Convert back to zero origin */ @@ -1054,6 +1150,8 @@ sys_semop(struct thread *td, struct semo error = EINVAL; goto done2; } + if ((error = sem_prison_cansee(rpr, semakptr)) != 0) + goto done2; /* * Initial pass thru sops to see what permissions are needed. * Also perform any checks that don't need repeating on each @@ -1377,11 +1475,207 @@ semexit_myhook(void *arg, struct proc *p static int sysctl_sema(SYSCTL_HANDLER_ARGS) { + struct prison *pr, *rpr; + struct semid_kernel tsemak; + int error, i; - return (SYSCTL_OUT(req, sema, - sizeof(struct semid_kernel) * seminfo.semmni)); + pr = req->td->td_ucred->cr_prison; + rpr = sem_find_prison(req->td->td_ucred); + error = 0; + for (i = 0; i < seminfo.semmni; i++) { + mtx_lock(&sema_mtx[i]); + if ((sema[i].u.sem_perm.mode & SEM_ALLOC) == 0 || + rpr == NULL || sem_prison_cansee(rpr, &sema[i]) != 0) + bzero(&tsemak, sizeof(tsemak)); + else { + tsemak = sema[i]; + if (tsemak.cred->cr_prison != pr) + tsemak.u.sem_perm.key = IPC_PRIVATE; + } + mtx_unlock(&sema_mtx[i]); + error = SYSCTL_OUT(req, &tsemak, sizeof(tsemak)); + if (error != 0) + break; + } + return (error); } +static int +sem_prison_check(void *obj, void *data) +{ + struct prison *pr = obj; + struct prison *prpr; + struct vfsoptlist *opts = data; + int error, jsys; + + /* + * sysvsem is a jailsys integer. + * It must be "disable" if the parent jail is disabled. + */ + error = vfs_copyopt(opts, "sysvsem", &jsys, sizeof(jsys)); + if (error != ENOENT) { + if (error != 0) + return (error); + switch (jsys) { + case JAIL_SYS_DISABLE: + break; + case JAIL_SYS_NEW: + case JAIL_SYS_INHERIT: + prison_lock(pr->pr_parent); + prpr = osd_jail_get(pr->pr_parent, sem_prison_slot); + prison_unlock(pr->pr_parent); + if (prpr == NULL) + return (EPERM); + break; + default: + return (EINVAL); + } + } + + return (0); +} + +static int +sem_prison_set(void *obj, void *data) +{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Sat Apr 30 06:35:21 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C02FFAD986F; Sat, 30 Apr 2016 06:35:21 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B6CB1E70; Sat, 30 Apr 2016 06:35:21 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3U6ZKKt001577; Sat, 30 Apr 2016 06:35:20 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3U6ZK9t001575; Sat, 30 Apr 2016 06:35:20 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201604300635.u3U6ZK9t001575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Sat, 30 Apr 2016 06:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298836 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2016 06:35:21 -0000 Author: arybchik Date: Sat Apr 30 06:35:20 2016 New Revision: 298836 URL: https://svnweb.freebsd.org/changeset/base/298836 Log: MFC r298735 sfxge(4): do not use RxQ index as label Labels are limitted by 32 on EF10. It is not sufficient on powerful hosts. Since only one RxQ is running over each EvQ, zero label may be used. Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. PR: 208267 Differential Revision: https://reviews.freebsd.org/D6121 Modified: stable/10/sys/dev/sfxge/sfxge_ev.c stable/10/sys/dev/sfxge/sfxge_rx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_ev.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_ev.c Sat Apr 30 04:02:32 2016 (r298835) +++ stable/10/sys/dev/sfxge/sfxge_ev.c Sat Apr 30 06:35:20 2016 (r298836) @@ -79,6 +79,21 @@ sfxge_ev_qcomplete(struct sfxge_evq *evq sfxge_rx_qcomplete(rxq, eop); } +static struct sfxge_rxq * +sfxge_get_rxq_by_label(struct sfxge_evq *evq, uint32_t label) +{ + struct sfxge_rxq *rxq; + + KASSERT(label == 0, ("unexpected rxq label != 0")); + + rxq = evq->sc->rxq[evq->index]; + + KASSERT(rxq != NULL, ("rxq == NULL")); + KASSERT(evq->index == rxq->index, ("evq->index != rxq->index")); + + return (rxq); +} + static boolean_t sfxge_ev_rx(void *arg, uint32_t label, uint32_t id, uint32_t size, uint16_t flags) @@ -98,11 +113,7 @@ sfxge_ev_rx(void *arg, uint32_t label, u if (evq->exception) goto done; - rxq = sc->rxq[label]; - KASSERT(rxq != NULL, ("rxq == NULL")); - KASSERT(evq->index == rxq->index, - ("evq->index != rxq->index")); - + rxq = sfxge_get_rxq_by_label(evq, label); if (__predict_false(rxq->init_state != SFXGE_RXQ_STARTED)) goto done; @@ -211,7 +222,7 @@ sfxge_ev_rxq_flush_done(void *arg, uint3 evq = sc->evq[index]; - label = rxq_index; + label = 0; KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label, ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != level")); magic = SFXGE_MAGIC_RX_QFLUSH_DONE | label; @@ -245,7 +256,7 @@ sfxge_ev_rxq_flush_failed(void *arg, uin index = rxq->index; evq = sc->evq[index]; - label = rxq_index; + label = 0; KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label, ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label")); magic = SFXGE_MAGIC_RX_QFLUSH_FAILED | label; @@ -364,36 +375,18 @@ sfxge_ev_software(void *arg, uint16_t ma magic &= ~SFXGE_MAGIC_DMAQ_LABEL_MASK; switch (magic) { - case SFXGE_MAGIC_RX_QFLUSH_DONE: { - struct sfxge_rxq *rxq = sc->rxq[label]; - - KASSERT(rxq != NULL, ("rxq == NULL")); - KASSERT(evq->index == rxq->index, - ("evq->index != rxq->index")); - - sfxge_rx_qflush_done(rxq); + case SFXGE_MAGIC_RX_QFLUSH_DONE: + sfxge_rx_qflush_done(sfxge_get_rxq_by_label(evq, label)); break; - } - case SFXGE_MAGIC_RX_QFLUSH_FAILED: { - struct sfxge_rxq *rxq = sc->rxq[label]; - KASSERT(rxq != NULL, ("rxq == NULL")); - KASSERT(evq->index == rxq->index, - ("evq->index != rxq->index")); - - sfxge_rx_qflush_failed(rxq); + case SFXGE_MAGIC_RX_QFLUSH_FAILED: + sfxge_rx_qflush_failed(sfxge_get_rxq_by_label(evq, label)); break; - } - case SFXGE_MAGIC_RX_QREFILL: { - struct sfxge_rxq *rxq = sc->rxq[label]; - - KASSERT(rxq != NULL, ("rxq == NULL")); - KASSERT(evq->index == rxq->index, - ("evq->index != rxq->index")); - sfxge_rx_qrefill(rxq); + case SFXGE_MAGIC_RX_QREFILL: + sfxge_rx_qrefill(sfxge_get_rxq_by_label(evq, label)); break; - } + case SFXGE_MAGIC_TX_QFLUSH_DONE: { struct sfxge_txq *txq = sfxge_get_txq_by_label(evq, label); Modified: stable/10/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_rx.c Sat Apr 30 04:02:32 2016 (r298835) +++ stable/10/sys/dev/sfxge/sfxge_rx.c Sat Apr 30 06:35:20 2016 (r298836) @@ -1034,7 +1034,7 @@ sfxge_rx_qstart(struct sfxge_softc *sc, return (rc); /* Create the common code receive queue. */ - if ((rc = efx_rx_qcreate(sc->enp, index, index, EFX_RXQ_TYPE_DEFAULT, + if ((rc = efx_rx_qcreate(sc->enp, index, 0, EFX_RXQ_TYPE_DEFAULT, esmp, sc->rxq_entries, rxq->buf_base_id, evq->common, &rxq->common)) != 0) goto fail; From owner-svn-src-stable-10@freebsd.org Sat Apr 30 14:47:46 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1B4DB22A88; Sat, 30 Apr 2016 14:47:46 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82DD41963; Sat, 30 Apr 2016 14:47:46 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3UEljui050689; Sat, 30 Apr 2016 14:47:45 GMT (envelope-from wblock@FreeBSD.org) Received: (from wblock@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3UEljJc050688; Sat, 30 Apr 2016 14:47:45 GMT (envelope-from wblock@FreeBSD.org) Message-Id: <201604301447.u3UEljJc050688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wblock set sender to wblock@FreeBSD.org using -f From: Warren Block Date: Sat, 30 Apr 2016 14:47:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298850 - stable/10/usr.sbin/pw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2016 14:47:46 -0000 Author: wblock (doc committer) Date: Sat Apr 30 14:47:45 2016 New Revision: 298850 URL: https://svnweb.freebsd.org/changeset/base/298850 Log: MFC r298525: Add a single example of adding a user that roughly corresponds with the adduser example in the Handbook. Modified: stable/10/usr.sbin/pw/pw.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw.8 ============================================================================== --- stable/10/usr.sbin/pw/pw.8 Sat Apr 30 14:43:42 2016 (r298849) +++ stable/10/usr.sbin/pw/pw.8 Sat Apr 30 14:47:45 2016 (r298850) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2016 +.Dd April 23, 2016 .Dt PW 8 .Os .Sh NAME @@ -954,6 +954,18 @@ Pw default options file .It Pa /var/log/userlog User/group modification logfile .El +.Sh EXAMPLES +Add new user Glurmo Smith (gsmith). +A gsmith login group is created if not already present. +The login shell is set to +.Xr csh 1 . +A new home directory at +.Pa /home/gsmith +is created if it does not already exist. +Finally, a random password is generated and displayed: +.Bd -literal -offset indent +pw useradd -n gsmith -c "Glurmo Smith" -s /bin/csh -m -w random +.Ed .Sh EXIT STATUS The .Nm From owner-svn-src-stable-10@freebsd.org Sat Apr 30 15:06:20 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2194BB22EEF; Sat, 30 Apr 2016 15:06:20 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F10D7128E; Sat, 30 Apr 2016 15:06:19 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3UF6J9s056612; Sat, 30 Apr 2016 15:06:19 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3UF6Ir9056609; Sat, 30 Apr 2016 15:06:18 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201604301506.u3UF6Ir9056609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Sat, 30 Apr 2016 15:06:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298852 - in stable/10: etc/defaults etc/rc.d share/man/man5 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2016 15:06:20 -0000 Author: jamie Date: Sat Apr 30 15:06:18 2016 New Revision: 298852 URL: https://svnweb.freebsd.org/changeset/base/298852 Log: MFC r295471: Add new rc.conf parameter "jail_reverse_stop" When a user defines "jail_list" in rc.conf the jails are started in the order defined. Currently the jails are not are stopped in reverse order which may break dependencies between jails/services and prevent a clean shutdown. The new parameter "jail_reverse_stop" will shutdown jails in "jail_list" in reverse order when set to "YES". Please note that this does not affect manual invocation of the jail rc script. If a user runs the command # service jail stop jail1 jail2 jail3 the jails will be stopped in exactly the order specified regardless of jail_reverse_stop being defined in rc.conf. MFC r295568: Document the new jail_reverse_stop parameter While here clean up the documentation for jail_list PR: 196152 Submitted by: feld Modified: stable/10/etc/defaults/rc.conf stable/10/etc/rc.d/jail stable/10/share/man/man5/rc.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/defaults/rc.conf ============================================================================== --- stable/10/etc/defaults/rc.conf Sat Apr 30 14:48:30 2016 (r298851) +++ stable/10/etc/defaults/rc.conf Sat Apr 30 15:06:18 2016 (r298852) @@ -700,6 +700,7 @@ rctl_rules="/etc/rctl.conf" # rctl(8) ru jail_enable="NO" # Set to NO to disable starting of any jails jail_parallel_start="NO" # Start jails in the background jail_list="" # Space separated list of names of jails +jail_reverse_stop="NO" # Stop jails in reverse order ############################################################## ### Define source_rc_confs, the mechanism used by /etc/rc.* ## Modified: stable/10/etc/rc.d/jail ============================================================================== --- stable/10/etc/rc.d/jail Sat Apr 30 14:48:30 2016 (r298851) +++ stable/10/etc/rc.d/jail Sat Apr 30 15:06:18 2016 (r298852) @@ -517,7 +517,11 @@ jail_stop() command=$jail_program rc_flags=$jail_flags command_args="-f $jail_conf -r" - $jail_jls name | while read _j; do + if checkyesno jail_reverse_stop; then + $jail_jls name | tail -r + else + $jail_jls name + fi | while read _j; do echo -n " $_j" _tmp=`mktemp -t jail` || exit 3 $command $rc_flags $command_args $_j >> $_tmp 2>&1 @@ -532,6 +536,7 @@ jail_stop() return ;; esac + checkyesno jail_reverse_stop && set -- $(reverse_list $@) for _j in $@; do _j=$(echo $_j | tr /. _) _jv=$(echo -n $_j | tr -c '[:alnum:]' _) @@ -567,5 +572,6 @@ jail_warn() load_rc_config $name case $# in 1) run_rc_command $@ ${jail_list:-_ALL} ;; -*) run_rc_command $@ ;; +*) jail_reverse_stop="no" + run_rc_command $@ ;; esac Modified: stable/10/share/man/man5/rc.conf.5 ============================================================================== --- stable/10/share/man/man5/rc.conf.5 Sat Apr 30 14:48:30 2016 (r298851) +++ stable/10/share/man/man5/rc.conf.5 Sat Apr 30 15:06:18 2016 (r298852) @@ -3938,20 +3938,22 @@ for every jail in .Va jail_list . .It Va jail_list .Pq Vt str -A space separated list of names for jails. -If this variable is empty, -all of +A space-delimited list of jail names. +When left empty, all of the .Xr jail 8 -instances in the configuration file will be configured. -This is purely a configuration aid to help identify and -configure multiple jails. -The names specified in this list will be used to -identify settings common to an instance of a jail, -and should contain alphanumeric characters only. -The literal jail name of -.Dq Li 0 -.Pq zero -is not allowed. +instances defined in the configuration file are started. +The names specified in this list control the jail startup order. +.Xr jail 8 +instances missing from +.Va jail_list +must be started manually. +.It Va jail_reverse_stop +.Pq Vt bool +When set to +.Dq Li YES , +all configured jails in +.Va jail_list +are stopped in reverse order. .It Va jail_* variables Note that older releases supported per-jail configuration via .Xr rc.conf 5