svn commit: r367283 - in stable/12: sbin/sysctl sys/kern sys/sys usr.bin/truss

2020-11-02 Thread Ryan Moeller
Author: freqlabs
Date: Mon Nov  2 20:00:50 2020
New Revision: 367283
URL: https://svnweb.freebsd.org/changeset/base/367283

Log:
  MFC r366465, r367003, r367006, r367009
  
  Enable iterating all sysctls, even ones with CTLFLAG_SKIP
  kern_sysctl: Misc code cleanup
  sysctl: Misc code cleanup
  sysctl+kern_sysctl: Honor SKIP for descendant nodes

Modified:
  stable/12/sbin/sysctl/sysctl.c
  stable/12/sys/kern/kern_sysctl.c
  stable/12/sys/sys/sysctl.h
  stable/12/usr.bin/truss/syscalls.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/sysctl/sysctl.c
==
--- stable/12/sbin/sysctl/sysctl.c  Mon Nov  2 19:56:15 2020
(r367282)
+++ stable/12/sbin/sysctl/sysctl.c  Mon Nov  2 20:00:50 2020
(r367283)
@@ -29,20 +29,9 @@
  * SUCH DAMAGE.
  */
 
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1993\n\
-   The Regents of the University of California.  All rights reserved.\n";
-#endif /* not lint */
+#include 
+__FBSDID("$FreeBSD$");
 
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93";
-#endif
-static const char rcsid[] =
-  "$FreeBSD$";
-#endif /* not lint */
-
 #include 
 #include 
 #include 
@@ -81,7 +70,7 @@ static intNflag, nflag, oflag, qflag, tflag, Tflag, W
 static int oidfmt(int *, int, char *, u_int *);
 static int parsefile(const char *);
 static int parse(const char *, int);
-static int show_var(int *, int);
+static int show_var(int *, int, bool);
 static int sysctl_all(int *oid, int len);
 static int name2oid(const char *, int *);
 
@@ -221,7 +210,7 @@ main(int argc, char **argv)
if (Nflag && nflag)
usage();
if (aflag && argc == 0)
-   exit(sysctl_all(0, 0));
+   exit(sysctl_all(NULL, 0));
if (argc == 0 && conffile == NULL)
usage();
 
@@ -369,6 +358,13 @@ parse(const char *string, int lineno)
else
line[0] = '\0';
 
+   /*
+* Split the string into name and value.
+*
+* Either = or : may be used as the delimiter.
+* Whitespace surrounding the delimiter is trimmed.
+* Quotes around the value are stripped.
+*/
cp = buf;
if (snprintf(buf, BUFSIZ, "%s", string) >= BUFSIZ) {
warnx("oid too long: '%s'%s", string, line);
@@ -381,6 +377,7 @@ parse(const char *string, int lineno)
warnx("Can't set variables when using -T or -W");
usage();
}
+   /* Trim whitespace before the value. */
while (isspace(*cp))
cp++;
/* Strip a pair of " or ' if any. */
@@ -394,14 +391,17 @@ parse(const char *string, int lineno)
newvalstr = cp;
newsize = strlen(cp);
}
-   /* Trim spaces */
+   /* Trim whitespace after the name. */
cp = bufp + strlen(bufp) - 1;
while (cp >= bufp && isspace((int)*cp)) {
*cp = '\0';
cp--;
}
-   len = name2oid(bufp, mib);
 
+   /*
+* Check the name is a useable oid.
+*/
+   len = name2oid(bufp, mib);
if (len < 0) {
if (iflag)
return (0);
@@ -425,118 +425,126 @@ parse(const char *string, int lineno)
exit(1);
}
 
+   /*
+* We have a useable oid to work with.  If there is no value given,
+* show the node and its children.  Otherwise, set the new value.
+*/
if (newvalstr == NULL || dflag) {
if ((kind & CTLTYPE) == CTLTYPE_NODE) {
if (dflag) {
-   i = show_var(mib, len);
+   i = show_var(mib, len, false);
if (!i && !bflag)
putchar('\n');
}
sysctl_all(mib, len);
} else {
-   i = show_var(mib, len);
+   i = show_var(mib, len, false);
if (!i && !bflag)
putchar('\n');
}
-   } else {
-   if ((kind & CTLTYPE) == CTLTYPE_NODE) {
-   warnx("oid '%s' isn't a leaf node%s", bufp, line);
-   return (1);
-   }
+   return (0);
+   }
 
-   if (!(kind & CTLFLAG_WR)) {
-   if (kind & CTLFLAG_TUN) {
-   warnx("oid '%s' is a read only tunable%s", 
bufp, line);
-   warnx("Tunable values are set in 
/boot/loader.conf");
-   } else
-   warnx("oid '%s' is read only%s", bufp, line);
-   

svn commit: r367055 - stable/12/usr.sbin/efibootmgr

2020-10-26 Thread Ryan Moeller
Author: freqlabs
Date: Mon Oct 26 12:34:50 2020
New Revision: 367055
URL: https://svnweb.freebsd.org/changeset/base/367055

Log:
  MFC r366830:
  
  efibootmgr: Use returned error code for error message, not errno
  
  efivar_unix_path_to_device_path returns the error code, it does not set errno.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D26852

Modified:
  stable/12/usr.sbin/efibootmgr/efibootmgr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/efibootmgr/efibootmgr.c
==
--- stable/12/usr.sbin/efibootmgr/efibootmgr.c  Mon Oct 26 08:17:41 2020
(r367054)
+++ stable/12/usr.sbin/efibootmgr/efibootmgr.c  Mon Oct 26 12:34:50 2020
(r367055)
@@ -641,11 +641,16 @@ make_boot_var(const char *label, const char *loader, c
err(1, "bootvar creation");
if (loader == NULL)
errx(1, "Must specify boot loader");
-   if (efivar_unix_path_to_device_path(loader, ) != 0)
-   err(1, "Cannot translate unix loader path '%s' to UEFI", 
loader);
+   ret = efivar_unix_path_to_device_path(loader, );
+   if (ret != 0)
+   errc(1, ret, "Cannot translate unix loader path '%s' to UEFI",
+   loader);
if (kernel != NULL) {
-   if (efivar_unix_path_to_device_path(kernel, ) != 0)
-   err(1, "Cannot translate unix kernel path '%s' to 
UEFI", kernel);
+   ret = efivar_unix_path_to_device_path(kernel, );
+   if (ret != 0)
+   errc(1, ret,
+   "Cannot translate unix kernel path '%s' to UEFI",
+   kernel);
} else {
kerneldp = NULL;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367025 - head/usr.bin/sockstat

2020-10-24 Thread Ryan Moeller
Author: freqlabs
Date: Sat Oct 24 22:36:20 2020
New Revision: 367025
URL: https://svnweb.freebsd.org/changeset/base/367025

Log:
  sockstat: Fix error message when jail_attach fails
  
  jail_errmsg is for libjail, jail_attach() is a system call.

Modified:
  head/usr.bin/sockstat/sockstat.c

Modified: head/usr.bin/sockstat/sockstat.c
==
--- head/usr.bin/sockstat/sockstat.cSat Oct 24 21:10:53 2020
(r367024)
+++ head/usr.bin/sockstat/sockstat.cSat Oct 24 22:36:20 2020
(r367025)
@@ -1372,7 +1372,7 @@ main(int argc, char *argv[])
errx(2, "%s", jail_errmsg);
case JAIL_SYS_NEW:
if (jail_attach(opt_j) < 0)
-   errx(3, "%s", jail_errmsg);
+   err(3, "jail_attach()");
/* Set back to -1 for normal output in vnet jail. */
opt_j = -1;
break;
___
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: r367013 - in head: . contrib/mandoc etc/mtree lib lib/flua lib/flua/libjail share/examples share/examples/flua share/man share/man/man3lua usr.bin/man

2020-10-24 Thread Ryan Moeller
Author: freqlabs
Date: Sat Oct 24 17:08:59 2020
New Revision: 367013
URL: https://svnweb.freebsd.org/changeset/base/367013

Log:
  flua: Add a libjail module
  
  libjail is pretty small, so it makes for a good proof of concept demonstrating
  how a system library can be wrapped to create a loadable Lua module for flua.
  
  * Introduce 3lua section for man pages
  * Add libjail module
  
  Reviewed by:  kevans, manpages
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D26080

Added:
  head/lib/flua/
  head/lib/flua/Makefile   (contents, props changed)
  head/lib/flua/libjail/
  head/lib/flua/libjail/Makefile   (contents, props changed)
  head/lib/flua/libjail/jail.3lua   (contents, props changed)
  head/lib/flua/libjail/lua_jail.c   (contents, props changed)
  head/share/examples/flua/
  head/share/examples/flua/libjail.lua   (contents, props changed)
  head/share/man/man3lua/
  head/share/man/man3lua/Makefile   (contents, props changed)
  head/share/man/man3lua/intro.3lua   (contents, props changed)
Modified:
  head/Makefile.inc1
  head/contrib/mandoc/msec.in
  head/etc/mtree/BSD.usr.dist
  head/lib/Makefile
  head/share/examples/Makefile
  head/share/man/Makefile
  head/usr.bin/man/man.1
  head/usr.bin/man/man.sh

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sat Oct 24 16:42:35 2020(r367012)
+++ head/Makefile.inc1  Sat Oct 24 17:08:59 2020(r367013)
@@ -2829,6 +2829,7 @@ _prebuild_libs=   ${_kerberos5_lib_libasn1} \
lib/libelf lib/libexpat \
lib/libfigpar \
${_lib_libgssapi} \
+   lib/libjail \
lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
lib/libzstd \
${_lib_casper} \

Modified: head/contrib/mandoc/msec.in
==
--- head/contrib/mandoc/msec.in Sat Oct 24 16:42:35 2020(r367012)
+++ head/contrib/mandoc/msec.in Sat Oct 24 17:08:59 2020(r367013)
@@ -25,6 +25,7 @@
 LINE("1",  "FreeBSD General Commands Manual")
 LINE("2",  "FreeBSD System Calls Manual")
 LINE("3",  "FreeBSD Library Functions Manual")
+LINE("3lua",   "Lua Library Functions Manual")
 LINE("3p", "Perl Library Functions Manual")
 LINE("4",  "FreeBSD Kernel Interfaces Manual")
 LINE("5",  "FreeBSD File Formats Manual")

Modified: head/etc/mtree/BSD.usr.dist
==
--- head/etc/mtree/BSD.usr.dist Sat Oct 24 16:42:35 2020(r367012)
+++ head/etc/mtree/BSD.usr.dist Sat Oct 24 17:08:59 2020(r367013)
@@ -281,6 +281,8 @@
 ..
 find_interface
 ..
+flua
+..
 hast
 ..
 hostapd
@@ -856,6 +858,8 @@
 man2
 ..
 man3
+..
+man3lua
 ..
 man4
 aarch64

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Sat Oct 24 16:42:35 2020(r367012)
+++ head/lib/Makefile   Sat Oct 24 17:08:59 2020(r367013)
@@ -142,6 +142,11 @@ SUBDIR_DEPEND_liblzma= ${_libthr}
 SUBDIR_DEPEND_libpcap= ofed
 .endif
 
+.if !defined(COMPAT_32BIT)
+SUBDIR+=   flua
+SUBDIR_DEPEND_flua=libjail
+.endif
+
 # NB: keep these sorted by MK_* knobs
 
 SUBDIR.${MK_ATM}+= libngatm

Added: head/lib/flua/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/flua/Makefile  Sat Oct 24 17:08:59 2020(r367013)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SUBDIR=libjail
+
+.include 

Added: head/lib/flua/libjail/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/flua/libjail/Makefile  Sat Oct 24 17:08:59 2020
(r367013)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+SHLIB_NAME=jail.so
+SHLIBDIR=  ${LIBDIR}/flua
+
+SRCS+= lua_jail.c
+
+CFLAGS+= \
+   -I${SRCTOP}/contrib/lua/src \
+   -I${SRCTOP}/lib/liblua \
+
+LIBADD+=   jail
+
+MAN=   jail.3lua
+
+.include 

Added: head/lib/flua/libjail/jail.3lua
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/flua/libjail/jail.3lua Sat Oct 24 17:08:59 2020
(r367013)
@@ -0,0 +1,210 @@
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+.\"
+.

svn commit: r367010 - head/sys/contrib/openzfs/module/os/freebsd/spl

2020-10-24 Thread Ryan Moeller
Author: freqlabs
Date: Sat Oct 24 16:25:52 2020
New Revision: 367010
URL: https://svnweb.freebsd.org/changeset/base/367010

Log:
  Skip RAW kstat sysctls by default
  
  hese kstats are often expensive to compute so we want to avoid them
  unless specifically requested.
  
  The following kstats are affected by this change:
  
  kstat.zfs.${pool}.multihost
  kstat.zfs.${pool}.misc.state
  kstat.zfs.${pool}.txgs
  kstat.zfs.misc.fletcher_4_bench
  kstat.zfs.misc.vdev_raidz_bench
  kstat.zfs.misc.dbufs
  kstat.zfs.misc.dbgmsg
  
  PR:   249258
  Reported by:  mjg
  Reviewed by:  mjg, allanjude
  Obtained from:https://github.com/openzfs/zfs/pull/11099
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c

Modified: head/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c
==
--- head/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c  Sat Oct 24 
16:17:07 2020(r367009)
+++ head/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c  Sat Oct 24 
16:25:52 2020(r367010)
@@ -475,14 +475,14 @@ kstat_install(kstat_t *ksp)
if (ksp->ks_raw_ops.data) {
root = SYSCTL_ADD_PROC(>ks_sysctl_ctx,
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
-   OID_AUTO, ksp->ks_name,
-   CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   OID_AUTO, ksp->ks_name, CTLTYPE_STRING | CTLFLAG_RD
+   | CTLFLAG_MPSAFE | CTLFLAG_SKIP,
ksp, 0, kstat_sysctl_raw, "A", ksp->ks_name);
} else {
root = SYSCTL_ADD_PROC(>ks_sysctl_ctx,
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
-   OID_AUTO, ksp->ks_name,
-   CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   OID_AUTO, ksp->ks_name, CTLTYPE_OPAQUE | CTLFLAG_RD
+   | CTLFLAG_MPSAFE | CTLFLAG_SKIP,
ksp, 0, kstat_sysctl_raw, "", ksp->ks_name);
}
break;
___
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: r367009 - in head: sbin/sysctl sys/kern

2020-10-24 Thread Ryan Moeller
Author: freqlabs
Date: Sat Oct 24 16:17:07 2020
New Revision: 367009
URL: https://svnweb.freebsd.org/changeset/base/367009

Log:
  sysctl+kern_sysctl: Honor SKIP for descendant nodes
  
  Ensure we also skip descendants of SKIP nodes when iterating through children
  of an explicitly specified node.
  
  Reported by:  np
  Reviewed by:  np
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26833

Modified:
  head/sbin/sysctl/sysctl.c
  head/sys/kern/kern_sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==
--- head/sbin/sysctl/sysctl.c   Sat Oct 24 16:11:46 2020(r367008)
+++ head/sbin/sysctl/sysctl.c   Sat Oct 24 16:17:07 2020(r367009)
@@ -952,6 +952,7 @@ oidfmt(int *oid, int len, char *fmt, u_int *kind)
 static int
 show_var(int *oid, int nlen, bool honor_skip)
 {
+   static int skip_len = 0, skip_oid[CTL_MAXNAME];
u_char buf[BUFSIZ], *val, *oval, *p;
char name[BUFSIZ], fmt[BUFSIZ];
const char *sep, *sep1, *prntype;
@@ -1021,9 +1022,21 @@ show_var(int *oid, int nlen, bool honor_skip)
return (0);
}
 
+   /* keep track of encountered skip nodes, ignoring descendants */
+   if (skip_len == 0 && (kind & CTLFLAG_SKIP) != 0) {
+   /* Save this oid so we can skip descendants. */
+   skip_len = nlen * sizeof(int);
+   memcpy(skip_oid, oid, skip_len);
+   }
+
/* bail before fetching the value if we're honoring skip */
-   if (honor_skip && (kind & CTLFLAG_SKIP) != 0)
-   return (1);
+   if (honor_skip) {
+   if (0 < skip_len && skip_len <= nlen * (int)sizeof(int) &&
+   memcmp(skip_oid, oid, skip_len) == 0)
+   return (1);
+   /* Not a skip node or descendant of a skip node. */
+   skip_len = 0;
+   }
 
/* don't fetch opaques that we don't know how to print */
if (ctltype == CTLTYPE_OPAQUE) {

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Sat Oct 24 16:11:46 2020(r367008)
+++ head/sys/kern/kern_sysctl.c Sat Oct 24 16:17:07 2020(r367009)
@@ -1126,9 +1126,13 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int
 * We have reached a node with a full name match and are
 * looking for the next oid in its children.
 *
+* For CTL_SYSCTL_NEXTNOSKIP we are done.
+*
 * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it
 * has a handler) and move on to the children.
 */
+   if (!honor_skip)
+   return (0);
if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) 
return (0);
if (oidp->oid_handler) 
@@ -1163,9 +1167,13 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int
/*
 * We have reached the next oid.
 *
+* For CTL_SYSCTL_NEXTNOSKIP we are done.
+*
 * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it
 * has a handler) and move on to the children.
 */
+   if (!honor_skip)
+   return (0);
if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE)
return (0);
if (oidp->oid_handler)
___
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: r367006 - head/sbin/sysctl

2020-10-24 Thread Ryan Moeller
Author: freqlabs
Date: Sat Oct 24 16:05:37 2020
New Revision: 367006
URL: https://svnweb.freebsd.org/changeset/base/367006

Log:
  sysctl: Misc code cleanup
  
  * Use defined SYS_SYSCTL names
  * Use memcmp instead of explicit loop
  * Use NULL instead of 0 for pointer value
  * Use __FBSDID
  * Reformat, improve comments in parse()
  
  No functional changes.
  
  Reviewed by:  imp
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26832

Modified:
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==
--- head/sbin/sysctl/sysctl.c   Sat Oct 24 15:58:42 2020(r367005)
+++ head/sbin/sysctl/sysctl.c   Sat Oct 24 16:05:37 2020(r367006)
@@ -29,20 +29,9 @@
  * SUCH DAMAGE.
  */
 
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1993\n\
-   The Regents of the University of California.  All rights reserved.\n";
-#endif /* not lint */
+#include 
+__FBSDID("$FreeBSD$");
 
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93";
-#endif
-static const char rcsid[] =
-  "$FreeBSD$";
-#endif /* not lint */
-
 #include 
 #include 
 #include 
@@ -221,7 +210,7 @@ main(int argc, char **argv)
if (Nflag && nflag)
usage();
if (aflag && argc == 0)
-   exit(sysctl_all(0, 0));
+   exit(sysctl_all(NULL, 0));
if (argc == 0 && conffile == NULL)
usage();
 
@@ -369,6 +358,13 @@ parse(const char *string, int lineno)
else
line[0] = '\0';
 
+   /*
+* Split the string into name and value.
+*
+* Either = or : may be used as the delimiter.
+* Whitespace surrounding the delimiter is trimmed.
+* Quotes around the value are stripped.
+*/
cp = buf;
if (snprintf(buf, BUFSIZ, "%s", string) >= BUFSIZ) {
warnx("oid too long: '%s'%s", string, line);
@@ -381,6 +377,7 @@ parse(const char *string, int lineno)
warnx("Can't set variables when using -T or -W");
usage();
}
+   /* Trim whitespace before the value. */
while (isspace(*cp))
cp++;
/* Strip a pair of " or ' if any. */
@@ -394,14 +391,17 @@ parse(const char *string, int lineno)
newvalstr = cp;
newsize = strlen(cp);
}
-   /* Trim spaces */
+   /* Trim whitespace after the name. */
cp = bufp + strlen(bufp) - 1;
while (cp >= bufp && isspace((int)*cp)) {
*cp = '\0';
cp--;
}
-   len = name2oid(bufp, mib);
 
+   /*
+* Check the name is a useable oid.
+*/
+   len = name2oid(bufp, mib);
if (len < 0) {
if (iflag)
return (0);
@@ -425,6 +425,10 @@ parse(const char *string, int lineno)
exit(1);
}
 
+   /*
+* We have a useable oid to work with.  If there is no value given,
+* show the node and its children.  Otherwise, set the new value.
+*/
if (newvalstr == NULL || dflag) {
if ((kind & CTLTYPE) == CTLTYPE_NODE) {
if (dflag) {
@@ -438,105 +442,109 @@ parse(const char *string, int lineno)
if (!i && !bflag)
putchar('\n');
}
-   } else {
-   if ((kind & CTLTYPE) == CTLTYPE_NODE) {
-   warnx("oid '%s' isn't a leaf node%s", bufp, line);
-   return (1);
-   }
+   return (0);
+   }
 
-   if (!(kind & CTLFLAG_WR)) {
-   if (kind & CTLFLAG_TUN) {
-   warnx("oid '%s' is a read only tunable%s", 
bufp, line);
-   warnx("Tunable values are set in 
/boot/loader.conf");
-   } else
-   warnx("oid '%s' is read only%s", bufp, line);
-   return (1);
-   }
+   /*
+* We have a new value to set.  Check its validity and parse if numeric.
+*/
+   if ((kind & CTLTYPE) == CTLTYPE_NODE) {
+   warnx("oid '%s' isn't a leaf node%s", bufp, line);
+   return (1);
+   }
 
-   switch (kind & CTLTYPE) {
-   case CTLTYPE_INT:
-   case CTLTYPE_UINT:
-   case CTLTYPE_LONG:
-   case CTLTYPE_ULONG:
-   case CTLTYPE_S8:
-   case CTLTYPE_S16:
-   case CTLTYPE_S32:
-   case CTLTYPE_S64:
-   case CTLTYPE_U8:
-   case CTLTYPE_U16:
-   case CTLTYPE_U32:
-   case CTLTYPE_U64:
-   if 

svn commit: r367003 - head/sys/kern

2020-10-24 Thread Ryan Moeller
Author: freqlabs
Date: Sat Oct 24 14:46:38 2020
New Revision: 367003
URL: https://svnweb.freebsd.org/changeset/base/367003

Log:
  kern_sysctl: Misc code cleanup
  
  Remove unused oidpp parameter from sysctl_sysctl_next_ls and
  add high level comments to describe how it works.
  
  No functional change.
  
  Reviewed by:  imp
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26854

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Sat Oct 24 14:39:17 2020(r367002)
+++ head/sys/kern/kern_sysctl.c Sat Oct 24 14:46:38 2020(r367003)
@@ -1100,9 +1100,13 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
 static SYSCTL_NODE(_sysctl, CTL_SYSCTL_NAME, name, CTLFLAG_RD |
 CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_name, "");
 
+/*
+ * Walk the sysctl subtree at lsp until we find the given name,
+ * and return the next name in order by oid_number.
+ */
 static int
 sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen, 
-int *next, int *len, int level, struct sysctl_oid **oidpp, bool honor_skip)
+int *next, int *len, int level, bool honor_skip)
 {
struct sysctl_oid *oidp;
 
@@ -1110,7 +1114,6 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int
*len = level;
SLIST_FOREACH(oidp, lsp, oid_link) {
*next = oidp->oid_number;
-   *oidpp = oidp;
 
if ((oidp->oid_kind & CTLFLAG_DORMANT) != 0)
continue;
@@ -1118,46 +1121,77 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int
if (honor_skip && (oidp->oid_kind & CTLFLAG_SKIP) != 0)
continue;
 
-   if (!namelen) {
+   if (namelen == 0) {
+   /*
+* We have reached a node with a full name match and are
+* looking for the next oid in its children.
+*
+* For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it
+* has a handler) and move on to the children.
+*/
if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) 
return (0);
if (oidp->oid_handler) 
-   /* We really should call the handler here...*/
return (0);
lsp = SYSCTL_CHILDREN(oidp);
-   if (!sysctl_sysctl_next_ls(lsp, 0, 0, next+1, 
-   len, level+1, oidpp, honor_skip))
+   if (!sysctl_sysctl_next_ls(lsp, NULL, 0, next + 1, len,
+   level + 1, honor_skip))
return (0);
+   /*
+* There were no useable children in this node.
+* Continue searching for the next oid at this level.
+*/
goto emptynode;
}
 
+   /*
+* No match yet. Continue seeking the given name.
+*
+* We are iterating in order by oid_number, so skip oids lower
+* than the one we are looking for.
+*
+* When the current oid_number is higher than the one we seek,
+* that means we have reached the next oid in the sequence and
+* should return it.
+*
+* If the oid_number matches the name at this level then we
+* have to find a node to continue searching at the next level.
+*/
if (oidp->oid_number < *name)
continue;
-
if (oidp->oid_number > *name) {
+   /*
+* We have reached the next oid.
+*
+* For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it
+* has a handler) and move on to the children.
+*/
if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE)
return (0);
if (oidp->oid_handler)
return (0);
lsp = SYSCTL_CHILDREN(oidp);
-   if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, 
-   next+1, len, level+1, oidpp, honor_skip))
+   if (!sysctl_sysctl_next_ls(lsp, name + 1, namelen - 1,
+   next + 1, len, level + 1, honor_skip))
return (0);
goto next;
}
if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE)
   

Re: svn commit: r366965 - stable/12/usr.sbin/bhyve

2020-10-23 Thread Ryan Moeller



On 10/23/20 8:27 AM, Konstantin Belousov wrote:

Does this description mean that if guest writes garbage into base, it can
crash monitor ?


The guest can crash the bhyve process by writing garbage into device 
registers, yes.


A bad base address will be mapped to NULL and eventually gets passed as 
src to memcpy.


-Ryan

___
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: r366965 - stable/12/usr.sbin/bhyve

2020-10-23 Thread Ryan Moeller
Author: freqlabs
Date: Fri Oct 23 10:48:14 2020
New Revision: 366965
URL: https://svnweb.freebsd.org/changeset/base/366965

Log:
  MFC r366771:
  
  bhyve: Update TX descriptor base address and host mapping on change
  
  bhyve sometimes segfaults when using an e1000 NIC with a Windows guest.
  
  We are only updating our tdba and cached host mapping when the low address
  register is written and when tx is set enabled, but not when the high address
  or length registers are written. It is observed that Windows 10 is 
occasionally
  enabling tx first then writing the registers in the order low, high, len. This
  leaves us with a bogus base address and mapping, which causes a segfault later
  when we try to copy from a descriptor that has unpredictable garbage in a
  pointer.
  
  Updating the address and mapping when any of those registers change seems to 
fix
  that particular issue.
  
  Reviewed by:  mav, grehan (bhyve)
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26798

Modified:
  stable/12/usr.sbin/bhyve/pci_e82545.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/pci_e82545.c
==
--- stable/12/usr.sbin/bhyve/pci_e82545.c   Fri Oct 23 10:24:37 2020
(r366964)
+++ stable/12/usr.sbin/bhyve/pci_e82545.c   Fri Oct 23 10:48:14 2020
(r366965)
@@ -1699,18 +1699,18 @@ e82545_write_register(struct e82545_softc *sc, uint32_
break;
case E1000_TDBAL(0):
sc->esc_TDBAL = value & ~0xF;
-   if (sc->esc_tx_enabled) {
-   /* Apparently legal */
+   if (sc->esc_tx_enabled)
e82545_tx_update_tdba(sc);
-   }
break;
case E1000_TDBAH(0):
-   //assert(!sc->esc_tx_enabled);  
sc->esc_TDBAH = value;
+   if (sc->esc_tx_enabled)
+   e82545_tx_update_tdba(sc);
break;
case E1000_TDLEN(0):
-   //assert(!sc->esc_tx_enabled);
sc->esc_TDLEN = value & ~0xFFF0007F;
+   if (sc->esc_tx_enabled)
+   e82545_tx_update_tdba(sc);
break;
case E1000_TDH(0):
//assert(!sc->esc_tx_enabled);
___
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: r366906 - in head: lib/libifconfig sbin/ifconfig

2020-10-20 Thread Ryan Moeller
Author: freqlabs
Date: Wed Oct 21 05:27:25 2020
New Revision: 366906
URL: https://svnweb.freebsd.org/changeset/base/366906

Log:
  Move list_cloners to libifconfig
  
  Move list_cloners() from ifconfig(8) to libifconfig(3) where it can be
  reused by other consumers.
  
  Reviewed by:  kp
  Differential Revision:https://reviews.freebsd.org/D26858

Modified:
  head/lib/libifconfig/libifconfig.c
  head/lib/libifconfig/libifconfig.h
  head/sbin/ifconfig/ifclone.c

Modified: head/lib/libifconfig/libifconfig.c
==
--- head/lib/libifconfig/libifconfig.c  Wed Oct 21 00:46:53 2020
(r366905)
+++ head/lib/libifconfig/libifconfig.c  Wed Oct 21 05:27:25 2020
(r366906)
@@ -628,3 +628,35 @@ ifconfig_set_vlantag(ifconfig_handle_t *h, const char 
}
return (0);
 }
+
+int
+ifconfig_list_cloners(ifconfig_handle_t *h, char **bufp, size_t *lenp)
+{
+   struct if_clonereq ifcr;
+   char *buf;
+
+   memset(, 0, sizeof(ifcr));
+   *bufp = NULL;
+   *lenp = 0;
+
+   if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFGCLONERS, ) < 0)
+   return (-1);
+
+   buf = malloc(ifcr.ifcr_total * IFNAMSIZ);
+   if (buf == NULL) {
+   h->error.errtype = OTHER;
+   h->error.errcode = ENOMEM;
+   return (-1);
+   }
+
+   ifcr.ifcr_count = ifcr.ifcr_total;
+   ifcr.ifcr_buffer = buf;
+   if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFGCLONERS, ) < 0) {
+   free(buf);
+   return (-1);
+   }
+
+   *bufp = buf;
+   *lenp = ifcr.ifcr_total;
+   return (0);
+}

