svn commit: r353118 - in head: . tests/sys/cddl/zfs/include tests/sys/cddl/zfs/tests/cli_root/zpool_create
Author: asomers Date: Sat Oct 5 03:19:53 2019 New Revision: 353118 URL: https://svnweb.freebsd.org/changeset/base/353118 Log: ZFS: fix several of the "zpool create" tests * Remove zpool_create_013_neg. FreeBSD doesn't have an equivalent of Solaris's metadevices. GEOM would be the equivalent, but since all geoms are the same from ZFS's perspective, this test would be redundant with zpool_create_012_neg * Remove zpool_create_014_neg. FreeBSD does not support swapping to regular files. * Remove zpool_create_016_pos. This test is redundant with literally every other test that creates a disk-backed pool. * s:/etc/vfstab:/etc/fstab in zpool_create_011_neg * Delete the VTOC-related portion of zpool_create_008_pos. FreeBSD doesn't use VTOC. * Replace dumpadm with dumpon and swap with swapon in multiple tests. * In zpool_create_015_neg, don't require "zpool create -n" to fail. It's reasonable for that variant to succeed, because it doesn't actually open the zvol. * Greatly simplify zpool_create_012_neg. Make it safer, too, but not interfering with the system's regular swap devices. * Expect zpool_create_011_neg to fail (PR 241070) * Delete some redundant cleanup steps in various tests * Remove some unneeeded ATF timeout specifications. The default is fine. PR: 241070 MFC after:2 weeks Sponsored by: Axcient Deleted: head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh Modified: head/ObsoleteFiles.inc head/tests/sys/cddl/zfs/include/commands.txt head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_008_pos.ksh head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_011_neg.ksh head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_012_neg.ksh head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_015_neg.ksh head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_test.sh Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Sat Oct 5 01:34:35 2019(r353117) +++ head/ObsoleteFiles.inc Sat Oct 5 03:19:53 2019(r353118) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20191003: Remove useless ZFS tests +OLD_FILES+=usr/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_013_neg.ksh +OLD_FILES+=usr/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_014_neg.ksh +OLD_FILES+=usr/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create_016_pos.ksh # 20190910: mklocale(1) and colldef(1) removed OLD_FILES+=usr/bin/mklocale OLD_FILES+=usr/share/man/man1/mklocale.1.gz Modified: head/tests/sys/cddl/zfs/include/commands.txt == --- head/tests/sys/cddl/zfs/include/commands.txtSat Oct 5 01:34:35 2019(r353117) +++ head/tests/sys/cddl/zfs/include/commands.txtSat Oct 5 03:19:53 2019(r353118) @@ -65,6 +65,7 @@ /usr/bin/dirname /usr/bin/du #%%STFSUITEDIR%%/bin/dumpadm +/sbin/dumpon /bin/echo /usr/bin/egrep /usr/bin/env Modified: head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/Makefile == --- head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/MakefileSat Oct 5 01:34:35 2019(r353117) +++ head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/MakefileSat Oct 5 03:19:53 2019(r353118) @@ -13,8 +13,6 @@ TEST_METADATA+= is_exclusive=true ${PACKAGE}FILES+= zpool_create_003_pos.ksh ${PACKAGE}FILES+= zpool_create_020_pos.ksh ${PACKAGE}FILES+= zpool_create_017_neg.ksh -${PACKAGE}FILES+= zpool_create_013_neg.ksh -${PACKAGE}FILES+= zpool_create_016_pos.ksh ${PACKAGE}FILES+= zpool_create_012_neg.ksh ${PACKAGE}FILES+= zpool_create_006_pos.ksh ${PACKAGE}FILES+= zpool_create_002_pos.ksh @@ -22,7 +20,6 @@ ${PACKAGE}FILES+= zpool_create_021_pos.ksh ${PACKAGE}FILES+= zpool_create_007_neg.ksh ${PACKAGE}FILES+= setup.ksh ${PACKAGE}FILES+= cleanup.ksh -${PACKAGE}FILES+= zpool_create_014_neg.ksh ${PACKAGE}FILES+= zpool_create_010_neg.ksh ${PACKAGE}FILES+= zpool_create_019_pos.ksh ${PACKAGE}FILES+= zpool_create_008_pos.ksh Modified: head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib == --- head/tests/sys/cddl/zfs/tests/cli_root/zpool_create/zpool_create.kshlib Sat Oct 5 01:34:35
svn commit: r353117 - head/tests/sys/cddl/zfs/tests/hotspare
Author: asomers Date: Sat Oct 5 01:34:35 2019 New Revision: 353117 URL: https://svnweb.freebsd.org/changeset/base/353117 Log: ZFS: the hotspare_add_004_neg test needs at least two disks MFC after:2 weeks Sponsored by: Axcient Modified: head/tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh Modified: head/tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh == --- head/tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh Fri Oct 4 22:10:38 2019(r353116) +++ head/tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh Sat Oct 5 01:34:35 2019(r353117) @@ -115,7 +115,7 @@ hotspare_add_004_neg_body() . $(atf_get_srcdir)/hotspare.kshlib . $(atf_get_srcdir)/hotspare.cfg - verify_disk_count "$DISKS" 1 + verify_disk_count "$DISKS" 2 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" ksh93 $(atf_get_srcdir)/hotspare_add_004_neg.ksh || atf_fail "Testcase failed" } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353116 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Fri Oct 4 22:10:38 2019 New Revision: 353116 URL: https://svnweb.freebsd.org/changeset/base/353116 Log: Add missing definition in DEBUG code. MFC after:3 days Modified: head/sys/contrib/ipfilter/netinet/radix_ipf.c Modified: head/sys/contrib/ipfilter/netinet/radix_ipf.c == --- head/sys/contrib/ipfilter/netinet/radix_ipf.c Fri Oct 4 21:47:09 2019(r353115) +++ head/sys/contrib/ipfilter/netinet/radix_ipf.c Fri Oct 4 22:10:38 2019(r353116) @@ -1323,7 +1323,7 @@ dumptree(rnh) void test_addr(rnh, pref, addr, limit) ipf_rdx_head_t *rnh; - int pref; + int pref, limit; addrfamily_t *addr; { static int extras[14] = { 0, -1, 1, 3, 5, 8, 9, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353115 - head/sys/modules/nvdimm
Author: cem Date: Fri Oct 4 21:47:09 2019 New Revision: 353115 URL: https://svnweb.freebsd.org/changeset/base/353115 Log: nvdimm(4): Fix Clang build after r353110 Clang spuriously warns about some well-defined C99 static initializers. Mute it. X-MFC-With: r353110 Modified: head/sys/modules/nvdimm/Makefile Modified: head/sys/modules/nvdimm/Makefile == --- head/sys/modules/nvdimm/MakefileFri Oct 4 21:46:11 2019 (r353114) +++ head/sys/modules/nvdimm/MakefileFri Oct 4 21:47:09 2019 (r353115) @@ -14,3 +14,8 @@ SRCS+=acpi_if.h bus_if.h device_if.h SRCS+= opt_acpi.h opt_ddb.h .include + +# Mute spurious Clang warning. +.if ${COMPILER_TYPE} == "clang" +CWARNFLAGS.nvdimm_e820.c+= -Wno-missing-braces +.endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353114 - head/sys/x86/x86
Author: vangyzen Date: Fri Oct 4 21:46:11 2019 New Revision: 353114 URL: https://svnweb.freebsd.org/changeset/base/353114 Log: Make the hw.intrs sysctl OID read-only The handler ignores the new value, so make the OID read-only. I found this while working on r353111. MFC after:2 weeks Sponsored by: Dell EMC Isilon Modified: head/sys/x86/x86/intr_machdep.c Modified: head/sys/x86/x86/intr_machdep.c == --- head/sys/x86/x86/intr_machdep.c Fri Oct 4 21:44:52 2019 (r353113) +++ head/sys/x86/x86/intr_machdep.c Fri Oct 4 21:46:11 2019 (r353114) @@ -750,7 +750,7 @@ sysctl_hw_intrs(SYSCTL_HANDLER_ARGS) sbuf_delete(); return (error); } -SYSCTL_PROC(_hw, OID_AUTO, intrs, CTLTYPE_STRING | CTLFLAG_RW, +SYSCTL_PROC(_hw, OID_AUTO, intrs, CTLTYPE_STRING | CTLFLAG_RD, 0, 0, sysctl_hw_intrs, "A", "interrupt:number @cpu: count"); /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353113 - head/sys/ufs/ffs
Author: vangyzen Date: Fri Oct 4 21:44:52 2019 New Revision: 353113 URL: https://svnweb.freebsd.org/changeset/base/353113 Log: Add CTLFLAG_STATS to several debug.softdep sysctl OIDs Refer to r353111. MFC after:2 weeks Sponsored by: Dell EMC Isilon Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c == --- head/sys/ufs/ffs/ffs_softdep.c Fri Oct 4 21:43:43 2019 (r353112) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Oct 4 21:44:52 2019 (r353113) @@ -1311,54 +1311,55 @@ SYSCTL_INT(_debug_softdep, OID_AUTO, tickdelay, CTLFLA , 0, ""); SYSCTL_INT(_debug_softdep, OID_AUTO, flush_threads, CTLFLAG_RD, _flush_threads, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, worklist_push, CTLFLAG_RW, -_worklist_push, 0,""); -SYSCTL_INT(_debug_softdep, OID_AUTO, blk_limit_push, CTLFLAG_RW, -_blk_limit_push, 0,""); -SYSCTL_INT(_debug_softdep, OID_AUTO, ino_limit_push, CTLFLAG_RW, -_ino_limit_push, 0,""); -SYSCTL_INT(_debug_softdep, OID_AUTO, blk_limit_hit, CTLFLAG_RW, -_blk_limit_hit, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, ino_limit_hit, CTLFLAG_RW, -_ino_limit_hit, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, sync_limit_hit, CTLFLAG_RW, -_sync_limit_hit, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, indir_blk_ptrs, CTLFLAG_RW, -_indir_blk_ptrs, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, inode_bitmap, CTLFLAG_RW, -_inode_bitmap, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, direct_blk_ptrs, CTLFLAG_RW, -_direct_blk_ptrs, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, dir_entry, CTLFLAG_RW, -_dir_entry, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, jaddref_rollback, CTLFLAG_RW, -_jaddref, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, jnewblk_rollback, CTLFLAG_RW, -_jnewblk, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, journal_low, CTLFLAG_RW, -_journal_low, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, journal_min, CTLFLAG_RW, -_journal_min, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, journal_wait, CTLFLAG_RW, -_journal_wait, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_filepage, CTLFLAG_RW, -_jwait_filepage, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_freeblks, CTLFLAG_RW, -_jwait_freeblks, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_inode, CTLFLAG_RW, -_jwait_inode, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_newblk, CTLFLAG_RW, -_jwait_newblk, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_blkrequests, CTLFLAG_RW, -_cleanup_blkrequests, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_inorequests, CTLFLAG_RW, -_cleanup_inorequests, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_high_delay, CTLFLAG_RW, -_cleanup_high_delay, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_retries, CTLFLAG_RW, -_cleanup_retries, 0, ""); -SYSCTL_INT(_debug_softdep, OID_AUTO, cleanup_failures, CTLFLAG_RW, -_cleanup_failures, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, worklist_push, +CTLFLAG_RW | CTLFLAG_STATS, _worklist_push, 0,""); +SYSCTL_INT(_debug_softdep, OID_AUTO, blk_limit_push, +CTLFLAG_RW | CTLFLAG_STATS, _blk_limit_push, 0,""); +SYSCTL_INT(_debug_softdep, OID_AUTO, ino_limit_push, +CTLFLAG_RW | CTLFLAG_STATS, _ino_limit_push, 0,""); +SYSCTL_INT(_debug_softdep, OID_AUTO, blk_limit_hit, +CTLFLAG_RW | CTLFLAG_STATS, _blk_limit_hit, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, ino_limit_hit, +CTLFLAG_RW | CTLFLAG_STATS, _ino_limit_hit, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, sync_limit_hit, +CTLFLAG_RW | CTLFLAG_STATS, _sync_limit_hit, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, indir_blk_ptrs, +CTLFLAG_RW | CTLFLAG_STATS, _indir_blk_ptrs, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, inode_bitmap, +CTLFLAG_RW | CTLFLAG_STATS, _inode_bitmap, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, direct_blk_ptrs, +CTLFLAG_RW | CTLFLAG_STATS, _direct_blk_ptrs, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, dir_entry, +CTLFLAG_RW | CTLFLAG_STATS, _dir_entry, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, jaddref_rollback, +CTLFLAG_RW | CTLFLAG_STATS, _jaddref, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, jnewblk_rollback, +CTLFLAG_RW | CTLFLAG_STATS, _jnewblk, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, journal_low, +CTLFLAG_RW | CTLFLAG_STATS, _journal_low, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, journal_min, +CTLFLAG_RW | CTLFLAG_STATS, _journal_min, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, journal_wait, +CTLFLAG_RW | CTLFLAG_STATS, _journal_wait, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_filepage, +CTLFLAG_RW | CTLFLAG_STATS, _jwait_filepage, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_freeblks, +CTLFLAG_RW | CTLFLAG_STATS, _jwait_freeblks, 0, ""); +SYSCTL_INT(_debug_softdep, OID_AUTO, jwait_inode, +CTLFLAG_RW |
svn commit: r353112 - head/sys/kern
Author: vangyzen Date: Fri Oct 4 21:43:43 2019 New Revision: 353112 URL: https://svnweb.freebsd.org/changeset/base/353112 Log: Add CTLFLAG_STATS to some vfs sysctl OIDs Add CTLFLAG_STATS to the following OIDs: vfs.altbufferflushes vfs.recursiveflushes vfs.barrierwrites vfs.flushwithdeps vfs.reassignbufcalls Refer to r353111. MFC after:2 weeks Sponsored by: Dell EMC Isilon Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Fri Oct 4 21:39:11 2019(r353111) +++ head/sys/kern/vfs_bio.c Fri Oct 4 21:43:43 2019(r353112) @@ -250,11 +250,11 @@ int bdwriteskip; SYSCTL_INT(_vfs, OID_AUTO, bdwriteskip, CTLFLAG_RW, , 0, "Number of buffers supplied to bdwrite with snapshot deadlock risk"); int altbufferflushes; -SYSCTL_INT(_vfs, OID_AUTO, altbufferflushes, CTLFLAG_RW, , -0, "Number of fsync flushes to limit dirty buffers"); +SYSCTL_INT(_vfs, OID_AUTO, altbufferflushes, CTLFLAG_RW | CTLFLAG_STATS, +, 0, "Number of fsync flushes to limit dirty buffers"); static int recursiveflushes; -SYSCTL_INT(_vfs, OID_AUTO, recursiveflushes, CTLFLAG_RW, , -0, "Number of flushes skipped due to being recursive"); +SYSCTL_INT(_vfs, OID_AUTO, recursiveflushes, CTLFLAG_RW | CTLFLAG_STATS, +, 0, "Number of flushes skipped due to being recursive"); static int sysctl_numdirtybuffers(SYSCTL_HANDLER_ARGS); SYSCTL_PROC(_vfs, OID_AUTO, numdirtybuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RD, NULL, 0, sysctl_numdirtybuffers, "I", @@ -309,8 +309,8 @@ static counter_u64_t notbufdflushes; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, notbufdflushes, CTLFLAG_RD, , "Number of dirty buffer flushes done by the bufdaemon helpers"); static long barrierwrites; -SYSCTL_LONG(_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW, , 0, -"Number of barrier writes"); +SYSCTL_LONG(_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW | CTLFLAG_STATS, +, 0, "Number of barrier writes"); SYSCTL_INT(_vfs, OID_AUTO, unmapped_buf_allowed, CTLFLAG_RD, _buf_allowed, 0, "Permit the use of the unmapped i/o"); @@ -3423,8 +3423,9 @@ buf_daemon() * particularly sensitive to. */ static int flushwithdeps = 0; -SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW, , -0, "Number of buffers flushed with dependecies that require rollbacks"); +SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW | CTLFLAG_STATS, +, 0, +"Number of buffers flushed with dependecies that require rollbacks"); static int flushbufqueues(struct vnode *lvp, struct bufdomain *bd, int target, Modified: head/sys/kern/vfs_subr.c == --- head/sys/kern/vfs_subr.cFri Oct 4 21:39:11 2019(r353111) +++ head/sys/kern/vfs_subr.cFri Oct 4 21:43:43 2019(r353112) @@ -210,8 +210,8 @@ SYSCTL_COUNTER_U64(_vfs, OID_AUTO, recycles, CTLFLAG_R * XXX these are probably of (very) limited utility now. */ static int reassignbufcalls; -SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW, , 0, -"Number of calls to reassignbuf"); +SYSCTL_INT(_vfs, OID_AUTO, reassignbufcalls, CTLFLAG_RW | CTLFLAG_STATS, +, 0, "Number of calls to reassignbuf"); static counter_u64_t free_owe_inact; SYSCTL_COUNTER_U64(_vfs, OID_AUTO, free_owe_inact, CTLFLAG_RD, _owe_inact, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353111 - head/sys/sys
Author: vangyzen Date: Fri Oct 4 21:39:11 2019 New Revision: 353111 URL: https://svnweb.freebsd.org/changeset/base/353111 Log: Add CTLFLAG_STATS to all COUNTER_U64* sysctl OIDs CTLFLAG_STATS identifies a sysctl OID as statistical or informational, as opposed to a configurable/tunable OID that changes behavior. This can be used, for example, to verfiy that the kyua tests do not modify configurable OIDs when allow_sysctl_side_effects is true. Add CTLFLAG_STATS to all COUNTER_U64* OIDs. I will add the flag to more OIDs in a few subsequent commits, to facilitate MFC. The flag should be added to many more OIDs. I plan to add it those that my test found and some nearby that looked obvious. MFC after:2 weeks Sponsored by: Dell EMC Isilon Modified: head/sys/sys/sysctl.h Modified: head/sys/sys/sysctl.h == --- head/sys/sys/sysctl.h Fri Oct 4 18:38:47 2019(r353110) +++ head/sys/sys/sysctl.h Fri Oct 4 21:39:11 2019(r353111) @@ -699,7 +699,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); /* Oid for a 64-bit unsigned counter(9). The pointer must be non NULL. */ #defineSYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr) \ SYSCTL_OID(parent, nbr, name, \ - CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),\ + CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access),\ (ptr), 0, sysctl_handle_counter_u64, "QU", descr); \ CTASSERTaccess) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) && \ @@ -712,7 +712,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ sysctl_add_oid(ctx, parent, nbr, name, \ - CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),\ + CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access),\ __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr), \ NULL); \ }) @@ -720,7 +720,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); /* Oid for an array of counter(9)s. The pointer and length must be non zero. */ #defineSYSCTL_COUNTER_U64_ARRAY(parent, nbr, name, access, ptr, len, descr) \ SYSCTL_OID(parent, nbr, name, \ - CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \ + CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access), \ (ptr), (len), sysctl_handle_counter_u64_array, "S", descr); \ CTASSERTaccess) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE) &&\ @@ -734,7 +734,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \ sysctl_add_oid(ctx, parent, nbr, name, \ - CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \ + CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | CTLFLAG_STATS | (access), \ __ptr, len, sysctl_handle_counter_u64_array, "S", \ __DESCR(descr), NULL); \ }) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r353103 - head/sys/net
On Fri, 4 Oct 2019, John Baldwin wrote: On 10/4/19 6:43 AM, Kyle Evans wrote: Author: kevans Date: Fri Oct 4 13:43:07 2019 New Revision: 353103 URL: https://svnweb.freebsd.org/changeset/base/353103 Log: tuntap(4): loosen up tunclose restrictions Realistically, this cannot work. We don't allow the tun to be opened twice, so it must be done via fd passing, fork, dup, some mechanism like these. Applications demonstrably do not enforce strict ordering when they're handing off tun devices, so the parent closing before the child will easily leave the tun/tap device in a bad state where it can't be destroyed and a confused user because they did nothing wrong. Concede that we can't leave the tun/tap device in this kind of state because of software not playing the TUNSIFPID game, but it is still good to find and fix this kind of thing to keep ifconfig(8) up-to-date and help ensure good discipline in tun handling. Why are you using d_close for last close anyway? It's not really reliable compared to using cdevpriv and a cdevpriv dtor. Correct last-close close is necessarily very complicated. Here is the ttydev_close() part of mine for the tty driver. It uses cdevpriv to a fault. One fault from this is that since tracking closes actually works, it breaks mmap() since cdevpriv is associated with open files, but mmap() is supposed to work on closed files and even for open files cdevpriv is not available in vm_fault(). So my fixes make vm_fault() on ttys always fail, since tty_mmap() always fails on entry since cdevpriv is invalid. XX Index: tty.c XX === XX --- tty.c(revision 332488) XX +++ tty.c(working copy) I only have this patch for an old version of FreeBSD. XX @@ -368,37 +693,157 @@ XX struct thread *td __unused) XX { XX struct tty *tp = dev->si_drv1; XX +int *ocountp; XX +int error; XX XX tty_lock(tp); XX +tty_trace(T_C_START, "start", dev, fflag, NO_E); XX +if (tp->t_dev == NULL) { XX +tty_trace(T_C_DONE | 0x2000 | T_V, "done (no t_dev)", dev, XX +fflag, ENXIO); XX +tty_unlock(tp); XX +return (ENXIO); XX +} XX +tp->t_acount++; XX +ocountp = ttydev_ocountp(dev); XX +if (*ocountp <= 0) { XX +tty_trace(0x4000 | T_C_DONE, "done (already closed)", dev, XX +fflag, 0); XX +if (fflag & FREVOKE) { XX +(*ttydev_devgenp(dev))++; XX +tty_wakeupall(tp); XX +} XX +ttydev_exit(tp); XX +return (0); XX +} XX +if ((fflag & FREVOKE) == 0) { XX +if (tty_devgen() != tty_filegen()) { This is the main use of cdevpriv. A file generation is stored in cdevpriv and returned by tty_filegen() (return -1 if cdevpriv is invalid). A device generation is one of 4 generation counts stored in the tty struct and is returned by tty_devgen(). When these are not equal, it means a revoke in the past or an even more complicated condition. XX +tty_trace(T_C_DONE | 0x8000 | T_I, XX +"done (revoked before starting)", dev, fflag, 0); XX +ttydev_exit(tp); XX +return (0); XX +} XX +if (*ocountp > 1) { XX +(*ocountp)--; XX +tty_trace(0x1 | T_C_DONE, "done (non-last)", XX +dev, fflag, 0); XX +ttydev_exit(tp); XX +return (0); XX +} XX +if (!tty_gone(tp)) { XX +tty_trace(0x2, "tty_drain", dev, fflag, NO_E); XX +/* XX + * This used to be broken by forcibly clearing XX + * TF_STOPPED earlier, and even asserted that. XX + * Expect more "correct" hangs now. The special XX + * timeout amelioriates this. Only software flow XX + * control was cleared anyway. XX + */ XX +error = tty_drain(tp, 1); XX +tty_trace(0x4, "tty_drain done", dev, fflag, error); XX +/* XX + * Do exactly the same as before draining. XX + * Revoking must be checked for explicitly, XX + * since tty_drain() returns ENXIO if both XX + * revoked and gone, and ERESTART can mean XX + * EINTR. XX + * XX + * Ignore errors in draining, since they are XX + * nonstandard except for EINTR and even EINTR XX + * is too hard for callers to handle. XX + */ XX +if (tty_devgen() != tty_filegen()) { XX +tty_trace(0x8 | T_C_DONE | T_I, XX +
Re: svn commit: r353103 - head/sys/net
On 10/4/19 6:43 AM, Kyle Evans wrote: > Author: kevans > Date: Fri Oct 4 13:43:07 2019 > New Revision: 353103 > URL: https://svnweb.freebsd.org/changeset/base/353103 > > Log: > tuntap(4): loosen up tunclose restrictions > > Realistically, this cannot work. We don't allow the tun to be opened twice, > so it must be done via fd passing, fork, dup, some mechanism like these. > Applications demonstrably do not enforce strict ordering when they're > handing off tun devices, so the parent closing before the child will easily > leave the tun/tap device in a bad state where it can't be destroyed and a > confused user because they did nothing wrong. > > Concede that we can't leave the tun/tap device in this kind of state because > of software not playing the TUNSIFPID game, but it is still good to find and > fix this kind of thing to keep ifconfig(8) up-to-date and help ensure good > discipline in tun handling. Why are you using d_close for last close anyway? It's not really reliable compared to using cdevpriv and a cdevpriv dtor. -- John Baldwin ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353110 - in head/sys: dev/nvdimm modules/nvdimm
Author: cem Date: Fri Oct 4 18:38:47 2019 New Revision: 353110 URL: https://svnweb.freebsd.org/changeset/base/353110 Log: nvdimm(4): Add nvdimm_e820 pseudo-bus nvdimm_e820 is a newbus pseudo driver that looks for "legacy" e820 PRAM spans and creates ordinary-looking SPA devfs nodes for them (/dev/nvdimm_spaN). As these legacy regions lack real NFIT SPA regions and namespace definitions, they must be administratively sliced up externally using device.hints. This is similar in purpose to the Linux memmap= mechanism. It is assumed that systems with working NFIT tables will not have any use for this driver, and that that will be the prevailing style going forward, so if there are no explicit hints provided, this driver does not automatically create any devices. Reviewed by: kib (previous version) Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D21885 Added: head/sys/dev/nvdimm/nvdimm_e820.c (contents, props changed) Modified: head/sys/dev/nvdimm/nvdimm_spa.c head/sys/dev/nvdimm/nvdimm_var.h head/sys/modules/nvdimm/Makefile Added: head/sys/dev/nvdimm/nvdimm_e820.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/nvdimm/nvdimm_e820.c Fri Oct 4 18:38:47 2019 (r353110) @@ -0,0 +1,394 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Dell EMC Isilon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include + +struct nvdimm_e820_bus { + SLIST_HEAD(, SPA_mapping) spas; +}; + +#defineNVDIMM_E820 "nvdimm_e820" + +static MALLOC_DEFINE(M_NVDIMM_E820, NVDIMM_E820, "NVDIMM e820 bus memory"); + +static const struct bios_smap *smapbase; +static struct { + vm_paddr_t start; + vm_paddr_t size; +} pram_segments[VM_PHYSSEG_MAX]; +static unsigned pram_nreg; + +static void +nvdimm_e820_dump_prams(device_t dev, const char *func, int hintunit) +{ + char buffer[256]; + struct sbuf sb; + bool printed = false; + unsigned i; + + sbuf_new(, buffer, sizeof(buffer), SBUF_FIXEDLEN); + sbuf_set_drain(, sbuf_printf_drain, NULL); + + sbuf_printf(, "%s: %s: ", device_get_nameunit(dev), func); + if (hintunit < 0) + sbuf_cat(, "Found BIOS PRAM regions: "); + else + sbuf_printf(, "Remaining unallocated PRAM regions after " + "hint %d: ", hintunit); + + for (i = 0; i < pram_nreg; i++) { + if (pram_segments[i].size == 0) + continue; + if (printed) + sbuf_putc(, ','); + else + printed = true; + sbuf_printf(, "0x%jx-0x%jx", + (uintmax_t)pram_segments[i].start, + (uintmax_t)pram_segments[i].start + pram_segments[i].size + - 1); + } + + if (!printed) + sbuf_cat(, ""); + sbuf_putc(, '\n'); + sbuf_finish(); + sbuf_delete(); +} + +static int +nvdimm_e820_create_spas(device_t dev) +{ + static const vm_size_t HINT_ALL = (vm_size_t)-1; + + ACPI_NFIT_SYSTEM_ADDRESS nfit_sa; + struct SPA_mapping *spa_mapping; + enum SPA_mapping_type spa_type; + struct nvdimm_e820_bus *sc; + const char *hinttype; + long hintaddrl, hintsizel; + vm_paddr_t hintaddr; +
svn commit: r353109 - stable/11/sys/kern
Author: emaste Date: Fri Oct 4 17:27:49 2019 New Revision: 353109 URL: https://svnweb.freebsd.org/changeset/base/353109 Log: MFC r352796: Check the vfs option length is valid before accessing through When a VFS option passed to nmount is present but NULL the kernel will place an empty option in its internal list. This will have a NULL pointer and a length of 0. When we come to read one of these the kernel will try to load from the last address of virtual memory. This is normally invalid so will fault resulting in a kernel panic. Fix this by checking if the length is valid before dereferencing. Modified: stable/11/sys/kern/vfs_mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_mount.c == --- stable/11/sys/kern/vfs_mount.c Fri Oct 4 16:36:09 2019 (r353108) +++ stable/11/sys/kern/vfs_mount.c Fri Oct 4 17:27:49 2019 (r353109) @@ -591,7 +591,7 @@ vfs_donmount(struct thread *td, uint64_t fsflags, stru */ fstypelen = 0; error = vfs_getopt(optlist, "fstype", (void **), ); - if (error || fstype[fstypelen - 1] != '\0') { + if (error || fstypelen <= 0 || fstype[fstypelen - 1] != '\0') { error = EINVAL; if (errmsg != NULL) strncpy(errmsg, "Invalid fstype", errmsg_len); @@ -599,7 +599,7 @@ vfs_donmount(struct thread *td, uint64_t fsflags, stru } fspathlen = 0; error = vfs_getopt(optlist, "fspath", (void **), ); - if (error || fspath[fspathlen - 1] != '\0') { + if (error || fspathlen <= 0 || fspath[fspathlen - 1] != '\0') { error = EINVAL; if (errmsg != NULL) strncpy(errmsg, "Invalid fspath", errmsg_len); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353108 - in releng/12.1/sys: arm64/arm64 arm64/include riscv/include riscv/riscv
Author: markj Date: Fri Oct 4 16:36:09 2019 New Revision: 353108 URL: https://svnweb.freebsd.org/changeset/base/353108 Log: MFS r353106: Implement pmap_page_is_mapped() correctly on arm64 and riscv. Approved by: re (kib) Modified: releng/12.1/sys/arm64/arm64/pmap.c releng/12.1/sys/arm64/include/pmap.h releng/12.1/sys/riscv/include/pmap.h releng/12.1/sys/riscv/riscv/pmap.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/arm64/arm64/pmap.c == --- releng/12.1/sys/arm64/arm64/pmap.c Fri Oct 4 16:17:00 2019 (r353107) +++ releng/12.1/sys/arm64/arm64/pmap.c Fri Oct 4 16:36:09 2019 (r353108) @@ -4237,6 +4237,27 @@ restart: } /* + * Returns true if the given page is mapped individually or as part of + * a 2mpage. Otherwise, returns false. + */ +bool +pmap_page_is_mapped(vm_page_t m) +{ + struct rwlock *lock; + bool rv; + + if ((m->oflags & VPO_UNMANAGED) != 0) + return (false); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); + rw_rlock(lock); + rv = !TAILQ_EMPTY(>md.pv_list) || + ((m->flags & PG_FICTITIOUS) == 0 && + !TAILQ_EMPTY(_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)); + rw_runlock(lock); + return (rv); +} + +/* * Destroy all managed, non-wired mappings in the given user-space * pmap. This pmap cannot be active on any processor besides the * caller. Modified: releng/12.1/sys/arm64/include/pmap.h == --- releng/12.1/sys/arm64/include/pmap.hFri Oct 4 16:17:00 2019 (r353107) +++ releng/12.1/sys/arm64/include/pmap.hFri Oct 4 16:36:09 2019 (r353108) @@ -152,6 +152,7 @@ vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); void pmap_kremove_device(vm_offset_t, vm_size_t); void *pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma); +bool pmap_page_is_mapped(vm_page_t m); bool pmap_ps_enabled(pmap_t pmap); void *pmap_mapdev(vm_offset_t, vm_size_t); @@ -168,8 +169,6 @@ boolpmap_get_tables(pmap_t, vm_offset_t, pd_entry_t * intpmap_fault(pmap_t, uint64_t, uint64_t); struct pcb *pmap_switch(struct thread *, struct thread *); - -#definepmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) static inline int pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) Modified: releng/12.1/sys/riscv/include/pmap.h == --- releng/12.1/sys/riscv/include/pmap.hFri Oct 4 16:17:00 2019 (r353107) +++ releng/12.1/sys/riscv/include/pmap.hFri Oct 4 16:36:09 2019 (r353108) @@ -149,6 +149,7 @@ voidpmap_kenter_device(vm_offset_t, vm_size_t, vm_pad vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); void pmap_kremove_device(vm_offset_t, vm_size_t); +bool pmap_page_is_mapped(vm_page_t m); bool pmap_ps_enabled(pmap_t); void *pmap_mapdev(vm_offset_t, vm_size_t); @@ -161,8 +162,6 @@ voidpmap_unmap_io_transient(vm_page_t *, vm_offset_t bool pmap_get_tables(pmap_t, vm_offset_t, pd_entry_t **, pd_entry_t **, pt_entry_t **); - -#definepmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) int pmap_fault_fixup(pmap_t, vm_offset_t, vm_prot_t); Modified: releng/12.1/sys/riscv/riscv/pmap.c == --- releng/12.1/sys/riscv/riscv/pmap.c Fri Oct 4 16:17:00 2019 (r353107) +++ releng/12.1/sys/riscv/riscv/pmap.c Fri Oct 4 16:36:09 2019 (r353108) @@ -3545,6 +3545,27 @@ restart: return (count); } +/* + * Returns true if the given page is mapped individually or as part of + * a 2mpage. Otherwise, returns false. + */ +bool +pmap_page_is_mapped(vm_page_t m) +{ + struct rwlock *lock; + bool rv; + + if ((m->oflags & VPO_UNMANAGED) != 0) + return (false); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); + rw_rlock(lock); + rv = !TAILQ_EMPTY(>md.pv_list) || + ((m->flags & PG_FICTITIOUS) == 0 && + !TAILQ_EMPTY(_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)); + rw_runlock(lock); + return (rv); +} + static void pmap_remove_pages_pv(pmap_t pmap, vm_page_t m, pv_entry_t pv, struct spglist *free, bool superpage) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353107 - head/sys/cddl/dev/dtrace/amd64
Author: oshogbo Date: Fri Oct 4 16:17:00 2019 New Revision: 353107 URL: https://svnweb.freebsd.org/changeset/base/353107 Log: dtrace: 64-bits registers support The registers in ilumos and FreeBSD have a different number. In the illumos, last 32-bits register defined is SS an in FreeBSD is GS. While translating register we should comper it to the highest one. PR: 240358 Reported by:lwhsu@ MFC after: 2 weeks Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c == --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Fri Oct 4 15:27:10 2019 (r353106) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Fri Oct 4 16:17:00 2019 (r353107) @@ -505,7 +505,11 @@ dtrace_getreg(struct trapframe *rp, uint_t reg) REG_SS /* 18 SS */ }; +#ifdef illumos if (reg <= SS) { +#else /* !illumos */ + if (reg <= GS) { +#endif if (reg >= sizeof (regmap) / sizeof (int)) { DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP); return (0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353106 - in stable/12/sys: arm64/arm64 arm64/include riscv/include riscv/riscv
Author: markj Date: Fri Oct 4 15:27:10 2019 New Revision: 353106 URL: https://svnweb.freebsd.org/changeset/base/353106 Log: MFC r352826: Implement pmap_page_is_mapped() correctly on arm64 and riscv. Modified: stable/12/sys/arm64/arm64/pmap.c stable/12/sys/arm64/include/pmap.h stable/12/sys/riscv/include/pmap.h stable/12/sys/riscv/riscv/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c == --- stable/12/sys/arm64/arm64/pmap.cFri Oct 4 15:24:16 2019 (r353105) +++ stable/12/sys/arm64/arm64/pmap.cFri Oct 4 15:27:10 2019 (r353106) @@ -4250,6 +4250,27 @@ restart: } /* + * Returns true if the given page is mapped individually or as part of + * a 2mpage. Otherwise, returns false. + */ +bool +pmap_page_is_mapped(vm_page_t m) +{ + struct rwlock *lock; + bool rv; + + if ((m->oflags & VPO_UNMANAGED) != 0) + return (false); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); + rw_rlock(lock); + rv = !TAILQ_EMPTY(>md.pv_list) || + ((m->flags & PG_FICTITIOUS) == 0 && + !TAILQ_EMPTY(_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)); + rw_runlock(lock); + return (rv); +} + +/* * Destroy all managed, non-wired mappings in the given user-space * pmap. This pmap cannot be active on any processor besides the * caller. Modified: stable/12/sys/arm64/include/pmap.h == --- stable/12/sys/arm64/include/pmap.h Fri Oct 4 15:24:16 2019 (r353105) +++ stable/12/sys/arm64/include/pmap.h Fri Oct 4 15:27:10 2019 (r353106) @@ -152,6 +152,7 @@ vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); void pmap_kremove_device(vm_offset_t, vm_size_t); void *pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma); +bool pmap_page_is_mapped(vm_page_t m); bool pmap_ps_enabled(pmap_t pmap); void *pmap_mapdev(vm_offset_t, vm_size_t); @@ -168,8 +169,6 @@ boolpmap_get_tables(pmap_t, vm_offset_t, pd_entry_t * intpmap_fault(pmap_t, uint64_t, uint64_t); struct pcb *pmap_switch(struct thread *, struct thread *); - -#definepmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) static inline int pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) Modified: stable/12/sys/riscv/include/pmap.h == --- stable/12/sys/riscv/include/pmap.h Fri Oct 4 15:24:16 2019 (r353105) +++ stable/12/sys/riscv/include/pmap.h Fri Oct 4 15:27:10 2019 (r353106) @@ -149,6 +149,7 @@ voidpmap_kenter_device(vm_offset_t, vm_size_t, vm_pad vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); void pmap_kremove_device(vm_offset_t, vm_size_t); +bool pmap_page_is_mapped(vm_page_t m); bool pmap_ps_enabled(pmap_t); void *pmap_mapdev(vm_offset_t, vm_size_t); @@ -161,8 +162,6 @@ voidpmap_unmap_io_transient(vm_page_t *, vm_offset_t bool pmap_get_tables(pmap_t, vm_offset_t, pd_entry_t **, pd_entry_t **, pt_entry_t **); - -#definepmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) int pmap_fault_fixup(pmap_t, vm_offset_t, vm_prot_t); Modified: stable/12/sys/riscv/riscv/pmap.c == --- stable/12/sys/riscv/riscv/pmap.cFri Oct 4 15:24:16 2019 (r353105) +++ stable/12/sys/riscv/riscv/pmap.cFri Oct 4 15:27:10 2019 (r353106) @@ -3545,6 +3545,27 @@ restart: return (count); } +/* + * Returns true if the given page is mapped individually or as part of + * a 2mpage. Otherwise, returns false. + */ +bool +pmap_page_is_mapped(vm_page_t m) +{ + struct rwlock *lock; + bool rv; + + if ((m->oflags & VPO_UNMANAGED) != 0) + return (false); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); + rw_rlock(lock); + rv = !TAILQ_EMPTY(>md.pv_list) || + ((m->flags & PG_FICTITIOUS) == 0 && + !TAILQ_EMPTY(_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)); + rw_runlock(lock); + return (rv); +} + static void pmap_remove_pages_pv(pmap_t pmap, vm_page_t m, pv_entry_t pv, struct spglist *free, bool superpage) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353105 - in stable/12/sys: amd64/vmm/amd amd64/vmm/intel dev/qlnx/qlnxe
Author: markj Date: Fri Oct 4 15:24:16 2019 New Revision: 353105 URL: https://svnweb.freebsd.org/changeset/base/353105 Log: MFC r352823: Correct the scope of several global variables. Modified: stable/12/sys/amd64/vmm/amd/amdvi_hw.c stable/12/sys/amd64/vmm/intel/vmx.c stable/12/sys/dev/qlnx/qlnxe/qlnx_os.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/vmm/amd/amdvi_hw.c == --- stable/12/sys/amd64/vmm/amd/amdvi_hw.c Fri Oct 4 14:10:56 2019 (r353104) +++ stable/12/sys/amd64/vmm/amd/amdvi_hw.c Fri Oct 4 15:24:16 2019 (r353105) @@ -96,7 +96,7 @@ SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, host_ptp, CTLFLAG_ TUNABLE_INT("hw.vmm.amdvi.host_ptp", _host_ptp); /* Page table level used <= supported by h/w[v1=7]. */ -static int amdvi_ptp_level = 4; +int amdvi_ptp_level = 4; SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, ptp_level, CTLFLAG_RDTUN, _ptp_level, 0, NULL); TUNABLE_INT("hw.vmm.amdvi.ptp_level", _ptp_level); Modified: stable/12/sys/amd64/vmm/intel/vmx.c == --- stable/12/sys/amd64/vmm/intel/vmx.c Fri Oct 4 14:10:56 2019 (r353104) +++ stable/12/sys/amd64/vmm/intel/vmx.c Fri Oct 4 15:24:16 2019 (r353105) @@ -189,10 +189,10 @@ static u_int vpid_alloc_failed; SYSCTL_UINT(_hw_vmm_vmx, OID_AUTO, vpid_alloc_failed, CTLFLAG_RD, _alloc_failed, 0, NULL); -static int guest_l1d_flush; +int guest_l1d_flush; SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, l1d_flush, CTLFLAG_RD, _l1d_flush, 0, NULL); -static int guest_l1d_flush_sw; +int guest_l1d_flush_sw; SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, l1d_flush_sw, CTLFLAG_RD, _l1d_flush_sw, 0, NULL); Modified: stable/12/sys/dev/qlnx/qlnxe/qlnx_os.c == --- stable/12/sys/dev/qlnx/qlnxe/qlnx_os.c Fri Oct 4 14:10:56 2019 (r353104) +++ stable/12/sys/dev/qlnx/qlnxe/qlnx_os.c Fri Oct 4 15:24:16 2019 (r353105) @@ -232,10 +232,9 @@ MODULE_DEPEND(if_qlnxev, ether, 1, 1, 1); MALLOC_DEFINE(M_QLNXBUF, "qlnxbuf", "Buffers for qlnx driver"); - -static char qlnx_dev_str[128]; -static char qlnx_ver_str[VER_SIZE]; -static char qlnx_name_str[NAME_SIZE]; +char qlnx_dev_str[128]; +char qlnx_ver_str[VER_SIZE]; +char qlnx_name_str[NAME_SIZE]; /* * Some PCI Configuration Space Related Defines ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353104 - releng/12.1/sys/kern
Author: andrew Date: Fri Oct 4 14:10:56 2019 New Revision: 353104 URL: https://svnweb.freebsd.org/changeset/base/353104 Log: MFS r353032: Check the vfs option length is valid before accessing through When a VFS option passed to nmount is present but NULL the kernel will place an empty option in its internal list. This will have a NULL pointer and a length of 0. When we come to read one of these the kernel will try to load from the last address of virtual memory. This is normally invalid so will fault resulting in a kernel panic. Fix this by checking if the length is valid before dereferencing. Approved by: re (kib) Sponsored by: DARPA, AFRL Modified: releng/12.1/sys/kern/vfs_mount.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/kern/vfs_mount.c == --- releng/12.1/sys/kern/vfs_mount.cFri Oct 4 13:43:07 2019 (r353103) +++ releng/12.1/sys/kern/vfs_mount.cFri Oct 4 14:10:56 2019 (r353104) @@ -603,7 +603,7 @@ vfs_donmount(struct thread *td, uint64_t fsflags, stru */ fstypelen = 0; error = vfs_getopt(optlist, "fstype", (void **), ); - if (error || fstype[fstypelen - 1] != '\0') { + if (error || fstypelen <= 0 || fstype[fstypelen - 1] != '\0') { error = EINVAL; if (errmsg != NULL) strncpy(errmsg, "Invalid fstype", errmsg_len); @@ -611,7 +611,7 @@ vfs_donmount(struct thread *td, uint64_t fsflags, stru } fspathlen = 0; error = vfs_getopt(optlist, "fspath", (void **), ); - if (error || fspath[fspathlen - 1] != '\0') { + if (error || fspathlen <= 0 || fspath[fspathlen - 1] != '\0') { error = EINVAL; if (errmsg != NULL) strncpy(errmsg, "Invalid fspath", errmsg_len); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353103 - head/sys/net
Author: kevans Date: Fri Oct 4 13:43:07 2019 New Revision: 353103 URL: https://svnweb.freebsd.org/changeset/base/353103 Log: tuntap(4): loosen up tunclose restrictions Realistically, this cannot work. We don't allow the tun to be opened twice, so it must be done via fd passing, fork, dup, some mechanism like these. Applications demonstrably do not enforce strict ordering when they're handing off tun devices, so the parent closing before the child will easily leave the tun/tap device in a bad state where it can't be destroyed and a confused user because they did nothing wrong. Concede that we can't leave the tun/tap device in this kind of state because of software not playing the TUNSIFPID game, but it is still good to find and fix this kind of thing to keep ifconfig(8) up-to-date and help ensure good discipline in tun handling. MFC after: 3 days Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c == --- head/sys/net/if_tuntap.cFri Oct 4 12:18:03 2019(r353102) +++ head/sys/net/if_tuntap.cFri Oct 4 13:43:07 2019(r353103) @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -1061,23 +1062,29 @@ tunopen(struct cdev *dev, int flag, int mode, struct t static int tunclose(struct cdev *dev, int foo, int bar, struct thread *td) { + struct proc *p; struct tuntap_softc *tp; struct ifnet *ifp; bool l2tun; + p = td->td_proc; tp = dev->si_drv1; ifp = TUN2IFP(tp); TUN_LOCK(tp); + /* -* Simply close the device if this isn't the controlling process. This -* may happen if, for instance, the tunnel has been handed off to -* another process. The original controller should be able to close it -* without putting us into an inconsistent state. +* Realistically, we can't be obstinate here. This only means that the +* tuntap device was closed out of order, and the last closer wasn't the +* controller. These are still good to know about, though, as software +* should avoid multiple processes with a tuntap device open and +* ill-defined transfer of control (e.g., handoff, TUNSIFPID, close in +* parent). */ - if (td->td_proc->p_pid != tp->tun_pid) { - TUN_UNLOCK(tp); - return (0); + if (p->p_pid != tp->tun_pid) { + log(LOG_INFO, + "pid %d (%s), %s: tun/tap protocol violation, non-controlling process closed last.\n", + p->p_pid, p->p_comm, dev->si_name); } /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r353057 - head/sys/net
On Thu, Oct 3, 2019 at 12:54 PM Kyle Evans wrote: > > Author: kevans > Date: Thu Oct 3 17:54:00 2019 > New Revision: 353057 > URL: https://svnweb.freebsd.org/changeset/base/353057 > > Log: > if_tuntap: create /dev aliases when a tuntap device gets renamed > > Currently, if you do: > > $ ifconfig tun0 create > $ ifconfig tun0 name wg0 > $ ls -l /dev | egrep 'wg|tun' > > You will see tun0, but no wg0. In fact, it's slightly more annoying to make > the association between the new name and the old name in order to open the > device (if it hadn't been opened during the rename). > > Register an eventhandler for ifnet_arrival_events and catch interface > renames. We can determine if the ifnet is a tun easily enough from the > if_dname, which matches the cevsw.d_name from the associated tuntap_driver. > > Some locking dance is required because renames don't require the device to > be opened, so it could go away in the middle of handling the ioctl, but as > soon as we've verified this isn't the case we can attempt to busy the tun > and either bail out if the tun device is dying, or we can proceed with the > rename. > > We only create these aliases on a best-effort basis. Renaming a tun device > to "usbctl", which doesn't exist as an ifnet but does as a /dev, is clearly > not that disastrous, but we can't and won't create a /dev for that. > It's been brought to my attention that I actually had a PR that I took six months ago that this should've belonged to. PR: 219746 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r353102 - in stable/12/sys: amd64/amd64 amd64/vmm arm/arm arm64/arm64 i386/i386 kern mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64 sys vm
Author: kib Date: Fri Oct 4 12:18:03 2019 New Revision: 353102 URL: https://svnweb.freebsd.org/changeset/base/353102 Log: MFC r352807: Improve MD page fault handlers. PR: 211924 Modified: stable/12/sys/amd64/amd64/trap.c stable/12/sys/amd64/vmm/vmm.c stable/12/sys/arm/arm/trap-v4.c stable/12/sys/arm/arm/trap-v6.c stable/12/sys/arm64/arm64/trap.c stable/12/sys/i386/i386/trap.c stable/12/sys/kern/sys_process.c stable/12/sys/mips/mips/trap.c stable/12/sys/powerpc/powerpc/trap.c stable/12/sys/riscv/riscv/trap.c stable/12/sys/sparc64/sparc64/trap.c stable/12/sys/sys/signal.h stable/12/sys/vm/vm_extern.h stable/12/sys/vm/vm_fault.c stable/12/sys/vm/vm_map.c stable/12/sys/vm/vm_param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/trap.c == --- stable/12/sys/amd64/amd64/trap.cFri Oct 4 10:45:10 2019 (r353101) +++ stable/12/sys/amd64/amd64/trap.cFri Oct 4 12:18:03 2019 (r353102) @@ -111,7 +111,7 @@ void __noinline trap(struct trapframe *frame); void trap_check(struct trapframe *frame); void dblfault_handler(struct trapframe *frame); -static int trap_pfault(struct trapframe *, int); +static int trap_pfault(struct trapframe *, bool, int *, int *); static void trap_fatal(struct trapframe *, vm_offset_t); #ifdef KDTRACE_HOOKS static bool trap_user_dtrace(struct trapframe *, @@ -155,10 +155,6 @@ static const char *const trap_msg[] = { [T_DTRACE_RET] ="DTrace pid return trap", }; -static int prot_fault_translation; -SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RWTUN, -_fault_translation, 0, -"Select signal to deliver on protection fault"); static int uprintf_signal; SYSCTL_INT(_machdep, OID_AUTO, uprintf_signal, CTLFLAG_RWTUN, _signal, 0, @@ -192,14 +188,11 @@ trap(struct trapframe *frame) struct thread *td; struct proc *p; register_t addr, dr6; - int signo, ucode; + int pf, signo, ucode; u_int type; td = curthread; p = td->td_proc; - signo = 0; - ucode = 0; - addr = 0; dr6 = 0; VM_CNT_INC(v_trap); @@ -345,47 +338,18 @@ trap(struct trapframe *frame) case T_PAGEFLT: /* page fault */ /* -* Emulator can take care about this trap? +* Can emulator handle this trap? */ if (*p->p_sysent->sv_trap != NULL && (*p->p_sysent->sv_trap)(td) == 0) return; - addr = frame->tf_addr; - signo = trap_pfault(frame, TRUE); - if (signo == -1) + pf = trap_pfault(frame, true, , ); + if (pf == -1) return; - if (signo == 0) + if (pf == 0) goto userret; - if (signo == SIGSEGV) { - ucode = SEGV_MAPERR; - } else if (prot_fault_translation == 0) { - /* -* Autodetect. This check also covers -* the images without the ABI-tag ELF -* note. -*/ - if (SV_CURPROC_ABI() == SV_ABI_FREEBSD && - p->p_osrel >= P_OSREL_SIGSEGV) { - signo = SIGSEGV; - ucode = SEGV_ACCERR; - } else { - signo = SIGBUS; - ucode = T_PAGEFLT; - } - } else if (prot_fault_translation == 1) { - /* -* Always compat mode. -*/ - signo = SIGBUS; - ucode = T_PAGEFLT; - } else { - /* -* Always SIGSEGV mode. -*/ - signo = SIGSEGV; - ucode = SEGV_ACCERR; - } + addr = frame->tf_addr; break; case T_DIVIDE: /* integer divide fault */ @@ -440,7 +404,7 @@ trap(struct trapframe *frame) ("kernel trap doesn't have ucred")); switch (type) { case T_PAGEFLT: /* page fault */ - (void) trap_pfault(frame, FALSE); +
svn commit: r353100 - head/tools/build/mk
Author: bapt Date: Fri Oct 4 10:24:10 2019 New Revision: 353100 URL: https://svnweb.freebsd.org/changeset/base/353100 Log: Do not remove the locale directory when building a system without locales This directory is actually needed during make installworld and will prevent to reinstall a system after make delete-old is done. PR: 226137 Reported by: rakuco MFC after:3 days Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc == --- head/tools/build/mk/OptionalObsoleteFiles.inc Fri Oct 4 05:28:36 2019(r353099) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Fri Oct 4 10:24:10 2019(r353100) @@ -4796,7 +4796,6 @@ OLD_FILES+=usr/share/man/man1/lldb.1.gz .endif .if ${MK_LOCALES} == no -OLD_DIRS+=usr/share/locale OLD_DIRS+=usr/share/locale/af_ZA.ISO8859-15 OLD_FILES+=usr/share/locale/af_ZA.ISO8859-15/LC_COLLATE OLD_FILES+=usr/share/locale/af_ZA.ISO8859-15/LC_CTYPE ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"