Modified: head/lib/libifconfig/libifconfig.h
==
--- head/lib/libifconfig/libifconfig.h  Wed Oct 21 00:46:53 2020
(r366905)
+++ head/lib/libifconfig/libifconfig.h  Wed Oct 21 05:27:25 2020
(r366906)
@@ -279,3 +279,13 @@ int ifconfig_create_interface_vlan(ifconfig_handle_t *
 
 int ifconfig_set_vlantag(ifconfig_handle_t *h, const char *name,
 const char *vlandev, const unsigned short vlantag);
+
+/** Gets the names of all interface cloners available on the system
+ * @param bufp Set to the address of the names buffer on success or NULL
+ *  if an error occurs.  This buffer must be freed when done.
+ * @param lenp Set to the number of names in the returned buffer or 0
+ * if an error occurs.  Each name is contained within an
+ * IFNAMSIZ length slice of the buffer, for a total buffer
+ * length of *lenp * IFNAMSIZ bytes.
+ */
+int ifconfig_list_cloners(ifconfig_handle_t *h, char **bufp, size_t *lenp);

Modified: head/sbin/ifconfig/ifclone.c
==
--- head/sbin/ifconfig/ifclone.cWed Oct 21 00:46:53 2020
(r366905)
+++ head/sbin/ifconfig/ifclone.cWed Oct 21 05:27:25 2020
(r366906)
@@ -41,6 +41,7 @@ static const char rcsid[] =
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -51,45 +52,27 @@ static const char rcsid[] =
 static void
 list_cloners(void)
 {
-   struct if_clonereq ifcr;
-   char *cp, *buf;
-   int idx;
-   int s;
+   ifconfig_handle_t *lifh;
+   char *cloners;
+   size_t cloners_count;
 
-   s = socket(AF_LOCAL, SOCK_DGRAM, 0);
-   if (s == -1)
-   err(1, "socket(AF_LOCAL,SOCK_DGRAM)");
+   lifh = ifconfig_open();
+   if (lifh == NULL)
+   return;
 
-   memset(, 0, sizeof(ifcr));
+   if (ifconfig_list_cloners(lifh, , _count) < 0)
+   errc(1, ifconfig_err_errno(lifh), "unable to list cloners");
+   ifconfig_close(lifh);
 
-   if (ioctl(s, SIOCIFGCLONERS, ) < 0)
-   err(1, "SIOCIFGCLONERS for count");
-
-   buf = malloc(ifcr.ifcr_total * IFNAMSIZ);
-   if (buf == NULL)
-   err(1, "unable to allocate cloner name buffer");
-
-   ifcr.ifcr_count = ifcr.ifcr_total;
-   ifcr.ifcr_buffer = buf;
-
-   if (ioctl(s, SIOCIFGCLONERS, ) < 0)
-   err(1, "SIOCIFGCLONERS for names");
-
-   /*
-* In case some disappeared in the mean time, clamp it down.
-*/
-   if (ifcr.ifcr_count > ifcr.ifcr_total)
-   ifcr.ifcr_count = ifcr.ifcr_total;
-
-   for (cp = buf, idx = 0; idx < ifcr.ifcr_count; idx++, cp += IFNAMSIZ) {
-   if (idx > 0)
+   for (const char *name = cloners;
+   name < cloners + cloners_count * IFNAMSIZ;
+   name += IFNAMSIZ) {
+   if (name > cloners)
putchar(' ');
-   printf("%s", cp);
+   printf("%s", name);
}
-
putchar('\n');
-   free(buf);
-   close(s);
+   free(cloners);
 }
 
 struct clone_defcb {
___
svn-src-all@freebsd.org mailing list

svn commit: r366830 - head/usr.sbin/efibootmgr

2020-10-19 Thread Ryan Moeller
Author: freqlabs
Date: Mon Oct 19 10:38:40 2020
New Revision: 366830
URL: https://svnweb.freebsd.org/changeset/base/366830

Log:
  efibootmgr: Use returned error code for error message, not errno
  
  efivar_unix_path_to_device_path returns the error code, it does not set errno.
  
  Reviewed by:  imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D26852

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.c

Modified: head/usr.sbin/efibootmgr/efibootmgr.c
==
--- head/usr.sbin/efibootmgr/efibootmgr.c   Mon Oct 19 09:52:52 2020
(r366829)
+++ head/usr.sbin/efibootmgr/efibootmgr.c   Mon Oct 19 10:38:40 2020
(r366830)
@@ -674,11 +674,16 @@ make_boot_var(const char *label, const char *loader, c
err(1, "bootvar creation");
if (loader == NULL)
errx(1, "Must specify boot loader");
-   if (efivar_unix_path_to_device_path(loader, ) != 0)
-   err(1, "Cannot translate unix loader path '%s' to UEFI", 
loader);
+   ret = efivar_unix_path_to_device_path(loader, );
+   if (ret != 0)
+   errc(1, ret, "Cannot translate unix loader path '%s' to UEFI",
+   loader);
if (kernel != NULL) {
-   if (efivar_unix_path_to_device_path(kernel, ) != 0)
-   err(1, "Cannot translate unix kernel path '%s' to 
UEFI", kernel);
+   ret = efivar_unix_path_to_device_path(kernel, );
+   if (ret != 0)
+   errc(1, ret,
+   "Cannot translate unix kernel path '%s' to UEFI",
+   kernel);
} else {
kerneldp = NULL;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366771 - head/usr.sbin/bhyve

2020-10-16 Thread Ryan Moeller
Author: freqlabs
Date: Fri Oct 16 20:27:20 2020
New Revision: 366771
URL: https://svnweb.freebsd.org/changeset/base/366771

Log:
  bhyve: Update TX descriptor base address and host mapping on change
  
  bhyve sometimes segfaults when using an e1000 NIC with a Windows guest.
  
  We are only updating our tdba and cached host mapping when the low address
  register is written and when tx is set enabled, but not when the high address
  or length registers are written. It is observed that Windows 10 is 
occasionally
  enabling tx first then writing the registers in the order low, high, len. This
  leaves us with a bogus base address and mapping, which causes a segfault later
  when we try to copy from a descriptor that has unpredictable garbage in a
  pointer.
  
  Updating the address and mapping when any of those registers change seems to 
fix
  that particular issue.
  
  Reviewed by:  mav, grehan (bhyve)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26798

Modified:
  head/usr.sbin/bhyve/pci_e82545.c

Modified: head/usr.sbin/bhyve/pci_e82545.c
==
--- head/usr.sbin/bhyve/pci_e82545.cFri Oct 16 17:51:09 2020
(r366770)
+++ head/usr.sbin/bhyve/pci_e82545.cFri Oct 16 20:27:20 2020
(r366771)
@@ -1701,18 +1701,18 @@ e82545_write_register(struct e82545_softc *sc, uint32_
break;
case E1000_TDBAL(0):
sc->esc_TDBAL = value & ~0xF;
-   if (sc->esc_tx_enabled) {
-   /* Apparently legal */
+   if (sc->esc_tx_enabled)
e82545_tx_update_tdba(sc);
-   }
break;
case E1000_TDBAH(0):
-   //assert(!sc->esc_tx_enabled);  
sc->esc_TDBAH = value;
+   if (sc->esc_tx_enabled)
+   e82545_tx_update_tdba(sc);
break;
case E1000_TDLEN(0):
-   //assert(!sc->esc_tx_enabled);
sc->esc_TDLEN = value & ~0xFFF0007F;
+   if (sc->esc_tx_enabled)
+   e82545_tx_update_tdba(sc);
break;
case E1000_TDH(0):
//assert(!sc->esc_tx_enabled);
___
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: r366651 - in stable/12/sys: contrib/ipfilter/netinet x86/bios

2020-10-12 Thread Ryan Moeller
Author: freqlabs
Date: Mon Oct 12 17:43:38 2020
New Revision: 366651
URL: https://svnweb.freebsd.org/changeset/base/366651

Log:
  MFC r366433
  
  Explicit CTLFLAG_DYN not needed
  
  Dynamically created OIDs automatically get this flag set.
  
  Reviewed by:  jhb
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26561

Modified:
  stable/12/sys/contrib/ipfilter/netinet/mlfk_ipl.c
  stable/12/sys/x86/bios/vpd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/mlfk_ipl.c
==
--- stable/12/sys/contrib/ipfilter/netinet/mlfk_ipl.c   Mon Oct 12 16:45:07 
2020(r366650)
+++ stable/12/sys/contrib/ipfilter/netinet/mlfk_ipl.c   Mon Oct 12 17:43:38 
2020(r366651)
@@ -87,16 +87,16 @@ SYSCTL_DECL(_net_inet);
   ptr, val, sysctl_ipf_int, "I", descr)
 #define SYSCTL_DYN_IPF_NAT(parent, nbr, name, access,ptr, val, descr) \
SYSCTL_ADD_OID(_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-   CTLFLAG_DYN|CTLTYPE_INT|CTLFLAG_VNET|access, ptr, val, 
sysctl_ipf_int_nat, "I", descr)
+   CTLTYPE_INT|CTLFLAG_VNET|access, ptr, val, sysctl_ipf_int_nat, "I", 
descr)
 #define SYSCTL_DYN_IPF_STATE(parent, nbr, name, access,ptr, val, descr) \
SYSCTL_ADD_OID(_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-   CTLFLAG_DYN|CTLTYPE_INT|CTLFLAG_VNET|access, ptr, val, 
sysctl_ipf_int_state, "I", descr)
+   CTLTYPE_INT|CTLFLAG_VNET|access, ptr, val, sysctl_ipf_int_state, "I", 
descr)
 #define SYSCTL_DYN_IPF_FRAG(parent, nbr, name, access,ptr, val, descr) \
SYSCTL_ADD_OID(_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-   CTLFLAG_DYN|CTLTYPE_INT|CTLFLAG_VNET|access, ptr, val, 
sysctl_ipf_int_frag, "I", descr)
+   CTLTYPE_INT|CTLFLAG_VNET|access, ptr, val, sysctl_ipf_int_frag, "I", 
descr)
 #define SYSCTL_DYN_IPF_AUTH(parent, nbr, name, access,ptr, val, descr) \
SYSCTL_ADD_OID(_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-   CTLFLAG_DYN|CTLTYPE_INT|CTLFLAG_VNET|access, ptr, val, 
sysctl_ipf_int_auth, "I", descr)
+   CTLTYPE_INT|CTLFLAG_VNET|access, ptr, val, sysctl_ipf_int_auth, "I", 
descr)
 static struct sysctl_ctx_list ipf_clist;
 #defineCTLFLAG_OFF 0x0080  /* IPFilter must be disabled */
 #defineCTLFLAG_RWO (CTLFLAG_RW|CTLFLAG_OFF)

Modified: stable/12/sys/x86/bios/vpd.c
==
--- stable/12/sys/x86/bios/vpd.cMon Oct 12 16:45:07 2020
(r366650)
+++ stable/12/sys/x86/bios/vpd.cMon Oct 12 17:43:38 2020
(r366651)
@@ -195,19 +195,19 @@ vpd_attach (device_t dev)
sysctl_ctx_init(>ctx);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_machine_type), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->MachineType, 0, NULL);
+   unit, CTLFLAG_RD, sc->MachineType, 0, NULL);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_machine_model), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->MachineModel, 0, NULL);
+   unit, CTLFLAG_RD, sc->MachineModel, 0, NULL);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_build_id), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->BuildID, 0, NULL);
+   unit, CTLFLAG_RD, sc->BuildID, 0, NULL);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_serial_box), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->BoxSerial, 0, NULL);
+   unit, CTLFLAG_RD, sc->BoxSerial, 0, NULL);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_serial_planar), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->PlanarSerial, 0, NULL);
+   unit, CTLFLAG_RD, sc->PlanarSerial, 0, NULL);
 
device_printf(dev, "Machine Type: %.4s, Model: %.3s, Build ID: %.9s\n",
sc->MachineType, sc->MachineModel, sc->BuildID);
___
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: r366465 - in head: sbin/sysctl sys/kern sys/sys usr.bin/truss

2020-10-05 Thread Ryan Moeller
Author: freqlabs
Date: Mon Oct  5 20:13:22 2020
New Revision: 366465
URL: https://svnweb.freebsd.org/changeset/base/366465

Log:
  Enable iterating all sysctls, even ones with CTLFLAG_SKIP
  
  Add an "nextnoskip" sysctl that allows for listing of sysctls intended to be
  normally skipped for cost reasons.
  
  This makes it so the names/descriptions of those sysctls can be discovered 
with
  sysctl -aN/sysctl -ad/sysctl -at.
  
  It also makes it so children are visited when a node flagged with CTLFLAG_SKIP
  is explicitly requested.
  
  The intended use case is to mark the root "kstat" node with CTLFLAG_SKIP so 
that
  the extensive and expensive stats are skipped by default but may still be 
easily
  obtained without having to know them all (which may not even be possible) and
  request each one-by-one.
  
  Reviewed by:  jhb
  MFC after:2 weeks
  Relnotes: yes
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26560

Modified:
  head/sbin/sysctl/sysctl.c
  head/sys/kern/kern_sysctl.c
  head/sys/sys/sysctl.h
  head/usr.bin/truss/syscalls.c

Modified: head/sbin/sysctl/sysctl.c
==
--- head/sbin/sysctl/sysctl.c   Mon Oct  5 19:58:55 2020(r366464)
+++ head/sbin/sysctl/sysctl.c   Mon Oct  5 20:13:22 2020(r366465)
@@ -81,7 +81,7 @@ static intNflag, nflag, oflag, qflag, tflag, Tflag, W
 static int oidfmt(int *, int, char *, u_int *);
 static int parsefile(const char *);
 static int parse(const char *, int);
-static int show_var(int *, int);
+static int show_var(int *, int, bool);
 static int sysctl_all(int *oid, int len);
 static int name2oid(const char *, int *);
 
@@ -428,13 +428,13 @@ parse(const char *string, int lineno)
if (newvalstr == NULL || dflag) {
if ((kind & CTLTYPE) == CTLTYPE_NODE) {
if (dflag) {
-   i = show_var(mib, len);
+   i = show_var(mib, len, false);
if (!i && !bflag)
putchar('\n');
}
sysctl_all(mib, len);
} else {
-   i = show_var(mib, len);
+   i = show_var(mib, len, false);
if (!i && !bflag)
putchar('\n');
}
@@ -504,7 +504,7 @@ parse(const char *string, int lineno)
break;
}
 
-   i = show_var(mib, len);
+   i = show_var(mib, len, false);
if (sysctl(mib, len, 0, 0, newval, newsize) == -1) {
free(newbuf);
if (!i && !bflag)
@@ -532,7 +532,7 @@ parse(const char *string, int lineno)
printf(" -> ");
i = nflag;
nflag = 1;
-   j = show_var(mib, len);
+   j = show_var(mib, len, false);
if (!j && !bflag)
putchar('\n');
nflag = i;
@@ -942,7 +942,7 @@ oidfmt(int *oid, int len, char *fmt, u_int *kind)
  * Return minus one if we had errors.
  */
 static int
-show_var(int *oid, int nlen)
+show_var(int *oid, int nlen, bool honor_skip)
 {
u_char buf[BUFSIZ], *val, *oval, *p;
char name[BUFSIZ], fmt[BUFSIZ];
@@ -976,11 +976,11 @@ show_var(int *oid, int nlen)
oidfmt(oid, nlen, fmt, );
/* if Wflag then only list sysctls that are writeable and not stats. */
if (Wflag && ((kind & CTLFLAG_WR) == 0 || (kind & CTLFLAG_STATS) != 0))
-   return 1;
+   return (1);
 
/* if Tflag then only list sysctls that are tuneables. */
if (Tflag && (kind & CTLFLAG_TUN) == 0)
-   return 1;
+   return (1);
 
if (Nflag) {
printf("%s", name);
@@ -1013,6 +1013,10 @@ show_var(int *oid, int nlen)
return (0);
}
 
+   /* bail before fetching the value if we're honoring skip */
+   if (honor_skip && (kind & CTLFLAG_SKIP) != 0)
+   return (1);
+
/* don't fetch opaques that we don't know how to print */
if (ctltype == CTLTYPE_OPAQUE) {
if (strcmp(fmt, "S,clockinfo") == 0)
@@ -1195,15 +1199,17 @@ sysctl_all(int *oid, int len)
int name1[22], name2[22];
int i, j;
size_t l1, l2;
+   bool honor_skip = false;
 
-   name1[0] = 0;
-   name1[1] = 2;
+   name1[0] = CTL_SYSCTL;
+   name1[1] = (oid != NULL || Nflag || dflag || tflag) ?
+   CTL_SYSCTL_NEXTNOSKIP : CTL_SYSCTL_NEXT;
l1 = 2;
if (len) {
-   memcpy(name1+2, oid, len * sizeof(int));
+   memcpy(name1 + 2, oid, len * sizeof(int));
l1 += len;
} else {
-   name1[2] = 1;
+   

svn commit: r366433 - in head/sys: contrib/ipfilter/netinet x86/bios

2020-10-04 Thread Ryan Moeller
Author: freqlabs
Date: Sun Oct  4 19:37:15 2020
New Revision: 366433
URL: https://svnweb.freebsd.org/changeset/base/366433

Log:
  Explicit CTLFLAG_DYN not needed
  
  Dynamically created OIDs automatically get this flag set.
  
  Reviewed by:  jhb
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26561

Modified:
  head/sys/contrib/ipfilter/netinet/mlfk_ipl.c
  head/sys/x86/bios/vpd.c

Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c
==
--- head/sys/contrib/ipfilter/netinet/mlfk_ipl.cSun Oct  4 17:23:39 
2020(r366432)
+++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.cSun Oct  4 19:37:15 
2020(r366433)
@@ -88,19 +88,19 @@ SYSCTL_DECL(_net_inet);
 ptr, val, sysctl_ipf_int, "I", descr)
 #define SYSCTL_DYN_IPF_NAT(parent, nbr, name, access,ptr, val, descr) \
 SYSCTL_ADD_OID(_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-CTLFLAG_DYN | CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE |access, \
+CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE |access, \
 ptr, val, sysctl_ipf_int_nat, "I", descr)
 #define SYSCTL_DYN_IPF_STATE(parent, nbr, name, access,ptr, val, descr) \
 SYSCTL_ADD_OID(_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-CTLFLAG_DYN | CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
+CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
 ptr, val, sysctl_ipf_int_state, "I", descr)
 #define SYSCTL_DYN_IPF_FRAG(parent, nbr, name, access,ptr, val, descr) \
 SYSCTL_ADD_OID(_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-CTLFLAG_DYN | CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
+CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
ptr, val, sysctl_ipf_int_frag, "I", descr)
 #define SYSCTL_DYN_IPF_AUTH(parent, nbr, name, access,ptr, val, descr) \
 SYSCTL_ADD_OID(_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-CTLFLAG_DYN | CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
+CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
ptr, val, sysctl_ipf_int_auth, "I", descr)
 static struct sysctl_ctx_list ipf_clist;
 #defineCTLFLAG_OFF 0x0080  /* IPFilter must be disabled */

Modified: head/sys/x86/bios/vpd.c
==
--- head/sys/x86/bios/vpd.c Sun Oct  4 17:23:39 2020(r366432)
+++ head/sys/x86/bios/vpd.c Sun Oct  4 19:37:15 2020(r366433)
@@ -210,19 +210,19 @@ vpd_attach (device_t dev)
sysctl_ctx_init(>ctx);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_machine_type), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->MachineType, 0, NULL);
+   unit, CTLFLAG_RD, sc->MachineType, 0, NULL);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_machine_model), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->MachineModel, 0, NULL);
+   unit, CTLFLAG_RD, sc->MachineModel, 0, NULL);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_build_id), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->BuildID, 0, NULL);
+   unit, CTLFLAG_RD, sc->BuildID, 0, NULL);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_serial_box), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->BoxSerial, 0, NULL);
+   unit, CTLFLAG_RD, sc->BoxSerial, 0, NULL);
SYSCTL_ADD_STRING(>ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_serial_planar), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->PlanarSerial, 0, NULL);
+   unit, CTLFLAG_RD, sc->PlanarSerial, 0, NULL);
 
device_printf(dev, "Machine Type: %.4s, Model: %.3s, Build ID: %.9s\n",
sc->MachineType, sc->MachineModel, sc->BuildID);
___
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: r365252 - head

2020-09-02 Thread Ryan Moeller
Author: freqlabs
Date: Wed Sep  2 16:03:33 2020
New Revision: 365252
URL: https://svnweb.freebsd.org/changeset/base/365252

Log:
  Correct and expand on OpenZFS cache file and auto import
  
  Reported by:  avg
  Sponsored by: iXsystems, Inc.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Wed Sep  2 15:55:16 2020(r365251)
+++ head/UPDATING   Wed Sep  2 16:03:33 2020(r365252)
@@ -37,8 +37,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
rebuilding world may fail.
 
The ZFS cache file has moved from /boot to /etc to match the OpenZFS
-   upstream default. This means your zpool won't auto import until you
-   upgrade your /etc/rc.d files or you import them manually.
+   upstream default. A fallback to /boot has been added for mountroot.
+
+   Pool auto import behavior at boot has been moved from the kernel module
+   to an explicit "zpool import -a" in one of the rc scripts enabled by
+   zfs_enable=YES. This means your non-root zpools won't auto import until
+   you upgrade your /etc/rc.d files.
 
 20200824:
The resume code now notifies devd with the 'kernel' system
___
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: r365249 - head

2020-09-02 Thread Ryan Moeller


On 9/2/20 11:43 AM, Andriy Gapon wrote:

On 02/09/2020 18:23, Ryan Moeller wrote:

On 9/2/20 10:28 AM, Warner Losh wrote:

Author: imp
Date: Wed Sep  2 14:28:54 2020
New Revision: 365249
URL: https://svnweb.freebsd.org/changeset/base/365249

Log:
    Add note about needing to manually import the zfs pools or update
    /etc/rc.d due to the cache file moving to /etc.

Modified:
    head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING    Wed Sep  2 12:57:34 2020    (r365248)
+++ head/UPDATING    Wed Sep  2 14:28:54 2020    (r365249)
@@ -36,6 +36,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
   scenarios have been tested and fixed, but rebuilding kernels without
   rebuilding world may fail.
   +    The ZFS cache file has moved from /boot to /etc to match the OpenZFS
+    upstream default. This means your zpool won't auto import until you
+    upgrade your /etc/rc.d files or you import them manually.
+
   20200824:
   The resume code now notifies devd with the 'kernel' system
   rather than the old 'kern' subsystem to be consistent with

Thanks, enough people seemed to be getting tripped up by this.

I think that this is a very useful note.

But I do not see a direct connection between the change of zpool.cache location
and the new ZFS's not automatically importing zpool.cache pools on boot.



True, the real reason is that the kernel module in OpenZFS does not 
autoimport pools.
Instead we explicitly "zpool import -a" in one of the ZFS rc scripts. 
I'll amend the

UPDATING message.

-Ryan

___
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: r365249 - head

2020-09-02 Thread Ryan Moeller



On 9/2/20 10:28 AM, Warner Losh wrote:

Author: imp
Date: Wed Sep  2 14:28:54 2020
New Revision: 365249
URL: https://svnweb.freebsd.org/changeset/base/365249

Log:
   Add note about needing to manually import the zfs pools or update
   /etc/rc.d due to the cache file moving to /etc.

Modified:
   head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Wed Sep  2 12:57:34 2020(r365248)
+++ head/UPDATING   Wed Sep  2 14:28:54 2020(r365249)
@@ -36,6 +36,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
scenarios have been tested and fixed, but rebuilding kernels without
rebuilding world may fail.
  
+	The ZFS cache file has moved from /boot to /etc to match the OpenZFS

+   upstream default. This means your zpool won't auto import until you
+   upgrade your /etc/rc.d files or you import them manually.
+
  20200824:
The resume code now notifies devd with the 'kernel' system
rather than the old 'kern' subsystem to be consistent with

Thanks, enough people seemed to be getting tripped up by this.

-Ryan

___
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: r365250 - in head/cddl/sbin: zfs zpool

2020-09-02 Thread Ryan Moeller
Author: freqlabs
Date: Wed Sep  2 15:20:10 2020
New Revision: 365250
URL: https://svnweb.freebsd.org/changeset/base/365250

Log:
  Use MLINKS where appropriate for zfs/zpool subcommand pages
  
  Reported by:  Julian H. Stacey
  Sponsored by: iXsystems, Inc.

Modified:
  head/cddl/sbin/zfs/Makefile
  head/cddl/sbin/zpool/Makefile

Modified: head/cddl/sbin/zfs/Makefile
==
--- head/cddl/sbin/zfs/Makefile Wed Sep  2 14:28:54 2020(r365249)
+++ head/cddl/sbin/zfs/Makefile Wed Sep  2 15:20:10 2020(r365250)
@@ -12,42 +12,43 @@ MAN= \
zfs.8 \
zfs-allow.8 \
zfs-bookmark.8 \
-   zfs-change-key.8 \
zfs-clone.8 \
zfs-create.8 \
zfs-destroy.8 \
zfs-diff.8 \
-   zfs-get.8 \
-   zfs-groupspace.8 \
zfs-hold.8 \
-   zfs-inherit.8 \
zfs-jail.8 \
zfs-list.8 \
zfs-load-key.8 \
zfs-mount.8 \
zfs-program.8 \
zfs-project.8 \
-   zfs-projectspace.8 \
zfs-promote.8 \
zfs-receive.8 \
-   zfs-recv.8 \
-   zfs-redact.8 \
-   zfs-release.8 \
zfs-rename.8 \
zfs-rollback.8 \
zfs-send.8 \
zfs-set.8 \
zfs-share.8 \
zfs-snapshot.8 \
-   zfs-unallow.8 \
-   zfs-unjail.8 \
-   zfs-unload-key.8 \
-   zfs-unmount.8 \
zfs-upgrade.8 \
zfs-userspace.8 \
zfs-wait.8 \
zfsconcepts.8 \
zfsprops.8
+MLINKS= \
+   zfs-allow.8 zfs-unallow.8 \
+   zfs-hold.8 zfs-release.8 \
+   zfs-jail.8 zfs-unjail.8 \
+   zfs-load-key.8 zfs-change-key.8 \
+   zfs-load-key.8 zfs-unload-key.8 \
+   zfs-mount.8 zfs-unmount.8 \
+   zfs-receive.8 zfs-recv.8 \
+   zfs-send.8 zfs-redact.8 \
+   zfs-set.8 zfs-get.8 \
+   zfs-set.8 zfs-inherit.8 \
+   zfs-userspace.8 zfs-groupspace.8 \
+   zfs-userspace.8 zfs-projectspace.8
 SRCS= \
zfs_iter.c \
zfs_iter.h \

Modified: head/cddl/sbin/zpool/Makefile
==
--- head/cddl/sbin/zpool/Makefile   Wed Sep  2 14:28:54 2020
(r365249)
+++ head/cddl/sbin/zpool/Makefile   Wed Sep  2 15:20:10 2020
(r365250)
@@ -33,14 +33,12 @@ MAN= \
zpool-labelclear.8 \
zpool-list.8 \
zpool-offline.8 \
-   zpool-online.8 \
zpool-reguid.8 \
zpool-remove.8 \
zpool-reopen.8 \
zpool-replace.8 \
zpool-resilver.8 \
zpool-scrub.8 \
-   zpool-set.8 \
zpool-split.8 \
zpool-status.8 \
zpool-sync.8 \
@@ -49,6 +47,9 @@ MAN= \
zpool-wait.8 \
zpoolconcepts.8 \
zpoolprops.8
+MLINKS= \
+   zpool-offline.8 zpool-online.8 \
+   zpool-get.8 zpool-set.8
 SRCS= \
zpool_iter.c \
zpool_main.c \
___
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: r365057 - head/cddl/usr.bin

2020-09-01 Thread Ryan Moeller
Author: freqlabs
Date: Tue Sep  1 19:02:07 2020
New Revision: 365057
URL: https://svnweb.freebsd.org/changeset/base/365057

Log:
  Ensure zstreamdump subdir can be visited
  
  Reported by:  Thomas Laus
  Sponsored by: iXsystems, Inc.

Modified:
  head/cddl/usr.bin/Makefile

Modified: head/cddl/usr.bin/Makefile
==
--- head/cddl/usr.bin/Makefile  Tue Sep  1 18:50:26 2020(r365056)
+++ head/cddl/usr.bin/Makefile  Tue Sep  1 19:02:07 2020(r365057)
@@ -18,6 +18,7 @@ _zinject= zinject
 .if ${MK_LIBTHR} != "no"
 _ztest=ztest
 _zstream = zstream
+_zstreamdump = zstreamdump
 .endif
 .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"


Re: svn commit: r364863 - head

2020-08-28 Thread Ryan Moeller


On 8/28/20 8:51 AM, Harry Schmalzbauer wrote:

Am 27.08.2020 um 15:26 schrieb Ryan Moeller:

Author: freqlabs
Date: Thu Aug 27 13:26:36 2020
New Revision: 364863
URL: https://svnweb.freebsd.org/changeset/base/364863

Log:
   libzfs: Also add the crypto dependency to Makefile.inc1
      Reported by:    kevans
   Discussed with:    kevans
   Sponsored by:    iXsystems, Inc.

Modified:
   head/Makefile.inc1



Hello,

this still doesn't allwo me to compile ZFS into the kernel:
linking kernel.full
ld: error: undefined symbol: zfs_zstd_compress
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)

ld: error: undefined symbol: zfs_zstd_decompress
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)

ld: error: undefined symbol: zfs_zstd_decompress_level
>>> referenced by zio_compress.c
>>>   zio_compress.o:(zio_compress_table)
*** Error code 1

According to src/sys/amd64/conf/NOTES, "options ZFS" should still be 
supported.

Unfortunately I have no adhoc idea how to fix. Anybody else?



You need options ZSTDIO, too. NOTES needs to be updated.

-Ryan




Thanks,
-harry

___
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: r364863 - head

2020-08-27 Thread Ryan Moeller
Author: freqlabs
Date: Thu Aug 27 13:26:36 2020
New Revision: 364863
URL: https://svnweb.freebsd.org/changeset/base/364863

Log:
  libzfs: Also add the crypto dependency to Makefile.inc1
  
  Reported by:  kevans
  Discussed with:   kevans
  Sponsored by: iXsystems, Inc.

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Aug 27 13:25:24 2020(r364862)
+++ head/Makefile.inc1  Thu Aug 27 13:26:36 2020(r364863)
@@ -2929,6 +2929,7 @@ cddl/lib/libzfs__L: cddl/lib/libzfs_core__L lib/msun__
 cddl/lib/libzfs__L: lib/libthr__L lib/libmd__L lib/libz__L cddl/lib/libumem__L
 cddl/lib/libzfs__L: cddl/lib/libuutil__L cddl/lib/libavl__L lib/libgeom__L
 cddl/lib/libzfs__L: cddl/lib/libnvpair__L cddl/lib/libzutil__L
+cddl/lib/libzfs__L: secure/lib/libcrypto__L
 
 lib/libbe__L: cddl/lib/libzfs__L
 .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: r364861 - in head: cddl/lib/libzfs share/mk

2020-08-27 Thread Ryan Moeller
Author: freqlabs
Date: Thu Aug 27 13:05:41 2020
New Revision: 364861
URL: https://svnweb.freebsd.org/changeset/base/364861

Log:
  libzfs: Add missing crypto dependency
  
  libzfs_crypto.c uses PKCS5_PBKDF2_HMAC_SHA1 from libcrypto.
  
  Reported by:  John Kennedy
  Sponsored by: iXsystems, Inc.

Modified:
  head/cddl/lib/libzfs/Makefile
  head/share/mk/src.libnames.mk

Modified: head/cddl/lib/libzfs/Makefile
==
--- head/cddl/lib/libzfs/Makefile   Thu Aug 27 10:28:12 2020
(r364860)
+++ head/cddl/lib/libzfs/Makefile   Thu Aug 27 13:05:41 2020
(r364861)
@@ -12,7 +12,21 @@
 
 PACKAGE=   runtime
 LIB=   zfs
-LIBADD=md pthread umem util uutil m avl bsdxml geom nvpair z zfs_core 
zutil
+LIBADD= \
+   avl \
+   bsdxml \
+   crypto \
+   geom \
+   m \
+   md \
+   nvpair \
+   pthread \
+   umem \
+   util \
+   uutil \
+   z \
+   zfs_core \
+   zutil
 
 INCS=  libzfs.h
 USER_C = \

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Thu Aug 27 10:28:12 2020
(r364860)
+++ head/share/mk/src.libnames.mk   Thu Aug 27 13:05:41 2020
(r364861)
@@ -382,7 +382,7 @@ _DP_fifolog=z
 _DP_ipf=   kvm
 _DP_tpool= spl
 _DP_uutil= avl spl
-_DP_zfs=   md pthread umem util uutil m avl bsdxml geom nvpair \
+_DP_zfs=   md pthread umem util uutil m avl bsdxml crypto geom nvpair \
z zfs_core zutil
 _DP_zfs_core=  nvpair
 _DP_zpool= md pthread z icp spl nvpair avl umem
___
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: r364830 - in head/cddl/lib: libzfs libzpool

2020-08-26 Thread Ryan Moeller
Author: freqlabs
Date: Wed Aug 26 19:03:15 2020
New Revision: 364830
URL: https://svnweb.freebsd.org/changeset/base/364830

Log:
  Move zstd sources from libzfs to libzpool
  
  zstd is kernel code that was not supposed to be in libzfs.
  
  libzpool provides userland shims for kernel code and is where the
  zstd code needs to be included.
  
  Reported by:  John Kennedy
  Discussed with:   mmacy
  Sponsored by: iXsystems, Inc.

Modified:
  head/cddl/lib/libzfs/Makefile
  head/cddl/lib/libzpool/Makefile

Modified: head/cddl/lib/libzfs/Makefile
==
--- head/cddl/lib/libzfs/Makefile   Wed Aug 26 19:00:17 2020
(r364829)
+++ head/cddl/lib/libzfs/Makefile   Wed Aug 26 19:03:15 2020
(r364830)
@@ -58,10 +58,6 @@ KERNEL_C = \
 zprop_common.c
 
 
-KERNEL_C+= zstd.c \
-   zfs_zstd.c
-
-
 ARCH_C =
 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
 ARCH_C +=  zfs_fletcher_intel.c \
@@ -94,8 +90,6 @@ CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/in
 CFLAGS+= -include 
${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
 CFLAGS+= -DHAVE_ISSETUGID
 CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
-CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
-CFLAGS.zstd.c= -fno-tree-vectorize
 
 
 .include 

Modified: head/cddl/lib/libzpool/Makefile
==
--- head/cddl/lib/libzpool/Makefile Wed Aug 26 19:00:17 2020
(r364829)
+++ head/cddl/lib/libzpool/Makefile Wed Aug 26 19:03:15 2020
(r364830)
@@ -8,6 +8,9 @@ ZFSTOP= ${SRCTOP}/sys/contrib/openzfs
 .PATH: ${ZFSTOP}/module/unicode
 # LUA_SRCS
 .PATH: ${ZFSTOP}/module/lua
+# ZSTD_SRCS
+.PATH: ${ZFSTOP}/module/zstd
+.PATH: ${ZFSTOP}/module/zstd/lib
 
 .PATH: ${ZFSTOP}/module/os/linux/zfs
 
@@ -44,6 +47,7 @@ KERNEL_C = \
zfs_namecheck.c \
zfs_prop.c \
zfs_uio.c \
+   zfs_zstd.c \
zpool_prop.c \
zprop_common.c \
abd.c \
@@ -167,6 +171,7 @@ KERNEL_C = \
zio_inject.c \
zle.c \
zrlock.c \
+   zstd.c \
zthr.c
 
 ARCH_C =
@@ -251,5 +256,8 @@ CSTD=   c99
 # it without debugging.
 
 CFLAGS+=   -g -DDEBUG=1
+
+CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
+CFLAGS.zstd.c+=-fno-tree-vectorize
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364829 - head/cddl/lib/libzpool

2020-08-26 Thread Ryan Moeller
Author: freqlabs
Date: Wed Aug 26 19:00:17 2020
New Revision: 364829
URL: https://svnweb.freebsd.org/changeset/base/364829

Log:
  Tidy up libzpool Makefile
  
  Sponsored by: iXsystems, Inc.

Modified:
  head/cddl/lib/libzpool/Makefile

Modified: head/cddl/lib/libzpool/Makefile
==
--- head/cddl/lib/libzpool/Makefile Wed Aug 26 18:35:32 2020
(r364828)
+++ head/cddl/lib/libzpool/Makefile Wed Aug 26 19:00:17 2020
(r364829)
@@ -1,16 +1,17 @@
 # $FreeBSD$
 
+ZFSTOP=${SRCTOP}/sys/contrib/openzfs
 
 # ZFS_COMMON_SRCS
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zfs
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zcommon
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/unicode
+.PATH: ${ZFSTOP}/module/zfs
+.PATH: ${ZFSTOP}/module/zcommon
+.PATH: ${ZFSTOP}/module/unicode
 # LUA_SRCS
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/lua
+.PATH: ${ZFSTOP}/module/lua
 
-.PATH: ${SRCTOP}/sys/contrib/openzfs/module/os/linux/zfs
+.PATH: ${ZFSTOP}/module/os/linux/zfs
 
-.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzpool
+.PATH: ${ZFSTOP}/lib/libzpool
 
 .if 
exists(${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S)
 .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
@@ -28,8 +29,6 @@ PICFLAG=  -fPIC
 
 LIB=   zpool
 
-
-
 USER_C = \
kernel.c \
taskq.c \
@@ -218,19 +217,19 @@ UNICODE_C = u8_textprep.c uconv.c
 SRCS=  ${USER_C} ${KERNEL_C} ${LUA_C} ${UNICODE_C} ${ARCH_C}
 
 WARNS?=2
-CFLAGS+= -DIN_BASE
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
-CFLAGS+= -I${SRCTOP}/sys
-CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
-CFLAGS+= -include 
${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
-CFLAGS+= -DHAVE_ISSETUGID
-CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
-CFLAGS+= -I${SRCTOP}/sys/modules/zfs
-CFLAGS+= -DLIB_ZPOOL_BUILD -DZFS_DEBUG
-
+CFLAGS+= \
+   -DIN_BASE \
+   -I${ZFSTOP}/include \
+   -I${ZFSTOP}/lib/libspl/include \
+   -I${ZFSTOP}/lib/libspl/include/os/freebsd \
+   -I${SRCTOP}/sys \
+   -I${SRCTOP}/cddl/compat/opensolaris/include \
+   -I${ZFSTOP}/module/icp/include \
+   -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \
+   -DHAVE_ISSETUGID \
+   -include ${SRCTOP}/sys/modules/zfs/zfs_config.h \
+   -I${SRCTOP}/sys/modules/zfs \
+   -DLIB_ZPOOL_BUILD -DZFS_DEBUG \
 
 # XXX: pthread doesn't have mutex_owned() equivalent, so we need to look
 #  into libthr private structures. That's sooo evil, but it's only for
___
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: r364821 - head/cddl/sbin/zpool

2020-08-26 Thread Ryan Moeller
Author: freqlabs
Date: Wed Aug 26 15:43:44 2020
New Revision: 364821
URL: https://svnweb.freebsd.org/changeset/base/364821

Log:
  Install zfs-events.5
  
  Sponsored by: iXsystems, Inc.

Modified:
  head/cddl/sbin/zpool/Makefile

Modified: head/cddl/sbin/zpool/Makefile
==
--- head/cddl/sbin/zpool/Makefile   Wed Aug 26 14:31:48 2020
(r364820)
+++ head/cddl/sbin/zpool/Makefile   Wed Aug 26 15:43:44 2020
(r364821)
@@ -12,6 +12,7 @@ PACKAGE=  runtime
 PROG=  zpool
 MAN= \
spl-module-parameters.5 \
+   zfs-events.5 \
zfs-module-parameters.5 \
zpool.8 \
zpool-add.8 \
___
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: r364785 - head/usr.sbin/bsdinstall/scripts

2020-08-25 Thread Ryan Moeller
Author: freqlabs
Date: Tue Aug 25 21:07:27 2020
New Revision: 364785
URL: https://svnweb.freebsd.org/changeset/base/364785

Log:
  bsdinstall: Update loader.conf for new OpenZFS deps
  
  zfs.ko now includes the SPL but relies on cryptodev instead.
  
  Reported by:  D Scott Phillips
  Sponsored by: iXsystems, Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/config

Modified: head/usr.sbin/bsdinstall/scripts/config
==
--- head/usr.sbin/bsdinstall/scripts/config Tue Aug 25 20:07:11 2020
(r364784)
+++ head/usr.sbin/bsdinstall/scripts/config Tue Aug 25 21:07:27 2020
(r364785)
@@ -44,9 +44,9 @@ cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc
 
 cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf
 rm $BSDINSTALL_TMPBOOT/loader.conf.*
-# The 'opensolaris_load' line is a workaround for arm64, which does not
-# automatically load opensolaris.ko with zfs.ko.
-df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "opensolaris_load=\"YES\"" >> 
$BSDINSTALL_TMPBOOT/loader.conf
+# The 'cryptodev_load' line is a workaround for arm64, which does not
+# automatically load cryptodev.ko with zfs.ko.
+df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "cryptodev_load=\"YES\"" >> 
$BSDINSTALL_TMPBOOT/loader.conf
 df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "zfs_load=\"YES\"" >> 
$BSDINSTALL_TMPBOOT/loader.conf
 
 cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot
___
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: r364783 - head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear

2020-08-25 Thread Ryan Moeller
Author: freqlabs
Date: Tue Aug 25 20:04:35 2020
New Revision: 364783
URL: https://svnweb.freebsd.org/changeset/base/364783

Log:
  Skip zpool_clear_005_pos test until bug fixed
  
  Messing with gnop devices under a zpool fails in this test, causing
  the pool to be suspended and eventually the system to deadlock.
  
  Skip the test for now until the issue is resolved.
  
  PR:   tests/248910
  Discussed with:   lwhsu
  Sponsored by: iXsystems, Inc.

Modified:
  head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh

Modified: head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh
==
--- head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh  
Tue Aug 25 19:57:11 2020(r364782)
+++ head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_test.sh  
Tue Aug 25 20:04:35 2020(r364783)
@@ -124,6 +124,7 @@ zpool_clear_005_pos_head()
 }
 zpool_clear_005_pos_body()
 {
+   atf_skip "Fails on OpenZFS, causing eventual deadlock. PR tests/248910"
. $(atf_get_srcdir)/../../../include/default.cfg
. $(atf_get_srcdir)/zpool_clear.cfg
 
___
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: r364777 - head/sys/modules/zfs

2020-08-25 Thread Ryan Moeller
Author: freqlabs
Date: Tue Aug 25 18:22:30 2020
New Revision: 364777
URL: https://svnweb.freebsd.org/changeset/base/364777

Log:
  Fix zstd in OpenZFS module with CPUTYPE?=
  
  The build breaks when something adds -march= to the
  compiler flags, for example CPUTYPE?=native.  When the arch supports BMI,
  __BMI__ is defined and zstd.c tries to include immintrin.h, which is not
  present when building the kernel.
  
  Disable experimental BMI intrinsics in zstd in the OpenZFS kernel module
  by explicitly undefining __BMI__ for zstd.c.
  
  A similar fix was needed for the original zstd import, done in r327738.
  
  Reported by:  Jakob Alvermark
  Discussed with:   mmacy
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/modules/zfs/Makefile

Modified: head/sys/modules/zfs/Makefile
==
--- head/sys/modules/zfs/Makefile   Tue Aug 25 18:21:13 2020
(r364776)
+++ head/sys/modules/zfs/Makefile   Tue Aug 25 18:22:30 2020
(r364777)
@@ -338,7 +338,7 @@ CFLAGS.zil.c= -Wno-cast-qual
 CFLAGS.zio.c= -Wno-cast-qual
 CFLAGS.zrlock.c= -Wno-cast-qual
 CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
-CFLAGS.zstd.c= -fno-tree-vectorize
+CFLAGS.zstd.c= -U__BMI__ -fno-tree-vectorize
 .if ${MACHINE_CPUARCH} == "aarch64"
 CFLAGS.zstd.c+= -include ${SRCDIR}/zstd/include/aarch64_compat.h
 .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: r364058 - in head: lib/libifconfig rescue/rescue sbin/ifconfig tools/lua

2020-08-09 Thread Ryan Moeller
Author: freqlabs
Date: Sun Aug  9 16:27:28 2020
New Revision: 364058
URL: https://svnweb.freebsd.org/changeset/base/364058

Log:
  Move ifconfig SFP status functionality into libifconfig
  
  libifconfig_sfp.h provides an API in libifconfig for querying SFP module
  properties, operational status, and vendor strings, as well as descriptions
  of the various fields, string conversions, and other useful helpers for
  implementing user interfaces.
  
  SFP module status is obtained by reading registers via an I2C interface.
  Descriptions of these registers and the values therein have been collected
  in a Lua table which is used to generate all the boilerplace C headers and
  source files for accessing these values, their names, and descriptions.
  The generated code is fully commented and readable.
  
  This is the first use of libifconfig in ifconfig itself.  For now, the
  scope remains very limited.  Over time, more of ifconfig will be replaced
  with libifconfig.
  
  Some minor changes to the formatting of ifconfig output have been made:
  - Module memory hex dumps are indented one extra space as a result of using
  hexdump(3) instead of a bespoke hex dump function.
  - Media descriptions have an added two-character short-name in parenthesis.
  - QSFP modules were incorrectly displaying TX bias current as power.  Now
TX channels display bias current, and this change has been made for both
SFP and QSFP modules for consistency.
  
  A Lua binding for libifconfig including this functionality is implemented
  but has not been included in this commit.  The plan is for it to be
  committed after dynamic module loading has been enabled in flua.
  
  Reviewed by:  kp, melifaro
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D25494

Added:
  head/lib/libifconfig/libifconfig_sfp.c   (contents, props changed)
  head/lib/libifconfig/libifconfig_sfp.h   (contents, props changed)
  head/lib/libifconfig/libifconfig_sfp_tables.tpl.c   (contents, props changed)
  head/lib/libifconfig/libifconfig_sfp_tables.tpl.h   (contents, props changed)
  head/lib/libifconfig/libifconfig_sfp_tables_internal.tpl.h   (contents, props 
changed)
  head/lib/libifconfig/sfp.lua   (contents, props changed)
  head/tools/lua/
  head/tools/lua/template.lua   (contents, props changed)
Modified:
  head/lib/libifconfig/Makefile
  head/lib/libifconfig/libifconfig.h
  head/rescue/rescue/Makefile
  head/sbin/ifconfig/Makefile
  head/sbin/ifconfig/sfp.c

Modified: head/lib/libifconfig/Makefile
==
--- head/lib/libifconfig/Makefile   Sun Aug  9 00:35:47 2020
(r364057)
+++ head/lib/libifconfig/Makefile   Sun Aug  9 16:27:28 2020
(r364058)
@@ -13,15 +13,30 @@ SRCS=   libifconfig.c \
libifconfig_inet6.c \
libifconfig_internal.c \
libifconfig_lagg.c \
-   libifconfig_media.c
+   libifconfig_media.c \
+   libifconfig_sfp.c
 
+GEN=   libifconfig_sfp_tables.h \
+   libifconfig_sfp_tables.c \
+   libifconfig_sfp_tables_internal.h
+
+SRCS+= ${GEN}
+
+.include 
+
+.SUFFIXES: .tpl.c .tpl.h
+.tpl.c.c .tpl.h.h: sfp.lua
+   ${LUA} ${.CURDIR}/sfp.lua ${.IMPSRC} >${.TARGET}
+
+CLEANFILES+= ${GEN}
+
 # If libifconfig become public uncomment those two lines
 #INCSDIR=  ${INCLUDEDIR}
-#INCS= libifconfig.h
+#INCS= libifconfig.h libifconfig_sfp.h libifconfig_sfp_tables.h
 
 #MAN=  libifconfig.3
 
-CFLAGS+= -I${.CURDIR}
+CFLAGS+= -I${.CURDIR} -I${.OBJDIR}
 NO_WCAST_ALIGN= yes
 
 .include 

Modified: head/lib/libifconfig/libifconfig.h
==
--- head/lib/libifconfig/libifconfig.h  Sun Aug  9 00:35:47 2020
(r364057)
+++ head/lib/libifconfig/libifconfig.h  Sun Aug  9 16:27:28 2020
(r364058)
@@ -28,6 +28,10 @@
 
 #pragma once
 
+#include 
+
+#include 
+
 #include 
 #include 
 

Added: head/lib/libifconfig/libifconfig_sfp.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libifconfig/libifconfig_sfp.c  Sun Aug  9 16:27:28 2020
(r364058)
@@ -0,0 +1,592 @@
+/*-
+ * Copyright (c) 2014, Alexander V. Chernikov
+ * Copyright (c) 2020, Ryan Moeller 
+ *
+ * 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 distribut

svn commit: r363831 - in stable/12: lib/libpmc sys/dev/hwpmc

2020-08-04 Thread Ryan Moeller
Author: freqlabs
Date: Tue Aug  4 12:04:47 2020
New Revision: 363831
URL: https://svnweb.freebsd.org/changeset/base/363831

Log:
  MFC r363630:
  
  libpmc: Use known pmc_cpuid buffer size
  
  Use the existing PMC_CPUID_LEN to size pmc_cpuid in the kernel and various
  buffers for reading it in libpmc.  This avoids some extra syscalls and
  malloc/frees.
  
  While in here, use strlcpy to copy a user-provided cpuid string instead of
  memcpy, to make sure we terminate the buffer.
  
  Reviewed by:mav
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25679

Modified:
  stable/12/lib/libpmc/libpmc_pmu_util.c
  stable/12/sys/dev/hwpmc/hwpmc_mod.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libpmc/libpmc_pmu_util.c
==
--- stable/12/lib/libpmc/libpmc_pmu_util.c  Tue Aug  4 11:13:13 2020
(r363830)
+++ stable/12/lib/libpmc/libpmc_pmu_util.c  Tue Aug  4 12:04:47 2020
(r363831)
@@ -30,6 +30,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -89,20 +90,13 @@ static struct pmu_alias pmu_amd_alias_table[] = {
 static pmu_mfr_t
 pmu_events_mfr(void)
 {
-   char *buf;
-   size_t s;
+   char buf[PMC_CPUID_LEN];
+   size_t s = sizeof(buf);
pmu_mfr_t mfr;
 
-   if (sysctlbyname("kern.hwpmc.cpuid", (void *)NULL, ,
+   if (sysctlbyname("kern.hwpmc.cpuid", buf, ,
(void *)NULL, 0) == -1)
return (PMU_INVALID);
-   if ((buf = malloc(s + 1)) == NULL)
-   return (PMU_INVALID);
-   if (sysctlbyname("kern.hwpmc.cpuid", buf, ,
-   (void *)NULL, 0) == -1) {
-   free(buf);
-   return (PMU_INVALID);
-   }
if (strcasestr(buf, "AuthenticAMD") != NULL ||
strcasestr(buf, "HygonGenuine") != NULL)
mfr = PMU_AMD;
@@ -110,7 +104,6 @@ pmu_events_mfr(void)
mfr = PMU_INTEL;
else
mfr = PMU_INVALID;
-   free(buf);
return (mfr);
 }
 
@@ -169,17 +162,14 @@ pmu_events_map_get(const char *cpuid)
 {
regex_t re;
regmatch_t pmatch[1];
-   size_t s;
-   char buf[64];
+   char buf[PMC_CPUID_LEN];
+   size_t s = sizeof(buf);
int match;
const struct pmu_events_map *pme;
 
if (cpuid != NULL) {
-   memcpy(buf, cpuid, 64);
+   strlcpy(buf, cpuid, s);
} else {
-   if (sysctlbyname("kern.hwpmc.cpuid", (void *)NULL, ,
-   (void *)NULL, 0) == -1)
-   return (NULL);
if (sysctlbyname("kern.hwpmc.cpuid", buf, ,
(void *)NULL, 0) == -1)
return (NULL);

Modified: stable/12/sys/dev/hwpmc/hwpmc_mod.c
==
--- stable/12/sys/dev/hwpmc/hwpmc_mod.c Tue Aug  4 11:13:13 2020
(r363830)
+++ stable/12/sys/dev/hwpmc/hwpmc_mod.c Tue Aug  4 12:04:47 2020
(r363831)
@@ -304,7 +304,7 @@ static int pmc_callchaindepth = PMC_CALLCHAIN_DEPTH;
 SYSCTL_INT(_kern_hwpmc, OID_AUTO, callchaindepth, CTLFLAG_RDTUN,
 _callchaindepth, 0, "depth of call chain records");
 
-char pmc_cpuid[64];
+char pmc_cpuid[PMC_CPUID_LEN];
 SYSCTL_STRING(_kern_hwpmc, OID_AUTO, cpuid, CTLFLAG_RD,
pmc_cpuid, 0, "cpu version string");
 #ifdef HWPMC_DEBUG
___
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: r363630 - in head: lib/libpmc sys/dev/hwpmc

2020-07-27 Thread Ryan Moeller
Author: freqlabs
Date: Tue Jul 28 02:56:26 2020
New Revision: 363630
URL: https://svnweb.freebsd.org/changeset/base/363630

Log:
  libpmc: Use known pmc_cpuid buffer size
  
  Use the existing PMC_CPUID_LEN to size pmc_cpuid in the kernel and various
  buffers for reading it in libpmc.  This avoids some extra syscalls and
  malloc/frees.
  
  While in here, use strlcpy to copy a user-provided cpuid string instead of
  memcpy, to make sure we terminate the buffer.
  
  Reviewed by:  mav
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D25679

Modified:
  head/lib/libpmc/libpmc_pmu_util.c
  head/sys/dev/hwpmc/hwpmc_mod.c

Modified: head/lib/libpmc/libpmc_pmu_util.c
==
--- head/lib/libpmc/libpmc_pmu_util.c   Tue Jul 28 02:53:44 2020
(r363629)
+++ head/lib/libpmc/libpmc_pmu_util.c   Tue Jul 28 02:56:26 2020
(r363630)
@@ -30,6 +30,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -89,20 +90,13 @@ static struct pmu_alias pmu_amd_alias_table[] = {
 static pmu_mfr_t
 pmu_events_mfr(void)
 {
-   char *buf;
-   size_t s;
+   char buf[PMC_CPUID_LEN];
+   size_t s = sizeof(buf);
pmu_mfr_t mfr;
 
-   if (sysctlbyname("kern.hwpmc.cpuid", (void *)NULL, ,
+   if (sysctlbyname("kern.hwpmc.cpuid", buf, ,
(void *)NULL, 0) == -1)
return (PMU_INVALID);
-   if ((buf = malloc(s + 1)) == NULL)
-   return (PMU_INVALID);
-   if (sysctlbyname("kern.hwpmc.cpuid", buf, ,
-   (void *)NULL, 0) == -1) {
-   free(buf);
-   return (PMU_INVALID);
-   }
if (strcasestr(buf, "AuthenticAMD") != NULL ||
strcasestr(buf, "HygonGenuine") != NULL)
mfr = PMU_AMD;
@@ -110,7 +104,6 @@ pmu_events_mfr(void)
mfr = PMU_INTEL;
else
mfr = PMU_INVALID;
-   free(buf);
return (mfr);
 }
 
@@ -169,17 +162,14 @@ pmu_events_map_get(const char *cpuid)
 {
regex_t re;
regmatch_t pmatch[1];
-   size_t s;
-   char buf[64];
+   char buf[PMC_CPUID_LEN];
+   size_t s = sizeof(buf);
int match;
const struct pmu_events_map *pme;
 
if (cpuid != NULL) {
-   memcpy(buf, cpuid, 64);
+   strlcpy(buf, cpuid, s);
} else {
-   if (sysctlbyname("kern.hwpmc.cpuid", (void *)NULL, ,
-   (void *)NULL, 0) == -1)
-   return (NULL);
if (sysctlbyname("kern.hwpmc.cpuid", buf, ,
(void *)NULL, 0) == -1)
return (NULL);

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==
--- head/sys/dev/hwpmc/hwpmc_mod.c  Tue Jul 28 02:53:44 2020
(r363629)
+++ head/sys/dev/hwpmc/hwpmc_mod.c  Tue Jul 28 02:56:26 2020
(r363630)
@@ -305,7 +305,7 @@ static int pmc_callchaindepth = PMC_CALLCHAIN_DEPTH;
 SYSCTL_INT(_kern_hwpmc, OID_AUTO, callchaindepth, CTLFLAG_RDTUN,
 _callchaindepth, 0, "depth of call chain records");
 
-char pmc_cpuid[64];
+char pmc_cpuid[PMC_CPUID_LEN];
 SYSCTL_STRING(_kern_hwpmc, OID_AUTO, cpuid, CTLFLAG_RD,
pmc_cpuid, 0, "cpu version string");
 #ifdef HWPMC_DEBUG
___
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: r363629 - in stable/12/sys: dev/coretemp dev/hwpmc x86/include

2020-07-27 Thread Ryan Moeller
Author: freqlabs
Date: Tue Jul 28 02:53:44 2020
New Revision: 363629
URL: https://svnweb.freebsd.org/changeset/base/363629

Log:
  MFC r363206:
  
  hwpmc: Always set pmc_cpuid to something
  
  pmc_cpuid was uninitialized for most AMD processor families.  We can still
  populate this string for unimplemented families.
  
  Also added a CPUID_TO_STEPPING macro and converted existing code to use it.
  
  Reviewed by:mav
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25673

Modified:
  stable/12/sys/dev/coretemp/coretemp.c
  stable/12/sys/dev/hwpmc/hwpmc_amd.c
  stable/12/sys/dev/hwpmc/hwpmc_intel.c
  stable/12/sys/x86/include/specialreg.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/coretemp/coretemp.c
==
--- stable/12/sys/dev/coretemp/coretemp.c   Tue Jul 28 01:05:40 2020
(r363628)
+++ stable/12/sys/dev/coretemp/coretemp.c   Tue Jul 28 02:53:44 2020
(r363629)
@@ -165,7 +165,7 @@ coretemp_attach(device_t dev)
sc->sc_dev = dev;
pdev = device_get_parent(dev);
cpu_model = CPUID_TO_MODEL(cpu_id);
-   cpu_stepping = cpu_id & CPUID_STEPPING;
+   cpu_stepping = CPUID_TO_STEPPING(cpu_id);
 
/*
 * Some CPUs, namely the PIII, don't have thermal sensors, but

Modified: stable/12/sys/dev/hwpmc/hwpmc_amd.c
==
--- stable/12/sys/dev/hwpmc/hwpmc_amd.c Tue Jul 28 01:05:40 2020
(r363628)
+++ stable/12/sys/dev/hwpmc/hwpmc_amd.c Tue Jul 28 02:53:44 2020
(r363629)
@@ -1073,7 +1073,7 @@ pmc_amd_initialize(void)
enum pmc_cputype cputype;
struct pmc_mdep *pmc_mdep;
enum pmc_class class;
-   int model, stepping;
+   int family, model, stepping;
char *name;
 
/*
@@ -1085,14 +1085,16 @@ pmc_amd_initialize(void)
 */
 
name = NULL;
-   model = ((cpu_id & 0xF) >> 12) | ((cpu_id & 0xF0) >> 4);
-   stepping = cpu_id & 0xF;
-   if (CPUID_TO_FAMILY(cpu_id) == 0x17)
-   snprintf(pmc_cpuid, sizeof(pmc_cpuid), 
"AuthenticAMD-%d-%02X-%X",
-CPUID_TO_FAMILY(cpu_id), model, stepping);
-   if (CPUID_TO_FAMILY(cpu_id) == 0x18)
+   family = CPUID_TO_FAMILY(cpu_id);
+   model = CPUID_TO_MODEL(cpu_id);
+   stepping = CPUID_TO_STEPPING(cpu_id);
+
+   if (family == 0x18)
snprintf(pmc_cpuid, sizeof(pmc_cpuid), 
"HygonGenuine-%d-%02X-%X",
-CPUID_TO_FAMILY(cpu_id), model, stepping);
+   family, model, stepping);
+   else
+   snprintf(pmc_cpuid, sizeof(pmc_cpuid), 
"AuthenticAMD-%d-%02X-%X",
+   family, model, stepping);
 
switch (cpu_id & 0xF00) {
 #ifdefined(__i386__)

Modified: stable/12/sys/dev/hwpmc/hwpmc_intel.c
==
--- stable/12/sys/dev/hwpmc/hwpmc_intel.c   Tue Jul 28 01:05:40 2020
(r363628)
+++ stable/12/sys/dev/hwpmc/hwpmc_intel.c   Tue Jul 28 02:53:44 2020
(r363629)
@@ -80,7 +80,7 @@ pmc_intel_initialize(void)
 {
struct pmc_mdep *pmc_mdep;
enum pmc_cputype cputype;
-   int error, model, nclasses, ncpus, stepping, verov;
+   int error, family, model, nclasses, ncpus, stepping, verov;
 
KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL,
("[intel,%d] Initializing non-intel processor", __LINE__));
@@ -91,11 +91,13 @@ pmc_intel_initialize(void)
nclasses = 2;
error = 0;
verov = 0;
-   model = ((cpu_id & 0xF) >> 12) | ((cpu_id & 0xF0) >> 4);
-   stepping = cpu_id & 0xF;
+   family = CPUID_TO_FAMILY(cpu_id);
+   model = CPUID_TO_MODEL(cpu_id);
+   stepping = CPUID_TO_STEPPING(cpu_id);
 
snprintf(pmc_cpuid, sizeof(pmc_cpuid), "GenuineIntel-%d-%02X-%X",
-(cpu_id & 0xF00) >> 8, model, stepping);
+   family, model, stepping);
+
switch (cpu_id & 0xF00) {
case 0x600: /* Pentium Pro, Celeron, Pentium II & III */
switch (model) {

Modified: stable/12/sys/x86/include/specialreg.h
==
--- stable/12/sys/x86/include/specialreg.h  Tue Jul 28 01:05:40 2020
(r363628)
+++ stable/12/sys/x86/include/specialreg.h  Tue Jul 28 02:53:44 2020
(r363629)
@@ -293,6 +293,7 @@
 id) & CPUID_FAMILY) >> 8) + \
 (((id) & CPUID_EXT_FAMILY) >> 20))
 #endif
+#define CPUID_TO_STEPPING(id) ((id) & CPUID_STEPPING)
 
 /*
  * CPUID instruction 1 ebx info
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r363206 - in head/sys: dev/coretemp dev/hwpmc x86/include

2020-07-14 Thread Ryan Moeller
Author: freqlabs
Date: Tue Jul 14 22:25:06 2020
New Revision: 363206
URL: https://svnweb.freebsd.org/changeset/base/363206

Log:
  hwpmc: Always set pmc_cpuid to something
  
  pmc_cpuid was uninitialized for most AMD processor families.  We can still
  populate this string for unimplemented families.
  
  Also added a CPUID_TO_STEPPING macro and converted existing code to use it.
  
  Reviewed by:  mav
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D25673

Modified:
  head/sys/dev/coretemp/coretemp.c
  head/sys/dev/hwpmc/hwpmc_amd.c
  head/sys/dev/hwpmc/hwpmc_intel.c
  head/sys/x86/include/specialreg.h

Modified: head/sys/dev/coretemp/coretemp.c
==
--- head/sys/dev/coretemp/coretemp.cTue Jul 14 21:56:59 2020
(r363205)
+++ head/sys/dev/coretemp/coretemp.cTue Jul 14 22:25:06 2020
(r363206)
@@ -166,7 +166,7 @@ coretemp_attach(device_t dev)
sc->sc_dev = dev;
pdev = device_get_parent(dev);
cpu_model = CPUID_TO_MODEL(cpu_id);
-   cpu_stepping = cpu_id & CPUID_STEPPING;
+   cpu_stepping = CPUID_TO_STEPPING(cpu_id);
 
/*
 * Some CPUs, namely the PIII, don't have thermal sensors, but

Modified: head/sys/dev/hwpmc/hwpmc_amd.c
==
--- head/sys/dev/hwpmc/hwpmc_amd.c  Tue Jul 14 21:56:59 2020
(r363205)
+++ head/sys/dev/hwpmc/hwpmc_amd.c  Tue Jul 14 22:25:06 2020
(r363206)
@@ -1073,7 +1073,7 @@ pmc_amd_initialize(void)
enum pmc_cputype cputype;
struct pmc_mdep *pmc_mdep;
enum pmc_class class;
-   int model, stepping;
+   int family, model, stepping;
char *name;
 
/*
@@ -1085,14 +1085,16 @@ pmc_amd_initialize(void)
 */
 
name = NULL;
-   model = ((cpu_id & 0xF) >> 12) | ((cpu_id & 0xF0) >> 4);
-   stepping = cpu_id & 0xF;
-   if (CPUID_TO_FAMILY(cpu_id) == 0x17)
-   snprintf(pmc_cpuid, sizeof(pmc_cpuid), 
"AuthenticAMD-%d-%02X-%X",
-CPUID_TO_FAMILY(cpu_id), model, stepping);
-   if (CPUID_TO_FAMILY(cpu_id) == 0x18)
+   family = CPUID_TO_FAMILY(cpu_id);
+   model = CPUID_TO_MODEL(cpu_id);
+   stepping = CPUID_TO_STEPPING(cpu_id);
+
+   if (family == 0x18)
snprintf(pmc_cpuid, sizeof(pmc_cpuid), 
"HygonGenuine-%d-%02X-%X",
-CPUID_TO_FAMILY(cpu_id), model, stepping);
+   family, model, stepping);
+   else
+   snprintf(pmc_cpuid, sizeof(pmc_cpuid), 
"AuthenticAMD-%d-%02X-%X",
+   family, model, stepping);
 
switch (cpu_id & 0xF00) {
 #ifdefined(__i386__)

Modified: head/sys/dev/hwpmc/hwpmc_intel.c
==
--- head/sys/dev/hwpmc/hwpmc_intel.cTue Jul 14 21:56:59 2020
(r363205)
+++ head/sys/dev/hwpmc/hwpmc_intel.cTue Jul 14 22:25:06 2020
(r363206)
@@ -80,7 +80,7 @@ pmc_intel_initialize(void)
 {
struct pmc_mdep *pmc_mdep;
enum pmc_cputype cputype;
-   int error, model, nclasses, ncpus, stepping, verov;
+   int error, family, model, nclasses, ncpus, stepping, verov;
 
KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL,
("[intel,%d] Initializing non-intel processor", __LINE__));
@@ -91,11 +91,13 @@ pmc_intel_initialize(void)
nclasses = 2;
error = 0;
verov = 0;
-   model = ((cpu_id & 0xF) >> 12) | ((cpu_id & 0xF0) >> 4);
-   stepping = cpu_id & 0xF;
+   family = CPUID_TO_FAMILY(cpu_id);
+   model = CPUID_TO_MODEL(cpu_id);
+   stepping = CPUID_TO_STEPPING(cpu_id);
 
snprintf(pmc_cpuid, sizeof(pmc_cpuid), "GenuineIntel-%d-%02X-%X",
-(cpu_id & 0xF00) >> 8, model, stepping);
+   family, model, stepping);
+
switch (cpu_id & 0xF00) {
case 0x600: /* Pentium Pro, Celeron, Pentium II & III */
switch (model) {

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Tue Jul 14 21:56:59 2020
(r363205)
+++ head/sys/x86/include/specialreg.h   Tue Jul 14 22:25:06 2020
(r363206)
@@ -280,6 +280,7 @@
 id) & CPUID_FAMILY) >> 8) + \
 (((id) & CPUID_EXT_FAMILY) >> 20))
 #endif
+#define CPUID_TO_STEPPING(id) ((id) & CPUID_STEPPING)
 
 /*
  * CPUID instruction 1 ebx info
___
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: r363037 - in stable/12: lib/libifconfig sbin/ifconfig sys/net

2020-07-09 Thread Ryan Moeller
Author: freqlabs
Date: Thu Jul  9 09:33:32 2020
New Revision: 363037
URL: https://svnweb.freebsd.org/changeset/base/363037

Log:
  MFC r362824:
  
  libifconfig: Add function to get bridge status
  
  The new function operates similarly to ifconfig_lagg_get_lagg_status and
  likewise is accompanied by a function to free the bridge status data 
structure.
  
  I have included in this patch the relocation of some strings describing STP
  parameters and the PV2ID macro from ifconfig into net/if_bridgevar.h as they
  are useful for consumers of libifconfig.
  
  Reviewed by:kp, melifaro, mmacy
  Relnotes:   yes
  Differential Revision:  https://reviews.freebsd.org/D25460

Added:
  stable/12/lib/libifconfig/libifconfig_bridge.c
 - copied unchanged from r362824, head/lib/libifconfig/libifconfig_bridge.c
Modified:
  stable/12/lib/libifconfig/Makefile
  stable/12/lib/libifconfig/libifconfig.h
  stable/12/sbin/ifconfig/ifbridge.c
  stable/12/sys/net/if_bridgevar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libifconfig/Makefile
==
--- stable/12/lib/libifconfig/Makefile  Thu Jul  9 08:00:46 2020
(r363036)
+++ stable/12/lib/libifconfig/Makefile  Thu Jul  9 09:33:32 2020
(r363037)
@@ -8,9 +8,14 @@ NO_PIC= 
 
 SHLIBDIR?= /lib
 SHLIB_MAJOR=   1
-SRCS=  libifconfig.c libifconfig_carp.c libifconfig_inet.c
-SRCS+= libifconfig_inet6.c libifconfig_internal.c libifconfig_lagg.c
-SRCS+= libifconfig_media.c
+SRCS=  libifconfig.c \
+   libifconfig_bridge.c \
+   libifconfig_carp.c \
+   libifconfig_inet.c \
+   libifconfig_inet6.c \
+   libifconfig_internal.c \
+   libifconfig_lagg.c \
+   libifconfig_media.c
 
 INCSDIR=   ${INCLUDEDIR}
 INCS=  libifconfig.h

Modified: stable/12/lib/libifconfig/libifconfig.h
==
--- stable/12/lib/libifconfig/libifconfig.h Thu Jul  9 08:00:46 2020
(r363036)
+++ stable/12/lib/libifconfig/libifconfig.h Thu Jul  9 09:33:32 2020
(r363037)
@@ -49,12 +49,23 @@ typedef struct ifconfig_handle ifconfig_handle_t;
 
 struct carpreq;
 struct ifaddrs;
+struct ifbropreq;
+struct ifbreq;
 struct in6_ndireq;
 struct lagg_reqall;
 struct lagg_reqflags;
 struct lagg_reqopts;
 struct lagg_reqport;
 
+/** Stores extra info associated with a bridge(4) interface */
+struct ifconfig_bridge_status {
+   struct ifbropreq *params;   /**< current operational parameters */
+   struct ifbreq *members; /**< list of bridge members */
+   size_t members_count;   /**< how many member interfaces */
+   uint32_t cache_size;/**< size of address cache */
+   uint32_t cache_lifetime;/**< address cache entry lifetime */
+};
+
 struct ifconfig_capabilities {
/** Current capabilities (ifconfig prints this as 'options')*/
int curcap;
@@ -217,6 +228,16 @@ int ifconfig_inet_get_addrinfo(ifconfig_handle_t *h,
 int ifconfig_inet6_get_addrinfo(ifconfig_handle_t *h,
 const char *name, struct ifaddrs *ifa, struct ifconfig_inet6_addr *addr);
 
+/** Retrieve additional information about a bridge(4) interface */
+int ifconfig_bridge_get_bridge_status(ifconfig_handle_t *h,
+const char *name, struct ifconfig_bridge_status **bridge);
+
+/** Frees the structure returned by ifconfig_bridge_get_bridge_status.  Does
+ * nothing if the argument is NULL
+ * @param bridge   Pointer to the structure to free
+ */
+void ifconfig_bridge_free_bridge_status(struct ifconfig_bridge_status *bridge);
+
 /** Retrieve additional information about a lagg(4) interface */
 int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h,
 const char *name, struct ifconfig_lagg_status **lagg_status);
@@ -225,8 +246,8 @@ int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h
 int ifconfig_lagg_get_laggport_status(ifconfig_handle_t *h,
 const char *name, struct lagg_reqport *rp);
 
-/** Frees the structure returned by ifconfig_lagg_get_status.  Does nothing if
- * the argument is NULL
+/** Frees the structure returned by ifconfig_lagg_get_lagg_status.  Does
+ * nothing if the argument is NULL
  * @param laggstat Pointer to the structure to free
  */
 void ifconfig_lagg_free_lagg_status(struct ifconfig_lagg_status *laggstat);

Copied: stable/12/lib/libifconfig/libifconfig_bridge.c (from r362824, 
head/lib/libifconfig/libifconfig_bridge.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/lib/libifconfig/libifconfig_bridge.c  Thu Jul  9 09:33:32 
2020(r363037, copy of r362824, 
head/lib/libifconfig/libifconfig_bridge.c)
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2020, Ryan Moeller 
+ *
+ *

svn commit: r362824 - in head: lib/libifconfig sbin/ifconfig sys/net

2020-06-30 Thread Ryan Moeller
Author: freqlabs
Date: Wed Jul  1 02:32:41 2020
New Revision: 362824
URL: https://svnweb.freebsd.org/changeset/base/362824

Log:
  libifconfig: Add function to get bridge status
  
  The new function operates similarly to ifconfig_lagg_get_lagg_status and
  likewise is accompanied by a function to free the bridge status data 
structure.
  
  I have included in this patch the relocation of some strings describing STP
  parameters and the PV2ID macro from ifconfig into net/if_bridgevar.h as they
  are useful for consumers of libifconfig.
  
  Reviewed by:  kp, melifaro, mmacy
  Approved by:  mmacy (mentor)
  MFC after:1 week
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D25460

Added:
  head/lib/libifconfig/libifconfig_bridge.c   (contents, props changed)
Modified:
  head/lib/libifconfig/Makefile
  head/lib/libifconfig/libifconfig.h
  head/sbin/ifconfig/ifbridge.c
  head/sys/net/if_bridgevar.h

Modified: head/lib/libifconfig/Makefile
==
--- head/lib/libifconfig/Makefile   Wed Jul  1 02:16:36 2020
(r362823)
+++ head/lib/libifconfig/Makefile   Wed Jul  1 02:32:41 2020
(r362824)
@@ -6,9 +6,14 @@ INTERNALLIB=   true
 
 SHLIBDIR?= /lib
 SHLIB_MAJOR=   1
-SRCS=  libifconfig.c libifconfig_carp.c libifconfig_inet.c
-SRCS+= libifconfig_inet6.c libifconfig_internal.c libifconfig_lagg.c
-SRCS+= libifconfig_media.c
+SRCS=  libifconfig.c \
+   libifconfig_bridge.c \
+   libifconfig_carp.c \
+   libifconfig_inet.c \
+   libifconfig_inet6.c \
+   libifconfig_internal.c \
+   libifconfig_lagg.c \
+   libifconfig_media.c
 
 # If libifconfig become public uncomment those two lines
 #INCSDIR=  ${INCLUDEDIR}

Modified: head/lib/libifconfig/libifconfig.h
==
--- head/lib/libifconfig/libifconfig.h  Wed Jul  1 02:16:36 2020
(r362823)
+++ head/lib/libifconfig/libifconfig.h  Wed Jul  1 02:32:41 2020
(r362824)
@@ -49,12 +49,23 @@ typedef struct ifconfig_handle ifconfig_handle_t;
 
 struct carpreq;
 struct ifaddrs;
+struct ifbropreq;
+struct ifbreq;
 struct in6_ndireq;
 struct lagg_reqall;
 struct lagg_reqflags;
 struct lagg_reqopts;
 struct lagg_reqport;
 
+/** Stores extra info associated with a bridge(4) interface */
+struct ifconfig_bridge_status {
+   struct ifbropreq *params;   /**< current operational parameters */
+   struct ifbreq *members; /**< list of bridge members */
+   size_t members_count;   /**< how many member interfaces */
+   uint32_t cache_size;/**< size of address cache */
+   uint32_t cache_lifetime;/**< address cache entry lifetime */
+};
+
 struct ifconfig_capabilities {
/** Current capabilities (ifconfig prints this as 'options')*/
int curcap;
@@ -217,6 +228,16 @@ int ifconfig_inet_get_addrinfo(ifconfig_handle_t *h,
 int ifconfig_inet6_get_addrinfo(ifconfig_handle_t *h,
 const char *name, struct ifaddrs *ifa, struct ifconfig_inet6_addr *addr);
 
+/** Retrieve additional information about a bridge(4) interface */
+int ifconfig_bridge_get_bridge_status(ifconfig_handle_t *h,
+const char *name, struct ifconfig_bridge_status **bridge);
+
+/** Frees the structure returned by ifconfig_bridge_get_bridge_status.  Does
+ * nothing if the argument is NULL
+ * @param bridge   Pointer to the structure to free
+ */
+void ifconfig_bridge_free_bridge_status(struct ifconfig_bridge_status *bridge);
+
 /** Retrieve additional information about a lagg(4) interface */
 int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h,
 const char *name, struct ifconfig_lagg_status **lagg_status);
@@ -225,8 +246,8 @@ int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h
 int ifconfig_lagg_get_laggport_status(ifconfig_handle_t *h,
 const char *name, struct lagg_reqport *rp);
 
-/** Frees the structure returned by ifconfig_lagg_get_status.  Does nothing if
- * the argument is NULL
+/** Frees the structure returned by ifconfig_lagg_get_lagg_status.  Does
+ * nothing if the argument is NULL
  * @param laggstat Pointer to the structure to free
  */
 void ifconfig_lagg_free_lagg_status(struct ifconfig_lagg_status *laggstat);

Added: head/lib/libifconfig/libifconfig_bridge.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libifconfig/libifconfig_bridge.c   Wed Jul  1 02:32:41 2020
(r362824)
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2020, Ryan Moeller 
+ *
+ * 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 

svn commit: r362638 - in stable: 11/lib/libdevdctl 12/lib/libdevdctl

2020-06-25 Thread Ryan Moeller
Author: freqlabs
Date: Fri Jun 26 00:58:59 2020
New Revision: 362638
URL: https://svnweb.freebsd.org/changeset/base/362638

Log:
  MFC r362544:
  
  libdevdctl: Force full match of "timestamp" field name
  
  OpenZFS generates events with a "zio_timestamp" field, which gets mistaken for
  "timestamp" by libdevdctl due to imprecise string matching.  Then later it is
  assumed a "timestamp" field exists when it doesn't and an exception is thrown.
  
  Add a space to the search string so we match exactly "timestamp" rather than
  anything with that as a suffix.
  
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.

Modified:
  stable/12/lib/libdevdctl/event.cc
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/lib/libdevdctl/event.cc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/lib/libdevdctl/event.cc
==
--- stable/12/lib/libdevdctl/event.cc   Fri Jun 26 00:01:31 2020
(r362637)
+++ stable/12/lib/libdevdctl/event.cc   Fri Jun 26 00:58:59 2020
(r362638)
@@ -427,7 +427,7 @@ Event::TimestampEventString(std::string )
 * Add a timestamp as the final field of the event if it is
 * not already present.
 */
-   if (eventString.find("timestamp=") == string::npos) {
+   if (eventString.find(" timestamp=") == string::npos) {
const size_t bufsize = 32;  // Long enough for a 
64-bit int
timeval now;
char timebuf[bufsize];
___
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: r362638 - in stable: 11/lib/libdevdctl 12/lib/libdevdctl

2020-06-25 Thread Ryan Moeller
Author: freqlabs
Date: Fri Jun 26 00:58:59 2020
New Revision: 362638
URL: https://svnweb.freebsd.org/changeset/base/362638

Log:
  MFC r362544:
  
  libdevdctl: Force full match of "timestamp" field name
  
  OpenZFS generates events with a "zio_timestamp" field, which gets mistaken for
  "timestamp" by libdevdctl due to imprecise string matching.  Then later it is
  assumed a "timestamp" field exists when it doesn't and an exception is thrown.
  
  Add a space to the search string so we match exactly "timestamp" rather than
  anything with that as a suffix.
  
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.

Modified:
  stable/11/lib/libdevdctl/event.cc
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/lib/libdevdctl/event.cc
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/lib/libdevdctl/event.cc
==
--- stable/11/lib/libdevdctl/event.cc   Fri Jun 26 00:01:31 2020
(r362637)
+++ stable/11/lib/libdevdctl/event.cc   Fri Jun 26 00:58:59 2020
(r362638)
@@ -427,7 +427,7 @@ Event::TimestampEventString(std::string )
 * Add a timestamp as the final field of the event if it is
 * not already present.
 */
-   if (eventString.find("timestamp=") == string::npos) {
+   if (eventString.find(" timestamp=") == string::npos) {
const size_t bufsize = 32;  // Long enough for a 
64-bit int
timeval now;
char timebuf[bufsize];
___
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: r362544 - head/lib/libdevdctl

2020-06-23 Thread Ryan Moeller
Author: freqlabs
Date: Tue Jun 23 16:29:59 2020
New Revision: 362544
URL: https://svnweb.freebsd.org/changeset/base/362544

Log:
  libdevdctl: Force full match of "timestamp" field name
  
  OpenZFS generates events with a "zio_timestamp" field, which gets mistaken for
  "timestamp" by libdevdctl due to imprecise string matching.  Then later it is
  assumed a "timestamp" field exists when it doesn't and an exception is thrown.
  
  Add a space to the search string so we match exactly "timestamp" rather than
  anything with that as a suffix.
  
  Approved by:  mav (mentor)
  MFC after:3 days
  Sponsored by: iXsystems, Inc.

Modified:
  head/lib/libdevdctl/event.cc

Modified: head/lib/libdevdctl/event.cc
==
--- head/lib/libdevdctl/event.ccTue Jun 23 15:36:05 2020
(r362543)
+++ head/lib/libdevdctl/event.ccTue Jun 23 16:29:59 2020
(r362544)
@@ -427,7 +427,7 @@ Event::TimestampEventString(std::string )
 * Add a timestamp as the final field of the event if it is
 * not already present.
 */
-   if (eventString.find("timestamp=") == string::npos) {
+   if (eventString.find(" timestamp=") == string::npos) {
const size_t bufsize = 32;  // Long enough for a 
64-bit int
timeval now;
char timebuf[bufsize];
___
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: r362511 - in stable: 11/sys/dev/cxgb 11/sys/dev/cxgbe 11/sys/dev/mlx4/mlx4_en 11/sys/dev/mlx5/mlx5_en 11/sys/dev/mxge 11/sys/dev/oce 12/sys/dev/cxgb 12/sys/dev/cxgbe 12/sys/dev/mlx4/mlx...

2020-06-22 Thread Ryan Moeller
Author: freqlabs
Date: Mon Jun 22 21:28:51 2020
New Revision: 362511
URL: https://svnweb.freebsd.org/changeset/base/362511

Log:
  MFC r362201:
  
  Avoid trying to toggle TSO twice
  
  Remove TSO from the toggle mask when automatically disabled by TXCKSUM* in
  various NIC drivers.
  
  Reviewed by:hselasky, np, gallatin, jpaetzel
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25120

Modified:
  stable/12/sys/dev/cxgb/cxgb_main.c
  stable/12/sys/dev/cxgbe/t4_main.c
  stable/12/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/12/sys/dev/mxge/if_mxge.c
  stable/12/sys/dev/oce/oce_if.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/cxgb/cxgb_main.c
  stable/11/sys/dev/cxgbe/t4_main.c
  stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/11/sys/dev/mxge/if_mxge.c
  stable/11/sys/dev/oce/oce_if.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/dev/cxgb/cxgb_main.c
==
--- stable/12/sys/dev/cxgb/cxgb_main.c  Mon Jun 22 20:55:45 2020
(r362510)
+++ stable/12/sys/dev/cxgb/cxgb_main.c  Mon Jun 22 21:28:51 2020
(r362511)
@@ -1961,6 +1961,7 @@ fail:
 
if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
if_printf(ifp,
"tso4 disabled due to -txcsum.\n");
@@ -1972,6 +1973,7 @@ fail:
 
if (IFCAP_TSO6 & ifp->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~IFCAP_TSO6;
if_printf(ifp,
"tso6 disabled due to -txcsum6.\n");

Modified: stable/12/sys/dev/cxgbe/t4_main.c
==
--- stable/12/sys/dev/cxgbe/t4_main.c   Mon Jun 22 20:55:45 2020
(r362510)
+++ stable/12/sys/dev/cxgbe/t4_main.c   Mon Jun 22 21:28:51 2020
(r362511)
@@ -1914,6 +1914,7 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, cadd
 
if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
if_printf(ifp,
"tso4 disabled due to -txcsum.\n");
@@ -1925,6 +1926,7 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, cadd
 
if (IFCAP_TSO6 & ifp->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~IFCAP_TSO6;
if_printf(ifp,
"tso6 disabled due to -txcsum6.\n");

Modified: stable/12/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==
--- stable/12/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Jun 22 20:55:45 
2020(r362510)
+++ stable/12/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Jun 22 21:28:51 
2020(r362511)
@@ -2008,6 +2008,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long com
 
if (IFCAP_TSO4 & dev->if_capenable &&
!(IFCAP_TXCSUM & dev->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
dev->if_capenable &= ~IFCAP_TSO4;
dev->if_hwassist &= ~CSUM_IP_TSO;
if_printf(dev,
@@ -2020,6 +2021,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long com
 
if (IFCAP_TSO6 & dev->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) {
+   mask &= ~IFCAP_TSO6;
dev->if_capenable &= ~IFCAP_TSO6;
dev->if_hwassist &= ~CSUM_IP6_TSO;
if_printf(dev,

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Jun 22 20:55:45 
2020(r362510)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Jun 22 21:28:51 
2020(r362511)
@@ -3285,6 +3285,7 @@ mlx5e_ioctl(struct ifnet 

svn commit: r362511 - in stable: 11/sys/dev/cxgb 11/sys/dev/cxgbe 11/sys/dev/mlx4/mlx4_en 11/sys/dev/mlx5/mlx5_en 11/sys/dev/mxge 11/sys/dev/oce 12/sys/dev/cxgb 12/sys/dev/cxgbe 12/sys/dev/mlx4/mlx...

2020-06-22 Thread Ryan Moeller
Author: freqlabs
Date: Mon Jun 22 21:28:51 2020
New Revision: 362511
URL: https://svnweb.freebsd.org/changeset/base/362511

Log:
  MFC r362201:
  
  Avoid trying to toggle TSO twice
  
  Remove TSO from the toggle mask when automatically disabled by TXCKSUM* in
  various NIC drivers.
  
  Reviewed by:hselasky, np, gallatin, jpaetzel
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25120

Modified:
  stable/11/sys/dev/cxgb/cxgb_main.c
  stable/11/sys/dev/cxgbe/t4_main.c
  stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/11/sys/dev/mxge/if_mxge.c
  stable/11/sys/dev/oce/oce_if.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/dev/cxgb/cxgb_main.c
  stable/12/sys/dev/cxgbe/t4_main.c
  stable/12/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/12/sys/dev/mxge/if_mxge.c
  stable/12/sys/dev/oce/oce_if.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/dev/cxgb/cxgb_main.c
==
--- stable/11/sys/dev/cxgb/cxgb_main.c  Mon Jun 22 20:55:45 2020
(r362510)
+++ stable/11/sys/dev/cxgb/cxgb_main.c  Mon Jun 22 21:28:51 2020
(r362511)
@@ -1952,6 +1952,7 @@ fail:
 
if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
if_printf(ifp,
"tso4 disabled due to -txcsum.\n");
@@ -1963,6 +1964,7 @@ fail:
 
if (IFCAP_TSO6 & ifp->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~IFCAP_TSO6;
if_printf(ifp,
"tso6 disabled due to -txcsum6.\n");

Modified: stable/11/sys/dev/cxgbe/t4_main.c
==
--- stable/11/sys/dev/cxgbe/t4_main.c   Mon Jun 22 20:55:45 2020
(r362510)
+++ stable/11/sys/dev/cxgbe/t4_main.c   Mon Jun 22 21:28:51 2020
(r362511)
@@ -1865,6 +1865,7 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, cadd
 
if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
if_printf(ifp,
"tso4 disabled due to -txcsum.\n");
@@ -1876,6 +1877,7 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, cadd
 
if (IFCAP_TSO6 & ifp->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~IFCAP_TSO6;
if_printf(ifp,
"tso6 disabled due to -txcsum6.\n");

Modified: stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==
--- stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Jun 22 20:55:45 
2020(r362510)
+++ stable/11/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Mon Jun 22 21:28:51 
2020(r362511)
@@ -2006,6 +2006,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long com
 
if (IFCAP_TSO4 & dev->if_capenable &&
!(IFCAP_TXCSUM & dev->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
dev->if_capenable &= ~IFCAP_TSO4;
dev->if_hwassist &= ~CSUM_IP_TSO;
if_printf(dev,
@@ -2018,6 +2019,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long com
 
if (IFCAP_TSO6 & dev->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) {
+   mask &= ~IFCAP_TSO6;
dev->if_capenable &= ~IFCAP_TSO6;
dev->if_hwassist &= ~CSUM_IP6_TSO;
if_printf(dev,

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Jun 22 20:55:45 
2020(r362510)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Jun 22 21:28:51 
2020(r362511)
@@ -3167,6 +3167,7 @@ mlx5e_ioctl(struct ifnet 

svn commit: r362477 - in head: . libexec/flua tools/build

2020-06-21 Thread Ryan Moeller
Author: freqlabs
Date: Mon Jun 22 03:14:43 2020
New Revision: 362477
URL: https://svnweb.freebsd.org/changeset/base/362477

Log:
  flua: add ucl library
  
  libucl comes with a Lua library binding.  Build it into flua.
  
  This lets us parse/generate config files in the various formats supported by
  libucl with flua.  For example, the following script will detect the format of
  an object written to stdin as one of UCL config, JSON, or YAML and write it to
  stdout as pretty-printed JSON:
  
  local ucl = require('ucl')
  local parser = ucl.parser()
  parser:parse_string(io.read('*a'))
  local obj = parser:get_object()
  print(ucl.to_format(obj, 'json'))
  
  Reviewed by:  kevans, pstef
  Approved by:  mmacy (mentor)
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D25009

Modified:
  head/Makefile.inc1
  head/libexec/flua/Makefile
  head/libexec/flua/linit_flua.c
  head/tools/build/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Jun 22 01:31:08 2020(r362476)
+++ head/Makefile.inc1  Mon Jun 22 03:14:43 2020(r362477)
@@ -2112,8 +2112,8 @@ ${_bt}-lib/libdwarf: ${_bt_m4_depend}
 # 13.0-CURRENT cycle, thus needs to be built on -older releases and stable
 # branches.
 .if ${BOOTSTRAPPING} < 1300059
-${_bt}-libexec/flua: ${_bt}-lib/liblua
-_flua= lib/liblua libexec/flua
+${_bt}-libexec/flua: ${_bt}-lib/liblua ${_bt}-lib/libucl
+_flua= lib/liblua lib/libucl libexec/flua
 .endif
 
 # r245440 mtree -N support added

Modified: head/libexec/flua/Makefile
==
--- head/libexec/flua/Makefile  Mon Jun 22 01:31:08 2020(r362476)
+++ head/libexec/flua/Makefile  Mon Jun 22 03:14:43 2020(r362477)
@@ -32,4 +32,10 @@ CFLAGS+= -I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/l
 LIBADD+=   edit
 .endif
 
+UCLSRC?=   ${SRCTOP}/contrib/libucl
+.PATH: ${UCLSRC}/lua
+SRCS+= lua_ucl.c
+CFLAGS+=   -I${UCLSRC}/include -I${UCLSRC}/src -I${UCLSRC}/uthash
+LIBADD+=   ucl
+
 .include 

Modified: head/libexec/flua/linit_flua.c
==
--- head/libexec/flua/linit_flua.c  Mon Jun 22 01:31:08 2020
(r362476)
+++ head/libexec/flua/linit_flua.c  Mon Jun 22 03:14:43 2020
(r362477)
@@ -36,6 +36,7 @@
 #include "lauxlib.h"
 #include "lfs.h"
 #include "lposix.h"
+#include "lua_ucl.h"
 
 /*
 ** these libs are loaded by lua.c and are readily available to any Lua
@@ -59,6 +60,7 @@ static const luaL_Reg loadedlibs[] = {
   {"lfs", luaopen_lfs},
   {"posix.sys.stat", luaopen_posix_sys_stat},
   {"posix.unistd", luaopen_posix_unistd},
+  {"ucl", luaopen_ucl},
   {NULL, NULL}
 };
 

Modified: head/tools/build/Makefile
==
--- head/tools/build/Makefile   Mon Jun 22 01:31:08 2020(r362476)
+++ head/tools/build/Makefile   Mon Jun 22 03:14:43 2020(r362477)
@@ -149,6 +149,7 @@ INSTALLDIR_LIST= \
lib/casper \
lib/geom \
usr/include/casper \
+   usr/include/private/ucl \
usr/include/private/zstd \
usr/lib \
usr/libexec
___
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: r362375 - in stable: 11/sys/kern 12/sys/kern

2020-06-19 Thread Ryan Moeller
Author: freqlabs
Date: Fri Jun 19 11:45:12 2020
New Revision: 362375
URL: https://svnweb.freebsd.org/changeset/base/362375

Log:
  MFC r362252:
  
  Apply default security flavor in vfs_export
  
  Reported by:npn
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25300

Modified:
  stable/12/sys/kern/vfs_export.c
  stable/12/sys/kern/vfs_mount.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/kern/vfs_export.c
  stable/11/sys/kern/vfs_mount.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/kern/vfs_export.c
==
--- stable/12/sys/kern/vfs_export.c Fri Jun 19 11:32:42 2020
(r362374)
+++ stable/12/sys/kern/vfs_export.c Fri Jun 19 11:45:12 2020
(r362375)
@@ -61,6 +61,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+
 static MALLOC_DEFINE(M_NETADDR, "export_host", "Export host address 
structure");
 
 #if defined(INET) || defined(INET6)
@@ -309,7 +312,7 @@ vfs_export(struct mount *mp, struct export_args *argp)
return (EINVAL);
 
if ((argp->ex_flags & MNT_EXPORTED) != 0 &&
-   (argp->ex_numsecflavors <= 0
+   (argp->ex_numsecflavors < 0
|| argp->ex_numsecflavors >= MAXSECFLAVORS))
return (EINVAL);
 
@@ -346,6 +349,10 @@ vfs_export(struct mount *mp, struct export_args *argp)
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_EXPUBLIC;
MNT_IUNLOCK(mp);
+   }
+   if (argp->ex_numsecflavors == 0) {
+   argp->ex_numsecflavors = 1;
+   argp->ex_secflavors[0] = AUTH_SYS;
}
if ((error = vfs_hang_addrlist(mp, nep, argp)))
goto out;

Modified: stable/12/sys/kern/vfs_mount.c
==
--- stable/12/sys/kern/vfs_mount.c  Fri Jun 19 11:32:42 2020
(r362374)
+++ stable/12/sys/kern/vfs_mount.c  Fri Jun 19 11:45:12 2020
(r362375)
@@ -68,9 +68,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -2050,18 +2047,13 @@ kernel_vmount(int flags, ...)
  * Convert the old export args format into new export args.
  *
  * The old export args struct does not have security flavors.  Otherwise, the
- * structs are identical.  The default security flavor 'sys' is applied when
- * the given args export the filesystem.
+ * structs are identical.  The default security flavor 'sys' is applied by
+ * vfs_export when .ex_numsecflavors is 0.
  */
 void
 vfs_oexport_conv(const struct oexport_args *oexp, struct export_args *exp)
 {
 
bcopy(oexp, exp, sizeof(*oexp));
-   if (exp->ex_flags & MNT_EXPORTED) {
-   exp->ex_numsecflavors = 1;
-   exp->ex_secflavors[0] = AUTH_SYS;
-   } else {
-   exp->ex_numsecflavors = 0;
-   }
+   exp->ex_numsecflavors = 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: r362375 - in stable: 11/sys/kern 12/sys/kern

2020-06-19 Thread Ryan Moeller
Author: freqlabs
Date: Fri Jun 19 11:45:12 2020
New Revision: 362375
URL: https://svnweb.freebsd.org/changeset/base/362375

Log:
  MFC r362252:
  
  Apply default security flavor in vfs_export
  
  Reported by:npn
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25300

Modified:
  stable/11/sys/kern/vfs_export.c
  stable/11/sys/kern/vfs_mount.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/kern/vfs_export.c
  stable/12/sys/kern/vfs_mount.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/kern/vfs_export.c
==
--- stable/11/sys/kern/vfs_export.c Fri Jun 19 11:32:42 2020
(r362374)
+++ stable/11/sys/kern/vfs_export.c Fri Jun 19 11:45:12 2020
(r362375)
@@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+
 static MALLOC_DEFINE(M_NETADDR, "export_host", "Export host address 
structure");
 
 static struct radix_node_head *vfs_create_addrlist_af(
@@ -303,7 +306,7 @@ vfs_export(struct mount *mp, struct export_args *argp)
return (EINVAL);
 
if ((argp->ex_flags & MNT_EXPORTED) != 0 &&
-   (argp->ex_numsecflavors <= 0
+   (argp->ex_numsecflavors < 0
|| argp->ex_numsecflavors >= MAXSECFLAVORS))
return (EINVAL);
 
@@ -340,6 +343,10 @@ vfs_export(struct mount *mp, struct export_args *argp)
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_EXPUBLIC;
MNT_IUNLOCK(mp);
+   }
+   if (argp->ex_numsecflavors == 0) {
+   argp->ex_numsecflavors = 1;
+   argp->ex_secflavors[0] = AUTH_SYS;
}
if ((error = vfs_hang_addrlist(mp, nep, argp)))
goto out;

Modified: stable/11/sys/kern/vfs_mount.c
==
--- stable/11/sys/kern/vfs_mount.c  Fri Jun 19 11:32:42 2020
(r362374)
+++ stable/11/sys/kern/vfs_mount.c  Fri Jun 19 11:45:12 2020
(r362375)
@@ -65,9 +65,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -2056,18 +2053,13 @@ kernel_vmount(int flags, ...)
  * Convert the old export args format into new export args.
  *
  * The old export args struct does not have security flavors.  Otherwise, the
- * structs are identical.  The default security flavor 'sys' is applied when
- * the given args export the filesystem.
+ * structs are identical.  The default security flavor 'sys' is applied by
+ * vfs_export when .ex_numsecflavors is 0.
  */
 void
 vfs_oexport_conv(const struct oexport_args *oexp, struct export_args *exp)
 {
 
bcopy(oexp, exp, sizeof(*oexp));
-   if (exp->ex_flags & MNT_EXPORTED) {
-   exp->ex_numsecflavors = 1;
-   exp->ex_secflavors[0] = AUTH_SYS;
-   } else {
-   exp->ex_numsecflavors = 0;
-   }
+   exp->ex_numsecflavors = 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: r362252 - head/sys/kern

2020-06-16 Thread Ryan Moeller
Author: freqlabs
Date: Tue Jun 16 21:30:30 2020
New Revision: 362252
URL: https://svnweb.freebsd.org/changeset/base/362252

Log:
  Apply default security flavor in vfs_export
  
  There may be some version of mountd out there that does not supply a default
  security flavor when none is given for an export.
  
  Set the default security flavor in vfs_export if none is given, and remove the
  workaround for oexport compat.
  
  Reported by:  npn
  Reviewed by:  rmacklem
  Approved by:  mav (mentor)
  MFC after:3 days
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D25300

Modified:
  head/sys/kern/vfs_export.c
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_export.c
==
--- head/sys/kern/vfs_export.c  Tue Jun 16 21:29:02 2020(r362251)
+++ head/sys/kern/vfs_export.c  Tue Jun 16 21:30:30 2020(r362252)
@@ -61,6 +61,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+
 static MALLOC_DEFINE(M_NETADDR, "export_host", "Export host address 
structure");
 
 #if defined(INET) || defined(INET6)
@@ -303,7 +306,7 @@ vfs_export(struct mount *mp, struct export_args *argp)
return (EINVAL);
 
if ((argp->ex_flags & MNT_EXPORTED) != 0 &&
-   (argp->ex_numsecflavors <= 0
+   (argp->ex_numsecflavors < 0
|| argp->ex_numsecflavors >= MAXSECFLAVORS))
return (EINVAL);
 
@@ -340,6 +343,10 @@ vfs_export(struct mount *mp, struct export_args *argp)
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_EXPUBLIC;
MNT_IUNLOCK(mp);
+   }
+   if (argp->ex_numsecflavors == 0) {
+   argp->ex_numsecflavors = 1;
+   argp->ex_secflavors[0] = AUTH_SYS;
}
if ((error = vfs_hang_addrlist(mp, nep, argp)))
goto out;

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Tue Jun 16 21:29:02 2020(r362251)
+++ head/sys/kern/vfs_mount.c   Tue Jun 16 21:30:30 2020(r362252)
@@ -70,9 +70,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -1131,8 +1128,6 @@ vfs_domount_update(
switch (len) {
case (sizeof(struct oexport_args)):
bzero(, sizeof(o2export));
-   o2export.ex_numsecflavors = 1;
-   o2export.ex_secflavors[0] = AUTH_SYS;
/* FALLTHROUGH */
case (sizeof(o2export)):
bcopy(bufp, , 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: r362201 - in head/sys/dev: cxgb cxgbe mlx4/mlx4_en mlx5/mlx5_en mxge oce

2020-06-15 Thread Ryan Moeller
Author: freqlabs
Date: Mon Jun 15 16:35:27 2020
New Revision: 362201
URL: https://svnweb.freebsd.org/changeset/base/362201

Log:
  Avoid trying to toggle TSO twice
  
  Remove TSO from the toggle mask when automatically disabled by TXCKSUM* in
  various NIC drivers.
  
  Reviewed by:  hselasky, np, gallatin, jpaetzel
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D25120

Modified:
  head/sys/dev/cxgb/cxgb_main.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mxge/if_mxge.c
  head/sys/dev/oce/oce_if.c

Modified: head/sys/dev/cxgb/cxgb_main.c
==
--- head/sys/dev/cxgb/cxgb_main.c   Mon Jun 15 15:59:44 2020
(r362200)
+++ head/sys/dev/cxgb/cxgb_main.c   Mon Jun 15 16:35:27 2020
(r362201)
@@ -1964,6 +1964,7 @@ fail:
 
if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
if_printf(ifp,
"tso4 disabled due to -txcsum.\n");
@@ -1975,6 +1976,7 @@ fail:
 
if (IFCAP_TSO6 & ifp->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~IFCAP_TSO6;
if_printf(ifp,
"tso6 disabled due to -txcsum6.\n");

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cMon Jun 15 15:59:44 2020
(r362200)
+++ head/sys/dev/cxgbe/t4_main.cMon Jun 15 16:35:27 2020
(r362201)
@@ -1989,6 +1989,7 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, cadd
 
if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
if_printf(ifp,
"tso4 disabled due to -txcsum.\n");
@@ -2000,6 +2001,7 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, cadd
 
if (IFCAP_TSO6 & ifp->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO6;
ifp->if_capenable &= ~IFCAP_TSO6;
if_printf(ifp,
"tso6 disabled due to -txcsum6.\n");

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Mon Jun 15 15:59:44 2020
(r362200)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Mon Jun 15 16:35:27 2020
(r362201)
@@ -2006,6 +2006,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long com
 
if (IFCAP_TSO4 & dev->if_capenable &&
!(IFCAP_TXCSUM & dev->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
dev->if_capenable &= ~IFCAP_TSO4;
dev->if_hwassist &= ~CSUM_IP_TSO;
if_printf(dev,
@@ -2018,6 +2019,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long com
 
if (IFCAP_TSO6 & dev->if_capenable &&
!(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) {
+   mask &= ~IFCAP_TSO6;
dev->if_capenable &= ~IFCAP_TSO6;
dev->if_hwassist &= ~CSUM_IP6_TSO;
if_printf(dev,

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Jun 15 15:59:44 2020
(r362200)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Jun 15 16:35:27 2020
(r362201)
@@ -3323,6 +3323,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 
if (IFCAP_TSO4 & ifp->if_capenable &&
!(IFCAP_TXCSUM & ifp->if_capenable)) {
+   mask &= ~IFCAP_TSO4;
ifp->if_capenable &= ~IFCAP_TSO4;
ifp->if_hwassist &= ~CSUM_IP_TSO;
mlx5_en_err(ifp,
@@ -3335,6 +3336,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
 
 

svn commit: r362001 - in stable/12/sys: fs/tmpfs sys

2020-06-09 Thread Ryan Moeller
Author: freqlabs
Date: Wed Jun 10 03:57:10 2020
New Revision: 362001
URL: https://svnweb.freebsd.org/changeset/base/362001

Log:
  MFC r361748:
  
  tmpfs: Preserve alignment of struct fid fields
  
  On 64-bit platforms, the two short fields in `struct tmpfs_fid` are padded to
  the 64-bit alignment of the long field.  This pushes the offsets of the
  subsequent fields by 4 bytes and makes `struct tmpfs_fid` bigger than
  `struct fid`.  `tmpfs_vptofh()` casts a `struct fid *` to `struct tmpfs_fid 
*`,
  causing 4 bytes of adjacent memory to be overwritten when the struct fields 
are
  set.  Through several layers of indirection and embedded structs, the adjacent
  memory for one particular call to `tmpfs_vptofh()` happens to be the stack
  canary for `nfsrvd_compound()`.  Half of the canary ends up being clobbered,
  going unnoticed until eventually the stack check fails when 
`nfsrvd_compound()`
  returns and a panic is triggered.
  
  Instead of duplicating fields of `struct fid` in `struct tmpfs_fid`, narrow 
the
  struct to cover only the unique fields for tmpfs and assert at compile time
  that the struct fits in the allotted space.  This way we don't have to
  replicate the offsets of `struct fid` fields, we just use them directly.
  
  Reviewed by:kib, mav, rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25077

Modified:
  stable/12/sys/fs/tmpfs/tmpfs.h
  stable/12/sys/fs/tmpfs/tmpfs_vfsops.c
  stable/12/sys/fs/tmpfs/tmpfs_vnops.c
  stable/12/sys/sys/mount.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/tmpfs/tmpfs.h
==
--- stable/12/sys/fs/tmpfs/tmpfs.h  Wed Jun 10 03:36:17 2020
(r362000)
+++ stable/12/sys/fs/tmpfs/tmpfs.h  Wed Jun 10 03:57:10 2020
(r362001)
@@ -37,6 +37,7 @@
 #ifndef _FS_TMPFS_TMPFS_H_
 #define _FS_TMPFS_TMPFS_H_
 
+#include 
 #include 
 #include 
 
@@ -391,12 +392,12 @@ struct tmpfs_mount {
  * This structure maps a file identifier to a tmpfs node.  Used by the
  * NFS code.
  */
-struct tmpfs_fid {
-   uint16_ttf_len;
-   uint16_ttf_pad;
-   ino_t   tf_id;
-   unsigned long   tf_gen;
+struct tmpfs_fid_data {
+   ino_t   tfd_id;
+   unsigned long   tfd_gen;
 };
+_Static_assert(sizeof(struct tmpfs_fid_data) <= MAXFIDSZ,
+"(struct tmpfs_fid_data) is larger than (struct fid).fid_data");
 
 struct tmpfs_dir_cursor {
struct tmpfs_dirent *tdc_current;

Modified: stable/12/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- stable/12/sys/fs/tmpfs/tmpfs_vfsops.c   Wed Jun 10 03:36:17 2020
(r362000)
+++ stable/12/sys/fs/tmpfs/tmpfs_vfsops.c   Wed Jun 10 03:57:10 2020
(r362001)
@@ -560,24 +560,29 @@ static int
 tmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
 struct vnode **vpp)
 {
-   struct tmpfs_fid *tfhp;
+   struct tmpfs_fid_data tfd;
struct tmpfs_mount *tmp;
struct tmpfs_node *node;
int error;
 
+   if (fhp->fid_len != sizeof(tfd))
+   return (EINVAL);
+
+   /*
+* Copy from fid_data onto the stack to avoid unaligned pointer use.
+* See the comment in sys/mount.h on struct fid for details.
+*/
+   memcpy(, fhp->fid_data, fhp->fid_len);
+
tmp = VFS_TO_TMPFS(mp);
 
-   tfhp = (struct tmpfs_fid *)fhp;
-   if (tfhp->tf_len != sizeof(struct tmpfs_fid))
+   if (tfd.tfd_id >= tmp->tm_nodes_max)
return (EINVAL);
 
-   if (tfhp->tf_id >= tmp->tm_nodes_max)
-   return (EINVAL);
-
TMPFS_LOCK(tmp);
LIST_FOREACH(node, >tm_nodes_used, tn_entries) {
-   if (node->tn_id == tfhp->tf_id &&
-   node->tn_gen == tfhp->tf_gen) {
+   if (node->tn_id == tfd.tfd_id &&
+   node->tn_gen == tfd.tfd_gen) {
tmpfs_ref_node(node);
break;
}

Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c
==
--- stable/12/sys/fs/tmpfs/tmpfs_vnops.cWed Jun 10 03:36:17 2020
(r362000)
+++ stable/12/sys/fs/tmpfs/tmpfs_vnops.cWed Jun 10 03:57:10 2020
(r362001)
@@ -1410,16 +1410,28 @@ tmpfs_pathconf(struct vop_pathconf_args *v)
 
 static int
 tmpfs_vptofh(struct vop_vptofh_args *ap)
+/*
+vop_vptofh {
+   IN struct vnode *a_vp;
+   IN struct fid *a_fhp;
+};
+*/
 {
-   struct tmpfs_fid *tfhp;
+   struct tmpfs_fid_data tfd;
struct tmpfs_node *node;
+   struct fid *fhp;
 
-   tfhp = (struct tmpfs_fid *)ap->a_fhp;
node = VP_TO_TMPFS_NODE(ap->a_vp);
+   fhp = ap->a_fhp;
+   fhp->fid_len = 

svn commit: r361862 - in stable: 11/sys/netinet6 12/sys/netinet6

2020-06-05 Thread Ryan Moeller
Author: freqlabs
Date: Sat Jun  6 03:54:06 2020
New Revision: 361862
URL: https://svnweb.freebsd.org/changeset/base/361862

Log:
  MFC r361756, r361757:
  
  scope6: Check for NULL afdata before dereferencing
  
  Narrows the race window with if_detach.
  
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25017

Modified:
  stable/12/sys/netinet6/scope6.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/netinet6/scope6.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/netinet6/scope6.c
==
--- stable/12/sys/netinet6/scope6.c Sat Jun  6 03:09:12 2020
(r361861)
+++ stable/12/sys/netinet6/scope6.c Sat Jun  6 03:54:06 2020
(r361862)
@@ -419,6 +419,10 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, 
in6->s6_addr16[1] = htons(zoneid & 0x); /* XXX */
} else if (scope != IPV6_ADDR_SCOPE_GLOBAL) {
IF_AFDATA_RLOCK(ifp);
+   if (ifp->if_afdata[AF_INET6] == NULL) {
+   IF_AFDATA_RUNLOCK(ifp);
+   return (ENETDOWN);
+   }
sid = SID(ifp);
zoneid = sid->s6id_list[scope];
IF_AFDATA_RUNLOCK(ifp);
___
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: r361862 - in stable: 11/sys/netinet6 12/sys/netinet6

2020-06-05 Thread Ryan Moeller
Author: freqlabs
Date: Sat Jun  6 03:54:06 2020
New Revision: 361862
URL: https://svnweb.freebsd.org/changeset/base/361862

Log:
  MFC r361756, r361757:
  
  scope6: Check for NULL afdata before dereferencing
  
  Narrows the race window with if_detach.
  
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25017

Modified:
  stable/11/sys/netinet6/scope6.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/netinet6/scope6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/netinet6/scope6.c
==
--- stable/11/sys/netinet6/scope6.c Sat Jun  6 03:09:12 2020
(r361861)
+++ stable/11/sys/netinet6/scope6.c Sat Jun  6 03:54:06 2020
(r361862)
@@ -417,6 +417,10 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, 
in6->s6_addr16[1] = htons(zoneid & 0x); /* XXX */
} else if (scope != IPV6_ADDR_SCOPE_GLOBAL) {
IF_AFDATA_RLOCK(ifp);
+   if (ifp->if_afdata[AF_INET6] == NULL) {
+   IF_AFDATA_RUNLOCK(ifp);
+   return (ENETDOWN);
+   }
sid = SID(ifp);
zoneid = sid->s6id_list[scope];
IF_AFDATA_RUNLOCK(ifp);
___
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: r361797 - in stable: 11/sys/kern 12/sys/kern

2020-06-04 Thread Ryan Moeller
Author: freqlabs
Date: Thu Jun  4 17:23:49 2020
New Revision: 361797
URL: https://svnweb.freebsd.org/changeset/base/361797

Log:
  MFC r361699, r361711:
  
  Assign default security flavor when converting old export args
  
  vfs_export requires security flavors be explicitly listed when
  exporting as of r360900.
  
  Use the default AUTH_SYS flavor when converting old export args to
  ensure compatibility with the legacy mount syscall.
  
  Reported by:rmacklem
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25045

Modified:
  stable/11/sys/kern/vfs_mount.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/kern/vfs_mount.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/kern/vfs_mount.c
==
--- stable/11/sys/kern/vfs_mount.c  Thu Jun  4 17:20:58 2020
(r361796)
+++ stable/11/sys/kern/vfs_mount.c  Thu Jun  4 17:23:49 2020
(r361797)
@@ -65,6 +65,9 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -2049,10 +2052,22 @@ kernel_vmount(int flags, ...)
return (error);
 }
 
+/*
+ * Convert the old export args format into new export args.
+ *
+ * The old export args struct does not have security flavors.  Otherwise, the
+ * structs are identical.  The default security flavor 'sys' is applied when
+ * the given args export the filesystem.
+ */
 void
 vfs_oexport_conv(const struct oexport_args *oexp, struct export_args *exp)
 {
 
bcopy(oexp, exp, sizeof(*oexp));
-   exp->ex_numsecflavors = 0;
+   if (exp->ex_flags & MNT_EXPORTED) {
+   exp->ex_numsecflavors = 1;
+   exp->ex_secflavors[0] = AUTH_SYS;
+   } else {
+   exp->ex_numsecflavors = 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: r361797 - in stable: 11/sys/kern 12/sys/kern

2020-06-04 Thread Ryan Moeller
Author: freqlabs
Date: Thu Jun  4 17:23:49 2020
New Revision: 361797
URL: https://svnweb.freebsd.org/changeset/base/361797

Log:
  MFC r361699, r361711:
  
  Assign default security flavor when converting old export args
  
  vfs_export requires security flavors be explicitly listed when
  exporting as of r360900.
  
  Use the default AUTH_SYS flavor when converting old export args to
  ensure compatibility with the legacy mount syscall.
  
  Reported by:rmacklem
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25045

Modified:
  stable/12/sys/kern/vfs_mount.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/kern/vfs_mount.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/kern/vfs_mount.c
==
--- stable/12/sys/kern/vfs_mount.c  Thu Jun  4 17:20:58 2020
(r361796)
+++ stable/12/sys/kern/vfs_mount.c  Thu Jun  4 17:23:49 2020
(r361797)
@@ -68,6 +68,9 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -2043,10 +2046,22 @@ kernel_vmount(int flags, ...)
return (error);
 }
 
+/*
+ * Convert the old export args format into new export args.
+ *
+ * The old export args struct does not have security flavors.  Otherwise, the
+ * structs are identical.  The default security flavor 'sys' is applied when
+ * the given args export the filesystem.
+ */
 void
 vfs_oexport_conv(const struct oexport_args *oexp, struct export_args *exp)
 {
 
bcopy(oexp, exp, sizeof(*oexp));
-   exp->ex_numsecflavors = 0;
+   if (exp->ex_flags & MNT_EXPORTED) {
+   exp->ex_numsecflavors = 1;
+   exp->ex_secflavors[0] = AUTH_SYS;
+   } else {
+   exp->ex_numsecflavors = 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: r361757 - head/sys/netinet6

2020-06-03 Thread Ryan Moeller
Author: freqlabs
Date: Wed Jun  3 17:26:00 2020
New Revision: 361757
URL: https://svnweb.freebsd.org/changeset/base/361757

Log:
  Fix typo in previous commit
  
  Applied the wrong patch
  
  Reported by:  Michael Butler 
  Approved by:  mav (mentor)
  Sponsored by: iXsystems.com

Modified:
  head/sys/netinet6/scope6.c

Modified: head/sys/netinet6/scope6.c
==
--- head/sys/netinet6/scope6.c  Wed Jun  3 16:57:30 2020(r361756)
+++ head/sys/netinet6/scope6.c  Wed Jun  3 17:26:00 2020(r361757)
@@ -422,7 +422,7 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, 
struct epoch_tracker et;
 
NET_EPOCH_ENTER(et);
-   if (ifp->if_afinfo[AF_INET6] == NULL) {
+   if (ifp->if_afdata[AF_INET6] == NULL) {
NET_EPOCH_EXIT(et);
return (ENETDOWN);
}
___
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: r361756 - head/sys/netinet6

2020-06-03 Thread Ryan Moeller
Author: freqlabs
Date: Wed Jun  3 16:57:30 2020
New Revision: 361756
URL: https://svnweb.freebsd.org/changeset/base/361756

Log:
  scope6: Check for NULL afdata before dereferencing
  
  Narrows the race window with if_detach.
  
  Approved by:  mav (mentor)
  MFC after:3 days
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D25017

Modified:
  head/sys/netinet6/scope6.c

Modified: head/sys/netinet6/scope6.c
==
--- head/sys/netinet6/scope6.c  Wed Jun  3 16:51:30 2020(r361755)
+++ head/sys/netinet6/scope6.c  Wed Jun  3 16:57:30 2020(r361756)
@@ -422,6 +422,10 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, 
struct epoch_tracker et;
 
NET_EPOCH_ENTER(et);
+   if (ifp->if_afinfo[AF_INET6] == NULL) {
+   NET_EPOCH_EXIT(et);
+   return (ENETDOWN);
+   }
sid = SID(ifp);
zoneid = sid->s6id_list[scope];
NET_EPOCH_EXIT(et);
___
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: r361748 - in head/sys: fs/tmpfs sys

2020-06-03 Thread Ryan Moeller
Author: freqlabs
Date: Wed Jun  3 09:38:51 2020
New Revision: 361748
URL: https://svnweb.freebsd.org/changeset/base/361748

Log:
  tmpfs: Preserve alignment of struct fid fields
  
  On 64-bit platforms, the two short fields in `struct tmpfs_fid` are padded to
  the 64-bit alignment of the long field.  This pushes the offsets of the
  subsequent fields by 4 bytes and makes `struct tmpfs_fid` bigger than
  `struct fid`.  `tmpfs_vptofh()` casts a `struct fid *` to `struct tmpfs_fid 
*`,
  causing 4 bytes of adjacent memory to be overwritten when the struct fields 
are
  set.  Through several layers of indirection and embedded structs, the adjacent
  memory for one particular call to `tmpfs_vptofh()` happens to be the stack
  canary for `nfsrvd_compound()`.  Half of the canary ends up being clobbered,
  going unnoticed until eventually the stack check fails when 
`nfsrvd_compound()`
  returns and a panic is triggered.
  
  Instead of duplicating fields of `struct fid` in `struct tmpfs_fid`, narrow 
the
  struct to cover only the unique fields for tmpfs and assert at compile time
  that the struct fits in the allotted space.  This way we don't have to
  replicate the offsets of `struct fid` fields, we just use them directly.
  
  Reviewed by:  kib, mav, rmacklem
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D25077

Modified:
  head/sys/fs/tmpfs/tmpfs.h
  head/sys/fs/tmpfs/tmpfs_vfsops.c
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/sys/mount.h

Modified: head/sys/fs/tmpfs/tmpfs.h
==
--- head/sys/fs/tmpfs/tmpfs.h   Wed Jun  3 05:49:19 2020(r361747)
+++ head/sys/fs/tmpfs/tmpfs.h   Wed Jun  3 09:38:51 2020(r361748)
@@ -37,6 +37,7 @@
 #ifndef _FS_TMPFS_TMPFS_H_
 #define _FS_TMPFS_TMPFS_H_
 
+#include 
 #include 
 #include 
 
@@ -393,12 +394,12 @@ struct tmpfs_mount {
  * This structure maps a file identifier to a tmpfs node.  Used by the
  * NFS code.
  */
-struct tmpfs_fid {
-   uint16_ttf_len;
-   uint16_ttf_pad;
-   ino_t   tf_id;
-   unsigned long   tf_gen;
+struct tmpfs_fid_data {
+   ino_t   tfd_id;
+   unsigned long   tfd_gen;
 };
+_Static_assert(sizeof(struct tmpfs_fid_data) <= MAXFIDSZ,
+"(struct tmpfs_fid_data) is larger than (struct fid).fid_data");
 
 struct tmpfs_dir_cursor {
struct tmpfs_dirent *tdc_current;

Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- head/sys/fs/tmpfs/tmpfs_vfsops.cWed Jun  3 05:49:19 2020
(r361747)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.cWed Jun  3 09:38:51 2020
(r361748)
@@ -566,24 +566,29 @@ static int
 tmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
 struct vnode **vpp)
 {
-   struct tmpfs_fid *tfhp;
+   struct tmpfs_fid_data tfd;
struct tmpfs_mount *tmp;
struct tmpfs_node *node;
int error;
 
+   if (fhp->fid_len != sizeof(tfd))
+   return (EINVAL);
+
+   /*
+* Copy from fid_data onto the stack to avoid unaligned pointer use.
+* See the comment in sys/mount.h on struct fid for details.
+*/
+   memcpy(, fhp->fid_data, fhp->fid_len);
+
tmp = VFS_TO_TMPFS(mp);
 
-   tfhp = (struct tmpfs_fid *)fhp;
-   if (tfhp->tf_len != sizeof(struct tmpfs_fid))
+   if (tfd.tfd_id >= tmp->tm_nodes_max)
return (EINVAL);
 
-   if (tfhp->tf_id >= tmp->tm_nodes_max)
-   return (EINVAL);
-
TMPFS_LOCK(tmp);
LIST_FOREACH(node, >tm_nodes_used, tn_entries) {
-   if (node->tn_id == tfhp->tf_id &&
-   node->tn_gen == tfhp->tf_gen) {
+   if (node->tn_id == tfd.tfd_id &&
+   node->tn_gen == tfd.tfd_gen) {
tmpfs_ref_node(node);
break;
}

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jun  3 05:49:19 2020
(r361747)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jun  3 09:38:51 2020
(r361748)
@@ -1435,16 +1435,28 @@ tmpfs_pathconf(struct vop_pathconf_args *v)
 
 static int
 tmpfs_vptofh(struct vop_vptofh_args *ap)
+/*
+vop_vptofh {
+   IN struct vnode *a_vp;
+   IN struct fid *a_fhp;
+};
+*/
 {
-   struct tmpfs_fid *tfhp;
+   struct tmpfs_fid_data tfd;
struct tmpfs_node *node;
+   struct fid *fhp;
 
-   tfhp = (struct tmpfs_fid *)ap->a_fhp;
node = VP_TO_TMPFS_NODE(ap->a_vp);
+   fhp = ap->a_fhp;
+   fhp->fid_len = sizeof(tfd);
 
-   tfhp->tf_len = sizeof(struct tmpfs_fid);
-   tfhp->tf_id = node->tn_id;
-   tfhp->tf_gen = node->tn_gen;
+   

Re: svn commit: r361711 - head/sys/kern

2020-06-01 Thread Ryan Moeller

On 6/1/20 8:03 PM, Rick Macklem wrote:


Author: rmacklem
Date: Tue Jun  2 00:03:26 2020
New Revision: 361711
URL: https://svnweb.freebsd.org/changeset/base/361711

Log:
   Fix build issue introduced by r361699.

Oops, that was easily avoidable. :/ Thanks for picking up the pieces.
   
   Reported by:	cy (and others)


Modified:
   head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Mon Jun  1 23:44:03 2020(r361710)
+++ head/sys/kern/vfs_mount.c   Tue Jun  2 00:03:26 2020(r361711)
@@ -70,6 +70,9 @@ __FBSDID("$FreeBSD$");
  
  #include 
  
+#include 

+#include 
+
  #include 
  #include 
  

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361699 - head/sys/kern

2020-06-01 Thread Ryan Moeller
Author: freqlabs
Date: Mon Jun  1 18:43:51 2020
New Revision: 361699
URL: https://svnweb.freebsd.org/changeset/base/361699

Log:
  Assign default security flavor when converting old export args
  
  vfs_export requires security flavors be explicitly listed when
  exporting as of r360900.
  
  Use the default AUTH_SYS flavor when converting old export args to
  ensure compatibility with the legacy mount syscall.
  
  Reported by:  rmacklem
  Reviewed by:  rmacklem
  Approved by:  mav (mentor)
  MFC after:3 days
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D25045

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Mon Jun  1 16:14:29 2020(r361698)
+++ head/sys/kern/vfs_mount.c   Mon Jun  1 18:43:51 2020(r361699)
@@ -2343,10 +2343,22 @@ kernel_vmount(int flags, ...)
return (error);
 }
 
+/*
+ * Convert the old export args format into new export args.
+ *
+ * The old export args struct does not have security flavors.  Otherwise, the
+ * structs are identical.  The default security flavor 'sys' is applied when
+ * the given args export the filesystem.
+ */
 void
 vfs_oexport_conv(const struct oexport_args *oexp, struct export_args *exp)
 {
 
bcopy(oexp, exp, sizeof(*oexp));
-   exp->ex_numsecflavors = 0;
+   if (exp->ex_flags & MNT_EXPORTED) {
+   exp->ex_numsecflavors = 1;
+   exp->ex_secflavors[0] = AUTH_SYS;
+   } else {
+   exp->ex_numsecflavors = 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: r361589 - in stable/12: lib/libugidfw sbin/mksnap_ffs sbin/umount sys/fs/nfs sys/fs/nfsserver sys/kern sys/security/mac_bsdextended sys/sys usr.sbin/autofs usr.sbin/mountd

2020-05-28 Thread Ryan Moeller
Author: freqlabs
Date: Thu May 28 17:08:39 2020
New Revision: 361589
URL: https://svnweb.freebsd.org/changeset/base/361589

Log:
  MFC r361313:
  
  Deduplicate fsid comparisons
  
  Comparing fsid_t objects requires internal knowledge of the fsid structure
  and yet this is duplicated across a number of places in the code.
  
  Simplify by creating a fsidcmp function (macro).
  
  Reviewed by:mjg, rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D24749

Modified:
  stable/12/lib/libugidfw/ugidfw.c
  stable/12/sbin/mksnap_ffs/mksnap_ffs.c
  stable/12/sbin/umount/umount.c
  stable/12/sys/fs/nfs/nfsdport.h
  stable/12/sys/fs/nfsserver/nfs_nfsdport.c
  stable/12/sys/fs/nfsserver/nfs_nfsdsocket.c
  stable/12/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/12/sys/kern/vfs_subr.c
  stable/12/sys/security/mac_bsdextended/mac_bsdextended.c
  stable/12/sys/security/mac_bsdextended/mac_bsdextended.h
  stable/12/sys/sys/mount.h
  stable/12/usr.sbin/autofs/autounmountd.c
  stable/12/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libugidfw/ugidfw.c
==
--- stable/12/lib/libugidfw/ugidfw.cThu May 28 16:34:53 2020
(r361588)
+++ stable/12/lib/libugidfw/ugidfw.cThu May 28 17:08:39 2020
(r361589)
@@ -334,9 +334,8 @@ bsde_rule_to_string(struct mac_bsdextended_rule *rule,
if (rule->mbr_object.mbo_flags & MBO_FSID_DEFINED) {
numfs = getmntinfo(, MNT_NOWAIT);
for (i = 0; i < numfs; i++)
-   if (memcmp(&(rule->mbr_object.mbo_fsid),
-   &(mntbuf[i].f_fsid),
-   sizeof(mntbuf[i].f_fsid)) == 0)
+   if (fsidcmp(>mbr_object.mbo_fsid,
+   [i].f_fsid) == 0)
break;
len = snprintf(cur, left, "filesys %s ",
i == numfs ? "???" : mntbuf[i].f_mntonname);

Modified: stable/12/sbin/mksnap_ffs/mksnap_ffs.c
==
--- stable/12/sbin/mksnap_ffs/mksnap_ffs.c  Thu May 28 16:34:53 2020
(r361588)
+++ stable/12/sbin/mksnap_ffs/mksnap_ffs.c  Thu May 28 17:08:39 2020
(r361589)
@@ -81,8 +81,7 @@ issamefs(const char *path, struct statfs *stfsp)
return (-1);
if (statfs(path, ) < 0)
return (-1);
-   if ((stfsbuf.f_fsid.val[0] != stfsp->f_fsid.val[0]) ||
-   (stfsbuf.f_fsid.val[1] != stfsp->f_fsid.val[1]))
+   if (fsidcmp(_fsid, >f_fsid) != 0)
return (0);
return (1);
 }

Modified: stable/12/sbin/umount/umount.c
==
--- stable/12/sbin/umount/umount.c  Thu May 28 16:34:53 2020
(r361588)
+++ stable/12/sbin/umount/umount.c  Thu May 28 17:08:39 2020
(r361589)
@@ -505,8 +505,7 @@ getmntentry(const char *fromname, const char *onname, 
continue;
if (onname != NULL && strcmp(sfs->f_mntonname, onname) != 0)
continue;
-   if (fsid != NULL && bcmp(>f_fsid, fsid,
-   sizeof(*fsid)) != 0)
+   if (fsid != NULL && fsidcmp(>f_fsid, fsid) != 0)
continue;
 
switch (what) {

Modified: stable/12/sys/fs/nfs/nfsdport.h
==
--- stable/12/sys/fs/nfs/nfsdport.h Thu May 28 16:34:53 2020
(r361588)
+++ stable/12/sys/fs/nfs/nfsdport.h Thu May 28 17:08:39 2020
(r361589)
@@ -85,8 +85,7 @@ struct nfsexstuff {
 #defineNFSVNO_SETEXRDONLY(e)   ((e)->nes_exflag = 
(MNT_EXPORTED|MNT_EXRDONLY))
 
 #defineNFSVNO_CMPFH(f1, f2)
\
-((f1)->fh_fsid.val[0] == (f2)->fh_fsid.val[0] &&   \
- (f1)->fh_fsid.val[1] == (f2)->fh_fsid.val[1] &&   \
+(fsidcmp(&(f1)->fh_fsid, &(f2)->fh_fsid) == 0 &&   \
  bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0)
 
 #defineNFSLOCKHASH(f)  
\

Modified: stable/12/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/12/sys/fs/nfsserver/nfs_nfsdport.c   Thu May 28 16:34:53 2020
(r361588)
+++ stable/12/sys/fs/nfsserver/nfs_nfsdport.c   Thu May 28 17:08:39 2020
(r361589)
@@ -3969,11 +3969,8 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, 
if (tds->nfsdev_nmp != NULL) {
if (tds->nfsdev_mdsisset == 0 && ds == NULL)

svn commit: r361314 - stable/12/usr.sbin/jail

2020-05-20 Thread Ryan Moeller
Author: freqlabs
Date: Thu May 21 02:04:10 2020
New Revision: 361314
URL: https://svnweb.freebsd.org/changeset/base/361314

Log:
  MFC r361066:
  
  jail: Add exec.prepare and exec.release command hooks
  
  This change introduces new jail command hooks that run before and after any
  other actions.
  
  The exec.prepare hook can be used for example to invoke a script that checks
  if the jail's root exists, creating it if it does not. Since arbitrary
  variables in jail.conf can be passed to the command, it can be pretty useful
  for templating jails.
  
  An example use case for exec.release would be to remove the filesystem of an
  ephemeral jail.
  
  The names "prepare" and "release" are borrowed from the names of similar hooks
  in libvirt.
  
  Reviewed by:jamie, manpages, mmacy
  Approved by:mmacy (mentor)
  Differential Revision:  https://reviews.freebsd.org/D24829

Modified:
  stable/12/usr.sbin/jail/command.c
  stable/12/usr.sbin/jail/config.c
  stable/12/usr.sbin/jail/jail.8
  stable/12/usr.sbin/jail/jail.c
  stable/12/usr.sbin/jail/jailp.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/jail/command.c
==
--- stable/12/usr.sbin/jail/command.c   Thu May 21 01:55:35 2020
(r361313)
+++ stable/12/usr.sbin/jail/command.c   Thu May 21 02:04:10 2020
(r361314)
@@ -148,7 +148,8 @@ next_command(struct cfjail *j)
if (j->comstring == NULL || j->comstring->len == 0 ||
(create_failed && (comparam == IP_EXEC_PRESTART ||
comparam == IP_EXEC_CREATED || comparam == IP_EXEC_START ||
-   comparam == IP_COMMAND || comparam == IP_EXEC_POSTSTART)))
+   comparam == IP_COMMAND || comparam == IP_EXEC_POSTSTART ||
+   comparam == IP_EXEC_PREPARE)))
continue;
switch (run_command(j)) {
case -1:

Modified: stable/12/usr.sbin/jail/config.c
==
--- stable/12/usr.sbin/jail/config.cThu May 21 01:55:35 2020
(r361313)
+++ stable/12/usr.sbin/jail/config.cThu May 21 02:04:10 2020
(r361314)
@@ -71,8 +71,10 @@ static const struct ipspec intparams[] = {
 [IP_EXEC_JAIL_USER] =  {"exec.jail_user",  PF_INTERNAL},
 [IP_EXEC_POSTSTART] =  {"exec.poststart",  PF_INTERNAL},
 [IP_EXEC_POSTSTOP] =   {"exec.poststop",   PF_INTERNAL},
+[IP_EXEC_PREPARE] ={"exec.prepare",PF_INTERNAL},
 [IP_EXEC_PRESTART] =   {"exec.prestart",   PF_INTERNAL},
 [IP_EXEC_PRESTOP] ={"exec.prestop",PF_INTERNAL},
+[IP_EXEC_RELEASE] ={"exec.release",PF_INTERNAL},
 [IP_EXEC_CREATED] ={"exec.created",PF_INTERNAL},
 [IP_EXEC_START] =  {"exec.start",  PF_INTERNAL},
 [IP_EXEC_STOP] =   {"exec.stop",   PF_INTERNAL},

Modified: stable/12/usr.sbin/jail/jail.8
==
--- stable/12/usr.sbin/jail/jail.8  Thu May 21 01:55:35 2020
(r361313)
+++ stable/12/usr.sbin/jail/jail.8  Thu May 21 02:04:10 2020
(r361314)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 17, 2020
+.Dd May 14, 2020
 .Dt JAIL 8
 .Os
 .Sh NAME
@@ -724,6 +724,11 @@ not be created or removed, as appropriate.
 .Pp
 The pseudo-parameters are:
 .Bl -tag -width indent
+.It Va exec.prepare
+Command(s) to run in the system environment to prepare a jail for creation.
+These commands are executed before assigning IP addresses and mounting
+filesystems, so they may be used to create a new jail filesystem if it does
+not already exist.
 .It Va exec.prestart
 Command(s) to run in the system environment before a jail is created.
 .It Va exec.created
@@ -758,6 +763,11 @@ A typical command to run is
 .Dq sh /etc/rc.shutdown jail .
 .It Va exec.poststop
 Command(s) to run in the system environment after a jail is removed.
+.It Va exec.release
+Command(s) to run in the system environment after all other actions are done.
+These commands are executed after unmounting filesystems and removing IP
+addresses, so they may be used to remove a jail filesystem if it is no longer
+needed.
 .It Va exec.clean
 Run commands in a clean environment.
 The environment is discarded except for

Modified: stable/12/usr.sbin/jail/jail.c
==
--- stable/12/usr.sbin/jail/jail.c  Thu May 21 01:55:35 2020
(r361313)
+++ stable/12/usr.sbin/jail/jail.c  Thu May 21 02:04:10 2020
(r361314)
@@ -87,6 +87,7 @@ static struct permspec perm_sysctl[] = {
 
 static const enum intparam startcommands[] = {
 IP__NULL,
+IP_EXEC_PREPARE,
 #ifdef INET
 IP__IP4_IFADDR,
 #endif
@@ 

svn commit: r361313 - in head: lib/libugidfw sbin/mksnap_ffs sbin/umount sys/fs/nfs sys/fs/nfsserver sys/kern sys/security/mac_bsdextended sys/sys usr.sbin/autofs usr.sbin/mountd

2020-05-20 Thread Ryan Moeller
Author: freqlabs
Date: Thu May 21 01:55:35 2020
New Revision: 361313
URL: https://svnweb.freebsd.org/changeset/base/361313

Log:
  Deduplicate fsid comparisons
  
  Comparing fsid_t objects requires internal knowledge of the fsid structure
  and yet this is duplicated across a number of places in the code.
  
  Simplify by creating a fsidcmp function (macro).
  
  Reviewed by:  mjg, rmacklem
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D24749

Modified:
  head/lib/libugidfw/ugidfw.c
  head/sbin/mksnap_ffs/mksnap_ffs.c
  head/sbin/umount/umount.c
  head/sys/fs/nfs/nfsdport.h
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/nfsserver/nfs_nfsdsocket.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c
  head/sys/kern/vfs_subr.c
  head/sys/security/mac_bsdextended/mac_bsdextended.c
  head/sys/security/mac_bsdextended/mac_bsdextended.h
  head/sys/sys/mount.h
  head/usr.sbin/autofs/autounmountd.c
  head/usr.sbin/mountd/mountd.c

Modified: head/lib/libugidfw/ugidfw.c
==
--- head/lib/libugidfw/ugidfw.c Thu May 21 01:55:10 2020(r361312)
+++ head/lib/libugidfw/ugidfw.c Thu May 21 01:55:35 2020(r361313)
@@ -334,9 +334,8 @@ bsde_rule_to_string(struct mac_bsdextended_rule *rule,
if (rule->mbr_object.mbo_flags & MBO_FSID_DEFINED) {
numfs = getmntinfo(, MNT_NOWAIT);
for (i = 0; i < numfs; i++)
-   if (memcmp(&(rule->mbr_object.mbo_fsid),
-   &(mntbuf[i].f_fsid),
-   sizeof(mntbuf[i].f_fsid)) == 0)
+   if (fsidcmp(>mbr_object.mbo_fsid,
+   [i].f_fsid) == 0)
break;
len = snprintf(cur, left, "filesys %s ",
i == numfs ? "???" : mntbuf[i].f_mntonname);

Modified: head/sbin/mksnap_ffs/mksnap_ffs.c
==
--- head/sbin/mksnap_ffs/mksnap_ffs.c   Thu May 21 01:55:10 2020
(r361312)
+++ head/sbin/mksnap_ffs/mksnap_ffs.c   Thu May 21 01:55:35 2020
(r361313)
@@ -81,8 +81,7 @@ issamefs(const char *path, struct statfs *stfsp)
return (-1);
if (statfs(path, ) < 0)
return (-1);
-   if ((stfsbuf.f_fsid.val[0] != stfsp->f_fsid.val[0]) ||
-   (stfsbuf.f_fsid.val[1] != stfsp->f_fsid.val[1]))
+   if (fsidcmp(_fsid, >f_fsid) != 0)
return (0);
return (1);
 }

Modified: head/sbin/umount/umount.c
==
--- head/sbin/umount/umount.c   Thu May 21 01:55:10 2020(r361312)
+++ head/sbin/umount/umount.c   Thu May 21 01:55:35 2020(r361313)
@@ -505,8 +505,7 @@ getmntentry(const char *fromname, const char *onname, 
continue;
if (onname != NULL && strcmp(sfs->f_mntonname, onname) != 0)
continue;
-   if (fsid != NULL && bcmp(>f_fsid, fsid,
-   sizeof(*fsid)) != 0)
+   if (fsid != NULL && fsidcmp(>f_fsid, fsid) != 0)
continue;
 
switch (what) {

Modified: head/sys/fs/nfs/nfsdport.h
==
--- head/sys/fs/nfs/nfsdport.h  Thu May 21 01:55:10 2020(r361312)
+++ head/sys/fs/nfs/nfsdport.h  Thu May 21 01:55:35 2020(r361313)
@@ -85,8 +85,7 @@ struct nfsexstuff {
 #defineNFSVNO_SETEXRDONLY(e)   ((e)->nes_exflag = 
(MNT_EXPORTED|MNT_EXRDONLY))
 
 #defineNFSVNO_CMPFH(f1, f2)
\
-((f1)->fh_fsid.val[0] == (f2)->fh_fsid.val[0] &&   \
- (f1)->fh_fsid.val[1] == (f2)->fh_fsid.val[1] &&   \
+(fsidcmp(&(f1)->fh_fsid, &(f2)->fh_fsid) == 0 &&   \
  bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0)
 
 #defineNFSLOCKHASH(f)  
\

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==
--- head/sys/fs/nfsserver/nfs_nfsdport.cThu May 21 01:55:10 2020
(r361312)
+++ head/sys/fs/nfsserver/nfs_nfsdport.cThu May 21 01:55:35 2020
(r361313)
@@ -4019,11 +4019,8 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, 
if (tds->nfsdev_nmp != NULL) {
if (tds->nfsdev_mdsisset == 0 && ds == NULL)
ds = tds;
-   else if (tds->nfsdev_mdsisset != 0 &&
-   mp->mnt_stat.f_fsid.val[0] ==
-   

svn commit: r361265 - head

2020-05-19 Thread Ryan Moeller
Author: freqlabs
Date: Tue May 19 18:41:46 2020
New Revision: 361265
URL: https://svnweb.freebsd.org/changeset/base/361265

Log:
  Mention new jail(8) command hooks in RELNOTES
  
  Reported by:  0mp
  Approved by:  mmacy (mentor)

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Tue May 19 18:38:46 2020(r361264)
+++ head/RELNOTES   Tue May 19 18:41:46 2020(r361265)
@@ -13,6 +13,12 @@ Changes to this file should not be MFCed.
 r361238:
ZFS will now reject read(2) of a dirfd with EISDIR.
 
+r361066:
+   Add exec.prepare and exec.release hooks for jail(8) and jail.conf(5).
+   exec.prepare runs before mounts, so can be used to populate new jails.
+   exec.release runs after unmounts, so can be used to remove ephemeral
+   jails.
+
 r360920,r360923,r360924,r360927,r360928,r360931,r360933,r360936:
Remove support for ARC4, Blowfish, Cast, DES, Triple DES, MD5,
MD5-KPDK, MD5-HMAC, SHA1-KPDK, and Skipjack algorithms from
___
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: r361264 - head

2020-05-19 Thread Ryan Moeller
Author: freqlabs
Date: Tue May 19 18:38:46 2020
New Revision: 361264
URL: https://svnweb.freebsd.org/changeset/base/361264

Log:
  Mention new dd flags in RELNOTES
  
  Approved by:  mmacy (mentor)
  Sponsored by: iXsystems, Inc.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Tue May 19 18:35:08 2020(r361263)
+++ head/RELNOTES   Tue May 19 18:38:46 2020(r361264)
@@ -87,6 +87,10 @@ r352304:
ntpd is no longer by default locked in memory. rlimit memlock 32
or rlimit memlock 0 can be used to restore this behaviour.
 
+r351770,r352920,r352922,r352923:
+   dd(1) now supports conv=fsync, conv=fdatasync, oflag=fsync, oflag=sync,
+   and iflag=fullblock flags, compatible with illumos and GNU.
+
 r351522:
Add kernel-side support for in-kernel Transport Layer Security
(KTLS).  KTLS permits using sendfile(2) over sockets using
___
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: r361236 - in stable: 11/sys/fs/nfs 11/sys/fs/nfsclient 11/sys/fs/nfsserver 12/sys/fs/nfs 12/sys/fs/nfsclient 12/sys/fs/nfsserver

2020-05-18 Thread Ryan Moeller
Author: freqlabs
Date: Tue May 19 01:43:00 2020
New Revision: 361236
URL: https://svnweb.freebsd.org/changeset/base/361236

Log:
  MFC r360960:
  
  nfs: Remove APPLESTATIC macro
  
  It is no longer useful.
  
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D24811

Modified:
  stable/12/sys/fs/nfs/nfs_commonacl.c
  stable/12/sys/fs/nfs/nfs_commonsubs.c
  stable/12/sys/fs/nfs/nfsport.h
  stable/12/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/12/sys/fs/nfsclient/nfs_clport.c
  stable/12/sys/fs/nfsclient/nfs_clrpcops.c
  stable/12/sys/fs/nfsclient/nfs_clstate.c
  stable/12/sys/fs/nfsserver/nfs_nfsdcache.c
  stable/12/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/12/sys/fs/nfsserver/nfs_nfsdsocket.c
  stable/12/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/12/sys/fs/nfsserver/nfs_nfsdsubs.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/fs/nfs/nfs_commonacl.c
  stable/11/sys/fs/nfs/nfs_commonsubs.c
  stable/11/sys/fs/nfs/nfsport.h
  stable/11/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/11/sys/fs/nfsclient/nfs_clport.c
  stable/11/sys/fs/nfsclient/nfs_clrpcops.c
  stable/11/sys/fs/nfsclient/nfs_clstate.c
  stable/11/sys/fs/nfsserver/nfs_nfsdcache.c
  stable/11/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/11/sys/fs/nfsserver/nfs_nfsdsocket.c
  stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/11/sys/fs/nfsserver/nfs_nfsdsubs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/fs/nfs/nfs_commonacl.c
==
--- stable/12/sys/fs/nfs/nfs_commonacl.cTue May 19 01:40:45 2020
(r361235)
+++ stable/12/sys/fs/nfs/nfs_commonacl.cTue May 19 01:43:00 2020
(r361236)
@@ -40,7 +40,7 @@ static int nfsrv_acemasktoperm(u_int32_t acetype, u_in
 /*
  * Handle xdr for an ace.
  */
-APPLESTATIC int
+int
 nfsrv_dissectace(struct nfsrv_descript *nd, struct acl_entry *acep,
 int *aceerrp, int *acesizep, NFSPROC_T *p)
 {
@@ -388,7 +388,7 @@ nfsrv_buildace(struct nfsrv_descript *nd, u_char *name
 /*
  * Build an NFSv4 ACL.
  */
-APPLESTATIC int
+int
 nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *aclp, enum vtype type,
 NFSPROC_T *p)
 {
@@ -451,7 +451,7 @@ nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *ac
  * Compare two NFSv4 acls.
  * Return 0 if they are the same, 1 if not the same.
  */
-APPLESTATIC int
+int
 nfsrv_compareacl(NFSACL_T *aclp1, NFSACL_T *aclp2)
 {
int i;

Modified: stable/12/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/12/sys/fs/nfs/nfs_commonsubs.c   Tue May 19 01:40:45 2020
(r361235)
+++ stable/12/sys/fs/nfs/nfs_commonsubs.c   Tue May 19 01:43:00 2020
(r361236)
@@ -282,7 +282,7 @@ static int nfs_bigrequest[NFSV41_NPROCS] = {
  * Start building a request. Mostly just put the first file handle in
  * place.
  */
-APPLESTATIC void
+void
 nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp,
 u_int8_t *nfhp, int fhlen, u_int32_t **opcntpp, struct nfsclsession *sep,
 int vers, int minorvers)
@@ -415,7 +415,7 @@ nfscl_reqstart(struct nfsrv_descript *nd, int procnum,
 /*
  * Put a state Id in the mbuf list.
  */
-APPLESTATIC void
+void
 nfsm_stateidtom(struct nfsrv_descript *nd, nfsv4stateid_t *stateidp, int flag)
 {
nfsv4stateid_t *st;
@@ -651,7 +651,7 @@ out:
  * This is used by the macro NFSM_DISSECT for tough
  * cases.
  */
-APPLESTATIC void *
+void *
 nfsm_dissct(struct nfsrv_descript *nd, int siz, int how)
 {
mbuf_t mp2;
@@ -717,7 +717,7 @@ nfsm_dissct(struct nfsrv_descript *nd, int siz, int ho
  * here than check for offs > 0 for all calls to nfsm_advance.
  * If left == -1, it should be calculated here.
  */
-APPLESTATIC int
+int
 nfsm_advance(struct nfsrv_descript *nd, int offs, int left)
 {
int error = 0;
@@ -765,7 +765,7 @@ out:
  * Copy a string into mbuf(s).
  * Return the number of bytes output, including XDR overheads.
  */
-APPLESTATIC int
+int
 nfsm_strtom(struct nfsrv_descript *nd, const char *cp, int siz)
 {
mbuf_t m2;
@@ -822,7 +822,7 @@ nfsm_strtom(struct nfsrv_descript *nd, const char *cp,
 /*
  * Called once to initialize data structures...
  */
-APPLESTATIC void
+void
 newnfs_init(void)
 {
static int nfs_inited = 0;
@@ -852,7 +852,7 @@ newnfs_init(void)
  * set_true == 1 if there should be an newnfs_true prepended on the file 
handle.
  * Return the number of bytes output, including XDR overhead.
  */
-APPLESTATIC int
+int
 nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, int size, int set_true)
 {
u_int32_t *tl;
@@ -895,7 +895,7 @@ nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, i
  * The AF_INET family is handled as a special case so that address mbufs
  * don't need to be saved to store "struct 

svn commit: r361236 - in stable: 11/sys/fs/nfs 11/sys/fs/nfsclient 11/sys/fs/nfsserver 12/sys/fs/nfs 12/sys/fs/nfsclient 12/sys/fs/nfsserver

2020-05-18 Thread Ryan Moeller
Author: freqlabs
Date: Tue May 19 01:43:00 2020
New Revision: 361236
URL: https://svnweb.freebsd.org/changeset/base/361236

Log:
  MFC r360960:
  
  nfs: Remove APPLESTATIC macro
  
  It is no longer useful.
  
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D24811

Modified:
  stable/11/sys/fs/nfs/nfs_commonacl.c
  stable/11/sys/fs/nfs/nfs_commonsubs.c
  stable/11/sys/fs/nfs/nfsport.h
  stable/11/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/11/sys/fs/nfsclient/nfs_clport.c
  stable/11/sys/fs/nfsclient/nfs_clrpcops.c
  stable/11/sys/fs/nfsclient/nfs_clstate.c
  stable/11/sys/fs/nfsserver/nfs_nfsdcache.c
  stable/11/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/11/sys/fs/nfsserver/nfs_nfsdsocket.c
  stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/11/sys/fs/nfsserver/nfs_nfsdsubs.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/fs/nfs/nfs_commonacl.c
  stable/12/sys/fs/nfs/nfs_commonsubs.c
  stable/12/sys/fs/nfs/nfsport.h
  stable/12/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/12/sys/fs/nfsclient/nfs_clport.c
  stable/12/sys/fs/nfsclient/nfs_clrpcops.c
  stable/12/sys/fs/nfsclient/nfs_clstate.c
  stable/12/sys/fs/nfsserver/nfs_nfsdcache.c
  stable/12/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/12/sys/fs/nfsserver/nfs_nfsdsocket.c
  stable/12/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/12/sys/fs/nfsserver/nfs_nfsdsubs.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs_commonacl.c
==
--- stable/11/sys/fs/nfs/nfs_commonacl.cTue May 19 01:40:45 2020
(r361235)
+++ stable/11/sys/fs/nfs/nfs_commonacl.cTue May 19 01:43:00 2020
(r361236)
@@ -38,7 +38,7 @@ static int nfsrv_acemasktoperm(u_int32_t acetype, u_in
 /*
  * Handle xdr for an ace.
  */
-APPLESTATIC int
+int
 nfsrv_dissectace(struct nfsrv_descript *nd, struct acl_entry *acep,
 int *aceerrp, int *acesizep, NFSPROC_T *p)
 {
@@ -386,7 +386,7 @@ nfsrv_buildace(struct nfsrv_descript *nd, u_char *name
 /*
  * Build an NFSv4 ACL.
  */
-APPLESTATIC int
+int
 nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *aclp, enum vtype type,
 NFSPROC_T *p)
 {
@@ -448,7 +448,7 @@ nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *ac
 /*
  * Set an NFSv4 acl.
  */
-APPLESTATIC int
+int
 nfsrv_setacl(vnode_t vp, NFSACL_T *aclp, struct ucred *cred,
 NFSPROC_T *p)
 {
@@ -479,7 +479,7 @@ out:
  * Compare two NFSv4 acls.
  * Return 0 if they are the same, 1 if not the same.
  */
-APPLESTATIC int
+int
 nfsrv_compareacl(NFSACL_T *aclp1, NFSACL_T *aclp2)
 {
int i;

Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/11/sys/fs/nfs/nfs_commonsubs.c   Tue May 19 01:40:45 2020
(r361235)
+++ stable/11/sys/fs/nfs/nfs_commonsubs.c   Tue May 19 01:43:00 2020
(r361236)
@@ -286,7 +286,7 @@ out:
  * This is used by the macro NFSM_DISSECT for tough
  * cases.
  */
-APPLESTATIC void *
+void *
 nfsm_dissct(struct nfsrv_descript *nd, int siz, int how)
 {
mbuf_t mp2;
@@ -352,7 +352,7 @@ nfsm_dissct(struct nfsrv_descript *nd, int siz, int ho
  * here than check for offs > 0 for all calls to nfsm_advance.
  * If left == -1, it should be calculated here.
  */
-APPLESTATIC int
+int
 nfsm_advance(struct nfsrv_descript *nd, int offs, int left)
 {
int error = 0;
@@ -400,7 +400,7 @@ out:
  * Copy a string into mbuf(s).
  * Return the number of bytes output, including XDR overheads.
  */
-APPLESTATIC int
+int
 nfsm_strtom(struct nfsrv_descript *nd, const char *cp, int siz)
 {
mbuf_t m2;
@@ -457,7 +457,7 @@ nfsm_strtom(struct nfsrv_descript *nd, const char *cp,
 /*
  * Called once to initialize data structures...
  */
-APPLESTATIC void
+void
 newnfs_init(void)
 {
static int nfs_inited = 0;
@@ -487,7 +487,7 @@ newnfs_init(void)
  * set_true == 1 if there should be an newnfs_true prepended on the file 
handle.
  * Return the number of bytes output, including XDR overhead.
  */
-APPLESTATIC int
+int
 nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, int size, int set_true)
 {
u_int32_t *tl;
@@ -530,7 +530,7 @@ nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, i
  * The AF_INET family is handled as a special case so that address mbufs
  * don't need to be saved to store "struct in_addr", which is only 4 bytes.
  */
-APPLESTATIC int
+int
 nfsaddr_match(int family, union nethostaddr *haddr, NFSSOCKADDR_T nam)
 {
struct sockaddr_in *inetaddr;
@@ -563,7 +563,7 @@ nfsaddr_match(int family, union nethostaddr *haddr, NF
 /*
  * Similar to the above, but takes to NFSSOCKADDR_T args.
  */
-APPLESTATIC int
+int
 nfsaddr2_match(NFSSOCKADDR_T nam1, NFSSOCKADDR_T nam2)
 {
struct sockaddr_in *addr1, *addr2;
@@ -601,7 +601,7 @@ 

svn commit: r361147 - in stable: 11/sys/kern 12/sys/kern

2020-05-17 Thread Ryan Moeller
Author: freqlabs
Date: Mon May 18 00:32:42 2020
New Revision: 361147
URL: https://svnweb.freebsd.org/changeset/base/361147

Log:
  MFC r360900:
  
  vfs_exports: Tighten bounds and assert consistency of numsecflavors
  
  We know the value must be greater than 0 and less than MAXSECFLAVORS.
  
  Reject values outside this range in the initial check in vfs_export and add
  KASSERTs in the later consumers.
  
  Also check that we are called with one of either MNT_DELEXPORT or MNT_EXPORTED
  set.
  
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D24753

Modified:
  stable/11/sys/kern/vfs_export.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/kern/vfs_export.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/kern/vfs_export.c
==
--- stable/11/sys/kern/vfs_export.c Mon May 18 00:07:45 2020
(r361146)
+++ stable/11/sys/kern/vfs_export.c Mon May 18 00:32:42 2020
(r361147)
@@ -108,6 +108,11 @@ vfs_hang_addrlist(struct mount *mp, struct netexport *
 #endif
int error;
 
+   KASSERT(argp->ex_numsecflavors > 0,
+   ("%s: numsecflavors <= 0", __func__));
+   KASSERT(argp->ex_numsecflavors < MAXSECFLAVORS,
+   ("%s: numsecflavors >= MAXSECFLAVORS", __func__));
+
/*
 * XXX: This routine converts from a `struct xucred'
 * (argp->ex_anon) to a `struct ucred' (np->netc_anon).  This
@@ -294,10 +299,14 @@ vfs_export(struct mount *mp, struct export_args *argp)
struct netexport *nep;
int error;
 
-   if (argp->ex_numsecflavors < 0
-   || argp->ex_numsecflavors >= MAXSECFLAVORS)
+   if ((argp->ex_flags & (MNT_DELEXPORT | MNT_EXPORTED)) == 0)
return (EINVAL);
 
+   if ((argp->ex_flags & MNT_EXPORTED) != 0 &&
+   (argp->ex_numsecflavors <= 0
+   || argp->ex_numsecflavors >= MAXSECFLAVORS))
+   return (EINVAL);
+
error = 0;
lockmgr(>mnt_explock, LK_EXCLUSIVE, NULL);
nep = mp->mnt_export;
@@ -510,8 +519,13 @@ vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam
*extflagsp = np->netc_exflags;
if ((*credanonp = np->netc_anon) != NULL)
crhold(*credanonp);
-   if (numsecflavors)
+   if (numsecflavors) {
*numsecflavors = np->netc_numsecflavors;
+   KASSERT(*numsecflavors > 0,
+   ("%s: numsecflavors <= 0", __func__));
+   KASSERT(*numsecflavors < MAXSECFLAVORS,
+   ("%s: numsecflavors >= MAXSECFLAVORS", __func__));
+   }
if (secflavors)
*secflavors = np->netc_secflavors;
lockmgr(>mnt_explock, LK_RELEASE, NULL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361147 - in stable: 11/sys/kern 12/sys/kern

2020-05-17 Thread Ryan Moeller
Author: freqlabs
Date: Mon May 18 00:32:42 2020
New Revision: 361147
URL: https://svnweb.freebsd.org/changeset/base/361147

Log:
  MFC r360900:
  
  vfs_exports: Tighten bounds and assert consistency of numsecflavors
  
  We know the value must be greater than 0 and less than MAXSECFLAVORS.
  
  Reject values outside this range in the initial check in vfs_export and add
  KASSERTs in the later consumers.
  
  Also check that we are called with one of either MNT_DELEXPORT or MNT_EXPORTED
  set.
  
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D24753

Modified:
  stable/12/sys/kern/vfs_export.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/kern/vfs_export.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/kern/vfs_export.c
==
--- stable/12/sys/kern/vfs_export.c Mon May 18 00:07:45 2020
(r361146)
+++ stable/12/sys/kern/vfs_export.c Mon May 18 00:32:42 2020
(r361147)
@@ -112,6 +112,11 @@ vfs_hang_addrlist(struct mount *mp, struct netexport *
 #endif
int error;
 
+   KASSERT(argp->ex_numsecflavors > 0,
+   ("%s: numsecflavors <= 0", __func__));
+   KASSERT(argp->ex_numsecflavors < MAXSECFLAVORS,
+   ("%s: numsecflavors >= MAXSECFLAVORS", __func__));
+
/*
 * XXX: This routine converts from a `struct xucred'
 * (argp->ex_anon) to a `struct ucred' (np->netc_anon).  This
@@ -300,10 +305,14 @@ vfs_export(struct mount *mp, struct export_args *argp)
struct netexport *nep;
int error;
 
-   if (argp->ex_numsecflavors < 0
-   || argp->ex_numsecflavors >= MAXSECFLAVORS)
+   if ((argp->ex_flags & (MNT_DELEXPORT | MNT_EXPORTED)) == 0)
return (EINVAL);
 
+   if ((argp->ex_flags & MNT_EXPORTED) != 0 &&
+   (argp->ex_numsecflavors <= 0
+   || argp->ex_numsecflavors >= MAXSECFLAVORS))
+   return (EINVAL);
+
error = 0;
lockmgr(>mnt_explock, LK_EXCLUSIVE, NULL);
nep = mp->mnt_export;
@@ -518,8 +527,13 @@ vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam
*extflagsp = np->netc_exflags;
if ((*credanonp = np->netc_anon) != NULL)
crhold(*credanonp);
-   if (numsecflavors)
+   if (numsecflavors) {
*numsecflavors = np->netc_numsecflavors;
+   KASSERT(*numsecflavors > 0,
+   ("%s: numsecflavors <= 0", __func__));
+   KASSERT(*numsecflavors < MAXSECFLAVORS,
+   ("%s: numsecflavors >= MAXSECFLAVORS", __func__));
+   }
if (secflavors)
*secflavors = np->netc_secflavors;
lockmgr(>mnt_explock, LK_RELEASE, 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: r361066 - head/usr.sbin/jail

2020-05-15 Thread Ryan Moeller



On 5/15/20 4:17 PM, Rodney W. Grimes wrote:

On 5/15/20 3:24 PM, Rodney W. Grimes wrote:


On 5/15/20 6:18 AM, Mateusz Piotrowski wrote:


On 5/15/20 1:38 AM, Ryan Moeller wrote:

Author: freqlabs
Date: Thu May 14 23:38:11 2020
New Revision: 361066
URL: https://svnweb.freebsd.org/changeset/base/361066

Log:
 jail: Add exec.prepare and exec.release command hooks
 
 This change introduces new jail command hooks that run before and after any

 other actions.

Should it go into RELNOTES?

I'm not sure what all the criteria are for relnotes.
The committer's guide makes it seem like relnotes is for breaking
changes, which this is not.

Please could you point at which specific language in the commiters
guide makes you believe that the RELNOTES are for breaking changes?

Every mention of "release notes" in the document is in the context of
deprecating, removing,
or breaking things, with one exception:

Fair, there should be a section on "new features and enhnacements"
which is laking.  However if one reads a release notes from a shipping
version it becomes clear that the actual majority of the text in it is
"new stuff."


Now that I know better, how do I retcon this and other potentially 
relnoteworthy enhancements I've made? :)



  > Relnotes:??? If the change is a candidate for inclusion in the
release notes for the next release from the branch, set to yes.

RELNOTES should be for all changes that have user visible impact
of any type.


-Ryan

___
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: r361066 - head/usr.sbin/jail

2020-05-15 Thread Ryan Moeller

On 5/15/20 3:24 PM, Rodney W. Grimes wrote:


On 5/15/20 6:18 AM, Mateusz Piotrowski wrote:


On 5/15/20 1:38 AM, Ryan Moeller wrote:

Author: freqlabs
Date: Thu May 14 23:38:11 2020
New Revision: 361066
URL: https://svnweb.freebsd.org/changeset/base/361066

Log:
jail: Add exec.prepare and exec.release command hooks

This change introduces new jail command hooks that run before and after any

other actions.

Should it go into RELNOTES?

I'm not sure what all the criteria are for relnotes.
The committer's guide makes it seem like relnotes is for breaking
changes, which this is not.

Please could you point at which specific language in the commiters
guide makes you believe that the RELNOTES are for breaking changes?


Every mention of "release notes" in the document is in the context of 
deprecating, removing,

or breaking things, with one exception:

> Relnotes:    If the change is a candidate for inclusion in the 
release notes for the next release from the branch, set to yes.


RELNOTES should be for all changes that have user visible impact
of any type.


-Ryan

___
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: r361066 - head/usr.sbin/jail

2020-05-15 Thread Ryan Moeller

On 5/15/20 6:18 AM, Mateusz Piotrowski wrote:


On 5/15/20 1:38 AM, Ryan Moeller wrote:

Author: freqlabs
Date: Thu May 14 23:38:11 2020
New Revision: 361066
URL: https://svnweb.freebsd.org/changeset/base/361066

Log:
   jail: Add exec.prepare and exec.release command hooks
   
   This change introduces new jail command hooks that run before and after any

   other actions.

Should it go into RELNOTES?

I'm not sure what all the criteria are for relnotes.
The committer's guide makes it seem like relnotes is for breaking 
changes, which this is not.


-Ryan

___
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: r361070 - in stable: 11/sys/fs/nfs 11/sys/fs/nfsclient 11/sys/fs/nfsserver 12/sys/fs/nfs 12/sys/fs/nfsclient 12/sys/fs/nfsserver

2020-05-14 Thread Ryan Moeller
Author: freqlabs
Date: Fri May 15 01:01:02 2020
New Revision: 361070
URL: https://svnweb.freebsd.org/changeset/base/361070

Log:
  MFC r360813:
  
  Remove APPLEKEXT ifndefs
  
  They are no longer useful.
  
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D24752

Modified:
  stable/12/sys/fs/nfs/nfs_commonacl.c
  stable/12/sys/fs/nfs/nfs_commonsubs.c
  stable/12/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/12/sys/fs/nfsclient/nfs_clrpcops.c
  stable/12/sys/fs/nfsclient/nfs_clstate.c
  stable/12/sys/fs/nfsserver/nfs_nfsdcache.c
  stable/12/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/12/sys/fs/nfsserver/nfs_nfsdsocket.c
  stable/12/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/12/sys/fs/nfsserver/nfs_nfsdsubs.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/fs/nfs/nfs_commonacl.c
  stable/11/sys/fs/nfs/nfs_commonsubs.c
  stable/11/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/11/sys/fs/nfsclient/nfs_clrpcops.c
  stable/11/sys/fs/nfsclient/nfs_clstate.c
  stable/11/sys/fs/nfsserver/nfs_nfsdcache.c
  stable/11/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/11/sys/fs/nfsserver/nfs_nfsdsocket.c
  stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/11/sys/fs/nfsserver/nfs_nfsdsubs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/fs/nfs/nfs_commonacl.c
==
--- stable/12/sys/fs/nfs/nfs_commonacl.cFri May 15 00:51:30 2020
(r361069)
+++ stable/12/sys/fs/nfs/nfs_commonacl.cFri May 15 01:01:02 2020
(r361070)
@@ -30,11 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#ifndef APPLEKEXT
 #include 
 
 extern int nfsrv_useacl;
-#endif
 
 static int nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner,
 enum vtype type, acl_perm_t *permp);

Modified: stable/12/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/12/sys/fs/nfs/nfs_commonsubs.c   Fri May 15 00:51:30 2020
(r361069)
+++ stable/12/sys/fs/nfs/nfs_commonsubs.c   Fri May 15 01:01:02 2020
(r361070)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
  * the nfs op functions. They do things like create the rpc header and
  * copy data between mbuf chains and uio lists.
  */
-#ifndef APPLEKEXT
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
@@ -169,7 +168,6 @@ struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS] = {
{ 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy ClientID */
{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Reclaim Complete */
 };
-#endif /* !APPLEKEXT */
 
 static int ncl_mbuf_mhlen = MHLEN;
 static int nfsrv_usercnt = 0;

Modified: stable/12/sys/fs/nfsclient/nfs_clcomsubs.c
==
--- stable/12/sys/fs/nfsclient/nfs_clcomsubs.c  Fri May 15 00:51:30 2020
(r361069)
+++ stable/12/sys/fs/nfsclient/nfs_clcomsubs.c  Fri May 15 01:01:02 2020
(r361070)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
  * the nfs op functions. They do things like create the rpc header and
  * copy data between mbuf chains and uio lists.
  */
-#ifndef APPLEKEXT
 #include 
 
 extern struct nfsstatsv1 nfsstatsv1;
@@ -49,7 +48,6 @@ extern int ncl_mbuf_mlen;
 extern enum vtype newnv2tov_type[8];
 extern enum vtype nv34tov_type[8];
 NFSCLSTATEMUTEX;
-#endif /* !APPLEKEXT */
 
 static nfsuint64 nfs_nullcookie = {{ 0, 0 }};
 

Modified: stable/12/sys/fs/nfsclient/nfs_clrpcops.c
==
--- stable/12/sys/fs/nfsclient/nfs_clrpcops.c   Fri May 15 00:51:30 2020
(r361069)
+++ stable/12/sys/fs/nfsclient/nfs_clrpcops.c   Fri May 15 01:01:02 2020
(r361070)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
  * arguments are all at the end, after the NFSPROC_T *p one.
  */
 
-#ifndef APPLEKEXT
 #include "opt_inet6.h"
 
 #include 
@@ -78,7 +77,6 @@ int nfscl_assumeposixlocks = 1;
 int nfscl_enablecallb = 0;
 short nfsv4_cbport = NFSV4_CBPORT;
 int nfstest_openallsetattr = 0;
-#endif /* !APPLEKEXT */
 
 #defineDIRHDSIZoffsetof(struct dirent, d_name)
 

Modified: stable/12/sys/fs/nfsclient/nfs_clstate.c
==
--- stable/12/sys/fs/nfsclient/nfs_clstate.cFri May 15 00:51:30 2020
(r361069)
+++ stable/12/sys/fs/nfsclient/nfs_clstate.cFri May 15 01:01:02 2020
(r361070)
@@ -80,7 +80,6 @@ __FBSDID("$FreeBSD$");
  * (Since we are done with them, they do not need to be recovered.)
  */
 
-#ifndef APPLEKEXT
 #include 
 
 /*
@@ -98,7 +97,6 @@ int nfscl_inited = 0;
 struct nfsclhead nfsclhead;/* Head of clientid list */
 int nfscl_deleghighwater = NFSCLDELEGHIGHWATER;
 int nfscl_layouthighwater = NFSCLLAYOUTHIGHWATER;
-#endif /* 

svn commit: r361070 - in stable: 11/sys/fs/nfs 11/sys/fs/nfsclient 11/sys/fs/nfsserver 12/sys/fs/nfs 12/sys/fs/nfsclient 12/sys/fs/nfsserver

2020-05-14 Thread Ryan Moeller
Author: freqlabs
Date: Fri May 15 01:01:02 2020
New Revision: 361070
URL: https://svnweb.freebsd.org/changeset/base/361070

Log:
  MFC r360813:
  
  Remove APPLEKEXT ifndefs
  
  They are no longer useful.
  
  Reviewed by:rmacklem
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D24752

Modified:
  stable/11/sys/fs/nfs/nfs_commonacl.c
  stable/11/sys/fs/nfs/nfs_commonsubs.c
  stable/11/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/11/sys/fs/nfsclient/nfs_clrpcops.c
  stable/11/sys/fs/nfsclient/nfs_clstate.c
  stable/11/sys/fs/nfsserver/nfs_nfsdcache.c
  stable/11/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/11/sys/fs/nfsserver/nfs_nfsdsocket.c
  stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/11/sys/fs/nfsserver/nfs_nfsdsubs.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/fs/nfs/nfs_commonacl.c
  stable/12/sys/fs/nfs/nfs_commonsubs.c
  stable/12/sys/fs/nfsclient/nfs_clcomsubs.c
  stable/12/sys/fs/nfsclient/nfs_clrpcops.c
  stable/12/sys/fs/nfsclient/nfs_clstate.c
  stable/12/sys/fs/nfsserver/nfs_nfsdcache.c
  stable/12/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/12/sys/fs/nfsserver/nfs_nfsdsocket.c
  stable/12/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/12/sys/fs/nfsserver/nfs_nfsdsubs.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs_commonacl.c
==
--- stable/11/sys/fs/nfs/nfs_commonacl.cFri May 15 00:51:30 2020
(r361069)
+++ stable/11/sys/fs/nfs/nfs_commonacl.cFri May 15 01:01:02 2020
(r361070)
@@ -28,11 +28,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#ifndef APPLEKEXT
 #include 
 
 extern int nfsrv_useacl;
-#endif
 
 static int nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner,
 enum vtype type, acl_perm_t *permp);

Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/11/sys/fs/nfs/nfs_commonsubs.c   Fri May 15 00:51:30 2020
(r361069)
+++ stable/11/sys/fs/nfs/nfs_commonsubs.c   Fri May 15 01:01:02 2020
(r361070)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
  * the nfs op functions. They do things like create the rpc header and
  * copy data between mbuf chains and uio lists.
  */
-#ifndef APPLEKEXT
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
@@ -160,7 +159,6 @@ struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS] = {
{ 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy ClientID */
{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Reclaim Complete */
 };
-#endif /* !APPLEKEXT */
 
 static int ncl_mbuf_mhlen = MHLEN;
 static int nfsrv_usercnt = 0;

Modified: stable/11/sys/fs/nfsclient/nfs_clcomsubs.c
==
--- stable/11/sys/fs/nfsclient/nfs_clcomsubs.c  Fri May 15 00:51:30 2020
(r361069)
+++ stable/11/sys/fs/nfsclient/nfs_clcomsubs.c  Fri May 15 01:01:02 2020
(r361070)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
  * the nfs op functions. They do things like create the rpc header and
  * copy data between mbuf chains and uio lists.
  */
-#ifndef APPLEKEXT
 #include 
 
 extern struct nfsstatsv1 nfsstatsv1;
@@ -49,7 +48,6 @@ extern enum vtype newnv2tov_type[8];
 extern enum vtype nv34tov_type[8];
 extern int nfs_bigreply[NFSV41_NPROCS];
 NFSCLSTATEMUTEX;
-#endif /* !APPLEKEXT */
 
 static nfsuint64 nfs_nullcookie = {{ 0, 0 }};
 static struct {

Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c
==
--- stable/11/sys/fs/nfsclient/nfs_clrpcops.c   Fri May 15 00:51:30 2020
(r361069)
+++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c   Fri May 15 01:01:02 2020
(r361070)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
  * arguments are all at the end, after the NFSPROC_T *p one.
  */
 
-#ifndef APPLEKEXT
 #include "opt_inet6.h"
 
 #include 
@@ -70,7 +69,6 @@ int nfscl_assumeposixlocks = 1;
 int nfscl_enablecallb = 0;
 short nfsv4_cbport = NFSV4_CBPORT;
 int nfstest_openallsetattr = 0;
-#endif /* !APPLEKEXT */
 
 #defineDIRHDSIZ(sizeof (struct dirent) - (MAXNAMLEN + 1))
 

Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c
==
--- stable/11/sys/fs/nfsclient/nfs_clstate.cFri May 15 00:51:30 2020
(r361069)
+++ stable/11/sys/fs/nfsclient/nfs_clstate.cFri May 15 01:01:02 2020
(r361070)
@@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
  * (Since we are done with them, they do not need to be recovered.)
  */
 
-#ifndef APPLEKEXT
 #include 
 
 /*
@@ -96,7 +95,6 @@ int nfscl_inited = 0;
 struct nfsclhead nfsclhead;/* Head of clientid list */
 int nfscl_deleghighwater = NFSCLDELEGHIGHWATER;
 int 

svn commit: r361066 - head/usr.sbin/jail

2020-05-14 Thread Ryan Moeller
Author: freqlabs
Date: Thu May 14 23:38:11 2020
New Revision: 361066
URL: https://svnweb.freebsd.org/changeset/base/361066

Log:
  jail: Add exec.prepare and exec.release command hooks
  
  This change introduces new jail command hooks that run before and after any
  other actions.
  
  The exec.prepare hook can be used for example to invoke a script that checks
  if the jail's root exists, creating it if it does not. Since arbitrary
  variables in jail.conf can be passed to the command, it can be pretty useful
  for templating jails.
  
  An example use case for exec.release would be to remove the filesystem of an
  ephemeral jail.
  
  The names "prepare" and "release" are borrowed from the names of similar hooks
  in libvirt.
  
  Reviewed by:  jamie, manpages, mmacy
  Approved by:  mmacy (mentor)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24829

Modified:
  head/usr.sbin/jail/command.c
  head/usr.sbin/jail/config.c
  head/usr.sbin/jail/jail.8
  head/usr.sbin/jail/jail.c
  head/usr.sbin/jail/jailp.h

Modified: head/usr.sbin/jail/command.c
==
--- head/usr.sbin/jail/command.cThu May 14 23:20:58 2020
(r361065)
+++ head/usr.sbin/jail/command.cThu May 14 23:38:11 2020
(r361066)
@@ -148,7 +148,8 @@ next_command(struct cfjail *j)
if (j->comstring == NULL || j->comstring->len == 0 ||
(create_failed && (comparam == IP_EXEC_PRESTART ||
comparam == IP_EXEC_CREATED || comparam == IP_EXEC_START ||
-   comparam == IP_COMMAND || comparam == IP_EXEC_POSTSTART)))
+   comparam == IP_COMMAND || comparam == IP_EXEC_POSTSTART ||
+   comparam == IP_EXEC_PREPARE)))
continue;
switch (run_command(j)) {
case -1:

Modified: head/usr.sbin/jail/config.c
==
--- head/usr.sbin/jail/config.c Thu May 14 23:20:58 2020(r361065)
+++ head/usr.sbin/jail/config.c Thu May 14 23:38:11 2020(r361066)
@@ -71,8 +71,10 @@ static const struct ipspec intparams[] = {
 [IP_EXEC_JAIL_USER] =  {"exec.jail_user",  PF_INTERNAL},
 [IP_EXEC_POSTSTART] =  {"exec.poststart",  PF_INTERNAL},
 [IP_EXEC_POSTSTOP] =   {"exec.poststop",   PF_INTERNAL},
+[IP_EXEC_PREPARE] ={"exec.prepare",PF_INTERNAL},
 [IP_EXEC_PRESTART] =   {"exec.prestart",   PF_INTERNAL},
 [IP_EXEC_PRESTOP] ={"exec.prestop",PF_INTERNAL},
+[IP_EXEC_RELEASE] ={"exec.release",PF_INTERNAL},
 [IP_EXEC_CREATED] ={"exec.created",PF_INTERNAL},
 [IP_EXEC_START] =  {"exec.start",  PF_INTERNAL},
 [IP_EXEC_STOP] =   {"exec.stop",   PF_INTERNAL},

Modified: head/usr.sbin/jail/jail.8
==
--- head/usr.sbin/jail/jail.8   Thu May 14 23:20:58 2020(r361065)
+++ head/usr.sbin/jail/jail.8   Thu May 14 23:38:11 2020(r361066)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 17, 2020
+.Dd May 14, 2020
 .Dt JAIL 8
 .Os
 .Sh NAME
@@ -726,6 +726,11 @@ not be created or removed, as appropriate.
 .Pp
 The pseudo-parameters are:
 .Bl -tag -width indent
+.It Va exec.prepare
+Command(s) to run in the system environment to prepare a jail for creation.
+These commands are executed before assigning IP addresses and mounting
+filesystems, so they may be used to create a new jail filesystem if it does
+not already exist.
 .It Va exec.prestart
 Command(s) to run in the system environment before a jail is created.
 .It Va exec.created
@@ -760,6 +765,11 @@ A typical command to run is
 .Dq sh /etc/rc.shutdown jail .
 .It Va exec.poststop
 Command(s) to run in the system environment after a jail is removed.
+.It Va exec.release
+Command(s) to run in the system environment after all other actions are done.
+These commands are executed after unmounting filesystems and removing IP
+addresses, so they may be used to remove a jail filesystem if it is no longer
+needed.
 .It Va exec.clean
 Run commands in a clean environment.
 The environment is discarded except for

Modified: head/usr.sbin/jail/jail.c
==
--- head/usr.sbin/jail/jail.c   Thu May 14 23:20:58 2020(r361065)
+++ head/usr.sbin/jail/jail.c   Thu May 14 23:38:11 2020(r361066)
@@ -87,6 +87,7 @@ static struct permspec perm_sysctl[] = {
 
 static const enum intparam startcommands[] = {
 IP__NULL,
+IP_EXEC_PREPARE,
 #ifdef INET
 IP__IP4_IFADDR,
 #endif
@@ -126,6 +127,7 @@ static const enum intparam stopcommands[] = {
 #ifdef INET
 IP__IP4_IFADDR,
 #endif
+IP_EXEC_RELEASE,
 IP__NULL
 };
 


svn commit: r360960 - in head/sys/fs: nfs nfsclient nfsserver

2020-05-12 Thread Ryan Moeller
Author: freqlabs
Date: Tue May 12 13:23:25 2020
New Revision: 360960
URL: https://svnweb.freebsd.org/changeset/base/360960

Log:
  nfs: Remove APPLESTATIC macro
  
  It is no longer useful.
  
  Reviewed by:  rmacklem
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D24811

Modified:
  head/sys/fs/nfs/nfs_commonacl.c
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfs/nfsport.h
  head/sys/fs/nfsclient/nfs_clcomsubs.c
  head/sys/fs/nfsclient/nfs_clport.c
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c
  head/sys/fs/nfsserver/nfs_nfsdcache.c
  head/sys/fs/nfsserver/nfs_nfsdserv.c
  head/sys/fs/nfsserver/nfs_nfsdsocket.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c
  head/sys/fs/nfsserver/nfs_nfsdsubs.c

Modified: head/sys/fs/nfs/nfs_commonacl.c
==
--- head/sys/fs/nfs/nfs_commonacl.c Tue May 12 12:29:39 2020
(r360959)
+++ head/sys/fs/nfs/nfs_commonacl.c Tue May 12 13:23:25 2020
(r360960)
@@ -40,7 +40,7 @@ static int nfsrv_acemasktoperm(u_int32_t acetype, u_in
 /*
  * Handle xdr for an ace.
  */
-APPLESTATIC int
+int
 nfsrv_dissectace(struct nfsrv_descript *nd, struct acl_entry *acep,
 int *aceerrp, int *acesizep, NFSPROC_T *p)
 {
@@ -388,7 +388,7 @@ nfsrv_buildace(struct nfsrv_descript *nd, u_char *name
 /*
  * Build an NFSv4 ACL.
  */
-APPLESTATIC int
+int
 nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *aclp, enum vtype type,
 NFSPROC_T *p)
 {
@@ -451,7 +451,7 @@ nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *ac
  * Compare two NFSv4 acls.
  * Return 0 if they are the same, 1 if not the same.
  */
-APPLESTATIC int
+int
 nfsrv_compareacl(NFSACL_T *aclp1, NFSACL_T *aclp2)
 {
int i;

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cTue May 12 12:29:39 2020
(r360959)
+++ head/sys/fs/nfs/nfs_commonsubs.cTue May 12 13:23:25 2020
(r360960)
@@ -314,7 +314,7 @@ static int nfs_bigrequest[NFSV42_NPROCS] = {
  * Start building a request. Mostly just put the first file handle in
  * place.
  */
-APPLESTATIC void
+void
 nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp,
 u_int8_t *nfhp, int fhlen, u_int32_t **opcntpp, struct nfsclsession *sep,
 int vers, int minorvers)
@@ -453,7 +453,7 @@ nfscl_reqstart(struct nfsrv_descript *nd, int procnum,
 /*
  * Put a state Id in the mbuf list.
  */
-APPLESTATIC void
+void
 nfsm_stateidtom(struct nfsrv_descript *nd, nfsv4stateid_t *stateidp, int flag)
 {
nfsv4stateid_t *st;
@@ -689,7 +689,7 @@ out:
  * This is used by the macro NFSM_DISSECT for tough
  * cases.
  */
-APPLESTATIC void *
+void *
 nfsm_dissct(struct nfsrv_descript *nd, int siz, int how)
 {
struct mbuf *mp2;
@@ -755,7 +755,7 @@ nfsm_dissct(struct nfsrv_descript *nd, int siz, int ho
  * here than check for offs > 0 for all calls to nfsm_advance.
  * If left == -1, it should be calculated here.
  */
-APPLESTATIC int
+int
 nfsm_advance(struct nfsrv_descript *nd, int offs, int left)
 {
int error = 0;
@@ -803,7 +803,7 @@ out:
  * Copy a string into mbuf(s).
  * Return the number of bytes output, including XDR overheads.
  */
-APPLESTATIC int
+int
 nfsm_strtom(struct nfsrv_descript *nd, const char *cp, int siz)
 {
struct mbuf *m2;
@@ -860,7 +860,7 @@ nfsm_strtom(struct nfsrv_descript *nd, const char *cp,
 /*
  * Called once to initialize data structures...
  */
-APPLESTATIC void
+void
 newnfs_init(void)
 {
static int nfs_inited = 0;
@@ -890,7 +890,7 @@ newnfs_init(void)
  * set_true == 1 if there should be an newnfs_true prepended on the file 
handle.
  * Return the number of bytes output, including XDR overhead.
  */
-APPLESTATIC int
+int
 nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, int size, int set_true)
 {
u_int32_t *tl;
@@ -933,7 +933,7 @@ nfsm_fhtom(struct nfsrv_descript *nd, u_int8_t *fhp, i
  * The AF_INET family is handled as a special case so that address mbufs
  * don't need to be saved to store "struct in_addr", which is only 4 bytes.
  */
-APPLESTATIC int
+int
 nfsaddr_match(int family, union nethostaddr *haddr, NFSSOCKADDR_T nam)
 {
 #ifdef INET
@@ -970,7 +970,7 @@ nfsaddr_match(int family, union nethostaddr *haddr, NF
 /*
  * Similar to the above, but takes to NFSSOCKADDR_T args.
  */
-APPLESTATIC int
+int
 nfsaddr2_match(NFSSOCKADDR_T nam1, NFSSOCKADDR_T nam2)
 {
struct sockaddr_in *addr1, *addr2;
@@ -1007,7 +1007,7 @@ nfsaddr2_match(NFSSOCKADDR_T nam1, NFSSOCKADDR_T nam2)
 /*
  * Trim trailing data off the mbuf list being built.
  */
-APPLESTATIC void
+void
 newnfs_trimtrailing(nd, mb, bpos)
struct nfsrv_descript *nd;
struct mbuf *mb;
@@ -1026,7 +1026,7 @@ newnfs_trimtrailing(nd, mb, bpos)
 /*
  * Dissect a file handle on 

svn commit: r360900 - head/sys/kern

2020-05-11 Thread Ryan Moeller
Author: freqlabs
Date: Mon May 11 15:38:44 2020
New Revision: 360900
URL: https://svnweb.freebsd.org/changeset/base/360900

Log:
  vfs_exports: Tighten bounds and assert consistency of numsecflavors
  
  We know the value must be greater than 0 and less than MAXSECFLAVORS.
  
  Reject values outside this range in the initial check in vfs_export and add 
KASSERTs
  in the later consumers.
  
  Also check that we are called with one of either MNT_DELEXPORT or 
MNT_EXPORTED set.
  
  Reviewed by:  rmacklem
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D24753

Modified:
  head/sys/kern/vfs_export.c

Modified: head/sys/kern/vfs_export.c
==
--- head/sys/kern/vfs_export.c  Mon May 11 15:32:32 2020(r360899)
+++ head/sys/kern/vfs_export.c  Mon May 11 15:38:44 2020(r360900)
@@ -112,6 +112,11 @@ vfs_hang_addrlist(struct mount *mp, struct netexport *
 #endif
int error;
 
+   KASSERT(argp->ex_numsecflavors > 0,
+   ("%s: numsecflavors <= 0", __func__));
+   KASSERT(argp->ex_numsecflavors < MAXSECFLAVORS,
+   ("%s: numsecflavors >= MAXSECFLAVORS", __func__));
+
/*
 * XXX: This routine converts from a `struct xucred'
 * (argp->ex_anon) to a `struct ucred' (np->netc_anon).  This
@@ -300,10 +305,14 @@ vfs_export(struct mount *mp, struct export_args *argp)
struct netexport *nep;
int error;
 
-   if (argp->ex_numsecflavors < 0
-   || argp->ex_numsecflavors >= MAXSECFLAVORS)
+   if ((argp->ex_flags & (MNT_DELEXPORT | MNT_EXPORTED)) == 0)
return (EINVAL);
 
+   if ((argp->ex_flags & MNT_EXPORTED) != 0 &&
+   (argp->ex_numsecflavors <= 0
+   || argp->ex_numsecflavors >= MAXSECFLAVORS))
+   return (EINVAL);
+
error = 0;
lockmgr(>mnt_explock, LK_EXCLUSIVE, NULL);
nep = mp->mnt_export;
@@ -518,8 +527,13 @@ vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam
*extflagsp = np->netc_exflags;
if ((*credanonp = np->netc_anon) != NULL)
crhold(*credanonp);
-   if (numsecflavors)
+   if (numsecflavors) {
*numsecflavors = np->netc_numsecflavors;
+   KASSERT(*numsecflavors > 0,
+   ("%s: numsecflavors <= 0", __func__));
+   KASSERT(*numsecflavors < MAXSECFLAVORS,
+   ("%s: numsecflavors >= MAXSECFLAVORS", __func__));
+   }
if (secflavors)
*secflavors = np->netc_secflavors;
lockmgr(>mnt_explock, LK_RELEASE, NULL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360813 - in head/sys/fs: nfs nfsclient nfsserver

2020-05-08 Thread Ryan Moeller
Author: freqlabs
Date: Fri May  8 14:39:38 2020
New Revision: 360813
URL: https://svnweb.freebsd.org/changeset/base/360813

Log:
  Remove APPLEKEXT ifndefs
  
  They are no longer useful.
  
  Reviewed by:  rmacklem
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D24752

Modified:
  head/sys/fs/nfs/nfs_commonacl.c
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfsclient/nfs_clcomsubs.c
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c
  head/sys/fs/nfsserver/nfs_nfsdcache.c
  head/sys/fs/nfsserver/nfs_nfsdserv.c
  head/sys/fs/nfsserver/nfs_nfsdsocket.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c
  head/sys/fs/nfsserver/nfs_nfsdsubs.c

Modified: head/sys/fs/nfs/nfs_commonacl.c
==
--- head/sys/fs/nfs/nfs_commonacl.c Fri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfs/nfs_commonacl.c Fri May  8 14:39:38 2020
(r360813)
@@ -30,11 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#ifndef APPLEKEXT
 #include 
 
 extern int nfsrv_useacl;
-#endif
 
 static int nfsrv_acemasktoperm(u_int32_t acetype, u_int32_t mask, int owner,
 enum vtype type, acl_perm_t *permp);

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cFri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfs/nfs_commonsubs.cFri May  8 14:39:38 2020
(r360813)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
  * the nfs op functions. They do things like create the rpc header and
  * copy data between mbuf chains and uio lists.
  */
-#ifndef APPLEKEXT
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
@@ -192,7 +191,6 @@ struct nfsv4_opflag nfsv4_opflag[NFSV42_NOPS] = {
{ 0, 1, 0, 0, LK_SHARED, 1, 1 },/* Listxattrs */
{ 0, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Removexattr */
 };
-#endif /* !APPLEKEXT */
 
 static int ncl_mbuf_mhlen = MHLEN;
 static int nfsrv_usercnt = 0;

Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c
==
--- head/sys/fs/nfsclient/nfs_clcomsubs.c   Fri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfsclient/nfs_clcomsubs.c   Fri May  8 14:39:38 2020
(r360813)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
  * the nfs op functions. They do things like create the rpc header and
  * copy data between mbuf chains and uio lists.
  */
-#ifndef APPLEKEXT
 #include 
 
 extern struct nfsstatsv1 nfsstatsv1;
@@ -49,7 +48,6 @@ extern int ncl_mbuf_mlen;
 extern enum vtype newnv2tov_type[8];
 extern enum vtype nv34tov_type[8];
 NFSCLSTATEMUTEX;
-#endif /* !APPLEKEXT */
 
 static nfsuint64 nfs_nullcookie = {{ 0, 0 }};
 

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cFri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cFri May  8 14:39:38 2020
(r360813)
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
  * arguments are all at the end, after the NFSPROC_T *p one.
  */
 
-#ifndef APPLEKEXT
 #include "opt_inet6.h"
 
 #include 
@@ -82,7 +81,6 @@ int nfscl_assumeposixlocks = 1;
 int nfscl_enablecallb = 0;
 short nfsv4_cbport = NFSV4_CBPORT;
 int nfstest_openallsetattr = 0;
-#endif /* !APPLEKEXT */
 
 #defineDIRHDSIZoffsetof(struct dirent, d_name)
 

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==
--- head/sys/fs/nfsclient/nfs_clstate.c Fri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfsclient/nfs_clstate.c Fri May  8 14:39:38 2020
(r360813)
@@ -80,7 +80,6 @@ __FBSDID("$FreeBSD$");
  * (Since we are done with them, they do not need to be recovered.)
  */
 
-#ifndef APPLEKEXT
 #include 
 
 /*
@@ -98,7 +97,6 @@ int nfscl_inited = 0;
 struct nfsclhead nfsclhead;/* Head of clientid list */
 int nfscl_deleghighwater = NFSCLDELEGHIGHWATER;
 int nfscl_layouthighwater = NFSCLLAYOUTHIGHWATER;
-#endif /* !APPLEKEXT */
 
 static int nfscl_delegcnt = 0;
 static int nfscl_layoutcnt = 0;

Modified: head/sys/fs/nfsserver/nfs_nfsdcache.c
==
--- head/sys/fs/nfsserver/nfs_nfsdcache.c   Fri May  8 14:38:48 2020
(r360812)
+++ head/sys/fs/nfsserver/nfs_nfsdcache.c   Fri May  8 14:39:38 2020
(r360813)
@@ -158,7 +158,6 @@ __FBSDID("$FreeBSD$");
  * that case. This level should be set high enough that this almost
  * never happens.
  */
-#ifndef APPLEKEXT
 #include 
 
 extern struct nfsstatsv1 nfsstatsv1;
@@ -166,7 +165,6 @@ extern struct mtx nfsrc_udpmtx;
 extern struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE];
 

svn commit: r360601 - stable/12/usr.bin/sockstat

2020-05-03 Thread Ryan Moeller
Author: freqlabs
Date: Sun May  3 08:13:44 2020
New Revision: 360601
URL: https://svnweb.freebsd.org/changeset/base/360601

Log:
  MFC r360356:
  
  sockstat: Attach to jail if in new vnet
  
  Attach sockstat -j to the specified jail if the jail is in a new vnet.
  Otherwise we do not see all sockets belonging to the jail.
  
  Reviewed by:jamie
  Approved by:mmacy (mentor)
  Differential Revision:  https://reviews.freebsd.org/D24413

Modified:
  stable/12/usr.bin/sockstat/sockstat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/sockstat/sockstat.c
==
--- stable/12/usr.bin/sockstat/sockstat.c   Sun May  3 04:22:27 2020
(r360600)
+++ stable/12/usr.bin/sockstat/sockstat.c   Sun May  3 08:13:44 2020
(r360601)
@@ -32,10 +32,11 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -1218,7 +1219,8 @@ display(void)
}
 }
 
-static int set_default_protos(void)
+static int
+set_default_protos(void)
 {
struct protoent *prot;
const char *pname;
@@ -1237,6 +1239,38 @@ static int set_default_protos(void)
return (pindex);
 }
 
+/*
+ * Return the vnet property of the jail, or -1 on error.
+ */
+static int
+jail_getvnet(int jid)
+{
+   struct iovec jiov[6];
+   int vnet;
+
+   vnet = -1;
+   jiov[0].iov_base = __DECONST(char *, "jid");
+   jiov[0].iov_len = sizeof("jid");
+   jiov[1].iov_base = 
+   jiov[1].iov_len = sizeof(jid);
+   jiov[2].iov_base = __DECONST(char *, "vnet");
+   jiov[2].iov_len = sizeof("vnet");
+   jiov[3].iov_base = 
+   jiov[3].iov_len = sizeof(vnet);
+   jiov[4].iov_base = __DECONST(char *, "errmsg");
+   jiov[4].iov_len = sizeof("errmsg");
+   jiov[5].iov_base = jail_errmsg;
+   jiov[5].iov_len = JAIL_ERRMSGLEN;
+   jail_errmsg[0] = '\0';
+   if (jail_get(jiov, nitems(jiov), 0) < 0) {
+   if (!jail_errmsg[0])
+   snprintf(jail_errmsg, JAIL_ERRMSGLEN,
+   "jail_get: %s", strerror(errno));
+   return (-1);
+   }
+   return (vnet);
+}
+
 static void
 usage(void)
 {
@@ -1310,6 +1344,21 @@ main(int argc, char *argv[])
 
if (argc > 0)
usage();
+
+   if (opt_j > 0) {
+   switch (jail_getvnet(opt_j)) {
+   case -1:
+   errx(2, "%s", jail_errmsg);
+   case JAIL_SYS_NEW:
+   if (jail_attach(opt_j) < 0)
+   errx(3, "%s", jail_errmsg);
+   /* Set back to -1 for normal output in vnet jail. */
+   opt_j = -1;
+   break;
+   default:
+   break;
+   }
+   }
 
if ((!opt_4 && !opt_6) && protos_defined != -1)
opt_4 = opt_6 = 1;
___
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: r360454 - stable/12/stand/lua

2020-04-28 Thread Ryan Moeller
Author: freqlabs
Date: Wed Apr 29 05:11:17 2020
New Revision: 360454
URL: https://svnweb.freebsd.org/changeset/base/360454

Log:
  MFC r360199
  
  menu.lua: Give names to menu entries
  
  Make menu customizations easier by naming the entries and using the
  names to build the table entries.
  
  Reviewed by:kevans
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D24527

Modified:
  stable/12/stand/lua/menu.lua
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/lua/menu.lua
==
--- stable/12/stand/lua/menu.luaWed Apr 29 02:18:39 2020
(r360453)
+++ stable/12/stand/lua/menu.luaWed Apr 29 05:11:17 2020
(r360454)
@@ -212,30 +212,50 @@ menu.boot_options = {
 menu.welcome = {
entries = function()
local menu_entries = menu.welcome.all_entries
-   -- Swap the first two menu items on single user boot
+   local multi_user = menu_entries.multi_user
+   local single_user = menu_entries.single_user
+   local boot_entry_1, boot_entry_2
if core.isSingleUserBoot() then
-   -- We'll cache the swapped menu, for performance
-   if menu.welcome.swapped_menu ~= nil then
-   return menu.welcome.swapped_menu
+   -- Swap the first two menu items on single user boot.
+   -- We'll cache the alternate entries for performance.
+   local alts = menu_entries.alts
+   if alts == nil then
+   single_user = core.deepCopyTable(single_user)
+   multi_user = core.deepCopyTable(multi_user)
+   single_user.name = single_user.alternate_name
+   multi_user.name = multi_user.alternate_name
+   menu_entries.alts = {
+   single_user = single_user,
+   multi_user = multi_user,
+   }
+   else
+   single_user = alts.single_user 
+   multi_user = alts.multi_user
end
-   -- Shallow copy the table
-   menu_entries = core.deepCopyTable(menu_entries)
-
-   -- Swap the first two menu entries
-   menu_entries[1], menu_entries[2] =
-   menu_entries[2], menu_entries[1]
-
-   -- Then set their names to their alternate names
-   menu_entries[1].name, menu_entries[2].name =
-   menu_entries[1].alternate_name,
-   menu_entries[2].alternate_name
-   menu.welcome.swapped_menu = menu_entries
+   boot_entry_1, boot_entry_2 = single_user, multi_user
+   else
+   boot_entry_1, boot_entry_2 = multi_user, single_user
end
-   return menu_entries
+   return {
+   boot_entry_1,
+   boot_entry_2,
+   menu_entries.prompt,
+   menu_entries.reboot,
+   {
+   entry_type = core.MENU_SEPARATOR,
+   },
+   {
+   entry_type = core.MENU_SEPARATOR,
+   name = "Options:",
+   },
+   menu_entries.kernel_options,
+   menu_entries.boot_options,
+   menu_entries.boot_envs,
+   menu_entries.chainload,
+   }
end,
all_entries = {
-   -- boot multi user
-   {
+   multi_user = {
entry_type = core.MENU_ENTRY,
name = color.highlight("B") .. "oot Multi user " ..
color.highlight("[Enter]"),
@@ -248,8 +268,7 @@ menu.welcome = {
end,
alias = {"b", "B"},
},
-   -- boot single user
-   {
+   single_user = {
entry_type = core.MENU_ENTRY,
name = "Boot " .. color.highlight("S") .. "ingle user",
-- Not a standard menu entry function!
@@ -261,8 +280,7 @@ menu.welcome = {
end,
alias = {"s", "S"},
},
-   -- escape to interpreter
-   {
+   prompt = {
entry_type = core.MENU_RETURN,
   

svn commit: r360356 - head/usr.bin/sockstat

2020-04-26 Thread Ryan Moeller
Author: freqlabs
Date: Sun Apr 26 20:55:11 2020
New Revision: 360356
URL: https://svnweb.freebsd.org/changeset/base/360356

Log:
  sockstat: Attach to jail if in new vnet
  
  Attach sockstat -j to the specified jail if the jail is in a new vnet.
  Otherwise we do not see all sockets belonging to the jail.
  
  Reviewed by:  jamie
  Approved by:  mmacy (mentor)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24413

Modified:
  head/usr.bin/sockstat/sockstat.c

Modified: head/usr.bin/sockstat/sockstat.c
==
--- head/usr.bin/sockstat/sockstat.cSun Apr 26 20:16:18 2020
(r360355)
+++ head/usr.bin/sockstat/sockstat.cSun Apr 26 20:55:11 2020
(r360356)
@@ -32,10 +32,11 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -1218,7 +1219,8 @@ display(void)
}
 }
 
-static int set_default_protos(void)
+static int
+set_default_protos(void)
 {
struct protoent *prot;
const char *pname;
@@ -1237,6 +1239,38 @@ static int set_default_protos(void)
return (pindex);
 }
 
+/*
+ * Return the vnet property of the jail, or -1 on error.
+ */
+static int
+jail_getvnet(int jid)
+{
+   struct iovec jiov[6];
+   int vnet;
+
+   vnet = -1;
+   jiov[0].iov_base = __DECONST(char *, "jid");
+   jiov[0].iov_len = sizeof("jid");
+   jiov[1].iov_base = 
+   jiov[1].iov_len = sizeof(jid);
+   jiov[2].iov_base = __DECONST(char *, "vnet");
+   jiov[2].iov_len = sizeof("vnet");
+   jiov[3].iov_base = 
+   jiov[3].iov_len = sizeof(vnet);
+   jiov[4].iov_base = __DECONST(char *, "errmsg");
+   jiov[4].iov_len = sizeof("errmsg");
+   jiov[5].iov_base = jail_errmsg;
+   jiov[5].iov_len = JAIL_ERRMSGLEN;
+   jail_errmsg[0] = '\0';
+   if (jail_get(jiov, nitems(jiov), 0) < 0) {
+   if (!jail_errmsg[0])
+   snprintf(jail_errmsg, JAIL_ERRMSGLEN,
+   "jail_get: %s", strerror(errno));
+   return (-1);
+   }
+   return (vnet);
+}
+
 static void
 usage(void)
 {
@@ -1310,6 +1344,21 @@ main(int argc, char *argv[])
 
if (argc > 0)
usage();
+
+   if (opt_j > 0) {
+   switch (jail_getvnet(opt_j)) {
+   case -1:
+   errx(2, "%s", jail_errmsg);
+   case JAIL_SYS_NEW:
+   if (jail_attach(opt_j) < 0)
+   errx(3, "%s", jail_errmsg);
+   /* Set back to -1 for normal output in vnet jail. */
+   opt_j = -1;
+   break;
+   default:
+   break;
+   }
+   }
 
if ((!opt_4 && !opt_6) && protos_defined != -1)
opt_4 = opt_6 = 1;
___
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: r360199 - head/stand/lua

2020-04-22 Thread Ryan Moeller
Author: freqlabs
Date: Wed Apr 22 17:04:31 2020
New Revision: 360199
URL: https://svnweb.freebsd.org/changeset/base/360199

Log:
  menu.lua: Give names to menu entries
  
  Make menu customizations easier by naming the entries and using the
  names to build the table entries.
  
  Reviewed by:  kevans
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D24527

Modified:
  head/stand/lua/menu.lua

Modified: head/stand/lua/menu.lua
==
--- head/stand/lua/menu.lua Wed Apr 22 14:45:00 2020(r360198)
+++ head/stand/lua/menu.lua Wed Apr 22 17:04:31 2020(r360199)
@@ -212,30 +212,50 @@ menu.boot_options = {
 menu.welcome = {
entries = function()
local menu_entries = menu.welcome.all_entries
-   -- Swap the first two menu items on single user boot
+   local multi_user = menu_entries.multi_user
+   local single_user = menu_entries.single_user
+   local boot_entry_1, boot_entry_2
if core.isSingleUserBoot() then
-   -- We'll cache the swapped menu, for performance
-   if menu.welcome.swapped_menu ~= nil then
-   return menu.welcome.swapped_menu
+   -- Swap the first two menu items on single user boot.
+   -- We'll cache the alternate entries for performance.
+   local alts = menu_entries.alts
+   if alts == nil then
+   single_user = core.deepCopyTable(single_user)
+   multi_user = core.deepCopyTable(multi_user)
+   single_user.name = single_user.alternate_name
+   multi_user.name = multi_user.alternate_name
+   menu_entries.alts = {
+   single_user = single_user,
+   multi_user = multi_user,
+   }
+   else
+   single_user = alts.single_user 
+   multi_user = alts.multi_user
end
-   -- Shallow copy the table
-   menu_entries = core.deepCopyTable(menu_entries)
-
-   -- Swap the first two menu entries
-   menu_entries[1], menu_entries[2] =
-   menu_entries[2], menu_entries[1]
-
-   -- Then set their names to their alternate names
-   menu_entries[1].name, menu_entries[2].name =
-   menu_entries[1].alternate_name,
-   menu_entries[2].alternate_name
-   menu.welcome.swapped_menu = menu_entries
+   boot_entry_1, boot_entry_2 = single_user, multi_user
+   else
+   boot_entry_1, boot_entry_2 = multi_user, single_user
end
-   return menu_entries
+   return {
+   boot_entry_1,
+   boot_entry_2,
+   menu_entries.prompt,
+   menu_entries.reboot,
+   {
+   entry_type = core.MENU_SEPARATOR,
+   },
+   {
+   entry_type = core.MENU_SEPARATOR,
+   name = "Options:",
+   },
+   menu_entries.kernel_options,
+   menu_entries.boot_options,
+   menu_entries.boot_envs,
+   menu_entries.chainload,
+   }
end,
all_entries = {
-   -- boot multi user
-   {
+   multi_user = {
entry_type = core.MENU_ENTRY,
name = color.highlight("B") .. "oot Multi user " ..
color.highlight("[Enter]"),
@@ -248,8 +268,7 @@ menu.welcome = {
end,
alias = {"b", "B"},
},
-   -- boot single user
-   {
+   single_user = {
entry_type = core.MENU_ENTRY,
name = "Boot " .. color.highlight("S") .. "ingle user",
-- Not a standard menu entry function!
@@ -261,8 +280,7 @@ menu.welcome = {
end,
alias = {"s", "S"},
},
-   -- escape to interpreter
-   {
+   prompt = {
entry_type = core.MENU_RETURN,
name = color.highlight("Esc") .. "ape to loader prompt",
 

svn commit: r359722 - in stable/11: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs

2020-04-08 Thread Ryan Moeller
Author: freqlabs
Date: Wed Apr  8 08:05:02 2020
New Revision: 359722
URL: https://svnweb.freebsd.org/changeset/base/359722

Log:
  MFC r359303
  
  MFOpenZFS: ZVOLs should not be allowed to have children
  
  zfs create, receive and rename can bypass this hierarchy rule. Update
  both userland and kernel module to prevent this issue and use pyzfs
  unit tests to exercise the ioctls directly.
  
  Note: this commit slightly changes zfs_ioc_create() ABI. This allow to
  differentiate a generic error (EINVAL) from the specific case where we
  tried to create a dataset below a ZVOL (ZFS_ERR_WRONG_PARENT).
  
  Reviewed-by: Paul Dagnelie 
  Reviewed-by: Matt Ahrens 
  Reviewed-by: Brian Behlendorf 
  Reviewed-by: Tom Caputi 
  Signed-off-by: loli10K 
  
  Approved by:mav (mentor)
  openzfs/zfs@d8d418ff0cc90776182534bce10b01e9487b63e4

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Wed Apr 
 8 06:06:13 2020(r359721)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Wed Apr 
 8 08:05:02 2020(r359722)
@@ -140,6 +140,7 @@ typedef enum zfs_error {
EZFS_TOOMANY,   /* argument list too long */
EZFS_INITIALIZING,  /* currently initializing */
EZFS_NO_INITIALIZE, /* no active initialize */
+   EZFS_WRONG_PARENT,  /* invalid parent dataset (e.g ZVOL) */
EZFS_UNKNOWN
 } zfs_error_t;
 

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Apr  8 06:06:13 2020(r359721)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Apr  8 08:05:02 2020(r359722)
@@ -3616,11 +3616,6 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs
"no such parent '%s'"), parent);
return (zfs_error(hdl, EZFS_NOENT, errbuf));
 
-   case EINVAL:
-   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-   "parent '%s' is not a filesystem"), parent);
-   return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
-
case ENOTSUP:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"pool must be upgraded to set this "

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Apr  8 06:06:13 2020(r359721)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Apr  8 08:05:02 2020(r359722)
@@ -28,6 +28,8 @@
  * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2016 Igor Kozhukhov 
+ * Copyright (c) 2018, loli10K . All rights reserved.
+ * Copyright (c) 2019 Datto Inc.
  */
 
 #include 
@@ -3356,6 +3358,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
 *  - we are resuming a failed receive.
 */
if (stream_wantsnewfs) {
+   boolean_t is_volume = drrb->drr_type == DMU_OST_ZVOL;
if (!flags->force) {
zcmd_free_nvlists();
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
@@ -3373,6 +3376,25 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
zc.zc_name);
return (zfs_error(hdl, EZFS_EXISTS, errbuf));
}
+   if (is_volume && strrchr(zc.zc_name, '/') == NULL) {
+   zcmd_free_nvlists();
+   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+   "destination '%s' is the root dataset\n"
+   "cannot overwrite with a ZVOL"),
+  

svn commit: r359721 - in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs

2020-04-08 Thread Ryan Moeller
Author: freqlabs
Date: Wed Apr  8 06:06:13 2020
New Revision: 359721
URL: https://svnweb.freebsd.org/changeset/base/359721

Log:
  MFC r359303
  
  MFOpenZFS: ZVOLs should not be allowed to have children
  
  zfs create, receive and rename can bypass this hierarchy rule. Update
  both userland and kernel module to prevent this issue and use pyzfs
  unit tests to exercise the ioctls directly.
  
  Note: this commit slightly changes zfs_ioc_create() ABI. This allow to
  differentiate a generic error (EINVAL) from the specific case where we
  tried to create a dataset below a ZVOL (ZFS_ERR_WRONG_PARENT).
  
  Reviewed-by: Paul Dagnelie 
  Reviewed-by: Matt Ahrens 
  Reviewed-by: Brian Behlendorf 
  Reviewed-by: Tom Caputi 
  Signed-off-by: loli10K 
  
  Approved by:mav (mentor)
  openzfs/zfs@d8d418ff0cc90776182534bce10b01e9487b63e4

Modified:
  stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Wed Apr 
 8 01:12:54 2020(r359720)
+++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Wed Apr 
 8 06:06:13 2020(r359721)
@@ -140,6 +140,7 @@ typedef enum zfs_error {
EZFS_TOOMANY,   /* argument list too long */
EZFS_INITIALIZING,  /* currently initializing */
EZFS_NO_INITIALIZE, /* no active initialize */
+   EZFS_WRONG_PARENT,  /* invalid parent dataset (e.g ZVOL) */
EZFS_UNKNOWN
 } zfs_error_t;
 

Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Apr  8 01:12:54 2020(r359720)
+++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Apr  8 06:06:13 2020(r359721)
@@ -3622,11 +3622,6 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs
"no such parent '%s'"), parent);
return (zfs_error(hdl, EZFS_NOENT, errbuf));
 
-   case EINVAL:
-   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-   "parent '%s' is not a filesystem"), parent);
-   return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
-
case ENOTSUP:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"pool must be upgraded to set this "

Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Apr  8 01:12:54 2020(r359720)
+++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Wed Apr  8 06:06:13 2020(r359721)
@@ -28,6 +28,7 @@
  * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2016 Igor Kozhukhov 
+ * Copyright (c) 2018, loli10K . All rights reserved.
  * Copyright (c) 2019 Datto Inc.
  */
 
@@ -3375,6 +3376,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
 *  - we are resuming a failed receive.
 */
if (stream_wantsnewfs) {
+   boolean_t is_volume = drrb->drr_type == DMU_OST_ZVOL;
if (!flags->force) {
zcmd_free_nvlists();
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
@@ -3392,6 +3394,25 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
zc.zc_name);
return (zfs_error(hdl, EZFS_EXISTS, errbuf));
}
+   if (is_volume && strrchr(zc.zc_name, '/') == NULL) {
+   zcmd_free_nvlists();
+   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+   "destination '%s' is the root dataset\n"
+   "cannot overwrite with a ZVOL"),
+ 

svn commit: r359586 - in stable/12/stand: forth lua

2020-04-02 Thread Ryan Moeller
Author: freqlabs
Date: Fri Apr  3 01:31:48 2020
New Revision: 359586
URL: https://svnweb.freebsd.org/changeset/base/359586

Log:
  MFC r359371
  
  loader: Fully reset terminal settings, not just colors
  
  Reviewed by:kevans, tsoome
  Approved by:mav (mentor)

Modified:
  stable/12/stand/forth/loader.4th
  stable/12/stand/forth/loader.rc
  stable/12/stand/forth/screen.4th
  stable/12/stand/lua/core.lua
  stable/12/stand/lua/loader.lua
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/forth/loader.4th
==
--- stable/12/stand/forth/loader.4thFri Apr  3 01:17:43 2020
(r359585)
+++ stable/12/stand/forth/loader.4thFri Apr  3 01:31:48 2020
(r359586)
@@ -49,6 +49,12 @@ include /boot/check-password.4th
 
 only forth definitions
 
+: maybe-resetcons ( -- )
+  loader_color? if
+ris
+  then
+;
+
 : bootmsg ( -- )
   loader_color? dup ( -- bool bool )
   if 7 fg 4 bg then

Modified: stable/12/stand/forth/loader.rc
==
--- stable/12/stand/forth/loader.rc Fri Apr  3 01:17:43 2020
(r359585)
+++ stable/12/stand/forth/loader.rc Fri Apr  3 01:31:48 2020
(r359586)
@@ -14,6 +14,7 @@ try-include /boot/loader.rc.local
 start
 
 maybe-efi-resizecons
+maybe-resetcons
 
 \ Tests for password -- executes autoboot first if a password was defined
 check-password

Modified: stable/12/stand/forth/screen.4th
==
--- stable/12/stand/forth/screen.4thFri Apr  3 01:17:43 2020
(r359585)
+++ stable/12/stand/forth/screen.4thFri Apr  3 01:31:48 2020
(r359586)
@@ -39,6 +39,9 @@ marker task-screen.4th
 \ clear screen
 : clear ( -- ) ho cld ;
 
+\ reset to initial state
+: ris ( -- ) 27 emit [char] c emit ;
+
 \ move cursor to x rows, y cols (1-based coords) ( Esc-[%d;%dH )
 : at-xy ( x y -- ) escc .# [char] ; emit .# [char] H emit ;
 

Modified: stable/12/stand/lua/core.lua
==
--- stable/12/stand/lua/core.luaFri Apr  3 01:17:43 2020
(r359585)
+++ stable/12/stand/lua/core.luaFri Apr  3 01:31:48 2020
(r359586)
@@ -103,6 +103,7 @@ core.KEY_DELETE = 127
 -- other contexts (outside of Lua) may mean 'octal'
 core.KEYSTR_ESCAPE = "\027"
 core.KEYSTR_CSI= core.KEYSTR_ESCAPE .. "["
+core.KEYSTR_RESET  = core.KEYSTR_ESCAPE .. "c"
 
 core.MENU_RETURN   = "return"
 core.MENU_ENTRY= "entry"

Modified: stable/12/stand/lua/loader.lua
==
--- stable/12/stand/lua/loader.lua  Fri Apr  3 01:17:43 2020
(r359585)
+++ stable/12/stand/lua/loader.lua  Fri Apr  3 01:31:48 2020
(r359586)
@@ -38,28 +38,21 @@ local color = require("color")
 local core = require("core")
 local config = require("config")
 local password = require("password")
--- The menu module will be brought in after config has loaded if we actually
--- need it.
-local menu
 
 config.load()
 
--- Our console may have been setup for a different color scheme before we get
--- here, so make sure we set the default.
-if color.isEnabled() then
-   printc(color.default())
-end
-try_include("local")
-if not core.isMenuSkipped() then
-   menu = require("menu")
-end
 if core.isUEFIBoot() then
loader.perform("efi-autoresizecons")
 end
+-- Our console may have been setup with different settings before we get
+-- here, so make sure we reset everything back to default.
+if color.isEnabled() then
+   printc(core.KEYSTR_RESET)
+end
+try_include("local")
 password.check()
--- menu might be disabled
-if menu ~= nil then
-   menu.run()
+if not core.isMenuSkipped() then
+   require("menu").run()
 else
-- Load kernel/modules before we go
config.loadelf()
___
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: r359371 - in head/stand: forth lua

2020-03-27 Thread Ryan Moeller
Author: freqlabs
Date: Fri Mar 27 17:37:31 2020
New Revision: 359371
URL: https://svnweb.freebsd.org/changeset/base/359371

Log:
  loader: Fully reset terminal settings, not just colors
  
  Reviewed by:  kevans
  Reviewed by:  tsoome
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D21733

Modified:
  head/stand/forth/loader.4th
  head/stand/forth/loader.rc
  head/stand/forth/screen.4th
  head/stand/lua/core.lua
  head/stand/lua/loader.lua

Modified: head/stand/forth/loader.4th
==
--- head/stand/forth/loader.4th Fri Mar 27 17:06:24 2020(r359370)
+++ head/stand/forth/loader.4th Fri Mar 27 17:37:31 2020(r359371)
@@ -72,6 +72,12 @@ include /boot/check-password.4th
 
 only forth definitions
 
+: maybe-resetcons ( -- )
+  loader_color? if
+ris
+  then
+;
+
 : bootmsg ( -- )
   loader_color? dup ( -- bool bool )
   if 7 fg 4 bg then

Modified: head/stand/forth/loader.rc
==
--- head/stand/forth/loader.rc  Fri Mar 27 17:06:24 2020(r359370)
+++ head/stand/forth/loader.rc  Fri Mar 27 17:37:31 2020(r359371)
@@ -14,6 +14,7 @@ try-include /boot/loader.rc.local
 start
 
 maybe-efi-resizecons
+maybe-resetcons
 
 \ Tests for password -- executes autoboot first if a password was defined
 check-password

Modified: head/stand/forth/screen.4th
==
--- head/stand/forth/screen.4th Fri Mar 27 17:06:24 2020(r359370)
+++ head/stand/forth/screen.4th Fri Mar 27 17:37:31 2020(r359371)
@@ -39,6 +39,9 @@ marker task-screen.4th
 \ clear screen
 : clear ( -- ) ho cld ;
 
+\ reset to initial state
+: ris ( -- ) 27 emit [char] c emit ;
+
 \ move cursor to x rows, y cols (1-based coords) ( Esc-[%d;%dH )
 : at-xy ( x y -- ) escc .# [char] ; emit .# [char] H emit ;
 

Modified: head/stand/lua/core.lua
==
--- head/stand/lua/core.lua Fri Mar 27 17:06:24 2020(r359370)
+++ head/stand/lua/core.lua Fri Mar 27 17:37:31 2020(r359371)
@@ -103,6 +103,7 @@ core.KEY_DELETE = 127
 -- other contexts (outside of Lua) may mean 'octal'
 core.KEYSTR_ESCAPE = "\027"
 core.KEYSTR_CSI= core.KEYSTR_ESCAPE .. "["
+core.KEYSTR_RESET  = core.KEYSTR_ESCAPE .. "c"
 
 core.MENU_RETURN   = "return"
 core.MENU_ENTRY= "entry"

Modified: head/stand/lua/loader.lua
==
--- head/stand/lua/loader.lua   Fri Mar 27 17:06:24 2020(r359370)
+++ head/stand/lua/loader.lua   Fri Mar 27 17:37:31 2020(r359371)
@@ -38,28 +38,21 @@ local color = require("color")
 local core = require("core")
 local config = require("config")
 local password = require("password")
--- The menu module will be brought in after config has loaded if we actually
--- need it.
-local menu
 
 config.load()
 
--- Our console may have been setup for a different color scheme before we get
--- here, so make sure we set the default.
-if color.isEnabled() then
-   printc(color.default())
-end
-try_include("local")
-if not core.isMenuSkipped() then
-   menu = require("menu")
-end
 if core.isUEFIBoot() then
loader.perform("efi-autoresizecons")
 end
+-- Our console may have been setup with different settings before we get
+-- here, so make sure we reset everything back to default.
+if color.isEnabled() then
+   printc(core.KEYSTR_RESET)
+end
+try_include("local")
 password.check()
--- menu might be disabled
-if menu ~= nil then
-   menu.run()
+if not core.isMenuSkipped() then
+   require("menu").run()
 else
-- Load kernel/modules before we go
config.loadelf()
___
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: r359304 - stable/12/stand/lua

2020-03-25 Thread Ryan Moeller
Author: freqlabs
Date: Wed Mar 25 16:24:28 2020
New Revision: 359304
URL: https://svnweb.freebsd.org/changeset/base/359304

Log:
  MFC r359072-r359073
  
  loader: Add a "kernel.loaded" hook
  
  This hook can be useful, for example to run a local function to choose
  different modules to load when a user has picked a different kernel
  from the menu.
  
  Reviewed by:kevans
  Approved by:mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D24115

Modified:
  stable/12/stand/lua/config.lua
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/lua/config.lua
==
--- stable/12/stand/lua/config.lua  Wed Mar 25 15:56:18 2020
(r359303)
+++ stable/12/stand/lua/config.lua  Wed Mar 25 16:24:28 2020
(r359304)
@@ -623,7 +623,7 @@ end
 function config.loadelf()
local xen_kernel = loader.getenv('xen_kernel')
local kernel = config.kernel_selected or config.kernel_loaded
-   local loaded, status
+   local status
 
if xen_kernel ~= nil then
print(MSG_XENKERNLOADING)
@@ -633,11 +633,10 @@ function config.loadelf()
end
end
print(MSG_KERNLOADING)
-   loaded = config.loadKernel(kernel)
-
-   if not loaded then
+   if not config.loadKernel(kernel) then
return false
end
+   hook.runAll("kernel.loaded")
 
print(MSG_MODLOADING)
status = loadModule(modules, not config.verbose)
@@ -647,5 +646,6 @@ end
 
 hook.registerType("config.loaded")
 hook.registerType("config.reloaded")
+hook.registerType("kernel.loaded")
 hook.registerType("modules.loaded")
 return config
___
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: r359303 - in head: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs

2020-03-25 Thread Ryan Moeller
Author: freqlabs
Date: Wed Mar 25 15:56:18 2020
New Revision: 359303
URL: https://svnweb.freebsd.org/changeset/base/359303

Log:
  MFOpenZFS: ZVOLs should not be allowed to have children
  
  zfs create, receive and rename can bypass this hierarchy rule. Update
  both userland and kernel module to prevent this issue and use pyzfs
  unit tests to exercise the ioctls directly.
  
  Note: this commit slightly changes zfs_ioc_create() ABI. This allow to
  differentiate a generic error (EINVAL) from the specific case where we
  tried to create a dataset below a ZVOL (ZFS_ERR_WRONG_PARENT).
  
  Reviewed-by: Paul Dagnelie 
  Reviewed-by: Matt Ahrens 
  Reviewed-by: Brian Behlendorf 
  Reviewed-by: Tom Caputi 
  Signed-off-by: loli10K 
  
  Approved by:  mav (mentor)
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.
  openzfs/zfs@d8d418ff0cc90776182534bce10b01e9487b63e4

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hWed Mar 25 
15:29:01 2020(r359302)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.hWed Mar 25 
15:56:18 2020(r359303)
@@ -141,6 +141,7 @@ typedef enum zfs_error {
EZFS_TOOMANY,   /* argument list too long */
EZFS_INITIALIZING,  /* currently initializing */
EZFS_NO_INITIALIZE, /* no active initialize */
+   EZFS_WRONG_PARENT,  /* invalid parent dataset (e.g ZVOL) */
EZFS_UNKNOWN
 } zfs_error_t;
 

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cWed Mar 
25 15:29:01 2020(r359302)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cWed Mar 
25 15:56:18 2020(r359303)
@@ -3654,11 +3654,6 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs
"no such parent '%s'"), parent);
return (zfs_error(hdl, EZFS_NOENT, errbuf));
 
-   case EINVAL:
-   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-   "parent '%s' is not a filesystem"), parent);
-   return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
-
case ENOTSUP:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"pool must be upgraded to set this "

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Wed Mar 
25 15:29:01 2020(r359302)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Wed Mar 
25 15:56:18 2020(r359303)
@@ -28,6 +28,7 @@
  * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2016 Igor Kozhukhov 
+ * Copyright (c) 2018, loli10K . All rights reserved.
  * Copyright (c) 2019 Datto Inc.
  */
 
@@ -3375,6 +3376,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
 *  - we are resuming a failed receive.
 */
if (stream_wantsnewfs) {
+   boolean_t is_volume = drrb->drr_type == DMU_OST_ZVOL;
if (!flags->force) {
zcmd_free_nvlists();
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
@@ -3392,6 +3394,25 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
zc.zc_name);
return (zfs_error(hdl, EZFS_EXISTS, errbuf));
}
+   if (is_volume && strrchr(zc.zc_name, '/') == NULL) {
+   zcmd_free_nvlists();
+   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+   "destination '%s' is the root dataset\n"
+   "cannot overwrite with a ZVOL"),
+   zc.zc_name);
+   return (zfs_error(hdl, EZFS_EXISTS, errbuf));
+   }

svn commit: r359217 - stable/12/sys/cddl/compat/opensolaris/sys

2020-03-22 Thread Ryan Moeller
Author: freqlabs
Date: Sun Mar 22 17:13:19 2020
New Revision: 359217
URL: https://svnweb.freebsd.org/changeset/base/359217

Log:
  MFC r358971:
  
  TODO DONE: Use sx_xholder in SPL rwlock.h
  
  Approved by:  mav (mentor)
  Sponsored by: iXsystems, Inc.

Modified:
  stable/12/sys/cddl/compat/opensolaris/sys/rwlock.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/compat/opensolaris/sys/rwlock.h
==
--- stable/12/sys/cddl/compat/opensolaris/sys/rwlock.h  Sun Mar 22 16:55:20 
2020(r359216)
+++ stable/12/sys/cddl/compat/opensolaris/sys/rwlock.h  Sun Mar 22 17:13:19 
2020(r359217)
@@ -87,8 +87,7 @@ typedef   struct sx   krwlock_t;
 #definerw_write_held(lock) sx_xlocked(lock)
 #definerw_lock_held(lock)  (rw_read_held(lock) || 
rw_write_held(lock))
 #definerw_iswriter(lock)   sx_xlocked(lock)
-/* TODO: Change to sx_xholder() once it is moved from kern_sx.c to sx.h. */
-#definerw_owner(lock)  ((lock)->sx_lock & SX_LOCK_SHARED ? 
NULL : (struct thread *)SX_OWNER((lock)->sx_lock))
+#definerw_owner(lock)  sx_xholder(lock)
 
 #endif /* defined(_KERNEL) */
 
___
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: r359073 - head/stand/lua

2020-03-18 Thread Ryan Moeller
Author: freqlabs
Date: Wed Mar 18 17:01:03 2020
New Revision: 359073
URL: https://svnweb.freebsd.org/changeset/base/359073

Log:
  Fixup line lost from previous commit (r359072)
  
  Reviewed by:  kevans
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D24115

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Wed Mar 18 16:21:11 2020(r359072)
+++ head/stand/lua/config.lua   Wed Mar 18 17:01:03 2020(r359073)
@@ -646,5 +646,6 @@ end
 
 hook.registerType("config.loaded")
 hook.registerType("config.reloaded")
+hook.registerType("kernel.loaded")
 hook.registerType("modules.loaded")
 return config
___
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: r359072 - head/stand/lua

2020-03-18 Thread Ryan Moeller
Author: freqlabs
Date: Wed Mar 18 16:21:11 2020
New Revision: 359072
URL: https://svnweb.freebsd.org/changeset/base/359072

Log:
  loader: Add a "kernel.loaded" hook
  
  This hook can be useful, for example to run a local function to choose
  different modules to load when a user has picked a different kernel
  from the menu.
  
  Reviewed by:  kevans
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D24115

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Wed Mar 18 15:02:09 2020(r359071)
+++ head/stand/lua/config.lua   Wed Mar 18 16:21:11 2020(r359072)
@@ -623,7 +623,7 @@ end
 function config.loadelf()
local xen_kernel = loader.getenv('xen_kernel')
local kernel = config.kernel_selected or config.kernel_loaded
-   local loaded, status
+   local status
 
if xen_kernel ~= nil then
print(MSG_XENKERNLOADING)
@@ -633,11 +633,10 @@ function config.loadelf()
end
end
print(MSG_KERNLOADING)
-   loaded = config.loadKernel(kernel)
-
-   if not loaded then
+   if not config.loadKernel(kernel) then
return false
end
+   hook.runAll("kernel.loaded")
 
print(MSG_MODLOADING)
status = loadModule(modules, not config.verbose)
___
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: r358971 - head/sys/cddl/compat/opensolaris/sys

2020-03-13 Thread Ryan Moeller
Author: freqlabs
Date: Sat Mar 14 00:16:15 2020
New Revision: 358971
URL: https://svnweb.freebsd.org/changeset/base/358971

Log:
  TODO DONE: Use sx_xholder in SPL rwlock.h
  
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cddl/compat/opensolaris/sys/rwlock.h

Modified: head/sys/cddl/compat/opensolaris/sys/rwlock.h
==
--- head/sys/cddl/compat/opensolaris/sys/rwlock.h   Fri Mar 13 22:18:40 
2020(r358970)
+++ head/sys/cddl/compat/opensolaris/sys/rwlock.h   Sat Mar 14 00:16:15 
2020(r358971)
@@ -87,8 +87,7 @@ typedef   struct sx   krwlock_t;
 #definerw_write_held(lock) sx_xlocked(lock)
 #definerw_lock_held(lock)  (rw_read_held(lock) || 
rw_write_held(lock))
 #definerw_iswriter(lock)   sx_xlocked(lock)
-/* TODO: Change to sx_xholder() once it is moved from kern_sx.c to sx.h. */
-#definerw_owner(lock)  ((lock)->sx_lock & SX_LOCK_SHARED ? 
NULL : (struct thread *)SX_OWNER((lock)->sx_lock))
+#definerw_owner(lock)  sx_xholder(lock)
 
 #endif /* defined(_KERNEL) */
 
___
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: r358923 - in head: lib/libpmcstat usr.sbin/pmcstat

2020-03-12 Thread Ryan Moeller


> It's unclear from the context- is there any particular reason this
> can't instead using sysctl kern.module_path and accept a semicolon
> delimited list of directories for -k (maybe calling it -k kernelpath
> instead)?

No, that looks technically possible.

-Ryan
___
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: r358923 - in head: lib/libpmcstat usr.sbin/pmcstat

2020-03-12 Thread Ryan Moeller
Author: freqlabs
Date: Thu Mar 12 23:04:40 2020
New Revision: 358923
URL: https://svnweb.freebsd.org/changeset/base/358923

Log:
  libpmcstat: Try /boot/modules if module not found
  
  Modules from ports/pkg are commonly installed to /boot/modules rather than to
  the same directory the kernel resides in.  Look there if a module is not found
  next to the kernel.
  
  Submitted by: mmacy
  Reported by:  Nick Principe 
  Approved by:  mmacy (mentor)
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/lib/libpmcstat/libpmcstat_image.c
  head/usr.sbin/pmcstat/pmcstat.8

Modified: head/lib/libpmcstat/libpmcstat_image.c
==
--- head/lib/libpmcstat/libpmcstat_image.c  Thu Mar 12 21:26:36 2020
(r358922)
+++ head/lib/libpmcstat/libpmcstat_image.c  Thu Mar 12 23:04:40 2020
(r358923)
@@ -278,6 +278,7 @@ pmcstat_image_get_elf_params(struct pmcstat_image *ima
GElf_Shdr sh;
enum pmcstat_image_type image_type;
char buffer[PATH_MAX];
+   char buffer_modules[PATH_MAX];
 
assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN);
 
@@ -292,23 +293,32 @@ pmcstat_image_get_elf_params(struct pmcstat_image *ima
assert(path != NULL);
 
/*
-* Look for kernel modules under FSROOT/KERNELPATH/NAME,
-* and user mode executable objects under FSROOT/PATHNAME.
+* Look for kernel modules under FSROOT/KERNELPATH/NAME and
+* FSROOT/boot/modules/NAME, and user mode executable objects
+* under FSROOT/PATHNAME.
 */
-   if (image->pi_iskernelmodule)
+   if (image->pi_iskernelmodule) {
(void) snprintf(buffer, sizeof(buffer), "%s%s/%s",
args->pa_fsroot, args->pa_kernel, path);
-   else
+   (void) snprintf(buffer_modules, sizeof(buffer_modules),
+   "%s/boot/modules/%s", args->pa_fsroot, path);
+   } else {
(void) snprintf(buffer, sizeof(buffer), "%s%s",
args->pa_fsroot, path);
+   }
 
e = NULL;
-   if ((fd = open(buffer, O_RDONLY, 0)) < 0) {
+   fd = open(buffer, O_RDONLY, 0);
+   if (fd < 0 && !image->pi_iskernelmodule) {
warnx("WARNING: Cannot open \"%s\".",
buffer);
goto done;
}
-
+   if (fd < 0 && (fd = open(buffer_modules, O_RDONLY, 0)) < 0) {
+   warnx("WARNING: Cannot open \"%s\" or \"%s\".",
+   buffer, buffer_modules);
+   goto done;
+   }
if (elf_version(EV_CURRENT) == EV_NONE) {
warnx("WARNING: failed to init elf\n");
goto done;

Modified: head/usr.sbin/pmcstat/pmcstat.8
==
--- head/usr.sbin/pmcstat/pmcstat.8 Thu Mar 12 21:26:36 2020
(r358922)
+++ head/usr.sbin/pmcstat/pmcstat.8 Thu Mar 12 23:04:40 2020
(r358923)
@@ -309,6 +309,8 @@ should look for the kernel and its modules.
 The default is to use the path of the running kernel obtained from the
 .Va kern.bootfile
 sysctl.
+Modules will also be searched for in /boot/modules if not found in
+.Ar kerneldir .
 .It Fl l Ar secs
 Set system-wide performance measurement duration for
 .Ar secs
___
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: r358057 - stable/12/share/misc

2020-02-17 Thread Ryan Moeller
Author: freqlabs
Date: Tue Feb 18 00:01:18 2020
New Revision: 358057
URL: https://svnweb.freebsd.org/changeset/base/358057

Log:
  MFC r357850:
  Add myself (freqlabs) as a src committer
  
  Approved by:mav (mentor)

Modified:
  stable/12/share/misc/committers-src.dot
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/misc/committers-src.dot
==
--- stable/12/share/misc/committers-src.dot Mon Feb 17 21:33:58 2020
(r358056)
+++ stable/12/share/misc/committers-src.dot Tue Feb 18 00:01:18 2020
(r358057)
@@ -171,6 +171,7 @@ fabient [label="Fabien Thomas\nfabi...@freebsd.org\n20
 fanf [label="Tony Finch\nf...@freebsd.org\n2002/05/05"]
 fjoe [label="Max Khon\nf...@freebsd.org\n2001/08/06"]
 flz [label="Florent Thoumie\n...@freebsd.org\n2006/03/30"]
+freqlabs [label="Ryan Moeller\nfreql...@freebsd.org\n2020/02/10"]
 fsu [label="Fedor Uporov\n...@freebsd.org\n2017/08/28"]
 gabor [label="Gabor Kovesdan\nga...@freebsd.org\n2010/02/02"]
 gad [label="Garance A. Drosehn\n...@freebsd.org\n2000/10/27"]
@@ -697,6 +698,7 @@ markm -> sheldonh
 
 mav -> ae
 mav -> eugen
+mav -> freqlabs
 mav -> ram
 
 mdf -> gleb
@@ -709,6 +711,8 @@ mlaier -> benjsc
 mlaier -> dhartmei
 mlaier -> thompsa
 mlaier -> eri
+
+mmacy -> freqlabs
 
 msmith -> cokane
 msmith -> jasone
___
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: r357850 - head/share/misc

2020-02-12 Thread Ryan Moeller
Author: freqlabs
Date: Thu Feb 13 01:42:13 2020
New Revision: 357850
URL: https://svnweb.freebsd.org/changeset/base/357850

Log:
  Add myself (freqlabs) as a src committer
  
  Approved by:  mav (mentor)
  MFC after:3 days

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Thu Feb 13 01:23:44 2020
(r357849)
+++ head/share/misc/committers-src.dot  Thu Feb 13 01:42:13 2020
(r357850)
@@ -175,6 +175,7 @@ fabient [label="Fabien Thomas\nfabi...@freebsd.org\n20
 fanf [label="Tony Finch\nf...@freebsd.org\n2002/05/05"]
 fjoe [label="Max Khon\nf...@freebsd.org\n2001/08/06"]
 flz [label="Florent Thoumie\n...@freebsd.org\n2006/03/30"]
+freqlabs [label="Ryan Moeller\nfreql...@freebsd.org\n2020/02/10"]
 fsu [label="Fedor Uporov\n...@freebsd.org\n2017/08/28"]
 gabor [label="Gabor Kovesdan\nga...@freebsd.org\n2010/02/02"]
 gad [label="Garance A. Drosehn\n...@freebsd.org\n2000/10/27"]
@@ -716,6 +717,7 @@ markm -> sheldonh
 
 mav -> ae
 mav -> eugen
+mav -> freqlabs
 mav -> ram
 
 mdf -> gleb
@@ -730,6 +732,8 @@ mlaier -> benjsc
 mlaier -> dhartmei
 mlaier -> thompsa
 mlaier -> eri
+
+mmacy -> freqlabs
 
 msmith -> cokane
 msmith -> jasone
___
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"