svn commit: r344426 - in stable: 11/lib/clang/libllvmminimal 12/lib/clang/libllvmminimal

2019-02-20 Thread Dimitry Andric
Author: dim
Date: Thu Feb 21 07:22:05 2019
New Revision: 344426
URL: https://svnweb.freebsd.org/changeset/base/344426

Log:
  MFC r344264:
  
  Add one additional file to libllvmminimal, since in some cases (e.g.
  upgrading from stable/10 to stable/11) symbols from it are needed to
  link llvm-tblgen and clang-tblgen.
  
  Reported by:  kib

Modified:
  stable/11/lib/clang/libllvmminimal/Makefile
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/lib/clang/libllvmminimal/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/lib/clang/libllvmminimal/Makefile
==
--- stable/11/lib/clang/libllvmminimal/Makefile Thu Feb 21 07:20:17 2019
(r344425)
+++ stable/11/lib/clang/libllvmminimal/Makefile Thu Feb 21 07:22:05 2019
(r344426)
@@ -18,6 +18,7 @@ SRCS+=Support/Errno.cpp
 SRCS+= Support/Error.cpp
 SRCS+= Support/ErrorHandling.cpp
 SRCS+= Support/FoldingSet.cpp
+SRCS+= Support/FormatVariadic.cpp
 SRCS+= Support/FormattedStream.cpp
 SRCS+= Support/Hashing.cpp
 SRCS+= Support/Host.cpp
___
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: r344426 - in stable: 11/lib/clang/libllvmminimal 12/lib/clang/libllvmminimal

2019-02-20 Thread Dimitry Andric
Author: dim
Date: Thu Feb 21 07:22:05 2019
New Revision: 344426
URL: https://svnweb.freebsd.org/changeset/base/344426

Log:
  MFC r344264:
  
  Add one additional file to libllvmminimal, since in some cases (e.g.
  upgrading from stable/10 to stable/11) symbols from it are needed to
  link llvm-tblgen and clang-tblgen.
  
  Reported by:  kib

Modified:
  stable/12/lib/clang/libllvmminimal/Makefile
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/lib/clang/libllvmminimal/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/lib/clang/libllvmminimal/Makefile
==
--- stable/12/lib/clang/libllvmminimal/Makefile Thu Feb 21 07:20:17 2019
(r344425)
+++ stable/12/lib/clang/libllvmminimal/Makefile Thu Feb 21 07:22:05 2019
(r344426)
@@ -18,6 +18,7 @@ SRCS+=Support/Errno.cpp
 SRCS+= Support/Error.cpp
 SRCS+= Support/ErrorHandling.cpp
 SRCS+= Support/FoldingSet.cpp
+SRCS+= Support/FormatVariadic.cpp
 SRCS+= Support/FormattedStream.cpp
 SRCS+= Support/Hashing.cpp
 SRCS+= Support/Host.cpp
___
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: r344425 - in stable: 11/contrib/libc++/include 12/contrib/libc++/include

2019-02-20 Thread Dimitry Andric
Author: dim
Date: Thu Feb 21 07:20:17 2019
New Revision: 344425
URL: https://svnweb.freebsd.org/changeset/base/344425

Log:
  MFC r344261:
  
  Pull in r345199 from upstream libc++ trunk (by Petr Hosek):
  
Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are
floating-point types."
  
This reverts commits r333103 and r333108. _Float16 and __fp16 are C11
extensions and compilers other than Clang don't define these for C++.
  
Differential Revision: https://reviews.llvm.org/D53670
  
  This prevents "_Float16 is not supported on this target" errors in
  libc++'s type_traits header, in some cases.
  
  Reported by:  Charlie Li

Modified:
  stable/12/contrib/libc++/include/type_traits
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/libc++/include/type_traits
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/contrib/libc++/include/type_traits
==
--- stable/12/contrib/libc++/include/type_traitsThu Feb 21 06:51:35 
2019(r344424)
+++ stable/12/contrib/libc++/include/type_traitsThu Feb 21 07:20:17 
2019(r344425)
@@ -733,12 +733,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_integral_
 // is_floating_point
 
 template  struct __libcpp_is_floating_point  : public 
false_type {};
-#ifdef __clang__
-template <>  struct __libcpp_is_floating_point<__fp16>  : public 
true_type {};
-#endif
-#ifdef __FLT16_MANT_DIG__
-template <>  struct __libcpp_is_floating_point<_Float16>: public 
true_type {};
-#endif
 template <>  struct __libcpp_is_floating_point   : public 
true_type {};
 template <>  struct __libcpp_is_floating_point  : public 
true_type {};
 template <>  struct __libcpp_is_floating_point : public 
true_type {};
___
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: r344425 - in stable: 11/contrib/libc++/include 12/contrib/libc++/include

2019-02-20 Thread Dimitry Andric
Author: dim
Date: Thu Feb 21 07:20:17 2019
New Revision: 344425
URL: https://svnweb.freebsd.org/changeset/base/344425

Log:
  MFC r344261:
  
  Pull in r345199 from upstream libc++ trunk (by Petr Hosek):
  
Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are
floating-point types."
  
This reverts commits r333103 and r333108. _Float16 and __fp16 are C11
extensions and compilers other than Clang don't define these for C++.
  
Differential Revision: https://reviews.llvm.org/D53670
  
  This prevents "_Float16 is not supported on this target" errors in
  libc++'s type_traits header, in some cases.
  
  Reported by:  Charlie Li

Modified:
  stable/11/contrib/libc++/include/type_traits
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/contrib/libc++/include/type_traits
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/contrib/libc++/include/type_traits
==
--- stable/11/contrib/libc++/include/type_traitsThu Feb 21 06:51:35 
2019(r344424)
+++ stable/11/contrib/libc++/include/type_traitsThu Feb 21 07:20:17 
2019(r344425)
@@ -733,12 +733,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_integral_
 // is_floating_point
 
 template  struct __libcpp_is_floating_point  : public 
false_type {};
-#ifdef __clang__
-template <>  struct __libcpp_is_floating_point<__fp16>  : public 
true_type {};
-#endif
-#ifdef __FLT16_MANT_DIG__
-template <>  struct __libcpp_is_floating_point<_Float16>: public 
true_type {};
-#endif
 template <>  struct __libcpp_is_floating_point   : public 
true_type {};
 template <>  struct __libcpp_is_floating_point  : public 
true_type {};
 template <>  struct __libcpp_is_floating_point : public 
true_type {};
___
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: r344422 - stable/12/lib/libcasper/services/cap_syslog

2019-02-20 Thread Jason A. Harmening
Author: jah
Date: Thu Feb 21 06:40:15 2019
New Revision: 344422
URL: https://svnweb.freebsd.org/changeset/base/344422

Log:
  MFC r343827:
  
  r342089 changed cap_syslog(3) to preserve the stdio descriptors inherited
  from its parent so that LOG_PERROR would work.  However, this caused
  dhclient(8)'s stdio streams to remain open across daemonization, breaking
  the ability to capture its foreground output as done in netconfig_ipv4.
  
  Fix this by reverting r341692 and instead passing the parent's stderr
  descriptor as an argument to cap_openlog() only when LOG_PERROR is specified
  in logopt.
  
  PR:   234514

Modified:
  stable/12/lib/libcasper/services/cap_syslog/cap_syslog.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libcasper/services/cap_syslog/cap_syslog.c
==
--- stable/12/lib/libcasper/services/cap_syslog/cap_syslog.cThu Feb 21 
06:02:51 2019(r344421)
+++ stable/12/lib/libcasper/services/cap_syslog/cap_syslog.cThu Feb 21 
06:40:15 2019(r344422)
@@ -88,6 +88,9 @@ cap_openlog(cap_channel_t *chan, const char *ident, in
}
nvlist_add_number(nvl, "logopt", logopt);
nvlist_add_number(nvl, "facility", facility);
+   if (logopt & LOG_PERROR) {
+   nvlist_add_descriptor(nvl, "stderr", STDERR_FILENO);
+   }
nvl = cap_xfer_nvlist(chan, nvl);
if (nvl == NULL) {
return;
@@ -131,6 +134,7 @@ cap_setlogmask(cap_channel_t *chan, int maskpri)
  */
 
 static char *LogTag;
+static int prev_stderr = -1;
 
 static void
 slog_vsyslog(const nvlist_t *limits __unused, const nvlist_t *nvlin,
@@ -146,6 +150,8 @@ slog_openlog(const nvlist_t *limits __unused, const nv
 nvlist_t *nvlout __unused)
 {
const char *ident;
+   uint64_t logopt;
+   int stderr_fd;
 
ident = dnvlist_get_string(nvlin, "ident", NULL);
if (ident != NULL) {
@@ -153,8 +159,19 @@ slog_openlog(const nvlist_t *limits __unused, const nv
LogTag = strdup(ident);
}
 
-   openlog(LogTag, nvlist_get_number(nvlin, "logopt"),
-   nvlist_get_number(nvlin, "facility"));
+   logopt = nvlist_get_number(nvlin, "logopt");
+   if (logopt & LOG_PERROR) {
+   stderr_fd = dnvlist_get_descriptor(nvlin, "stderr", -1);
+   if (prev_stderr == -1)
+   prev_stderr = dup(STDERR_FILENO);
+   if (prev_stderr != -1)
+   (void)dup2(stderr_fd, STDERR_FILENO);
+   } else if (prev_stderr != -1) {
+   (void)dup2(prev_stderr, STDERR_FILENO);
+   close(prev_stderr);
+   prev_stderr = -1;
+   }
+   openlog(LogTag, logopt, nvlist_get_number(nvlin, "facility"));
 }
 
 static void
@@ -166,6 +183,12 @@ slog_closelog(const nvlist_t *limits __unused, const n
 
free(LogTag);
LogTag = NULL;
+
+   if (prev_stderr != -1) {
+   (void)dup2(prev_stderr, STDERR_FILENO);
+   close(prev_stderr);
+   prev_stderr = -1;
+   }
 }
 
 static void
@@ -198,4 +221,4 @@ syslog_command(const char *cmd, const nvlist_t *limits
return (0);
 }
 
-CREATE_SERVICE("system.syslog", NULL, syslog_command, CASPER_SERVICE_STDIO);
+CREATE_SERVICE("system.syslog", NULL, syslog_command, 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: r344417 - stable/11/share/man/man7

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 03:39:51 2019
New Revision: 344417
URL: https://svnweb.freebsd.org/changeset/base/344417

Log:
  MFc r338043: Document LOADER_DEFAULT_INTERP.
  
  This controls what interpreter the default boot loader in
  /boot/loader{,.efi} is, and which one we compile into userboot by
  default.

Modified:
  stable/11/share/man/man7/build.7
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man7/build.7
==
--- stable/11/share/man/man7/build.7Thu Feb 21 03:37:31 2019
(r344416)
+++ stable/11/share/man/man7/build.7Thu Feb 21 03:39:51 2019
(r344417)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 10, 2018
+.Dd February 20, 2019
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -572,6 +572,18 @@ using the
 option of
 .Xr make 1 :
 .Bl -tag -width ".Va -DNO_KERNELCONFIG"
+.It Va LOADER_DEFAULT_INTERP
+Defines what interpreter the default loader program will have.
+Valid values include
+.Dq 4th ,
+.Dq lua ,
+and
+.Dq simp .
+This creates the default link for
+.Pa /boot/loader
+to the loader with that interpreter.
+It also determines what interpreter is compiled into
+.Pa userboot .
 .It Va NO_CLEANDIR
 If set, the build targets that clean parts of the object tree use the
 equivalent of
___
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: r344410 - stable/11/stand/efi/loader

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 02:48:38 2019
New Revision: 344410
URL: https://svnweb.freebsd.org/changeset/base/344410

Log:
  MFC r337131, r337231: stand: efipart fixes
  
  r337131:
  loader.efi: efipart_inithandles() failure should not prevent devsw 
initialization
  
  The efipart_inithandles() can return error code when there are no block 
devices,
  however, we still should walk and initialize devsw.
  
  r337231:
  loader.efi: clean up misleading noise from missing block devices
  
  If there are no block devices, there is no need to printout
  error (ENOENT).
  
  In case of netboot, our image path has no block device, no need to make
  noise about it.

Modified:
  stable/11/stand/efi/loader/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/loader/main.c
==
--- stable/11/stand/efi/loader/main.c   Thu Feb 21 02:46:32 2019
(r344409)
+++ stable/11/stand/efi/loader/main.c   Thu Feb 21 02:48:38 2019
(r344410)
@@ -338,8 +338,6 @@ find_currdev(EFI_LOADED_IMAGE *img)
return (0);
}
}
-   } else {
-   printf("Can't find device by handle\n");
}
 
/*
@@ -642,12 +640,15 @@ main(int argc, CHAR16 *argv[])
 * Scan the BLOCK IO MEDIA handles then
 * march through the device switch probing for things.
 */
-   if ((i = efipart_inithandles()) == 0) {
-   for (i = 0; devsw[i] != NULL; i++)
-   if (devsw[i]->dv_init != NULL)
-   (devsw[i]->dv_init)();
-   } else
-   printf("efipart_inithandles failed %d, expect failures", i);
+   i = efipart_inithandles();
+   if (i != 0 && i != ENOENT) {
+   printf("efipart_inithandles failed with ERRNO %d, expect "
+   "failures\n", i);
+   }
+
+   for (i = 0; devsw[i] != NULL; i++)
+   if (devsw[i]->dv_init != NULL)
+   (devsw[i]->dv_init)();
 
printf("%s\n", bootprog_info);
printf("   Command line arguments:");
___
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: r344414 - stable/11

2019-02-20 Thread Rodney W. Grimes
> Author: kevans
> Date: Thu Feb 21 03:22:20 2019
> New Revision: 344414
> URL: https://svnweb.freebsd.org/changeset/base/344414
> 
> Log:
>   MFC (RECORD ONLY) r338050: Loader default interpreter flip
>   
>   The default interpreter for stable/11 is 4th; this will never and can never
>   change. Record MFC of r338050 to proactively prevent any accidents in future
>   batching of MFCs.
> 
> Modified:
> Directory Properties:
>   stable/11/   (props changed)

Does it make sense to do a direct commit to stable/11
marking the line that does this flip with a
"Do not change this in the stable/11 branch"
so that someone does not try to manually merge
the change if they happen to notice the code
is different?

-- 
Rod Grimes rgri...@freebsd.org
___
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: r344405 - in stable/11/stand/efi: . boot1 loader

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 02:32:30 2019
New Revision: 344405
URL: https://svnweb.freebsd.org/changeset/base/344405

Log:
  MFC r336535: Hoist EFI_TARGET and SOURCE_DATE_EPOCH up into efi/Makefile.inc

Modified:
  stable/11/stand/efi/Makefile.inc
  stable/11/stand/efi/boot1/Makefile
  stable/11/stand/efi/loader/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/Makefile.inc
==
--- stable/11/stand/efi/Makefile.incThu Feb 21 02:31:14 2019
(r344404)
+++ stable/11/stand/efi/Makefile.incThu Feb 21 02:32:30 2019
(r344405)
@@ -19,4 +19,16 @@ CFLAGS+= -fPIC
 CFLAGS+=   -fPIC
 .endif
 
+.if ${MACHINE_CPUARCH} == "amd64"
+EFI_TARGET=efi-app-x86_64
+.elif ${MACHINE_CPUARCH} == "i386"
+EFI_TARGET=efi-app-ia32
+.else
+EFI_TARGET=binary
+.endif
+
+# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
+# for build reproducibility.
+SOURCE_DATE_EPOCH?=1451606400
+
 .include "../Makefile.inc"

Modified: stable/11/stand/efi/boot1/Makefile
==
--- stable/11/stand/efi/boot1/Makefile  Thu Feb 21 02:31:14 2019
(r344404)
+++ stable/11/stand/efi/boot1/Makefile  Thu Feb 21 02:32:30 2019
(r344405)
@@ -76,17 +76,6 @@ LDADD+=  ${LIBEFI} ${LIBSA}
 
 DPADD+=${LDSCRIPT}
 
-.if ${MACHINE_CPUARCH} == "amd64"
-EFI_TARGET=efi-app-x86_64
-.elif ${MACHINE_CPUARCH} == "i386"
-EFI_TARGET=efi-app-ia32
-.else
-EFI_TARGET=binary
-.endif
-
-# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
-# for build reproducibility.
-SOURCE_DATE_EPOCH?=1451606400
 boot1.efi: ${PROG}
if ${NM} ${.ALLSRC} | grep ' U '; then \
echo "Undefined symbols in ${.ALLSRC}"; \

Modified: stable/11/stand/efi/loader/Makefile
==
--- stable/11/stand/efi/loader/Makefile Thu Feb 21 02:31:14 2019
(r344404)
+++ stable/11/stand/efi/loader/Makefile Thu Feb 21 02:32:30 2019
(r344405)
@@ -91,17 +91,6 @@ CLEANFILES+= loader.efi
 
 NEWVERSWHAT=   "EFI loader" ${MACHINE}
 
-.if ${MACHINE_CPUARCH} == "amd64"
-EFI_TARGET=efi-app-x86_64
-.elif ${MACHINE_CPUARCH} == "i386"
-EFI_TARGET=efi-app-ia32
-.else
-EFI_TARGET=binary
-.endif
-
-# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
-# for build reproducibility.
-SOURCE_DATE_EPOCH?=1451606400
 loader.efi: ${PROG}
if ${NM} ${.ALLSRC} | grep ' U '; then \
echo "Undefined symbols in ${.ALLSRC}"; \
___
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: r344404 - stable/11/stand/efi/loader

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 02:31:14 2019
New Revision: 344404
URL: https://svnweb.freebsd.org/changeset/base/344404

Log:
  MFC r336463: If rootdev is set, use it as currdev.
  
  Setting rootdev in the enviornment should specify things
  completely. If it is set, then have it override everything else.

Modified:
  stable/11/stand/efi/loader/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/loader/main.c
==
--- stable/11/stand/efi/loader/main.c   Thu Feb 21 02:28:04 2019
(r344403)
+++ stable/11/stand/efi/loader/main.c   Thu Feb 21 02:31:14 2019
(r344404)
@@ -166,16 +166,21 @@ out:
 }
 
 static void
+set_currdev(const char *devname)
+{
+
+   env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, 
env_nounset);
+   env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset);
+}
+
+static void
 set_currdev_devdesc(struct devdesc *currdev)
 {
const char *devname;
 
devname = efi_fmtdev(currdev);
-
printf("Setting currdev to %s\n", devname);
-
-   env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, 
env_nounset);
-   env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset);
+   set_currdev(devname);
 }
 
 static void
@@ -279,7 +284,15 @@ find_currdev(EFI_LOADED_IMAGE *img)
struct devsw *dev;
int unit;
uint64_t extra;
+   char *rootdev;
 
+   rootdev = getenv("rootdev");
+   if (rootdev != NULL) {
+   printf("Setting currdev to configured rootdev %s\n", rootdev);
+   set_currdev(rootdev);
+   return (0);
+   }
+
 #ifdef EFI_ZFS_BOOT
/*
 * Did efi_zfs_probe() detect the boot pool? If so, use the zpool
@@ -616,7 +629,7 @@ main(int argc, CHAR16 *argv[])
 * set the env based on it.
 */
boot_howto_to_env(howto);
-   
+
if (efi_copy_init()) {
printf("failed to allocate staging area\n");
return (EFI_BUFFER_TOO_SMALL);
___
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: r344418 - stable/11

2019-02-20 Thread Rodney W. Grimes
> Author: kevans
> Date: Thu Feb 21 03:48:39 2019
> New Revision: 344418
> URL: https://svnweb.freebsd.org/changeset/base/344418
> 
> Log:
>   Direct commit for post-mortem UPDATING update regarding lualoader
>   
>   Indicate that it's been merged (after some delay since lua came back to this
>   branch) and how one can test lua, both by swapping build knobs and creating
>   links in /boot.
> 
> Modified:
>   stable/11/UPDATING
> 
> Modified: stable/11/UPDATING
> ==
> --- stable/11/UPDATINGThu Feb 21 03:39:51 2019(r344417)
> +++ stable/11/UPDATINGThu Feb 21 03:48:39 2019(r344418)
> @@ -17,6 +17,20 @@ the tip of head, and then rebuild without this option.
>  from older version of current across the gcc/clang cutover is a bit fragile.
>  
>  20190220:
> + Co-existance for Forth and Lua interpreters in bootloaders has now been
> + merged to ease testing of lualoader.  LOADER_DEFAULT_INTERP, documented
> + in build(7), may be used to control which interpreter flavor is used in
> + the default loader to be installed.  For systems where Lua and Forth
> + coexist, this switch can also be made on a running system by creating a
> + link from /boot/loader_${flavor}{,efi} to /boot/loader{,.efi} rather
  ^. missing
And is not the direction of that link reversed?
/boot/loader_${,.efi} -> /boot/loader_${flavor}{,.efi}
is what I would expect the link to be for this.

> + than requiring a rebuild.
> +
> + The default flavor in this branch will remain Forth.  As indicated in
> + the 20190216 UPDATING entry, booting is a complex environment; it would
> + be prudent to assume that lualoader may not work for your setup and make
> + provisions for backup boot methods.
> +
> +20190220:
>   zfsloader's functionality has now been folded into loader.
>   zfsloader is no longer necesasary once you've updated your
>   boot blocks. For a transition period, we will install a
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r344421 - in stable/11: share/mk stand/pc98/kgzldr stand/pc98/libpc98

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 06:02:51 2019
New Revision: 344421
URL: https://svnweb.freebsd.org/changeset/base/344421

Log:
  Direct commit to catch pc98 up to recent changes
  
  I have no means of actually testing the new features on pc98, so simply mark
  them as BROKEN_OPTIONS on pc98 and interested parties can test/report back
  as to the functionality. This is done out of an abundance of caution.
  
  pc98 also needed catching up on the inflate.c -> subr_inflate.c rename.

Modified:
  stable/11/share/mk/src.opts.mk
  stable/11/stand/pc98/kgzldr/Makefile
  stable/11/stand/pc98/libpc98/biosdisk.c

Modified: stable/11/share/mk/src.opts.mk
==
--- stable/11/share/mk/src.opts.mk  Thu Feb 21 04:47:44 2019
(r344420)
+++ stable/11/share/mk/src.opts.mk  Thu Feb 21 06:02:51 2019
(r344421)
@@ -306,7 +306,11 @@ BROKEN_OPTIONS+=LOADER_UBOOT
 .if ${__T} == "sparc64" || ${__T:Mpowerpc*}
 BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
 .endif
-
+# Both features are untested on pc98, so we'll mark them as disabled just to
+# be safe and make sure we keep pc98 stable.
+.if ${__TT:Mpc98*}
+BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
+.endif
 .if ${__T:Mmips64*}
 # profiling won't work on MIPS64 because there is only assembly for o32
 BROKEN_OPTIONS+=PROFILE

Modified: stable/11/stand/pc98/kgzldr/Makefile
==
--- stable/11/stand/pc98/kgzldr/MakefileThu Feb 21 04:47:44 2019
(r344420)
+++ stable/11/stand/pc98/kgzldr/MakefileThu Feb 21 06:02:51 2019
(r344421)
@@ -7,7 +7,7 @@ STRIP=
 BINMODE=${LIBMODE}
 BINDIR=${LIBDIR}
 
-SRCS=  start.s boot.c inflate.c lib.c crt.s sio.s
+SRCS=  start.s boot.c subr_inflate.c lib.c crt.s sio.s
 CFLAGS=-Os
 CFLAGS+=-DKZIP
 NO_SHARED=

Modified: stable/11/stand/pc98/libpc98/biosdisk.c
==
--- stable/11/stand/pc98/libpc98/biosdisk.c Thu Feb 21 04:47:44 2019
(r344420)
+++ stable/11/stand/pc98/libpc98/biosdisk.c Thu Feb 21 06:02:51 2019
(r344421)
@@ -51,10 +51,6 @@ __FBSDID("$FreeBSD$");
 #include "disk.h"
 #include "libi386.h"
 
-#ifdef LOADER_GELI_SUPPORT
-#error "Nope! No GELI on pc98 so sorry."
-#endif
-
 #define BIOS_NUMDRIVES 0x475
 #define BIOSDISK_SECSIZE   512
 #define BUFSIZE(1 * BIOSDISK_SECSIZE)
@@ -364,7 +360,6 @@ bd_open(struct open_file *f, ...)
 
err = disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize,
BD(dev).bd_sectorsize);
-   /* i386 has GELI here */
return(err);
 }
 
@@ -665,7 +660,6 @@ static int
 bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks,
 caddr_t dest)
 {
-   /* i386 has GELI here */
 
return (bd_io(dev, dblk, blks, dest, 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: r344418 - stable/11

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 03:48:39 2019
New Revision: 344418
URL: https://svnweb.freebsd.org/changeset/base/344418

Log:
  Direct commit for post-mortem UPDATING update regarding lualoader
  
  Indicate that it's been merged (after some delay since lua came back to this
  branch) and how one can test lua, both by swapping build knobs and creating
  links in /boot.

Modified:
  stable/11/UPDATING

Modified: stable/11/UPDATING
==
--- stable/11/UPDATING  Thu Feb 21 03:39:51 2019(r344417)
+++ stable/11/UPDATING  Thu Feb 21 03:48:39 2019(r344418)
@@ -17,6 +17,20 @@ the tip of head, and then rebuild without this option.
 from older version of current across the gcc/clang cutover is a bit fragile.
 
 20190220:
+   Co-existance for Forth and Lua interpreters in bootloaders has now been
+   merged to ease testing of lualoader.  LOADER_DEFAULT_INTERP, documented
+   in build(7), may be used to control which interpreter flavor is used in
+   the default loader to be installed.  For systems where Lua and Forth
+   coexist, this switch can also be made on a running system by creating a
+   link from /boot/loader_${flavor}{,efi} to /boot/loader{,.efi} rather
+   than requiring a rebuild.
+
+   The default flavor in this branch will remain Forth.  As indicated in
+   the 20190216 UPDATING entry, booting is a complex environment; it would
+   be prudent to assume that lualoader may not work for your setup and make
+   provisions for backup boot methods.
+
+20190220:
zfsloader's functionality has now been folded into loader.
zfsloader is no longer necesasary once you've updated your
boot blocks. For a transition period, we will install a
___
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: r344389 - head/usr.sbin/newsyslog

2019-02-20 Thread Warner Losh
On Wed, Feb 20, 2019, 9:59 PM Enji Cooper 
> > On Feb 20, 2019, at 5:17 PM, Bruce Evans  wrote:
> >
> > On Wed, 20 Feb 2019, David Bright wrote:
> >
> >> Log:
> >> Complete fix for CID 1007454, CID 1007453: Resource leak in newsyslog
> >>
> >> The result of a strdup() was stored in a global variable and not freed
> >> before program exit. This is a follow-up to r343906. That change
> >
> > This was an especially large bug in Coverity.  Understanding that exit(3)
> > exits is about the first thing to understand for a checker.
> >
> > Now it is also a style bug in the source code.
> >
> >> attempted to plug these resource leaks but managed to miss a code path
> >> on which the leak still occurs. Plug the leak on that path, too.
> >
> >> Modified: head/usr.sbin/newsyslog/newsyslog.c
> >>
> ==
> >> --- head/usr.sbin/newsyslog/newsyslog.c  Wed Feb 20 21:24:56 2019
>   (r344388)
> >> +++ head/usr.sbin/newsyslog/newsyslog.c  Wed Feb 20 22:05:44 2019
>   (r344389)
> >> @@ -793,6 +793,9 @@ usage(void)
> >>  fprintf(stderr,
> >>  "usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory]
> [-f config_file]\n"
> >>  " [-S pidfile] [-t timefmt] [[-R tagname] file
> ...]\n");
> >> +/* Free global dynamically-allocated storage. */
> >> +free(timefnamefmt);
> >> +free(requestor);
> >>  exit(1);
> >> }
> >
> > There was no leak here.  exit(3) frees storage much more finally than
> > free(3).
> >
> > It is especially obvious that there is no leak here, since the exit() is
> > 1-2 lines later than the frees.
> >
> > In theory, exit() might fail because it tries to allocate 100 MB more
> > storage but wouldn't fail if 100 bytes are freed here (applications can
> > easily do this foot shooting by allocating without freeing in atexit()
> > destructors).  In practice, even allocation failures "can't happen",
> > except in programs that use setrlimit followed but foot shooting to test
> > the limits.  setrlimit is now broken for this purpose, since it doesn't
> > limit allocations done using mmap() instead of break(), and malloc() now
> > uses mmap().
> >
> > If coverity understood this and wanted to spam you with warnings, then it
> > would not warn about this, but would warn about more important things
> like
> > failure to fflush() or fclose() or check for or handle errors for all
> > open streams before calling exit().  Also, if all callers of usage() are
> > not understood, for failures to switch stderr to unbuffered mode before
> > using it in usage().
> >
> > The error reporting is even harder to do if stderr is not available.
> > Windowing systems and even curses need to do lots more cleanup _before_
> > exit() and it may be difficult to clean up enough to print error messages
> > using the windowing system.
>
> I agree with Bruce. Items like these should be ignored in the Coverity UI
> as false positives with reasoning, like “global variables; freed on exit”.
>
> As others have noted in past mailing threads, freeing variables on exit
> can cause applications to hang for a period of time, while the memory is
> being reclaimed. I think it’s best to ignore these kinds of allocations on
> exit to avoid introducing unnecessary complexity in the program, as they’re
> benign issues.
>


It's been a long running debate since 92 or so when purify came out and
this problem started to be found. In the last 25 years the question hasn't
been settled. I tend to think it's a waste of time, though I get that
issues like this create a lot of false positives.

Warner

Thank you,
> -Enji
>
___
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: r344389 - head/usr.sbin/newsyslog

2019-02-20 Thread Enji Cooper

> On Feb 20, 2019, at 5:17 PM, Bruce Evans  wrote:
> 
> On Wed, 20 Feb 2019, David Bright wrote:
> 
>> Log:
>> Complete fix for CID 1007454, CID 1007453: Resource leak in newsyslog
>> 
>> The result of a strdup() was stored in a global variable and not freed
>> before program exit. This is a follow-up to r343906. That change
> 
> This was an especially large bug in Coverity.  Understanding that exit(3)
> exits is about the first thing to understand for a checker.
> 
> Now it is also a style bug in the source code.
> 
>> attempted to plug these resource leaks but managed to miss a code path
>> on which the leak still occurs. Plug the leak on that path, too.
> 
>> Modified: head/usr.sbin/newsyslog/newsyslog.c
>> ==
>> --- head/usr.sbin/newsyslog/newsyslog.c  Wed Feb 20 21:24:56 2019
>> (r344388)
>> +++ head/usr.sbin/newsyslog/newsyslog.c  Wed Feb 20 22:05:44 2019
>> (r344389)
>> @@ -793,6 +793,9 @@ usage(void)
>>  fprintf(stderr,
>>  "usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f 
>> config_file]\n"
>>  " [-S pidfile] [-t timefmt] [[-R tagname] file 
>> ...]\n");
>> +/* Free global dynamically-allocated storage. */
>> +free(timefnamefmt);
>> +free(requestor);
>>  exit(1);
>> }
> 
> There was no leak here.  exit(3) frees storage much more finally than
> free(3).
> 
> It is especially obvious that there is no leak here, since the exit() is
> 1-2 lines later than the frees.
> 
> In theory, exit() might fail because it tries to allocate 100 MB more
> storage but wouldn't fail if 100 bytes are freed here (applications can
> easily do this foot shooting by allocating without freeing in atexit()
> destructors).  In practice, even allocation failures "can't happen",
> except in programs that use setrlimit followed but foot shooting to test
> the limits.  setrlimit is now broken for this purpose, since it doesn't
> limit allocations done using mmap() instead of break(), and malloc() now
> uses mmap().
> 
> If coverity understood this and wanted to spam you with warnings, then it
> would not warn about this, but would warn about more important things like
> failure to fflush() or fclose() or check for or handle errors for all
> open streams before calling exit().  Also, if all callers of usage() are
> not understood, for failures to switch stderr to unbuffered mode before
> using it in usage().
> 
> The error reporting is even harder to do if stderr is not available.
> Windowing systems and even curses need to do lots more cleanup _before_
> exit() and it may be difficult to clean up enough to print error messages
> using the windowing system.

I agree with Bruce. Items like these should be ignored in the Coverity UI as 
false positives with reasoning, like “global variables; freed on exit”.

As others have noted in past mailing threads, freeing variables on exit can 
cause applications to hang for a period of time, while the memory is being 
reclaimed. I think it’s best to ignore these kinds of allocations on exit to 
avoid introducing unnecessary complexity in the program, as they’re benign 
issues.

Thank you,
-Enji
___
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: r344419 - stable/11/etc/mtree

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 04:13:20 2019
New Revision: 344419
URL: https://svnweb.freebsd.org/changeset/base/344419

Log:
  MFC r329226: Add /boot/lua to mtree spec

Modified:
  stable/11/etc/mtree/BSD.root.dist
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/etc/mtree/BSD.root.dist
==
--- stable/11/etc/mtree/BSD.root.dist   Thu Feb 21 03:48:39 2019
(r344418)
+++ stable/11/etc/mtree/BSD.root.dist   Thu Feb 21 04:13:20 2019
(r344419)
@@ -16,6 +16,8 @@
 ..
 firmware
 ..
+lua
+..
 kernel
 ..
 modules
___
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: r344413 - in stable/11: release/tools share/mk stand stand/common stand/efi stand/efi/loader stand/efi/loader_4th stand/efi/loader_lua stand/efi/loader_simp stand/i386 stand/i386/loader...

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 03:18:12 2019
New Revision: 344413
URL: https://svnweb.freebsd.org/changeset/base/344413

Log:
  MFC Loader Interpreter Coexistance: r337806, r337868, r337914, r337927,
  r337989, r338052, r338064, r338407, r338418, r338474
  
  r337806:
  Create a loader for each interpreter for x86 BIOS and all EFI
  
  Create loader_{4th,lua,simp}{,.efi}. All of these are installed by
  default. Create LOADER_DEFAULT_INTERP to specify the default
  interpreter when no other is specified. LOADER_INTERP is the current
  interpreter language building. Turn building of lua on by default to
  match 4th. simploader is a simplified loader build w/o any interpreter
  language (but with a simple loader).  This is the historic behavir you
  got with WITHOUT_FORTH. Make a hard link to the default loader. This
  has to be a hard link rather than the more desirable soft link because
  older zfsboot blocks don't support symlinks.
  
  r337868:
  stand: Use -Oz/-Os for all loader/stand builds.
  
  While we're not super size constrained, the x86 BIOS /boot/loader has
  to be less than about 520k-530k to be reliable. The LUA loader is at
  this size today. -Oz saves 15-20% on the size, keeping us safely small
  enough (comparable to where we were with the 4th loader). This will
  also help with sjg's work on bringing in bearssl, though we may again
  be looking for space in the LUA loader.
  
  Size table for clang 6.0.0:
default -O1 -Os -Oz
  4th   442368  417792  389120  376832
  lua   524288  479232  446464  430080
  
  r337914:
  Install links for loader.efi.
  
  r337927:
  Add ashldi3 and ashrdi3 to mips.
  
  Now that we're using -Os, mips needs these routines.
  
  r337989:
  Copy the boot loader from the new location for the co-existing
  loaders.
  
  r338052:
  libsa: Add lshrdi3.c for powerpc* and mips
  
  r338064:
  Turn back the clock just a little: make userboot.so always be 4th
  
  Turns out there was a hidden dependency we hasn't counted upon.  The
  host load /boot/userboot.so to boot the VMs it runs. This means that
  the change to lua meant suddently that nobody could run their older
  VMs because LUA wasn't in 10.0, last month's HardenedBSD, 11.2 or
  whatever.  Even more than for the /boot/loader* binaries, we need a
  good coexistance strategy for this. While that's being designed and
  implemented, drop back to always 4th for userboot.so. This will fail
  safe in all but the most extreme environments (but lua-only hacks
  to .lua files won't be processes in VMs until we fix it).
  
  r338407:
  lualoader: Print error messages from command failures at the prompt
  
  Previously lualoader would remain silent, rather than printing
  command_errmsg or noting that a command had failed or was not found.
  
  r338418:
  userboot: handle guest interpreter mismatches more intelligently
  
  The switch to lualoader creates a problem with userboot: the host is
  inclined to build userboot with Lua, but the host userboot's interpreter
  must match what's available on the guest. For almost all FreeBSD guests in
  the wild, Lua is not yet available and a Lua-based userboot will fail.
  
  This revision updates userboot protocol to version 5, which adds a
  swap_interpreter callback to request a different interpreter, and tries to
  determine the proper interpreter to be used based on how the guest
  /boot/loader is compiled. This is still a bit of a guess, but it's likely
  the best possible guess we can make in order to get it right. The
  interpreter is now embedded in the resulting executable, so we can open
  /boot/loader on the guest and hunt that down to derive the interpreter it
  was built with.
  
  Using -l with bhyveload will not allow an intepreter swap, even if the
  loader specified happens to be a userboot with the wrong interpreter. We'll
  simply complain about the mismatch and bail out.
  
  For legacy guests without the interpreter marker, we assume they're 4th.
  For new guests with the interpreter marker, we'll read it and swap over
  to the proper interpreter if it doesn't match what the userboot we're using
  was compiled with.
  
  Both flavors of userboot are installed by default, userboot_4th.so and
  userboot_lua.so. This fixes the build WITHOUT_FORTH as a coincidence, which
  was broken by userboot being forced to 4th.
  
  r338474:
  Be a little conservative about when to force size optimizations.
  
  Reports have come in that there's issue with powerpc and sparc64 since
  we've switched to using -Oz / -Os. We don't strictly need them for
  !x86, so be conservative about when we enable them.

Added:
  stable/11/stand/efi/loader_4th/
 - copied from r337806, head/stand/efi/loader_4th/
  stable/11/stand/efi/loader_lua/
 - copied from r337806, head/stand/efi/loader_lua/
  stable/11/stand/efi/loader_simp/
 - copied from r337806, head/stand/efi/loader_simp/
  stable/11/s

svn commit: r344414 - stable/11

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 03:22:20 2019
New Revision: 344414
URL: https://svnweb.freebsd.org/changeset/base/344414

Log:
  MFC (RECORD ONLY) r338050: Loader default interpreter flip
  
  The default interpreter for stable/11 is 4th; this will never and can never
  change. Record MFC of r338050 to proactively prevent any accidents in future
  batching of MFCs.

Modified:
Directory Properties:
  stable/11/   (props changed)
___
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: r344412 - stable/11/stand/efi/loader

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 02:52:27 2019
New Revision: 344412
URL: https://svnweb.freebsd.org/changeset/base/344412

Log:
  MFC r336837: Be more conservative about setting hw.uart.console
  
  Note when we've found a 8250 PNP node. Only try to set hw.uart.console
  if we see one (otherwise ignore serial hints). The 8250 is the only
  one known to have I/O ports, so limit the guessing to when we've
  positively seen one.  And limit this to x86 since that's the only
  platform where we have I/O ports. Otherwise, we'd set the serial port
  to something crazy for the platform and fall off the cliff early in
  boot.

Modified:
  stable/11/stand/efi/loader/bootinfo.c
  stable/11/stand/efi/loader/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/loader/bootinfo.c
==
--- stable/11/stand/efi/loader/bootinfo.c   Thu Feb 21 02:50:45 2019
(r344411)
+++ stable/11/stand/efi/loader/bootinfo.c   Thu Feb 21 02:52:27 2019
(r344412)
@@ -82,10 +82,13 @@ bi_getboothowto(char *kargs)
howto |= RB_SERIAL;
if (strcmp(console, "nullconsole") == 0)
howto |= RB_MUTE;
-   if (strcmp(console, "efi") == 0) {
+#if defined(__i386__) || defined(__amd64__)
+   if (strcmp(console, "efi") == 0 &&
+   getenv("efi_8250_uid") != NULL &&
+   getenv("hw.uart.console") == NULL) {
/*
-* If we found a com port and com speed, we need to tell
-* the kernel where the serial port is, and how
+* If we found a 8250 com port and com speed, we need to
+* tell the kernel where the serial port is, and how
 * fast. Ideally, we'd get the port from ACPI, but that
 * isn't running in the loader. Do the next best thing
 * by allowing it to be set by a loader.conf variable,
@@ -93,24 +96,31 @@ bi_getboothowto(char *kargs)
 * comconsole_port if not. PCI support is needed, but
 * for that we'd ideally refactor the
 * libi386/comconsole.c code to have identical behavior.
+* We only try to set the port for cases where we saw
+* the Serial(x) node when parsing, otherwise
+* specialized hardware that has Uart nodes will have a
+* bogus address set.
+* But if someone specifically setup hw.uart.console,
+* don't override that.
 */
+   speed = -1;
+   port = -1;
tmp = getenv("efi_com_speed");
-   if (tmp != NULL) {
+   if (tmp != NULL)
speed = strtol(tmp, NULL, 0);
-   tmp = getenv("efi_com_port");
-   if (tmp == NULL)
-   tmp = getenv("comconsole_port");
-   /* XXX fallback to EFI variable set in rc.d? */
-   if (tmp != NULL)
-   port = strtol(tmp, NULL, 0);
-   else
-   port = 0x3f8;
+   tmp = getenv("efi_com_port");
+   if (tmp == NULL)
+   tmp = getenv("comconsole_port");
+   if (tmp != NULL)
+   port = strtol(tmp, NULL, 0);
+   if (speed != -1 && port != -1) {
snprintf(buf, sizeof(buf), "io:%d,br:%d", port,
speed);
env_setenv("hw.uart.console", EV_VOLATILE, buf,
NULL, NULL);
}
}
+#endif
}
 
return (howto);

Modified: stable/11/stand/efi/loader/main.c
==
--- stable/11/stand/efi/loader/main.c   Thu Feb 21 02:50:45 2019
(r344411)
+++ stable/11/stand/efi/loader/main.c   Thu Feb 21 02:52:27 2019
(r344412)
@@ -435,6 +435,15 @@ parse_args(int argc, CHAR16 *argv[])
return (howto);
 }
 
+static void
+setenv_int(const char *key, int val)
+{
+   char buf[20];
+
+   snprintf(buf, sizeof(buf), "%d", val);
+   setenv(key, buf, 1);
+}
+
 /*
  * Parse ConOut (the list of consoles active) and see if we can find a
  * serial port and/or a video port. It would be nice to also walk the
@@ -466,15 +475,15 @@ parse_uefi_con_out(void)
DevicePathSubType(node) == ACPI_DP) {

svn commit: r344411 - stable/11/stand/efi/libefi

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 02:50:45 2019
New Revision: 344411
URL: https://svnweb.freebsd.org/changeset/base/344411

Log:
  MFC r336431: stand: Fix UEFI console scrolling
  
  Remove bogus attempt to simulate scrolling. It's not needed and messes
  up serial output. Setting the cursor position after every character is
  inefficient, and causes all lines to be over-printed in the serial
  console for the boot loader. Allow the terminal to do the emulation.
  
  This isn't completely perfect when the size of the terminal attached
  to the serial port isn't the same as 80x25 to match the viedoe console
  (or whatever the video console is). While imperfect still, these
  changes make it much better.
  
  This makes the serial port useful with UEFI.

Modified:
  stable/11/stand/efi/libefi/efi_console.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/libefi/efi_console.c
==
--- stable/11/stand/efi/libefi/efi_console.cThu Feb 21 02:48:38 2019
(r344410)
+++ stable/11/stand/efi/libefi/efi_console.cThu Feb 21 02:50:45 2019
(r344411)
@@ -147,20 +147,20 @@ efi_cons_rawputchar(int c)
switch (c) {
case '\r':
curx = 0;
-   curs_move(&curx, &cury, curx, cury);
+   efi_cons_efiputchar('\r');
return;
case '\n':
+   efi_cons_efiputchar('\n');
+   efi_cons_efiputchar('\r');
cury++;
-   if (cury >= y) {
-   efi_cons_efiputchar('\n');
+   if (cury >= y)
cury--;
-   } else
-   curs_move(&curx, &cury, curx, cury);
+   curx = 0;
return;
case '\b':
if (curx > 0) {
+   efi_cons_efiputchar('\b');
curx--;
-   curs_move(&curx, &cury, curx, cury);
}
return;
default:
@@ -175,7 +175,6 @@ efi_cons_rawputchar(int c)
cury--;
}
}
-   curs_move(&curx, &cury, curx, cury);
 #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: r344406 - in stable/11/stand/efi: include libefi

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 02:37:01 2019
New Revision: 344406
URL: https://svnweb.freebsd.org/changeset/base/344406

Log:
  MFC r336651-r336655: stand: libefi: various boot protocol aux impl.
  
  r336651:
  Implement efi_devpath_to_media_path
  
  Takes a generic device path as its input. Scans through it to find the
  first media_path node in it and returns a pointer to it. If none is
  found, NULL is returned.
  
  r336652:
  Store the number of handles we get back in efipart_nhandles rather
  than the number of bytes. Don't divide by the element size every time
  we have to iterate. Eliminate now-unused variables.
  
  r336653:
  Implement efi_devpath_match_node
  
  Returns true if the first node pointed to by devpath1 is identical to
  the first node pointed to by devpath2, with care taken to not read
  past the end of the valid parts of either devpath1 or
  devpath2. Otherwise, returns false.
  
  r336654:
  Implement efi_devpath_length
  
  Return the total length, in bytes, of the device path (including the
  terminating node at the end).
  
  r336655:
  Implement efiblk_get_pdinfo_by_device_path
  
  Lookup a block device by it's device path. We use a 'loose' lookup
  whereby we scan forward to the first Media Path portion of the device
  path, then look at all our handles for one whose first Media Path
  matches. This will also work if the device path pointed to has a
  following file path (or paths) as that's ignored. It assumes that
  there's only one media path node that describes the entire device,
  which is true as of the latest UEFI spec (2.7 Errata A) as far as I've
  been able to determine.

Modified:
  stable/11/stand/efi/include/efilib.h
  stable/11/stand/efi/libefi/devpath.c
  stable/11/stand/efi/libefi/efipart.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/include/efilib.h
==
--- stable/11/stand/efi/include/efilib.hThu Feb 21 02:32:30 2019
(r344405)
+++ stable/11/stand/efi/include/efilib.hThu Feb 21 02:37:01 2019
(r344406)
@@ -66,6 +66,7 @@ typedef struct pdinfo
 pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *dev);
 pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev);
 pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h);
+pdinfo_t *efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path);
 
 void *efi_get_table(EFI_GUID *tbl);
 
@@ -85,9 +86,12 @@ EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *);
 EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *);
 EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *);
 bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
+bool efi_devpath_match_node(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
 bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
 CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
 void efi_free_devpath_name(CHAR16 *);
+EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *);
+UINTN efi_devpath_length(EFI_DEVICE_PATH *);
 
 int efi_status_to_errno(EFI_STATUS);
 EFI_STATUS errno_to_efi_status(int errno);

Modified: stable/11/stand/efi/libefi/devpath.c
==
--- stable/11/stand/efi/libefi/devpath.cThu Feb 21 02:32:30 2019
(r344405)
+++ stable/11/stand/efi/libefi/devpath.cThu Feb 21 02:37:01 2019
(r344406)
@@ -140,25 +140,33 @@ efi_devpath_handle(EFI_DEVICE_PATH *devpath)
 }
 
 bool
-efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2)
+efi_devpath_match_node(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2)
 {
size_t len;
 
if (devpath1 == NULL || devpath2 == NULL)
return (false);
+   if (DevicePathType(devpath1) != DevicePathType(devpath2) ||
+   DevicePathSubType(devpath1) != DevicePathSubType(devpath2))
+   return (false);
+   len = DevicePathNodeLength(devpath1);
+   if (len != DevicePathNodeLength(devpath2))
+   return (false);
+   if (memcmp(devpath1, devpath2, len) != 0)
+   return (false);
+   return (true);
+}
 
-   while (true) {
-   if (DevicePathType(devpath1) != DevicePathType(devpath2) ||
-   DevicePathSubType(devpath1) != DevicePathSubType(devpath2))
-   return (false);
+bool
+efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2)
+{
 
-   len = DevicePathNodeLength(devpath1);
-   if (len != DevicePathNodeLength(devpath2))
-   return (false);
+   if (devpath1 == NULL || devpath2 == NULL)
+   return (false);
 
-   if (memcmp(devpath1, devpath2, len) != 0)
-   return (false);
-
+   while (true) {
+   if (!efi_devpath_match_node(devpath1, devpath2))
+   return false;
if (IsDevicePathEnd(devpath1))
   

svn commit: r344409 - in stable/11/stand/efi: boot1 loader/arch/arm64

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 02:46:32 2019
New Revision: 344409
URL: https://svnweb.freebsd.org/changeset/base/344409

Log:
  MFC r338337: Fix lualoader on arm64
  
  Lua has a few places where it allocates a large buffer on the stack. This
  is normally fine, except there are a few places where there can be multiple
  frames with this buffer. This can cause a stack overflow on some arm64 SoCs.
  
  Fix this by allocating our own stack in loader.efi large enough for these
  objects. The required size has been found by tracing how the stack pointer
  changes in a virtual machine and found to be no larger than 50kB. A
  larger stack is allocated to reduce the likelihood of overflow from future
  changes.

Modified:
  stable/11/stand/efi/boot1/Makefile
  stable/11/stand/efi/loader/arch/arm64/start.S
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/boot1/Makefile
==
--- stable/11/stand/efi/boot1/Makefile  Thu Feb 21 02:43:48 2019
(r344408)
+++ stable/11/stand/efi/boot1/Makefile  Thu Feb 21 02:46:32 2019
(r344409)
@@ -6,6 +6,7 @@ PROG=   boot1.sym
 INTERNALPROG=
 WARNS?=6
 
+CFLAGS+=   -DEFI_BOOT1
 # We implement a slightly non-standard %S in that it always takes a
 # CHAR16 that's common in UEFI-land instead of a wchar_t. This only
 # seems to matter on arm64 where wchar_t defaults to an int instead

Modified: stable/11/stand/efi/loader/arch/arm64/start.S
==
--- stable/11/stand/efi/loader/arch/arm64/start.S   Thu Feb 21 02:43:48 
2019(r344408)
+++ stable/11/stand/efi/loader/arch/arm64/start.S   Thu Feb 21 02:46:32 
2019(r344409)
@@ -160,6 +160,23 @@ _start:
 
ldp x0, x1, [sp], #16
 
+#ifndef EFI_BOOT1
+   /*
+* Load the stack to use. The default stack may be too small for
+* the lua loader.
+*/
+   adr x2, initstack_end
+   mov sp, x2
+#endif
+
bl  efi_main
 
 1: b   1b
+
+#ifndef EFI_BOOT1
+.bss
+   .align  4
+initstack:
+   .space  (64 * 1024)
+initstack_end:
+#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: r344408 - in stable/11/stand/libsa: . zfs

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 02:43:48 2019
New Revision: 344408
URL: https://svnweb.freebsd.org/changeset/base/344408

Log:
  MFC various libsa fixes: r337037-r337039, r337065, r337412-r337413, r337874,
  r338535, r338540, r339651, r339992-r339993, r340026
  
  r337037:
  libsa: pointer differs in signedness
  
  A small cleanup, fix the argument type and while there, replace (char *)0 with
  NULL.
  
  r337038:
  libsa: bootp is using pointers with different sign
  
  Just change bp_file to char and same for variable s.
  
  r337039:
  libsa: assignment to char * from u_char *
  
  Cast to char * instead of u_char *
  
  r337065:
  libsa: dereferencing type-punned pointer in cd9660
  
  The warning is given by gcc build, but it is good to fix anyhow.
  use bcopy instead of direct assignment.
  
  r337412:
  libsa: dos_checksum() should take unsigned chars
  
  Fix pointers to integers with different sign issue.
  
  r337413:
  libsa: gzipfs.c converts pointers to integer types with different sign
  
  Signed versus unsigned char.
  
  r337874:
  libsa: zfs_probe() needs to set spa to NULL
  
  Silence the warning about possibly uninitialized use of spa.
  
  r338535:
  libsa: memory leak in tftp_open()
  
  tftpfile is allocated just above and needs to be freed.
  
  r338540:
  libsa: validate tftp_makereq() after we did reset the read
  
  The name check referred in the comment is not the only possible error source,
  we need to validate the result.
  
  r339651:
  libsa: re-send ACK for older data packets in tftp
  
  In current tftp code we drop out-of-order packets; however, we should play
  nice and re-send ACK for older data packets we are receiving. This will
  hopefully stop server repeating those packets we already have received.
  Note we do not answer duplicates from "previous" session (that is, session
  with different port number), those will eventually time out.
  
  r339992:
  libsa: tftp should not read past file end
  
  When we have the file size via tsize option, use it to make sure we
  will not attempt to read past file end.
  
  r339993:
  libsa: tftp should use calloc
  
  instead of malloc() memset(), use calloc().
  
  r340026:
  libsa: cstyle cleanup tftp.c
  
  No functinal changes intended.

Modified:
  stable/11/stand/libsa/bootp.c
  stable/11/stand/libsa/bootp.h
  stable/11/stand/libsa/cd9660.c
  stable/11/stand/libsa/cd9660read.c
  stable/11/stand/libsa/dosfs.c
  stable/11/stand/libsa/gzipfs.c
  stable/11/stand/libsa/net.c
  stable/11/stand/libsa/nfs.c
  stable/11/stand/libsa/tftp.c
  stable/11/stand/libsa/zfs/zfs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/bootp.c
==
--- stable/11/stand/libsa/bootp.c   Thu Feb 21 02:41:57 2019
(r344407)
+++ stable/11/stand/libsa/bootp.c   Thu Feb 21 02:43:48 2019
(r344408)
@@ -735,7 +735,7 @@ setenv_(u_char *cp,  u_char *ep, struct dhcp_opt *opts
bcopy(cp, buf, size);   /* cannot overflow */
buf[size] = '\0';
for (endv = buf; endv; endv = vp) {
-   u_char *s = NULL;   /* semicolon ? */
+   char *s = NULL; /* semicolon ? */
 
/* skip leading whitespace */
while (*endv && strchr(" \t\n\r", *endv))

Modified: stable/11/stand/libsa/bootp.h
==
--- stable/11/stand/libsa/bootp.h   Thu Feb 21 02:41:57 2019
(r344407)
+++ stable/11/stand/libsa/bootp.h   Thu Feb 21 02:43:48 2019
(r344408)
@@ -39,7 +39,7 @@ struct bootp {
struct in_addr  bp_giaddr;  /* gateway IP address */
unsigned char   bp_chaddr[16];  /* client hardware address */
unsigned char   bp_sname[64];   /* server host name */
-   unsigned char   bp_file[128];   /* boot file name */
+   charbp_file[128];   /* boot file name */
 #ifdef SUPPORT_DHCP
 #define BOOTP_VENDSIZE 312
 #else

Modified: stable/11/stand/libsa/cd9660.c
==
--- stable/11/stand/libsa/cd9660.c  Thu Feb 21 02:41:57 2019
(r344407)
+++ stable/11/stand/libsa/cd9660.c  Thu Feb 21 02:43:48 2019
(r344408)
@@ -304,7 +304,7 @@ cd9660_open(const char *path, struct open_file *f)
if (isonum_723(vd->logical_block_size) != ISO_DEFAULT_BLOCK_SIZE)
goto out;
 
-   rec = *(struct iso_directory_record *) vd->root_directory_record;
+   bcopy(vd->root_directory_record, &rec, sizeof(rec));
if (*path == '/') path++; /* eat leading '/' */
 
first = 1;

Modified: stable/11/stand/libsa/cd9660read.c
==
--- stable/11/stand/libsa/cd9660read.c  Thu Feb 21 02:41:57 2019
(r344407)
+++ stable/11/stand/libsa/cd9660read.c  Thu Feb 21 02:43:48

svn commit: r344403 - in stable/11/stand/efi: include loader

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Thu Feb 21 02:28:04 2019
New Revision: 344403
URL: https://svnweb.freebsd.org/changeset/base/344403

Log:
  MFC r336264, r336270-r336272, r336464, r336627: UEFI Console Improvements
  
  r336264:
  Define ADR subtype of ACPI type for a device path.
  
  r336270:
  uefi stand: Guess the console better
  
  For server machines, ComOut is set to the set of devices that the efi
  console suppots. Parse it to see if we have serial, video or both.
  Make that take precidence over the command line args. boot1.efi parses
  them, but loader.efi doesn't. It's not clear where to read boot.conf
  from, so we don't do that. The command line args can still be set via
  efibootmgr, which is more inline with the UEFI boot manager to replace
  that. These args are typically used only to set serial vs video and
  the com speed line. We can infer that from ComOut, so do so.
  Remember the com speed and hw.uart.console to match.
  
  r336271:
  Add reporting of whether or not a keyboard is detected. In addition,
  note that r336270's commit message was slightly incorrect. It changed
  the default setting of the console to honor the ConOut
  variable. Overrides via the command line are still possible, and we
  use the devices in ConOut to set the proper console. If, for example,
  serial cosnole is specified, we'll set console to "efi" if ConOut has
  a serial port list and to either "efi comconsole" or "comconsole efi"
  if not depending on whether -D or -D -h was specified.
  
  r336272:
  Minor adjustments:
  
  o Fix the parsing of the device path. a last minute change terminated
it too soon.
  o Kill setting LINES. We don't need to do it, and even if we did hard
coding it to 24 is wrong.
  o Now that the console is working again for the loader, adjust the
printfs to be more in line with other platforms.
  
  r336464:
  If the console is already set, don't override it.
  
  If console=X is specified on the command line, it's effectively
  overridden by the current code. It shouldn't do that.
  
  r336627:
  Fix the attempt to see if we're overriding the console in the command
  line args. I had thought console would be NULL, but it's efi. Set it
  to efi (as a clue) before we initialize the console, then test it to
  see if it changed on the command line to do the automatic
  override. This gets my serial console back.
  
  RelNotes: yes

Modified:
  stable/11/stand/efi/include/efidevp.h
  stable/11/stand/efi/loader/bootinfo.c
  stable/11/stand/efi/loader/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/include/efidevp.h
==
--- stable/11/stand/efi/include/efidevp.h   Thu Feb 21 01:30:37 2019
(r344402)
+++ stable/11/stand/efi/include/efidevp.h   Thu Feb 21 02:28:04 2019
(r344403)
@@ -141,6 +141,9 @@ typedef struct _ACPI_EXTENDED_HID_DEVICE_PATH {
   UINT32  CID;
 } ACPI_EXTENDED_HID_DEVICE_PATH;
 
+#define ACPI_ADR_DP 0x03
+/* ACPI_ADR_DEVICE_PATH not defined */
+
 //
 // EISA ID Macro
 // EISA ID Definition 32-bits

Modified: stable/11/stand/efi/loader/bootinfo.c
==
--- stable/11/stand/efi/loader/bootinfo.c   Thu Feb 21 01:30:37 2019
(r344402)
+++ stable/11/stand/efi/loader/bootinfo.c   Thu Feb 21 02:28:04 2019
(r344403)
@@ -67,10 +67,11 @@ extern EFI_SYSTEM_TABLE *ST;
 static int
 bi_getboothowto(char *kargs)
 {
-   const char *sw;
+   const char *sw, *tmp;
char *opts;
char *console;
-   int howto;
+   int howto, speed, port;
+   char buf[50];
 
howto = boot_parse_cmdline(kargs);
howto |= boot_env_to_howto();
@@ -81,6 +82,35 @@ bi_getboothowto(char *kargs)
howto |= RB_SERIAL;
if (strcmp(console, "nullconsole") == 0)
howto |= RB_MUTE;
+   if (strcmp(console, "efi") == 0) {
+   /*
+* If we found a com port and com speed, we need to tell
+* the kernel where the serial port is, and how
+* fast. Ideally, we'd get the port from ACPI, but that
+* isn't running in the loader. Do the next best thing
+* by allowing it to be set by a loader.conf variable,
+* either a EFI specific one, or the compatible
+* comconsole_port if not. PCI support is needed, but
+* for that we'd ideally refactor the
+* libi386/comconsole.c code to have identical behavior.
+*/
+   tmp = getenv("efi_com_speed");
+   if (tmp != NULL) {
+   speed = strtol(tmp, NULL, 0);
+ 

svn commit: r344407 - head/sys/fs/fuse

2019-02-20 Thread Conrad Meyer
Author: cem
Date: Thu Feb 21 02:41:57 2019
New Revision: 344407
URL: https://svnweb.freebsd.org/changeset/base/344407

Log:
  fuse: Fix a regression introduced in r337165
  
  On systems with non-default DFLTPHYS and/or MAXBSIZE, FUSE would attempt to
  use a buf cache block size in excess of permitted size.  This did not affect
  most configurations, since DFLTPHYS and MAXBSIZE both default to 64kB.
  The issue was discovered and reported using a custom kernel with a DFLTPHYS
  of 512kB.
  
  PR:   230260 (comment #9)
  Reported by:  ken@
  MFC after:π/𝑒 weeks

Modified:
  head/sys/fs/fuse/fuse_vfsops.c

Modified: head/sys/fs/fuse/fuse_vfsops.c
==
--- head/sys/fs/fuse/fuse_vfsops.c  Thu Feb 21 02:37:01 2019
(r344406)
+++ head/sys/fs/fuse/fuse_vfsops.c  Thu Feb 21 02:41:57 2019
(r344407)
@@ -338,7 +338,7 @@ fuse_vfsop_mount(struct mount *mp)
mp->mnt_kern_flag |= MNTK_USES_BCACHE;
MNT_IUNLOCK(mp);
/* We need this here as this slot is used by getnewvnode() */
-   mp->mnt_stat.f_iosize = DFLTPHYS;
+   mp->mnt_stat.f_iosize = MIN(DFLTPHYS, MAXBSIZE);
if (subtype) {
strlcat(mp->mnt_stat.f_fstypename, ".", MFSNAMELEN);
strlcat(mp->mnt_stat.f_fstypename, subtype, MFSNAMELEN);
___
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: r344389 - head/usr.sbin/newsyslog

2019-02-20 Thread Bruce Evans

On Wed, 20 Feb 2019, David Bright wrote:


Log:
 Complete fix for CID 1007454, CID 1007453: Resource leak in newsyslog

 The result of a strdup() was stored in a global variable and not freed
 before program exit. This is a follow-up to r343906. That change


This was an especially large bug in Coverity.  Understanding that exit(3)
exits is about the first thing to understand for a checker.

Now it is also a style bug in the source code.


 attempted to plug these resource leaks but managed to miss a code path
 on which the leak still occurs. Plug the leak on that path, too.



Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Wed Feb 20 21:24:56 2019
(r344388)
+++ head/usr.sbin/newsyslog/newsyslog.c Wed Feb 20 22:05:44 2019
(r344389)
@@ -793,6 +793,9 @@ usage(void)
fprintf(stderr,
"usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f 
config_file]\n"
" [-S pidfile] [-t timefmt] [[-R tagname] file 
...]\n");
+   /* Free global dynamically-allocated storage. */
+   free(timefnamefmt);
+   free(requestor);
exit(1);
}


There was no leak here.  exit(3) frees storage much more finally than
free(3).

It is especially obvious that there is no leak here, since the exit() is
1-2 lines later than the frees.

In theory, exit() might fail because it tries to allocate 100 MB more
storage but wouldn't fail if 100 bytes are freed here (applications can
easily do this foot shooting by allocating without freeing in atexit()
destructors).  In practice, even allocation failures "can't happen",
except in programs that use setrlimit followed but foot shooting to test
the limits.  setrlimit is now broken for this purpose, since it doesn't
limit allocations done using mmap() instead of break(), and malloc() now
uses mmap().

If coverity understood this and wanted to spam you with warnings, then it
would not warn about this, but would warn about more important things like
failure to fflush() or fclose() or check for or handle errors for all
open streams before calling exit().  Also, if all callers of usage() are
not understood, for failures to switch stderr to unbuffered mode before
using it in usage().

The error reporting is even harder to do if stderr is not available.
Windowing systems and even curses need to do lots more cleanup _before_
exit() and it may be difficult to clean up enough to print error messages
using the windowing system.

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


svn commit: r344402 - in head: sys/kgssapi usr.sbin/gssd

2019-02-20 Thread Sean Eric Fagan
Author: sef
Date: Thu Feb 21 01:30:37 2019
New Revision: 344402
URL: https://svnweb.freebsd.org/changeset/base/344402

Log:
  * Handle SIGPIPE in gssd
  We've got some cases where the other end of gssd's AF_LOCAL socket gets
  closed, resulting in an error (and SIGPIPE) when it tries to do I/O to it.
  Closing without cleaning up means the next time nfsd starts up, it hangs,
  unkillably; this allows gssd to handle that particular error.
  
  * Limit the retry cound in gssd_syscall to 5.
  The default is INT_MAX, which effectively means forever.  And it's an
  uninterruptable RPC call, so it will never stop.
  
  The two changes mitigate the problem.
  
  Reviewed by:  macklem
  MFC after:2 weeks
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D19153

Modified:
  head/sys/kgssapi/gss_impl.c
  head/usr.sbin/gssd/gssd.c

Modified: head/sys/kgssapi/gss_impl.c
==
--- head/sys/kgssapi/gss_impl.c Thu Feb 21 00:44:26 2019(r344401)
+++ head/sys/kgssapi/gss_impl.c Thu Feb 21 01:30:37 2019(r344402)
@@ -112,6 +112,15 @@ sys_gssd_syscall(struct thread *td, struct gssd_syscal
cl = clnt_reconnect_create(nconf,
(struct sockaddr *) &sun, GSSD, GSSDVERS,
RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+   /*
+* The number of retries defaults to INT_MAX, which effectively
+* means an infinite, uninterruptable loop.  Limiting it to
+* five retries keeps it from running forever.
+*/
+   if (cl != NULL) {
+   int retry_count = 5;
+   CLNT_CONTROL(cl, CLSET_RETRIES, &retry_count);
+   }
} else
cl = NULL;
 

Modified: head/usr.sbin/gssd/gssd.c
==
--- head/usr.sbin/gssd/gssd.c   Thu Feb 21 00:44:26 2019(r344401)
+++ head/usr.sbin/gssd/gssd.c   Thu Feb 21 01:30:37 2019(r344402)
@@ -202,6 +202,7 @@ main(int argc, char **argv)
signal(SIGHUP, SIG_IGN);
}
signal(SIGTERM, gssd_terminate);
+   signal(SIGPIPE, gssd_terminate);
 
memset(&sun, 0, sizeof sun);
sun.sun_family = AF_LOCAL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344401 - stable/11/sys/dev/ioat

2019-02-20 Thread Alexander Motin
Author: mav
Date: Thu Feb 21 00:44:26 2019
New Revision: 344401
URL: https://svnweb.freebsd.org/changeset/base/344401

Log:
  MFC r302669,302677-302686,303761,304602,304603,305027-305028,305259,
  305710,305711,308067-308070,308178,308179,308230,308553,309338,309526,
  343125 (by cem):  Synchronize ioat(4) with head.
  
  Most of these changes are 3 years old, just never got merged.

Modified:
  stable/11/sys/dev/ioat/ioat.c
  stable/11/sys/dev/ioat/ioat.h
  stable/11/sys/dev/ioat/ioat_hw.h
  stable/11/sys/dev/ioat/ioat_internal.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ioat/ioat.c
==
--- stable/11/sys/dev/ioat/ioat.c   Thu Feb 21 00:17:24 2019
(r344400)
+++ stable/11/sys/dev/ioat/ioat.c   Thu Feb 21 00:44:26 2019
(r344401)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -62,7 +63,6 @@ __FBSDID("$FreeBSD$");
 #defineBUS_SPACE_MAXADDR_40BIT 0xFFULL
 #endif
 #defineIOAT_REFLK  (&ioat->submit_lock)
-#defineIOAT_SHRINK_PERIOD  (10 * hz)
 
 static int ioat_probe(device_t device);
 static int ioat_attach(device_t device);
@@ -81,23 +81,14 @@ static void ioat_process_events(struct ioat_softc *ioa
 static inline uint32_t ioat_get_active(struct ioat_softc *ioat);
 static inline uint32_t ioat_get_ring_space(struct ioat_softc *ioat);
 static void ioat_free_ring(struct ioat_softc *, uint32_t size,
-struct ioat_descriptor **);
-static void ioat_free_ring_entry(struct ioat_softc *ioat,
-struct ioat_descriptor *desc);
-static struct ioat_descriptor *ioat_alloc_ring_entry(struct ioat_softc *,
-int mflags);
+struct ioat_descriptor *);
 static int ioat_reserve_space(struct ioat_softc *, uint32_t, int mflags);
-static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *ioat,
+static union ioat_hw_descriptor *ioat_get_descriptor(struct ioat_softc *,
 uint32_t index);
-static struct ioat_descriptor **ioat_prealloc_ring(struct ioat_softc *,
-uint32_t size, boolean_t need_dscr, int mflags);
-static int ring_grow(struct ioat_softc *, uint32_t oldorder,
-struct ioat_descriptor **);
-static int ring_shrink(struct ioat_softc *, uint32_t oldorder,
-struct ioat_descriptor **);
+static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *,
+uint32_t index);
 static void ioat_halted_debug(struct ioat_softc *, uint32_t);
 static void ioat_poll_timer_callback(void *arg);
-static void ioat_shrink_timer_callback(void *arg);
 static void dump_descriptor(void *hw_desc);
 static void ioat_submit_single(struct ioat_softc *ioat);
 static void ioat_comp_update_map(void *arg, bus_dma_segment_t *seg, int nseg,
@@ -134,6 +125,10 @@ int g_ioat_debug_level = 0;
 SYSCTL_INT(_hw_ioat, OID_AUTO, debug_level, CTLFLAG_RWTUN, &g_ioat_debug_level,
 0, "Set log level (0-3) for ioat(4). Higher is more verbose.");
 
+unsigned g_ioat_ring_order = 13;
+SYSCTL_UINT(_hw_ioat, OID_AUTO, ring_order, CTLFLAG_RDTUN, &g_ioat_ring_order,
+0, "Set IOAT ring order.  (1 << this) == ring size.");
+
 /*
  * OS <-> Driver interface structures
  */
@@ -335,7 +330,6 @@ ioat_detach(device_t device)
 
ioat_teardown_intr(ioat);
callout_drain(&ioat->poll_timer);
-   callout_drain(&ioat->shrink_timer);
 
pci_disable_busmaster(device);
 
@@ -353,7 +347,12 @@ ioat_detach(device_t device)
bus_dma_tag_destroy(ioat->comp_update_tag);
}
 
-   bus_dma_tag_destroy(ioat->hw_desc_tag);
+   if (ioat->hw_desc_ring != NULL) {
+   bus_dmamap_unload(ioat->hw_desc_tag, ioat->hw_desc_map);
+   bus_dmamem_free(ioat->hw_desc_tag, ioat->hw_desc_ring,
+   ioat->hw_desc_map);
+   bus_dma_tag_destroy(ioat->hw_desc_tag);
+   }
 
return (0);
 }
@@ -387,8 +386,8 @@ ioat_start_channel(struct ioat_softc *ioat)
 
/* Submit 'NULL' operation manually to avoid quiescing flag */
desc = ioat_get_ring_entry(ioat, ioat->head);
+   hw_desc = &ioat_get_descriptor(ioat, ioat->head)->dma;
dmadesc = &desc->bus_dmadesc;
-   hw_desc = desc->u.dma;
 
dmadesc->callback_fn = NULL;
dmadesc->callback_arg = NULL;
@@ -425,9 +424,10 @@ static int
 ioat3_attach(device_t device)
 {
struct ioat_softc *ioat;
-   struct ioat_descriptor **ring;
-   struct ioat_descriptor *next;
+   struct ioat_descriptor *ring;
struct ioat_dma_hw_descriptor *dma_hw_desc;
+   void *hw_desc;
+   size_t ringsz;
int i, num_descriptors;
int error;
uint8_t xfercap;
@@ -452,7 +452,6 @@ ioat3_attach(device_t device)
mtx_init(&ioat->submit_lock, "ioat_submit", NULL, MTX_DEF);
mtx_init(&ioat->cleanup_lock, "ioat_cleanup", NULL, MTX_DEF);
callout_init(&ioat->poll_timer, 1);
-   callout_init(&ioat->

svn commit: r344400 - stable/12/sys/dev/ioat

2019-02-20 Thread Alexander Motin
Author: mav
Date: Thu Feb 21 00:17:24 2019
New Revision: 344400
URL: https://svnweb.freebsd.org/changeset/base/344400

Log:
  MFC r343125 (by cem): ioat(4): Set __result_use_check on ioat_acquire_reserve
  
  Even M_WAITOK callers must check for failure.  For example, if the device is
  quiescing, either due to automatic error-recovery induced reset, or due to
  administrative detach, the routine will return ENXIO and the acquire
  reference will not be held.  So, there is no mode in which it is safe to
  assume the routine succeeds without checking.

Modified:
  stable/12/sys/dev/ioat/ioat.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ioat/ioat.h
==
--- stable/12/sys/dev/ioat/ioat.h   Wed Feb 20 23:55:35 2019
(r344399)
+++ stable/12/sys/dev/ioat/ioat.h   Thu Feb 21 00:17:24 2019
(r344400)
@@ -173,7 +173,8 @@ void ioat_release(bus_dmaengine_t dmaengine);
  *
  * On failure, the caller does not hold the dmaengine.
  */
-int ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags);
+int ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags)
+__result_use_check;
 
 /*
  * Issue a blockfill operation.  The 64-bit pattern 'fillpattern' is written to
___
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: r344399 - in stable/11: . share/mk stand stand/common stand/efi/boot1 stand/efi/libefi stand/efi/loader stand/i386 stand/i386/boot2 stand/i386/common stand/i386/gptboot stand/i386/gptzf...

2019-02-20 Thread Kyle Evans
 *.hpp  diff=cpp
 *.py   diff=python
+. svn-properties=svn:keywords=tools/build/options/WITHOUT_LOADER_ZFS

Modified: stable/11/UPDATING
==
--- stable/11/UPDATING  Wed Feb 20 23:53:39 2019(r344398)
+++ stable/11/UPDATING  Wed Feb 20 23:55:35 2019(r344399)
@@ -16,6 +16,14 @@ from older versions of FreeBSD, try WITHOUT_CLANG and 
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
+20190220:
+   zfsloader's functionality has now been folded into loader.
+   zfsloader is no longer necesasary once you've updated your
+   boot blocks. For a transition period, we will install a
+   hardlink for zfsloader to loader to allow a smooth transition
+   until the boot blocks can be updated (hard link because old
+   zfs boot blocks don't understand symlinks).
+
 20190216:
Lualoader has been merged to facilitate testing on this branch.  It's
purely opt-in for now by building WITH_LOADER_LUA and WITHOUT_FORTH in

Modified: stable/11/share/mk/src.opts.mk
==
--- stable/11/share/mk/src.opts.mk  Wed Feb 20 23:53:39 2019
(r344398)
+++ stable/11/share/mk/src.opts.mk  Wed Feb 20 23:55:35 2019
(r344399)
@@ -183,6 +183,7 @@ __DEFAULT_YES_OPTIONS = \
 WIRELESS \
 WPA_SUPPLICANT_EAPOL \
 ZFS \
+LOADER_ZFS \
 ZONEINFO
 
 __DEFAULT_NO_OPTIONS = \
@@ -290,10 +291,6 @@ BROKEN_OPTIONS+=LIBSOFT
 ${__T:Mriscv*}
 BROKEN_OPTIONS+=EFI
 .endif
-# GELI isn't supported on !x86
-.if ${__T} != "i386" && ${__T} != "amd64"
-BROKEN_OPTIONS+=LOADER_GELI
-.endif
 # OFW is only for powerpc and sparc64, exclude others
 .if ${__T:Mpowerpc*} == "" && ${__T:Msparc64} == ""
 BROKEN_OPTIONS+=LOADER_OFW
@@ -377,6 +374,7 @@ MK_SOURCELESS_UCODE:= no
 
 .if ${MK_CDDL} == "no"
 MK_ZFS:=   no
+MK_LOADER_ZFS:=no
 MK_CTF:=   no
 .endif
 

Modified: stable/11/stand/common/devopen.c
==
--- stable/11/stand/common/devopen.cWed Feb 20 23:53:39 2019
(r344398)
+++ stable/11/stand/common/devopen.cWed Feb 20 23:55:35 2019
(r344399)
@@ -32,6 +32,10 @@ __FBSDID("$FreeBSD$");
 
 #include "bootstrap.h"
 
+#ifdef LOADER_GELI_SUPPORT
+#include "geliboot.h"
+#endif
+
 int
 devopen(struct open_file *f, const char *fname, const char **file) 
 {
@@ -43,6 +47,7 @@ devopen(struct open_file *f, const char *fname, const 
return (result);
 
/* point to device-specific data so that device open can use it */
+   f->f_dev = dev->d_dev;
f->f_devdata = dev;
result = dev->d_dev->dv_open(f, dev);
if (result != 0) {
@@ -51,8 +56,17 @@ devopen(struct open_file *f, const char *fname, const 
return (result);
}
 
-   /* reference the devsw entry from the open_file structure */
-   f->f_dev = dev->d_dev;
+#ifdef LOADER_GELI_SUPPORT
+   /*
+* If f->f_dev is geli-encrypted and we can decrypt it (will prompt for
+* pw if needed), this will attach the geli code to the open_file by
+* replacing f->f_dev and f_devdata with pointers to a geli_devdesc.
+*/
+   if (f->f_dev->dv_type == DEVT_DISK) {
+   geli_probe_and_attach(f);
+   }
+#endif
+
return (0);
 }
 

Modified: stable/11/stand/common/metadata.c
==
--- stable/11/stand/common/metadata.c   Wed Feb 20 23:53:39 2019
(r344398)
+++ stable/11/stand/common/metadata.c   Wed Feb 20 23:55:35 2019
(r344399)
@@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$");
 
 #include "bootstrap.h"
 
+#ifdef LOADER_GELI_SUPPORT
+#include "geliboot.h"
+#endif
+
 #if defined(__sparc64__)
 #include 
 
@@ -355,7 +359,9 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs
 #endif
file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend);
 }
-
+#ifdef LOADER_GELI_SUPPORT
+geli_export_key_metadata(kfp);
+#endif
 #if defined(__sparc64__)
 file_addmetadata(kfp, MODINFOMD_DTLB_SLOTS,
sizeof dtlb_slot, &dtlb_slot);

Modified: stable/11/stand/common/paths.h
==
--- stable/11/stand/common/paths.h  Wed Feb 20 23:53:39 2019
(r344398)
+++ stable/11/stand/common/paths.h  Wed Feb 20 23:55:35 2019
(r344399)
@@ -33,7 +33,6 @@
 #define PATH_CONFIG"/boot/config"
 #define PATH_LOADER"/boot/loader"
 #define PATH_LOADER_EFI"/boot/loader.efi&quo

svn commit: r344398 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/disassembler components/dispatcher components/events components/executer components/namespace ...

2019-02-20 Thread Jung-uk Kim
Author: jkim
Date: Wed Feb 20 23:53:39 2019
New Revision: 344398
URL: https://svnweb.freebsd.org/changeset/base/344398

Log:
  MFV:  r344395
  
  Import ACPICA 20190215.

Modified:
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/common/ahpredef.c
  head/sys/contrib/dev/acpica/common/ahuuids.c
  head/sys/contrib/dev/acpica/common/dmextern.c
  head/sys/contrib/dev/acpica/common/dmrestag.c
  head/sys/contrib/dev/acpica/common/dmtable.c
  head/sys/contrib/dev/acpica/common/dmtbdump1.c
  head/sys/contrib/dev/acpica/common/dmtbdump3.c
  head/sys/contrib/dev/acpica/common/dmtbinfo1.c
  head/sys/contrib/dev/acpica/common/dmtbinfo2.c
  head/sys/contrib/dev/acpica/common/dmtbinfo3.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslcompiler.h
  head/sys/contrib/dev/acpica/compiler/aslcompiler.l
  head/sys/contrib/dev/acpica/compiler/aslload.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.h
  head/sys/contrib/dev/acpica/compiler/asloperands.c
  head/sys/contrib/dev/acpica/compiler/aslopt.c
  head/sys/contrib/dev/acpica/compiler/aslpredef.c
  head/sys/contrib/dev/acpica/compiler/aslprintf.c
  head/sys/contrib/dev/acpica/compiler/aslresources.y
  head/sys/contrib/dev/acpica/compiler/aslsupport.l
  head/sys/contrib/dev/acpica/compiler/aslxref.c
  head/sys/contrib/dev/acpica/compiler/cvcompiler.c
  head/sys/contrib/dev/acpica/compiler/cvparser.c
  head/sys/contrib/dev/acpica/compiler/dtexpress.c
  head/sys/contrib/dev/acpica/compiler/dtio.c
  head/sys/contrib/dev/acpica/compiler/dttable1.c
  head/sys/contrib/dev/acpica/compiler/dttable2.c
  head/sys/contrib/dev/acpica/compiler/dttemplate.h
  head/sys/contrib/dev/acpica/components/debugger/dbdisply.c
  head/sys/contrib/dev/acpica/components/debugger/dbexec.c
  head/sys/contrib/dev/acpica/components/debugger/dbnames.c
  head/sys/contrib/dev/acpica/components/debugger/dbobject.c
  head/sys/contrib/dev/acpica/components/debugger/dbtest.c
  head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c
  head/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c
  head/sys/contrib/dev/acpica/components/disassembler/dmnames.c
  head/sys/contrib/dev/acpica/components/disassembler/dmresrc.c
  head/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c
  head/sys/contrib/dev/acpica/components/dispatcher/dswload2.c
  head/sys/contrib/dev/acpica/components/events/evgpe.c
  head/sys/contrib/dev/acpica/components/events/evregion.c
  head/sys/contrib/dev/acpica/components/events/evrgnini.c
  head/sys/contrib/dev/acpica/components/events/evxfgpe.c
  head/sys/contrib/dev/acpica/components/executer/exconvrt.c
  head/sys/contrib/dev/acpica/components/executer/exfield.c
  head/sys/contrib/dev/acpica/components/executer/exserial.c
  head/sys/contrib/dev/acpica/components/executer/exutils.c
  head/sys/contrib/dev/acpica/components/namespace/nsload.c
  head/sys/contrib/dev/acpica/components/namespace/nsparse.c
  head/sys/contrib/dev/acpica/components/namespace/nsutils.c
  head/sys/contrib/dev/acpica/components/parser/psloop.c
  head/sys/contrib/dev/acpica/components/parser/psparse.c
  head/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c
  head/sys/contrib/dev/acpica/components/resources/rsirq.c
  head/sys/contrib/dev/acpica/components/resources/rsserial.c
  head/sys/contrib/dev/acpica/components/tables/tbfadt.c
  head/sys/contrib/dev/acpica/components/tables/tbxface.c
  head/sys/contrib/dev/acpica/components/tables/tbxfload.c
  head/sys/contrib/dev/acpica/components/utilities/utdecode.c
  head/sys/contrib/dev/acpica/components/utilities/utdelete.c
  head/sys/contrib/dev/acpica/components/utilities/uterror.c
  head/sys/contrib/dev/acpica/include/acclib.h
  head/sys/contrib/dev/acpica/include/acconfig.h
  head/sys/contrib/dev/acpica/include/acdebug.h
  head/sys/contrib/dev/acpica/include/acdisasm.h
  head/sys/contrib/dev/acpica/include/acexcep.h
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acmacros.h
  head/sys/contrib/dev/acpica/include/acobject.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/acpredef.h
  head/sys/contrib/dev/acpica/include/acrestyp.h
  head/sys/contrib/dev/acpica/include/actbinfo.h
  head/sys/contrib/dev/acpica/include/actbl1.h
  head/sys/contrib/dev/acpica/include/actbl2.h
  head/sys/contrib/dev/acpica/include/actbl3.h
  head/sys/contrib/dev/acpica/include/actypes.h
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/contrib/dev/acpica/changes.txt
==
--- head/sys/contrib/dev/acpica/changes.txt Wed Feb 20 23:42:03 2019
(r344397)
+++ head/sys/contrib/dev/acpica/changes.txt Wed Feb 20 23:53:39 2019
(r

Re: svn commit: r344353 - in head/sys: amd64/amd64 amd64/include arm/include arm64/include i386/include mips/include powerpc/include riscv/include sparc64/include vm x86/include

2019-02-20 Thread Conrad Meyer
Nevermind, sorry about that.  I see the subsequent commits now.

On Wed, Feb 20, 2019 at 2:33 PM Conrad Meyer  wrote:
>
> Hi Konstantin,
>
> What is the (K)API for this (do you have any intended consumers in
> mind)?  Will it be documented in a manual page at some point?  Does it
> make sense to expose to userspace via mmap(2) or similar?
>
> Thanks,
> Conrad
>
> On Wed, Feb 20, 2019 at 1:51 AM Konstantin Belousov  wrote:
> >
> > Author: kib
> > Date: Wed Feb 20 09:51:13 2019
> > New Revision: 344353
> > URL: https://svnweb.freebsd.org/changeset/base/344353
> >
> > Log:
> >   Add kernel support for Intel userspace protection keys feature on
> >   Skylake Xeons.
> >
> >   See SDM rev. 68 Vol 3 4.6.2 Protection Keys and the description of the
> >   RDPKRU and WRPKRU instructions.
> >
> >   Reviewed by:  markj
> >   Tested by:pho
> >   Sponsored by: The FreeBSD Foundation
> >   MFC after:2 weeks
> >   Differential revision:https://reviews.freebsd.org/D18893
___
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: r344397 - in stable/11: sbin/geom/class/eli stand/libsa/geli sys/geom/eli

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 23:42:03 2019
New Revision: 344397
URL: https://svnweb.freebsd.org/changeset/base/344397

Log:
  MFC r316312, r332361, r333438-r333439, r339804: GELI dry-run
  
  r316312:
  sys/geom/eli: Switch bzero() to explicit_bzero() for sensitive data
  
  In GELI, anywhere we are zeroing out possibly sensitive data, like
  the metadata struct, the metadata sector (both contain the encrypted
  master key), the user key, or the master key, use explicit_bzero.
  
  Didn't touch the bzero() used to initialize structs.
  
  r332361:
  Introduce dry run option for attaching the device.
  This will allow us to verify if passphrase and key is valid without
  decrypting whole device.
  
  r333438:
  Change option dry-run from 'n' to 'C' in geli attach command.
  
  'n' is used in other commands to define the key index.
  We should be consistent with that.
  'C' option is used by patch(1) to perform dryrun so lets use that.
  
  r333439:
  Introduce the 'n' flag for the geli attach command.
  
  If the 'n' flag is provided the provided key number will be used to
  decrypt device. This can be used combined with dryrun to verify if the key
  is set correctly. This can be also used to determine which key slot we want to
  change on already attached device.
  
  r339804:
  Restore backward compatibility for "attach" verb.
  
  In r332361 and r333439, two new parameters were added to geli attach
  verb using gctl_get_paraml, which requires the value to be present.
  This would prevent old geli(8) binary from attaching geli(4) device
  as they have no knowledge about the new parameters.
  
  Restore backward compatibility by treating the absense of these two
  values as seeing the default value supplied by userland.

Modified:
  stable/11/sbin/geom/class/eli/geli.8
  stable/11/sbin/geom/class/eli/geom_eli.c
  stable/11/stand/libsa/geli/geliboot.c
  stable/11/sys/geom/eli/g_eli.c
  stable/11/sys/geom/eli/g_eli.h
  stable/11/sys/geom/eli/g_eli_ctl.c
  stable/11/sys/geom/eli/g_eli_key.c
  stable/11/sys/geom/eli/g_eli_key_cache.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/geom/class/eli/geli.8
==
--- stable/11/sbin/geom/class/eli/geli.8Wed Feb 20 23:05:17 2019
(r344396)
+++ stable/11/sbin/geom/class/eli/geli.8Wed Feb 20 23:42:03 2019
(r344397)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 17, 2017
+.Dd May 9, 2018
 .Dt GELI 8
 .Os
 .Sh NAME
@@ -67,7 +67,8 @@ utility:
 .Cm init
 .Nm
 .Cm attach
-.Op Fl dprv
+.Op Fl Cdprv
+.Op Fl n Ar keyno
 .Op Fl j Ar passfile
 .Op Fl k Ar keyfile
 .Ar prov
@@ -393,6 +394,9 @@ suffix.
 .Pp
 Additional options include:
 .Bl -tag -width ".Fl j Ar passfile"
+.It Fl C
+Do a dry-run decryption.
+This is useful to verify passphrase and keyfile without decrypting the device.
 .It Fl d
 If specified, a decrypted provider will be detached automatically on last 
close.
 This can help with scarce memory so the user does not have to remember to 
detach the
@@ -404,6 +408,9 @@ Probably a better choice is the
 option for the
 .Cm detach
 subcommand.
+.It Fl n Ar keyno
+Specifies the index number of the Master Key copy to use (could be 0 or 1).
+If the index number is not provided all keys will be tested.
 .It Fl j Ar passfile
 Specifies a file which contains the passphrase component of the User Key
 (or part of it).

Modified: stable/11/sbin/geom/class/eli/geom_eli.c
==
--- stable/11/sbin/geom/class/eli/geom_eli.cWed Feb 20 23:05:17 2019
(r344396)
+++ stable/11/sbin/geom/class/eli/geom_eli.cWed Feb 20 23:42:03 2019
(r344397)
@@ -86,7 +86,7 @@ static int eli_backup_create(struct gctl_req *req, con
  *
  * init [-bdgPTv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l 
keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] [-V version] prov
  * label - alias for 'init'
- * attach [-dprv] [-j passfile] [-k keyfile] prov
+ * attach [-Cdprv] [-n keyno] [-j passfile] [-k keyfile] prov
  * detach [-fl] prov ...
  * stop - alias for 'detach'
  * onetime [-d] [-a aalgo] [-e ealgo] [-l keylen] prov
@@ -145,14 +145,16 @@ struct g_command class_commands[] = {
},
{ "attach", G_FLAG_VERBOSE | G_FLAG_LOADKLD, eli_main,
{
+   { 'C', "dryrun", NULL, G_TYPE_BOOL },
{ 'd', "detach", NULL, G_TYPE_BOOL },
{ 'j', "passfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI 
},
{ 'k', "keyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI 
},
+   { 'n', "keyno", "-1", G_TYPE_NUMBER },
{ 'p', "nopassphrase", NULL, G_TYPE_BOOL },
{ 'r', "readonly", NULL, G_TYPE_BOOL },
G_OPT_SENTINEL
},
-   "[-dprv] [-j passfile] [-k keyfile] prov"
+   "[-Cdprv] [-n keyno] [-j passfile] [-k k

Re: svn commit: r344364 - vendor/illumos/dist/lib/libdtrace/common

2019-02-20 Thread Warner Losh
On Wed, Feb 20, 2019 at 10:19 AM Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> wrote:

> > Author: markj
> > Date: Wed Feb 20 17:05:13 2019
> > New Revision: 344364
> > URL: https://svnweb.freebsd.org/changeset/base/344364
> >
> > Log:
> >   9058 postmortem DTrace frequently broken under vmware
> >
> >   illumos/illumos-gate@793bd7e3617ae7d3d24e8c6b7d6befe35f07ec1f
> >
> >   Reviewed by: Tim Kordas 
> >   Reviewed by: Patrick Mooney 
> >   Reviewed by: Yuri Pankov 
> >   Reviewed by: Matthew Ahrens 
> >   Approved by: Matthew Ahrens 
> >   Author: Sam Gwydir 
> >
> > Modified:
> >   vendor/illumos/dist/lib/libdtrace/common/dt_consume.c
> >
> > Modified: vendor/illumos/dist/lib/libdtrace/common/dt_consume.c
> >
> ==
> > --- vendor/illumos/dist/lib/libdtrace/common/dt_consume.c Wed Feb 20
> 14:12:25 2019(r344363)
> > +++ vendor/illumos/dist/lib/libdtrace/common/dt_consume.c Wed Feb 20
> 17:05:13 2019(r344364)
> > @@ -24,7 +24,7 @@
> >   */
> >
> >  /*
> > - * Copyright (c) 2013, Joyent, Inc. All rights reserved.
> > + * Copyright (c) 2017, Joyent, Inc. All rights reserved.
>
> This change to this copyright is very questionable.
> One should always retain the first date of publication
> in a copyright statement.
>
> I do understand your just importing a change from illumous,
> but I want it on public record that I have raised issue
> with this change to a copyright, and this has nothing to
> do with you personally, or you wanting to bring this code
> over.
>

Joyent is following the old Sun practice of listing the last date only.
I've had my company's lawyers tell me in the past this is acceptable.

In my research, as layperson, I've found advice going all three ways: list
every year, or else; earliest-latest year range; only the latest year. I
once asked an IP lawyer that handled a friend's trademark case for clue.com.
He said that there is a diversity of legal opinion in the legal community,
and that in some specific cases one might be favored over the other. Most
of the time, in his opinion, the differences don't matter to open source.
He hastened to add he couldn't give any blanket statements on the topic and
for proper legal advice he'd need to know more about the specific use. And
then we had another beer and chatted about other things. I never followed
up. In the years since this, I've seen all three styles used.

Warner

>   * Copyright (c) 2012 by Delphix. All rights reserved.
> >   */
> >
> > @@ -3010,9 +3010,6 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
> >   break;
> >
> >   timestamp = dt_buf_oldest(buf, dtp);
> > - assert(timestamp >= dtp->dt_last_timestamp);
> > - dtp->dt_last_timestamp = timestamp;
> > -
> >   if (timestamp == buf->dtbd_timestamp) {
> >   /*
> >* We've reached the end of the time
> covered
> > @@ -3026,6 +3023,8 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
> >   break;
> >   continue;
> >   }
> > + assert(timestamp >= dtp->dt_last_timestamp);
> > + dtp->dt_last_timestamp = timestamp;
> >
> >   if ((rval = dt_consume_cpu(dtp, fp,
> >   buf->dtbd_cpu, buf, B_TRUE, pf, rf, arg)) != 0)
> >
> >
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
>
___
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: r344396 - vendor-sys/acpica/20190215

2019-02-20 Thread Jung-uk Kim
Author: jkim
Date: Wed Feb 20 23:05:17 2019
New Revision: 344396
URL: https://svnweb.freebsd.org/changeset/base/344396

Log:
  Tag ACPICA 20190215.

Added:
  vendor-sys/acpica/20190215/
 - copied from r344395, vendor-sys/acpica/dist/
___
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: r344395 - in vendor-sys/acpica/dist: . generate/unix/iasl source/common source/compiler source/components/debugger source/components/disassembler source/components/dispatcher source/com...

2019-02-20 Thread Jung-uk Kim
Author: jkim
Date: Wed Feb 20 23:04:28 2019
New Revision: 344395
URL: https://svnweb.freebsd.org/changeset/base/344395

Log:
  Import ACPICA 20190215.

Modified:
  vendor-sys/acpica/dist/changes.txt
  vendor-sys/acpica/dist/generate/unix/iasl/Makefile
  vendor-sys/acpica/dist/source/common/ahpredef.c
  vendor-sys/acpica/dist/source/common/ahuuids.c
  vendor-sys/acpica/dist/source/common/dmextern.c
  vendor-sys/acpica/dist/source/common/dmrestag.c
  vendor-sys/acpica/dist/source/common/dmtable.c
  vendor-sys/acpica/dist/source/common/dmtbdump1.c
  vendor-sys/acpica/dist/source/common/dmtbdump3.c
  vendor-sys/acpica/dist/source/common/dmtbinfo1.c
  vendor-sys/acpica/dist/source/common/dmtbinfo2.c
  vendor-sys/acpica/dist/source/common/dmtbinfo3.c
  vendor-sys/acpica/dist/source/compiler/aslcompile.c
  vendor-sys/acpica/dist/source/compiler/aslcompiler.h
  vendor-sys/acpica/dist/source/compiler/aslcompiler.l
  vendor-sys/acpica/dist/source/compiler/aslload.c
  vendor-sys/acpica/dist/source/compiler/aslmessages.c
  vendor-sys/acpica/dist/source/compiler/aslmessages.h
  vendor-sys/acpica/dist/source/compiler/asloperands.c
  vendor-sys/acpica/dist/source/compiler/aslopt.c
  vendor-sys/acpica/dist/source/compiler/aslpredef.c
  vendor-sys/acpica/dist/source/compiler/aslprintf.c
  vendor-sys/acpica/dist/source/compiler/aslresources.y
  vendor-sys/acpica/dist/source/compiler/aslsupport.l
  vendor-sys/acpica/dist/source/compiler/aslxref.c
  vendor-sys/acpica/dist/source/compiler/cvcompiler.c
  vendor-sys/acpica/dist/source/compiler/cvparser.c
  vendor-sys/acpica/dist/source/compiler/dtexpress.c
  vendor-sys/acpica/dist/source/compiler/dtio.c
  vendor-sys/acpica/dist/source/compiler/dttable1.c
  vendor-sys/acpica/dist/source/compiler/dttable2.c
  vendor-sys/acpica/dist/source/compiler/dttemplate.h
  vendor-sys/acpica/dist/source/components/debugger/dbdisply.c
  vendor-sys/acpica/dist/source/components/debugger/dbexec.c
  vendor-sys/acpica/dist/source/components/debugger/dbnames.c
  vendor-sys/acpica/dist/source/components/debugger/dbobject.c
  vendor-sys/acpica/dist/source/components/debugger/dbtest.c
  vendor-sys/acpica/dist/source/components/disassembler/dmbuffer.c
  vendor-sys/acpica/dist/source/components/disassembler/dmcstyle.c
  vendor-sys/acpica/dist/source/components/disassembler/dmnames.c
  vendor-sys/acpica/dist/source/components/disassembler/dmresrc.c
  vendor-sys/acpica/dist/source/components/disassembler/dmresrcs.c
  vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c
  vendor-sys/acpica/dist/source/components/dispatcher/dsopcode.c
  vendor-sys/acpica/dist/source/components/dispatcher/dswload2.c
  vendor-sys/acpica/dist/source/components/events/evgpe.c
  vendor-sys/acpica/dist/source/components/events/evregion.c
  vendor-sys/acpica/dist/source/components/events/evrgnini.c
  vendor-sys/acpica/dist/source/components/events/evxfgpe.c
  vendor-sys/acpica/dist/source/components/executer/exconvrt.c
  vendor-sys/acpica/dist/source/components/executer/exfield.c
  vendor-sys/acpica/dist/source/components/executer/exserial.c
  vendor-sys/acpica/dist/source/components/executer/exutils.c
  vendor-sys/acpica/dist/source/components/namespace/nsload.c
  vendor-sys/acpica/dist/source/components/namespace/nsparse.c
  vendor-sys/acpica/dist/source/components/namespace/nsutils.c
  vendor-sys/acpica/dist/source/components/parser/psloop.c
  vendor-sys/acpica/dist/source/components/parser/psparse.c
  vendor-sys/acpica/dist/source/components/resources/rsdumpinfo.c
  vendor-sys/acpica/dist/source/components/resources/rsirq.c
  vendor-sys/acpica/dist/source/components/resources/rsserial.c
  vendor-sys/acpica/dist/source/components/tables/tbfadt.c
  vendor-sys/acpica/dist/source/components/tables/tbxface.c
  vendor-sys/acpica/dist/source/components/tables/tbxfload.c
  vendor-sys/acpica/dist/source/components/utilities/utclib.c
  vendor-sys/acpica/dist/source/components/utilities/utdecode.c
  vendor-sys/acpica/dist/source/components/utilities/utdelete.c
  vendor-sys/acpica/dist/source/components/utilities/uterror.c
  vendor-sys/acpica/dist/source/include/acclib.h
  vendor-sys/acpica/dist/source/include/acconfig.h
  vendor-sys/acpica/dist/source/include/acdebug.h
  vendor-sys/acpica/dist/source/include/acdisasm.h
  vendor-sys/acpica/dist/source/include/acexcep.h
  vendor-sys/acpica/dist/source/include/aclocal.h
  vendor-sys/acpica/dist/source/include/acmacros.h
  vendor-sys/acpica/dist/source/include/acobject.h
  vendor-sys/acpica/dist/source/include/acpixf.h
  vendor-sys/acpica/dist/source/include/acpredef.h
  vendor-sys/acpica/dist/source/include/acrestyp.h
  vendor-sys/acpica/dist/source/include/actbinfo.h
  vendor-sys/acpica/dist/source/include/actbl1.h
  vendor-sys/acpica/dist/source/include/actbl2.h
  vendor-sys/acpica/dist/source/include/actbl3.h
  vendor-sys/acpica/dist/source/include/actypes.h
  vendor-sys/acpica/dist/source/include/platform/acefi.h
  vendor-sys/acpica/dist/source/tools/acpiexec/aeinstall.c
  vend

svn commit: r344393 - stable/11/sys/cam/scsi

2019-02-20 Thread David Bright
Author: dab
Date: Wed Feb 20 22:48:55 2019
New Revision: 344393
URL: https://svnweb.freebsd.org/changeset/base/344393

Log:
  MFC r344024:
  
  CID 1009492: Logically dead code in sys/cam/scsi/scsi_xpt.c
  
  In `probedone()`, for the `PROBE_REPORT_LUNS` case, all paths that
  fall to the bottom of the case set `lp` to `NULL`, so the test for a
  non-NULL value of `lp` and call to `free()` if true is dead code as
  the test can never be true. Fix by eliminating the whole if
  statement. To guard against a possible future change that accidentally
  violates this assumption, use a `KASSERT()` to catch if `lp` is
  non-NULL.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/cam/scsi/scsi_xpt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_xpt.c
==
--- stable/11/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:48:38 2019
(r344392)
+++ stable/11/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:48:55 2019
(r344393)
@@ -1379,6 +1379,12 @@ out:
probe_purge_old(path, lp, softc->flags);
lp = NULL;
}
+   /* The processing above should either exit via a `goto
+* out` or leave the `lp` variable `NULL` and (if
+* applicable) `free()` the storage to which it had
+* pointed. Assert here that is the case.
+*/
+   KASSERT(lp == NULL, ("%s: lp is not NULL", __func__));
inq_buf = &path->device->inq_data;
if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID &&
(SID_QUAL(inq_buf) == SID_QUAL_LU_CONNECTED ||
@@ -1391,9 +1397,6 @@ out:
xpt_release_ccb(done_ccb);
xpt_schedule(periph, priority);
goto out;
-   }
-   if (lp) {
-   free(lp, M_CAMXPT);
}
PROBE_SET_ACTION(softc, PROBE_INVALID);
xpt_release_ccb(done_ccb);
___
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: r344392 - stable/12/sys/cam/scsi

2019-02-20 Thread David Bright
Author: dab
Date: Wed Feb 20 22:48:38 2019
New Revision: 344392
URL: https://svnweb.freebsd.org/changeset/base/344392

Log:
  MFC r344024:
  
  CID 1009492: Logically dead code in sys/cam/scsi/scsi_xpt.c
  
  In `probedone()`, for the `PROBE_REPORT_LUNS` case, all paths that
  fall to the bottom of the case set `lp` to `NULL`, so the test for a
  non-NULL value of `lp` and call to `free()` if true is dead code as
  the test can never be true. Fix by eliminating the whole if
  statement. To guard against a possible future change that accidentally
  violates this assumption, use a `KASSERT()` to catch if `lp` is
  non-NULL.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/cam/scsi/scsi_xpt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/scsi/scsi_xpt.c
==
--- stable/12/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:41:14 2019
(r344391)
+++ stable/12/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:48:38 2019
(r344392)
@@ -1385,6 +1385,12 @@ out:
probe_purge_old(path, lp, softc->flags);
lp = NULL;
}
+   /* The processing above should either exit via a `goto
+* out` or leave the `lp` variable `NULL` and (if
+* applicable) `free()` the storage to which it had
+* pointed. Assert here that is the case.
+*/
+   KASSERT(lp == NULL, ("%s: lp is not NULL", __func__));
inq_buf = &path->device->inq_data;
if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID &&
(SID_QUAL(inq_buf) == SID_QUAL_LU_CONNECTED ||
@@ -1397,9 +1403,6 @@ out:
xpt_release_ccb(done_ccb);
xpt_schedule(periph, priority);
goto out;
-   }
-   if (lp) {
-   free(lp, M_CAMXPT);
}
PROBE_SET_ACTION(softc, PROBE_INVALID);
xpt_release_ccb(done_ccb);
___
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: r344394 - stable/10/sys/cam/scsi

2019-02-20 Thread David Bright
Author: dab
Date: Wed Feb 20 22:49:09 2019
New Revision: 344394
URL: https://svnweb.freebsd.org/changeset/base/344394

Log:
  MFC r344024:
  
  CID 1009492: Logically dead code in sys/cam/scsi/scsi_xpt.c
  
  In `probedone()`, for the `PROBE_REPORT_LUNS` case, all paths that
  fall to the bottom of the case set `lp` to `NULL`, so the test for a
  non-NULL value of `lp` and call to `free()` if true is dead code as
  the test can never be true. Fix by eliminating the whole if
  statement. To guard against a possible future change that accidentally
  violates this assumption, use a `KASSERT()` to catch if `lp` is
  non-NULL.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/10/sys/cam/scsi/scsi_xpt.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_xpt.c
==
--- stable/10/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:48:55 2019
(r344393)
+++ stable/10/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:49:09 2019
(r344394)
@@ -1351,6 +1351,12 @@ out:
probe_purge_old(path, lp, softc->flags);
lp = NULL;
}
+   /* The processing above should either exit via a `goto
+* out` or leave the `lp` variable `NULL` and (if
+* applicable) `free()` the storage to which it had
+* pointed. Assert here that is the case.
+*/
+   KASSERT(lp == NULL, ("%s: lp is not NULL", __func__));
inq_buf = &path->device->inq_data;
if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID &&
(SID_QUAL(inq_buf) == SID_QUAL_LU_CONNECTED ||
@@ -1363,9 +1369,6 @@ out:
xpt_release_ccb(done_ccb);
xpt_schedule(periph, priority);
goto out;
-   }
-   if (lp) {
-   free(lp, M_CAMXPT);
}
PROBE_SET_ACTION(softc, PROBE_INVALID);
xpt_release_ccb(done_ccb);
___
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: r344391 - head/sys/kern

2019-02-20 Thread Andrew Turner
Author: andrew
Date: Wed Feb 20 22:41:14 2019
New Revision: 344391
URL: https://svnweb.freebsd.org/changeset/base/344391

Log:
  Unwire the kcov buffer when freeing the info struct.
  
  Without this the physical memory will not be returned to the kernel.
  
  While here call vm_object_reference on the object when mmapping the buffer.
  This removed the need for buggy tracking of if it has been mapped or not.
  
  This fixes issues where kcov could use all the system memory.
  
  Reported by:  tuexen
  Reviewed by:  kib
  Sponsored by: DARPA, AFTL
  Differential Revision:https://reviews.freebsd.org/D19252

Modified:
  head/sys/kern/kern_kcov.c

Modified: head/sys/kern/kern_kcov.c
==
--- head/sys/kern/kern_kcov.c   Wed Feb 20 22:32:28 2019(r344390)
+++ head/sys/kern/kern_kcov.c   Wed Feb 20 22:41:14 2019(r344391)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 MALLOC_DEFINE(M_KCOV_INFO, "kcovinfo", "KCOV info type");
 
@@ -347,6 +348,7 @@ kcov_mmap_single(struct cdev *dev, vm_ooffset_t *offse
info->mmap != false)
return (EINVAL);
 
+   vm_object_reference(info->bufobj);
info->mmap = true;
*offset = 0;
*object = info->bufobj;
@@ -393,13 +395,26 @@ kcov_alloc(struct kcov_info *info, size_t entries)
 static void
 kcov_free(struct kcov_info *info)
 {
+   vm_page_t m;
+   size_t i;
 
if (info->kvaddr != 0) {
pmap_qremove(info->kvaddr, info->bufsize / PAGE_SIZE);
kva_free(info->kvaddr, info->bufsize);
}
-   if (info->bufobj != NULL && !info->mmap)
+   if (info->bufobj != NULL) {
+   VM_OBJECT_WLOCK(info->bufobj);
+   m = vm_page_lookup(info->bufobj, 0);
+   for (i = 0; i < info->bufsize / PAGE_SIZE; i++) {
+   vm_page_lock(m);
+   vm_page_unwire_noq(m);
+   vm_page_unlock(m);
+
+   m = vm_page_next(m);
+   }
+   VM_OBJECT_WUNLOCK(info->bufobj);
vm_object_deallocate(info->bufobj);
+   }
free(info, M_KCOV_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"


Re: svn commit: r344353 - in head/sys: amd64/amd64 amd64/include arm/include arm64/include i386/include mips/include powerpc/include riscv/include sparc64/include vm x86/include

2019-02-20 Thread Conrad Meyer
Hi Konstantin,

What is the (K)API for this (do you have any intended consumers in
mind)?  Will it be documented in a manual page at some point?  Does it
make sense to expose to userspace via mmap(2) or similar?

Thanks,
Conrad

On Wed, Feb 20, 2019 at 1:51 AM Konstantin Belousov  wrote:
>
> Author: kib
> Date: Wed Feb 20 09:51:13 2019
> New Revision: 344353
> URL: https://svnweb.freebsd.org/changeset/base/344353
>
> Log:
>   Add kernel support for Intel userspace protection keys feature on
>   Skylake Xeons.
>
>   See SDM rev. 68 Vol 3 4.6.2 Protection Keys and the description of the
>   RDPKRU and WRPKRU instructions.
>
>   Reviewed by:  markj
>   Tested by:pho
>   Sponsored by: The FreeBSD Foundation
>   MFC after:2 weeks
>   Differential revision:https://reviews.freebsd.org/D18893
___
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: r344390 - head/sys/kern

2019-02-20 Thread Andrew Turner
Author: andrew
Date: Wed Feb 20 22:32:28 2019
New Revision: 344390
URL: https://svnweb.freebsd.org/changeset/base/344390

Log:
  Call pmap_qenter for each page when creating the kcov buffer.
  
  This removes the need to allocate a buffer to hold the vm_page_t objects
  at the cost of extra IPIs on some architectures.
  
  Reviewed by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D19252

Modified:
  head/sys/kern/kern_kcov.c

Modified: head/sys/kern/kern_kcov.c
==
--- head/sys/kern/kern_kcov.c   Wed Feb 20 22:05:44 2019(r344389)
+++ head/sys/kern/kern_kcov.c   Wed Feb 20 22:32:28 2019(r344390)
@@ -357,7 +357,7 @@ static int
 kcov_alloc(struct kcov_info *info, size_t entries)
 {
size_t n, pages;
-   vm_page_t *m;
+   vm_page_t m;
 
KASSERT(info->kvaddr == 0, ("kcov_alloc: Already have a buffer"));
KASSERT(info->state == KCOV_STATE_OPEN,
@@ -376,16 +376,14 @@ kcov_alloc(struct kcov_info *info, size_t entries)
info->bufobj = vm_pager_allocate(OBJT_PHYS, 0, info->bufsize,
PROT_READ | PROT_WRITE, 0, curthread->td_ucred);
 
-   m = malloc(sizeof(*m) * pages, M_TEMP, M_WAITOK);
VM_OBJECT_WLOCK(info->bufobj);
for (n = 0; n < pages; n++) {
-   m[n] = vm_page_grab(info->bufobj, n,
+   m = vm_page_grab(info->bufobj, n,
VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_WIRED);
-   m[n]->valid = VM_PAGE_BITS_ALL;
+   m->valid = VM_PAGE_BITS_ALL;
+   pmap_qenter(info->kvaddr + n * PAGE_SIZE, &m, 1);
}
VM_OBJECT_WUNLOCK(info->bufobj);
-   pmap_qenter(info->kvaddr, m, pages);
-   free(m, M_TEMP);
 
info->entries = entries;
 
___
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: r344389 - head/usr.sbin/newsyslog

2019-02-20 Thread David Bright
Author: dab
Date: Wed Feb 20 22:05:44 2019
New Revision: 344389
URL: https://svnweb.freebsd.org/changeset/base/344389

Log:
  Complete fix for CID 1007454, CID 1007453: Resource leak in newsyslog
  
  The result of a strdup() was stored in a global variable and not freed
  before program exit. This is a follow-up to r343906. That change
  attempted to plug these resource leaks but managed to miss a code path
  on which the leak still occurs. Plug the leak on that path, too.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

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

Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Wed Feb 20 21:24:56 2019
(r344388)
+++ head/usr.sbin/newsyslog/newsyslog.c Wed Feb 20 22:05:44 2019
(r344389)
@@ -793,6 +793,9 @@ usage(void)
fprintf(stderr,
"usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f 
config_file]\n"
" [-S pidfile] [-t timefmt] [[-R tagname] file 
...]\n");
+   /* Free global dynamically-allocated storage. */
+   free(timefnamefmt);
+   free(requestor);
exit(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: r344388 - head/tools/tools/crypto

2019-02-20 Thread Sean Eric Fagan
Author: sef
Date: Wed Feb 20 21:24:56 2019
New Revision: 344388
URL: https://svnweb.freebsd.org/changeset/base/344388

Log:
  It turns out that setting the IV length is necessary with CCM in OpenSSL.
  This adds that back.
  
  Reviewed by:  cem

Modified:
  head/tools/tools/crypto/cryptocheck.c

Modified: head/tools/tools/crypto/cryptocheck.c
==
--- head/tools/tools/crypto/cryptocheck.c   Wed Feb 20 21:07:09 2019
(r344387)
+++ head/tools/tools/crypto/cryptocheck.c   Wed Feb 20 21:24:56 2019
(r344388)
@@ -1185,6 +1185,9 @@ openssl_ccm_encrypt(struct alg *alg, const EVP_CIPHER 
if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1)
errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name,
size, ERR_error_string(ERR_get_error(), NULL));
+   if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_IVLEN, iv_len, NULL) != 1)
+   errx(1, "OpenSSL %s (%zu) setting iv length failed: %s", 
alg->name,
+   size, ERR_error_string(ERR_get_error(), NULL));
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, 
AES_CBC_MAC_HASH_LEN, NULL) != 1)
errx(1, "OpenSSL %s (%zu) setting tag length failed: %s", 
alg->name,
 size, ERR_error_string(ERR_get_error(), NULL));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344386 - head/contrib/libc++/include

2019-02-20 Thread Dimitry Andric
Author: dim
Date: Wed Feb 20 21:06:11 2019
New Revision: 344386
URL: https://svnweb.freebsd.org/changeset/base/344386

Log:
  Pull in r354515 from upstream libc++ trunk:
  
Fix the build with gcc when `-Wredundant-decls` is passed
  
Summary:
  
gcc warns that `__throw_runtime_error` is declared both in
`<__locale>` and ``, if `-Wredundant-decls` is passed on
the command line; this is the case with FreeBSD when ${WARNS} == 6.
  
Since `<__locale>` gets its first declaration via a transitive
include of ``, and the second declaration is after the
first invocation of `__throw_runtime_error`, delete that second
declaration.
  
Signed-off-by: Enji Cooper 
  
Reviewers: kristina, MaskRay, EricWF, ldionne, ngie
  
Reviewed By: EricWF
  
Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, 
libcxx-commits
  
Tags: #libc
  
Differential Revision: https://reviews.llvm.org/D58425
  
  Submitted by: ngie
  MFC after:3 days

Modified:
  head/contrib/libc++/include/__locale

Modified: head/contrib/libc++/include/__locale
==
--- head/contrib/libc++/include/__localeWed Feb 20 20:55:02 2019
(r344385)
+++ head/contrib/libc++/include/__localeWed Feb 20 21:06:11 2019
(r344386)
@@ -1230,8 +1230,6 @@ _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS 
codecvt_byname)
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS 
codecvt_byname)
 
-_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
-
 template 
 struct __narrow_to_utf8
 {
___
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: r344387 - head/stand/libsa

2019-02-20 Thread Toomas Soome
Author: tsoome
Date: Wed Feb 20 21:07:09 2019
New Revision: 344387
URL: https://svnweb.freebsd.org/changeset/base/344387

Log:
  loader: really fix cd9660 dirmatch
  
  The cd9660_open() does pass whole path to dirmatch() and we need to
  compare only the current path component, not full path.
  
  Additinally, skip over duplicate / (if any) and check if the last component
  in the path was meant to be directory (having trailing /). If it is in fact
  a file, error out.

Modified:
  head/stand/libsa/cd9660.c

Modified: head/stand/libsa/cd9660.c
==
--- head/stand/libsa/cd9660.c   Wed Feb 20 21:06:11 2019(r344386)
+++ head/stand/libsa/cd9660.c   Wed Feb 20 21:07:09 2019(r344387)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -227,8 +228,8 @@ static int
 dirmatch(struct open_file *f, const char *path, struct iso_directory_record 
*dp,
 int use_rrip, int lenskip)
 {
-   size_t len;
-   char *cp;
+   size_t len, plen;
+   char *cp, *sep;
int i, icase;
 
if (use_rrip)
@@ -242,7 +243,14 @@ dirmatch(struct open_file *f, const char *path, struct
} else
icase = 0;
 
-   if (strlen(path) != len)
+   sep = strchr(path, '/');
+   if (sep != NULL) {
+   plen = sep - path;
+   } else {
+   plen = strlen(path);
+   }
+
+   if (plen != len)
return (0);
 
for (i = len; --i >= 0; path++, cp++) {
@@ -283,6 +291,7 @@ cd9660_open(const char *path, struct open_file *f)
struct iso_directory_record rec;
struct iso_directory_record *dp = NULL;
int rc, first, use_rrip, lenskip;
+   bool isdir = false;
 
/* First find the volume descriptor */
buf = malloc(buf_size = ISO_DEFAULT_BLOCK_SIZE);
@@ -372,7 +381,24 @@ cd9660_open(const char *path, struct open_file *f)
rec = *dp;
while (*path && *path != '/') /* look for next component */
path++;
-   if (*path) path++; /* skip '/' */
+
+   if (*path)  /* this component was directory */
+   isdir = true;
+
+   while (*path == '/')
+   path++; /* skip '/' */
+
+   if (*path)  /* We do have next component. */
+   isdir = false;
+   }
+
+   /*
+* if the path had trailing / but the path does point to file,
+* report the error ENOTDIR.
+*/
+   if (isdir == true && (isonum_711(rec.flags) & 2) == 0) {
+   rc = ENOTDIR;
+   goto out;
}
 
/* allocate file system specific data structure */
___
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: r344385 - head/sys/fs/pseudofs

2019-02-20 Thread Matt Macy
Author: mmacy
Date: Wed Feb 20 20:55:02 2019
New Revision: 344385
URL: https://svnweb.freebsd.org/changeset/base/344385

Log:
  PFS: Bump NAMELEN and don't require clients to be sleepable
  
  - debugfs consumers expect to be able to export names more than 48 characters
  
  - debugfs consumers expect to be able to hold locks across calls and are able
to handle allocation failures
  
  Reviewed by:  hps@
  MFC after:1 week
  Sponsored by: iX Systems
  Differential Revision:https://reviews.freebsd.org/D19256

Modified:
  head/sys/fs/pseudofs/pseudofs.c
  head/sys/fs/pseudofs/pseudofs.h

Modified: head/sys/fs/pseudofs/pseudofs.c
==
--- head/sys/fs/pseudofs/pseudofs.c Wed Feb 20 20:48:10 2019
(r344384)
+++ head/sys/fs/pseudofs/pseudofs.c Wed Feb 20 20:55:02 2019
(r344385)
@@ -68,15 +68,20 @@ SYSCTL_INT(_vfs_pfs, OID_AUTO, trace, CTLFLAG_RW, &pfs
  * Allocate and initialize a node
  */
 static struct pfs_node *
-pfs_alloc_node(struct pfs_info *pi, const char *name, pfs_type_t type)
+pfs_alloc_node_flags(struct pfs_info *pi, const char *name, pfs_type_t type, 
int flags)
 {
struct pfs_node *pn;
+   int malloc_flags;
 
KASSERT(strlen(name) < PFS_NAMELEN,
("%s(): node name is too long", __func__));
-
-   pn = malloc(sizeof *pn,
-   M_PFSNODES, M_WAITOK|M_ZERO);
+   if (flags & PFS_NOWAIT)
+   malloc_flags = M_NOWAIT | M_ZERO;
+   else
+   malloc_flags = M_WAITOK | M_ZERO;
+   pn = malloc(sizeof *pn, M_PFSNODES, malloc_flags);
+   if (pn == NULL)
+   return (NULL);
mtx_init(&pn->pn_mutex, "pfs_node", NULL, MTX_DEF | MTX_DUPOK);
strlcpy(pn->pn_name, name, sizeof pn->pn_name);
pn->pn_type = type;
@@ -84,6 +89,12 @@ pfs_alloc_node(struct pfs_info *pi, const char *name, 
return (pn);
 }
 
+static struct pfs_node *
+pfs_alloc_node(struct pfs_info *pi, const char *name, pfs_type_t type)
+{
+   return (pfs_alloc_node_flags(pi, name, type, 0));
+}
+
 /*
  * Add a node to a directory
  */
@@ -160,15 +171,29 @@ pfs_detach_node(struct pfs_node *pn)
 /*
  * Add . and .. to a directory
  */
+static int
+pfs_fixup_dir_flags(struct pfs_node *parent, int flags)
+{
+   struct pfs_node *dot, *dotdot;
+
+   dot = pfs_alloc_node_flags(parent->pn_info, ".", pfstype_this, flags);
+   if (dot == NULL)
+   return (ENOMEM);
+   dotdot = pfs_alloc_node_flags(parent->pn_info, "..", pfstype_parent, 
flags);
+   if (dotdot == NULL) {
+   pfs_destroy(dot);
+   return (ENOMEM);
+   }
+   pfs_add_node(parent, dot);
+   pfs_add_node(parent, dotdot);
+   return (0);
+}
+
 static void
 pfs_fixup_dir(struct pfs_node *parent)
 {
-   struct pfs_node *pn;
 
-   pn = pfs_alloc_node(parent->pn_info, ".", pfstype_this);
-   pfs_add_node(parent, pn);
-   pn = pfs_alloc_node(parent->pn_info, "..", pfstype_parent);
-   pfs_add_node(parent, pn);
+   pfs_fixup_dir_flags(parent, 0);
 }
 
 /*
@@ -180,16 +205,22 @@ pfs_create_dir(struct pfs_node *parent, const char *na
   int flags)
 {
struct pfs_node *pn;
+   int rc;
 
-   pn = pfs_alloc_node(parent->pn_info, name,
-   (flags & PFS_PROCDEP) ? pfstype_procdir : pfstype_dir);
+   pn = pfs_alloc_node_flags(parent->pn_info, name,
+(flags & PFS_PROCDEP) ? pfstype_procdir : pfstype_dir, 
flags);
+   if (pn == NULL)
+   return (NULL);
pn->pn_attr = attr;
pn->pn_vis = vis;
pn->pn_destroy = destroy;
pn->pn_flags = flags;
pfs_add_node(parent, pn);
-   pfs_fixup_dir(pn);
-
+   rc = pfs_fixup_dir_flags(pn, flags);
+   if (rc) {
+   pfs_destroy(pn);
+   return (NULL);
+   }
return (pn);
 }
 
@@ -203,7 +234,9 @@ pfs_create_file(struct pfs_node *parent, const char *n
 {
struct pfs_node *pn;
 
-   pn = pfs_alloc_node(parent->pn_info, name, pfstype_file);
+   pn = pfs_alloc_node_flags(parent->pn_info, name, pfstype_file, flags);
+   if (pn == NULL)
+   return (NULL);
pn->pn_fill = fill;
pn->pn_attr = attr;
pn->pn_vis = vis;
@@ -224,7 +257,9 @@ pfs_create_link(struct pfs_node *parent, const char *n
 {
struct pfs_node *pn;
 
-   pn = pfs_alloc_node(parent->pn_info, name, pfstype_symlink);
+   pn = pfs_alloc_node_flags(parent->pn_info, name, pfstype_symlink, 
flags);
+   if (pn == NULL)
+   return (NULL);
pn->pn_fill = fill;
pn->pn_attr = attr;
pn->pn_vis = vis;

Modified: head/sys/fs/pseudofs/pseudofs.h
==
--- head/sys/fs/pseudofs/pseudofs.h Wed Feb 20 20:48:10 2019
(r344384)
+++ head/sys/fs/pseudofs/pseudofs.h Wed Feb 20 20:55:

svn commit: r344384 - in head/sys: libkern sys

2019-02-20 Thread Matt Macy
Author: mmacy
Date: Wed Feb 20 20:48:10 2019
New Revision: 344384
URL: https://svnweb.freebsd.org/changeset/base/344384

Log:
  Add non-sleepable strdup variant strdup_flags
  
  debugfs expects to do non-sleepable allocations
  
  Reviewed by:  hps@
  MFC after:1 week
  Sponsored by: iX Systems
  Differential Revision:https://reviews.freebsd.org/D19259

Modified:
  head/sys/libkern/strdup.c
  head/sys/sys/libkern.h

Modified: head/sys/libkern/strdup.c
==
--- head/sys/libkern/strdup.c   Wed Feb 20 20:34:43 2019(r344383)
+++ head/sys/libkern/strdup.c   Wed Feb 20 20:48:10 2019(r344384)
@@ -40,13 +40,22 @@ __FBSDID("$FreeBSD$");
 #include 
 
 char *
-strdup(const char *string, struct malloc_type *type)
+strdup_flags(const char *string, struct malloc_type *type, int flags)
 {
size_t len;
char *copy;
 
len = strlen(string) + 1;
-   copy = malloc(len, type, M_WAITOK);
+   copy = malloc(len, type, flags);
+   if (copy == NULL)
+   return (NULL);
bcopy(string, copy, len);
return (copy);
+}
+
+char *
+strdup(const char *string, struct malloc_type *type)
+{
+
+   return (strdup_flags(string, type, M_WAITOK));
 }

Modified: head/sys/sys/libkern.h
==
--- head/sys/sys/libkern.h  Wed Feb 20 20:34:43 2019(r344383)
+++ head/sys/sys/libkern.h  Wed Feb 20 20:48:10 2019(r344384)
@@ -173,6 +173,7 @@ char*strchr(const char *, int);
 int strcmp(const char *, const char *);
 char   *strcpy(char * __restrict, const char * __restrict);
 size_t  strcspn(const char * __restrict, const char * __restrict) __pure;
+char   *strdup_flags(const char *__restrict, struct malloc_type *, int);
 char   *strdup(const char *__restrict, struct malloc_type *);
 char   *strncat(char *, const char *, size_t);
 char   *strndup(const char *__restrict, size_t, struct malloc_type *);
___
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: r344383 - stable/11/sys/arm/arm

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 20:34:43 2019
New Revision: 344383
URL: https://svnweb.freebsd.org/changeset/base/344383

Log:
  MFC r336283: Fix build after r344378
  
  Eliminate an unused var warning-error; the var is used only when parsing
  linux-style boot args, so wrap it in the appropriate ifdef.

Modified:
  stable/11/sys/arm/arm/machdep_boot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/arm/machdep_boot.c
==
--- stable/11/sys/arm/arm/machdep_boot.cWed Feb 20 20:28:48 2019
(r344382)
+++ stable/11/sys/arm/arm/machdep_boot.cWed Feb 20 20:34:43 2019
(r344383)
@@ -68,7 +68,9 @@ __FBSDID("$FreeBSD$");
 #definedebugf(fmt, args...)
 #endif
 
+#ifdef LINUX_BOOT_ABI
 static char static_kenv[4096];
+#endif
 
 extern int *end;
 
___
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: r344382 - stable/12/usr.bin/top

2019-02-20 Thread Dimitry Andric
Author: dim
Date: Wed Feb 20 20:28:48 2019
New Revision: 344382
URL: https://svnweb.freebsd.org/changeset/base/344382

Log:
  MFC r343165 (by jhibbits):
  
  Fix top(1) long options handling
  
  getopt_long(3) requires the long options be terminated by a NULL block.
  Without the terminator, an invalid long option results in a segmentation
  fault.
  
  Reported by:  Brandon Bergren
  
  MFC r343957:
  
  Fix multiple warnings in usr.bin/top about discarded qualifiers from
  both clang and gcc, by either constifying variables, or when that is not
  possible, using __DECONST.
  
  MFC r343958:
  
  Fix multiple warnings in usr.bin/top about variables shadowing global
  declarations from base gcc, by renaming those variables.
  
  MFC r343959:
  
  Fix the first couple of AddressSanitizer violations in usr.bin/top.
  
  Avoid setting zero bytes beyond the length of the 'thisline' parameters
  in i_process() and u_process(), and don't attempt to memset a negative
  number of bytes.

Modified:
  stable/12/usr.bin/top/Makefile
  stable/12/usr.bin/top/display.c
  stable/12/usr.bin/top/display.h
  stable/12/usr.bin/top/machine.c
  stable/12/usr.bin/top/top.c
  stable/12/usr.bin/top/username.c
  stable/12/usr.bin/top/utils.c
  stable/12/usr.bin/top/utils.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/top/Makefile
==
--- stable/12/usr.bin/top/Makefile  Wed Feb 20 20:17:54 2019
(r344381)
+++ stable/12/usr.bin/top/Makefile  Wed Feb 20 20:28:48 2019
(r344382)
@@ -7,14 +7,5 @@ SRCS=  commands.c display.c machine.c screen.c top.c \
username.c utils.c
 MAN=   top.1
 
-.if ${COMPILER_TYPE} == "gcc"
-.if ${COMPILER_VERSION} >= 5
-CFLAGS.gcc=-Wno-error=discarded-qualifiers 
-Wno-error=incompatible-pointer-types
-.else #base gcc
-NO_WERROR=
-.endif
-.endif
-CFLAGS.clang=-Wno-error=incompatible-pointer-types-discards-qualifiers
-
 LIBADD=ncursesw m kvm jail util sbuf
 .include 

Modified: stable/12/usr.bin/top/display.c
==
--- stable/12/usr.bin/top/display.c Wed Feb 20 20:17:54 2019
(r344381)
+++ stable/12/usr.bin/top/display.c Wed Feb 20 20:28:48 2019
(r344382)
@@ -184,7 +184,7 @@ int
 display_init(struct statics * statics)
 {
 int lines;
-char **pp;
+const char * const *pp;
 int *ip;
 int i;
 
@@ -516,8 +516,8 @@ void
 z_cpustates(void)
 {
 int i = 0;
-const char **names;
-char *thisname;
+const char * const *names;
+const char *thisname;
 int cpu, value;
 
 for (cpu = 0; cpu < num_cpus; cpu++) {
@@ -751,7 +751,7 @@ static int header_length;
  * allocated area with the trimmed header.
  */
 
-const char *
+char *
 trim_header(const char *text)
 {
char *s;
@@ -829,7 +829,11 @@ i_process(int line, char *thisline)
 }
 
 /* truncate the line to conform to our current screen width */
-thisline[screen_width] = '\0';
+int len = strlen(thisline);
+if (screen_width < len)
+{
+   thisline[screen_width] = '\0';
+}
 
 /* write the line out */
 fputs(thisline, stdout);
@@ -839,7 +843,10 @@ i_process(int line, char *thisline)
 p = stpcpy(base, thisline);
 
 /* zero fill the rest of it */
-memset(p, 0, screen_width - (p - base));
+if (p - base < screen_width)
+{
+   memset(p, 0, screen_width - (p - base));
+}
 }
 
 void
@@ -853,7 +860,11 @@ u_process(int line, char *newline)
 bufferline = &screenbuf[lineindex(line)];
 
 /* truncate the line to conform to our current screen width */
-newline[screen_width] = '\0';
+int len = strlen(newline);
+if (screen_width < len)
+{
+   newline[screen_width] = '\0';
+}
 
 /* is line higher than we went on the last display? */
 if (line >= last_hi)
@@ -878,7 +889,10 @@ u_process(int line, char *newline)
optr = stpcpy(bufferline, newline);
 
/* zero fill the rest of it */
-   memset(optr, 0, screen_width - (optr - bufferline));
+   if (optr - bufferline < screen_width)
+   {
+   memset(optr, 0, screen_width - (optr - bufferline));
+   }
 }
 else
 {

Modified: stable/12/usr.bin/top/display.h
==
--- stable/12/usr.bin/top/display.h Wed Feb 20 20:17:54 2019
(r344381)
+++ stable/12/usr.bin/top/display.h Wed Feb 20 20:28:48 2019
(r344382)
@@ -27,7 +27,7 @@ void   i_timeofday(time_t *tod);
 voidi_uptime(struct timeval *bt, time_t *tod);
 voidnew_message(int type, const char *msgfmt, ...);
 int readline(char *buffer, int size, int numeric);
-const char *trim_header(const char *text);
+char   *trim_header(const char *text);
 voidu_arc(int *stats);
 voidu_carc(int *stats);
 voidu_cpustates(int *states);

Modified: stable/12/u

svn commit: r344381 - head/usr.bin/top

2019-02-20 Thread Dimitry Andric
Author: dim
Date: Wed Feb 20 20:17:54 2019
New Revision: 344381
URL: https://svnweb.freebsd.org/changeset/base/344381

Log:
  Fix more AddressSanitizer violations in usr.bin/top
  
  In line_update(), set lastcol correctly after moving to any non-zero
  column, so the "overwrite old stuff" part does not attempt to address
  negative offsets in the current line.
  
  Rewrite setup_buffer() to always allocate at least 80 characters,
  otherwise various calls to summary_format() will overwrite the end of
  the buffers, if the screen width gets small enough.
  
  MFC after:1 week

Modified:
  head/usr.bin/top/display.c

Modified: head/usr.bin/top/display.c
==
--- head/usr.bin/top/display.c  Wed Feb 20 20:09:59 2019(r344380)
+++ head/usr.bin/top/display.c  Wed Feb 20 20:17:54 2019(r344381)
@@ -378,13 +378,13 @@ u_procstates(int total, int *brkdn)
 if (ltotal != total)
 {
/* move and overwrite */
-if (x_procstate == 0) {
-   Move_to(x_procstate, y_procstate);
-}
-else {
-   /* cursor is already there...no motion needed */
-   assert(lastline == 1);
-}
+   if (x_procstate == 0) {
+   Move_to(x_procstate, y_procstate);
+   }
+   else {
+   /* cursor is already there...no motion needed */
+   assert(lastline == 1);
+   }
printf("%d", total);
 
/* if number of digits differs, rewrite the label */
@@ -1205,7 +1205,7 @@ line_update(char *old, char *new, int start, int line)
cursor_on_line = true;
putchar(ch);
*old = ch;
-   lastcol = 1;
+   lastcol = start + 1;
 }
 old++;
 
@@ -1341,33 +1341,27 @@ i_uptime(struct timeval *bt, time_t *tod)
 }
 }
 
+#define SETUPBUFFER_MIN_SCREENWIDTH 80
 #define SETUPBUFFER_REQUIRED_ADDBUFSIZ 2
 
 static char *
 setup_buffer(char *buffer, int addlen)
 {
-   char *b = NULL;
+size_t len;
 
-   if (NULL == buffer) {
-   setup_buffer_bufsiz = screen_width;
-   b = calloc(setup_buffer_bufsiz + addlen +
-   SETUPBUFFER_REQUIRED_ADDBUFSIZ,
-   sizeof(char));
-   } else {
-   if (screen_width > setup_buffer_bufsiz) {
-   setup_buffer_bufsiz = screen_width;
-   free(buffer);
-   b = calloc(setup_buffer_bufsiz + addlen +
-   SETUPBUFFER_REQUIRED_ADDBUFSIZ,
-   sizeof(char));
-   } else {
-   b = buffer;
-   }   
-   }
+setup_buffer_bufsiz = screen_width;
+if (setup_buffer_bufsiz < SETUPBUFFER_MIN_SCREENWIDTH)
+{
+   setup_buffer_bufsiz = SETUPBUFFER_MIN_SCREENWIDTH;
+}
 
-   if (NULL == b) {
-   errx(4, "can't allocate sufficient memory");
-   }
+free(buffer);
+len = setup_buffer_bufsiz + addlen + SETUPBUFFER_REQUIRED_ADDBUFSIZ;
+buffer = calloc(len, sizeof(char));
+if (buffer == NULL)
+{
+   errx(4, "can't allocate sufficient memory");
+}
 
-   return b;
+return buffer;
 }
___
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: r344379 - in stable/11: stand/i386/kgzldr sys/conf sys/kern

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 19:32:02 2019
New Revision: 344379
URL: https://svnweb.freebsd.org/changeset/base/344379

Log:
  MFC r306681, r336249-r336250, r336261: remove inflate conflict
  
  r306681:
  ANSIfy inflate.c
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8143
  
  r336249:
  Fix sparc64 builds
  
  gcc is complaining about struct infate being defined in a parameter
  list. It's inclear how long this has been broken, but the fix is
  simple enough.
  
  r336250:
  There's two files in the sys tree named inflate.c, in addition
  to it being a common name elsewhere. Rename the old kzip one
  to subr_inflate.c.
  
  This actually fixes the build issues on sparc64 that my inclusion of
  .PATH ${SYSDIR}/kern created in r336244, so also revert the broken
  workaround I committed in r336249.
  
  This slipped passed me because apparently, I never did a clean build.
  
  r336261:
  Catch up to the inflate renaming.

Added:
  stable/11/sys/kern/subr_inflate.c   (contents, props changed)
 - copied, changed from r344378, stable/11/sys/kern/inflate.c
Deleted:
  stable/11/sys/kern/inflate.c
Modified:
  stable/11/stand/i386/kgzldr/Makefile
  stable/11/sys/conf/Makefile.arm
  stable/11/sys/conf/files
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/i386/kgzldr/Makefile
==
--- stable/11/stand/i386/kgzldr/MakefileWed Feb 20 19:19:24 2019
(r344378)
+++ stable/11/stand/i386/kgzldr/MakefileWed Feb 20 19:32:02 2019
(r344379)
@@ -7,7 +7,7 @@ STRIP=
 BINMODE=${LIBMODE}
 BINDIR=${LIBDIR}
 
-SRCS=  start.s boot.c inflate.c lib.c crt.s sio.s
+SRCS=  start.s boot.c subr_inflate.c lib.c crt.s sio.s
 CFLAGS=-Os
 CFLAGS+=-DKZIP
 NO_SHARED=

Modified: stable/11/sys/conf/Makefile.arm
==
--- stable/11/sys/conf/Makefile.arm Wed Feb 20 19:19:24 2019
(r344378)
+++ stable/11/sys/conf/Makefile.arm Wed Feb 20 19:32:02 2019
(r344379)
@@ -111,7 +111,7 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S
gzip -f9 ${KERNEL_KO}.tmp
eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \
echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h
-   ${CC} -O2 -ffreestanding -DKZIP -I. -I$S -c $S/kern/inflate.c -o \
+   ${CC} -O2 -ffreestanding -DKZIP -I. -I$S -c $S/kern/subr_inflate.c -o \
inflate-tramp.o
${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker ldscript.$M.tramp \
-DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \

Modified: stable/11/sys/conf/files
==
--- stable/11/sys/conf/filesWed Feb 20 19:19:24 2019(r344378)
+++ stable/11/sys/conf/filesWed Feb 20 19:32:02 2019(r344379)
@@ -3581,7 +3581,6 @@ kern/imgact_binmisc.c optional
imagact_binmisc
 kern/imgact_elf.c  standard
 kern/imgact_elf32.coptional compat_freebsd32
 kern/imgact_shell.cstandard
-kern/inflate.c optional gzip
 kern/init_main.c   standard
 kern/init_sysent.c standard
 kern/ksched.c  optional _kposix_priority_scheduling
@@ -3690,6 +3689,7 @@ kern/subr_firmware.c  optional firmware
 kern/subr_gtaskqueue.c standard
 kern/subr_hash.c   standard
 kern/subr_hints.c  standard
+kern/subr_inflate.coptional gzip
 kern/subr_kdb.cstandard
 kern/subr_kobj.c   standard
 kern/subr_lock.c   standard

Copied and modified: stable/11/sys/kern/subr_inflate.c (from r344378, 
stable/11/sys/kern/inflate.c)
==
--- stable/11/sys/kern/inflate.cWed Feb 20 19:19:24 2019
(r344378, copy source)
+++ stable/11/sys/kern/subr_inflate.c   Wed Feb 20 19:32:02 2019
(r344379)
@@ -411,16 +411,19 @@ static const int dbits = 6;   /* bits in base 
distance l
The code with value 256 is special, and the tables are constructed
so that no bits beyond that code are fetched when that code is
decoded. */
+/*
+ * Arguments:
+ * b   code lengths in bits (all assumed <= BMAX)
+ * n   number of codes (assumed <= N_MAX)
+ * s   number of simple-valued codes (0..s-1)
+ * d   list of base values for non-simple codes
+ * e   list of extra bits for non-simple codes
+ * t   result: starting table
+ * m   maximum lookup bits, returns actual
+ */
 static int
-huft_build(glbl, b, n, s, d, e, t, m)
-   struct inflate *glbl;
-   unsigned   *b;  /* code lengths in bits (all assumed <= BMAX) */
-   unsignedn;  /* number of codes (assumed <= N_MAX) */
-   unsigneds;

svn commit: r344378 - in stable/11: stand/common stand/efi/loader stand/i386/libi386 stand/libsa stand/userboot/userboot sys/arm/arm sys/conf sys/kern sys/sys sys/x86/xen

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 19:19:24 2019
New Revision: 344378
URL: https://svnweb.freebsd.org/changeset/base/344378

Log:
  MFC r336244, r336246-r336247: Standardize boot arg parsing
  
  r336244:
  Create helper functions for parsing boot args.
  
  boot_parse_argto parse a single arg
  boot_parse_cmdlineto parse a command line string
  boot_parse_args   to parse all the args in a vector
  boot_howto_to_env Convert howto bits to env vars
  boot_env_to_howto Return howto mask mased on what's set in the 
environment.
  
  All these routines return an int that's the bitmask of the args
  translated to RB_* flags. As a special case, the 'S' flag sets the
  comconsole_speed env var. Any arg that looks like a=b will set the env
  key 'a' to value 'b'. If =b is omitted, 'a' is set to '1'.  This
  should help us reduce the number of redundant copies of these routines
  in the tree.  It should also give a more uniform experience between
  platforms.
  
  Also, invent a new flag RB_PROBE that's set when 'P' is parsed.  On
  x86 + BIOS, this means 'probe for the keyboard, and if it's not there
  set both RB_MULTIPLE and RB_SERIAL (which means show the output on
  both video and serial consoles, but make serial primary).  Others it
  may be some similar concept of probing, but it's loader dependent
  what, exactly, it means.
  
  These routines are suitable for /boot/loader and/or the kernel,
  though they may not be suitable for the tightly hand-rolled-for-space
  environments like boot2.
  
  r336246:
  Eliminate boot loader copies of boot arg parsing.
  
  Eliminate 4 of the copies of the arg parsing in /boot/laoder
  by using boot_parse_cmdline.
  
  r336247:
  Transition to boot_env_to_howto and boot_howto_to_env in the boot
  loader.

Added:
  stable/11/sys/kern/subr_boot.c
 - copied unchanged from r336244, head/sys/kern/subr_boot.c
Modified:
  stable/11/stand/common/boot.c
  stable/11/stand/common/bootstrap.h
  stable/11/stand/common/metadata.c
  stable/11/stand/efi/loader/bootinfo.c
  stable/11/stand/efi/loader/main.c
  stable/11/stand/i386/libi386/bootinfo.c
  stable/11/stand/libsa/Makefile
  stable/11/stand/userboot/userboot/bootinfo.c
  stable/11/sys/arm/arm/machdep_boot.c
  stable/11/sys/conf/files
  stable/11/sys/sys/boot.h
  stable/11/sys/sys/reboot.h
  stable/11/sys/x86/xen/pv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/boot.c
==
--- stable/11/stand/common/boot.c   Wed Feb 20 19:13:09 2019
(r344377)
+++ stable/11/stand/common/boot.c   Wed Feb 20 19:19:24 2019
(r344378)
@@ -160,30 +160,6 @@ autoboot_maybe()
autoboot(-1, NULL); /* try to boot automatically */
 }
 
-int
-bootenv_flags()
-{
-   int i, howto;
-   char *val;
-
-   for (howto = 0, i = 0; howto_names[i].ev != NULL; i++) {
-   val = getenv(howto_names[i].ev);
-   if (val != NULL && strcasecmp(val, "no") != 0)
-   howto |= howto_names[i].mask;
-   }
-   return (howto);
-}
-
-void
-bootenv_set(int howto)
-{
-   int i;
-
-   for (i = 0; howto_names[i].ev != NULL; i++)
-   if (howto & howto_names[i].mask)
-   setenv(howto_names[i].ev, "YES", 1);
-}
-
 static int
 autoboot(int timeout, char *prompt)
 {

Modified: stable/11/stand/common/bootstrap.h
==
--- stable/11/stand/common/bootstrap.h  Wed Feb 20 19:13:09 2019
(r344377)
+++ stable/11/stand/common/bootstrap.h  Wed Feb 20 19:19:24 2019
(r344378)
@@ -63,8 +63,6 @@ int   parse(int *argc, char ***argv, const char *str);
 /* boot.c */
 void   autoboot_maybe(void);
 intgetrootmount(char *rootdev);
-intbootenv_flags(void);
-void   bootenv_set(int);
 
 /* misc.c */
 char   *unargv(int argc, char *argv[]);

Modified: stable/11/stand/common/metadata.c
==
--- stable/11/stand/common/metadata.c   Wed Feb 20 19:13:09 2019
(r344377)
+++ stable/11/stand/common/metadata.c   Wed Feb 20 19:19:24 2019
(r344378)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #if defined(LOADER_FDT_SUPPORT)
 #include 
@@ -96,62 +97,11 @@ md_bootserial(void)
 static int
 md_getboothowto(char *kargs)
 {
-char   *cp;
 inthowto;
-intactive;
 
 /* Parse kargs */
-howto = 0;
-if (kargs != NULL) {
-   cp = kargs;
-   active = 0;
-   while (*cp != 0) {
-   if (!active && (*cp == '-')) {
-   active = 1;
-   } else if (active)
-   switch (*cp) {
-   case 'a':
-   howto |= RB_ASKNAME;
-   break;
-   case 'C':
- 

svn commit: r344377 - in stable/11/stand: . common efi/boot1 efi/loader i386/gptzfsboot i386/libi386 i386/loader i386/zfsboot i386/zfsloader libsa libsa/zfs ofw/libofw pc98/libpc98 sparc64/loader s...

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 19:13:09 2019
New Revision: 344377
URL: https://svnweb.freebsd.org/changeset/base/344377

Log:
  MFC r336084-r336085, r336118: Move zfs impl into libsa
  
  r336084:
  Move ZFS files into libsa
  
  Move the libzfs stuff into libsa. There's no need for it to be a
  separate library. The separate library adds to the issues of build
  ordering that we see from time to time. Move the filesystem support
  into libsa, like all the other filesystem support rather than making
  zfs the odd-duck out.
  
  Discussed with: allanjude@
  
  r336085:
  Stop using ../zfs/libzfs.h but instead use libzfs.h.
  
  While ../zfs/libzfs.h mostly works, there are a few situations where
  it does not. Eliminate the problem by using plain libzfs.h, like we do
  for ufs support. This fixes the weird cases, and is easier to
  understand. It also follows the general style convetion of avoiding
  ../ in #includes.
  
  r336118:
  Remove dirs that git svn should have removed but didn't.

Added:
  stable/11/stand/libsa/zfs/
 - copied from r336085, head/stand/libsa/zfs/
Deleted:
  stable/11/stand/zfs/
  stable/11/stand/zfs32/
Modified:
  stable/11/stand/Makefile
  stable/11/stand/common/zfs_cmd.c
  stable/11/stand/defs.mk
  stable/11/stand/efi/boot1/Makefile
  stable/11/stand/efi/loader/Makefile
  stable/11/stand/i386/gptzfsboot/Makefile
  stable/11/stand/i386/libi386/Makefile
  stable/11/stand/i386/libi386/devicename.c
  stable/11/stand/i386/loader/Makefile
  stable/11/stand/i386/loader/conf.c
  stable/11/stand/i386/loader/main.c
  stable/11/stand/i386/zfsboot/Makefile
  stable/11/stand/i386/zfsloader/Makefile
  stable/11/stand/libsa/Makefile
  stable/11/stand/loader.mk
  stable/11/stand/ofw/libofw/Makefile
  stable/11/stand/ofw/libofw/devicename.c
  stable/11/stand/pc98/libpc98/Makefile
  stable/11/stand/sparc64/loader/Makefile
  stable/11/stand/sparc64/loader/main.c
  stable/11/stand/sparc64/zfsloader/Makefile
  stable/11/stand/userboot/userboot/Makefile
  stable/11/stand/userboot/userboot/conf.c
  stable/11/stand/userboot/userboot/devicename.c
  stable/11/stand/userboot/userboot/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/Makefile
==
--- stable/11/stand/MakefileWed Feb 20 19:05:58 2019(r344376)
+++ stable/11/stand/MakefileWed Feb 20 19:13:09 2019(r344377)
@@ -6,7 +6,7 @@
 # others we don't. LIB32LIST is a list of libraries, which if
 # included, need to be built 32-bit as well.
 .if ${MACHINE_ARCH} == "amd64"
-LIB32LIST=libsa ficl liblua zfs
+LIB32LIST=libsa ficl liblua
 .endif
 
 S.yes+=libsa
@@ -17,7 +17,6 @@ S.${MK_LOADER_LUA}+=  liblua
 S.${MK_LOADER_LUA}+=   lua
 S.${MK_FDT}+=  fdt
 S.${MK_LOADER_OFW}+=   ofw
-S.${MK_ZFS}+=  zfs
 S.yes+=defaults
 S.yes+=man
 

Modified: stable/11/stand/common/zfs_cmd.c
==
--- stable/11/stand/common/zfs_cmd.cWed Feb 20 19:05:58 2019
(r344376)
+++ stable/11/stand/common/zfs_cmd.cWed Feb 20 19:13:09 2019
(r344377)
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
 #include "bootstrap.h"
 
 #ifdef LOADER_ZFS_SUPPORT
-#include "../zfs/libzfs.h"
+#include "libzfs.h"
 #endif
 
 COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset",

Modified: stable/11/stand/defs.mk
==
--- stable/11/stand/defs.mk Wed Feb 20 19:05:58 2019(r344376)
+++ stable/11/stand/defs.mk Wed Feb 20 19:13:09 2019(r344377)
@@ -28,7 +28,7 @@ LUASRC=   ${SRCTOP}/contrib/lua/src
 SASRC= ${BOOTSRC}/libsa
 SYSDIR=${SRCTOP}/sys
 UBOOTSRC=  ${BOOTSRC}/uboot
-ZFSSRC=${BOOTSRC}/zfs
+ZFSSRC=${SASRC}/zfs
 
 BOOTOBJ=   ${OBJTOP}/stand
 

Modified: stable/11/stand/efi/boot1/Makefile
==
--- stable/11/stand/efi/boot1/Makefile  Wed Feb 20 19:05:58 2019
(r344376)
+++ stable/11/stand/efi/boot1/Makefile  Wed Feb 20 19:13:09 2019
(r344377)
@@ -30,7 +30,6 @@ CFLAGS.zfs_module.c+= -I${ZFSSRC}
 CFLAGS.zfs_module.c+=  -I${SYSDIR}/cddl/boot/zfs
 CFLAGS.zfs_module.c+=  -I${SYSDIR}/crypto/skein
 CFLAGS+=   -DEFI_ZFS_BOOT
-LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a
 .endif
 
 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
@@ -72,8 +71,8 @@ LIBEFI=   ${BOOTOBJ}/efi/libefi/libefi.a
 # __aeabi_* (arm) or __divdi3 (i386).
 # as well as required string and memory functions for all platforms.
 #
-DPADD+=${LIBEFI} ${LIBZFSBOOT} ${LIBSA}
-LDADD+=${LIBEFI} ${LIBZFSBOOT} ${LIBSA}
+DPADD+=${LIBEFI} ${LIBSA}
+LDADD+=${LIBEFI} ${LIBSA}
 
 DPADD+= 

svn commit: r344376 - in stable/11: stand/libsa sys/ufs/ffs sys/ufs/ufs

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 19:05:58 2019
New Revision: 344376
URL: https://svnweb.freebsd.org/changeset/base/344376

Log:
  MFC r304850, r305480, r324550-r324551, r324655, r324684: correct mis-merge
  
  Some of these commits were improperly MFC'd in the sys/boot => stand
  mega-MFC, others were simply missed. Correct that mistake now by manually
  merging the few that were missed and record-only merge on the others.
  
  r304850:
  Unused variables and cstyle fix for loader dosfs
  
  r305480:
  Renumber the advertising clause.
  
  r324550:
  Add $FreeBSD$ to ancient sources that it's missing from.
  
  r324551:
  Move lib/libstand to sys/boot/libsa
  
  Move the sources to sys/boot. Make adjustments related to the
  move. Kill LIBSTAND_SRC since it's no longer needed.
  
  r324655:
  Remove the libstand directory which is now empty.
  
  r324684:
  Remove lib/libstand again, accidentally readded in r324683

Modified:
  stable/11/stand/libsa/bootparam.h
  stable/11/stand/libsa/dosfs.c
  stable/11/stand/libsa/tftp.h
  stable/11/stand/libsa/ufs.c
  stable/11/sys/ufs/ffs/fs.h
  stable/11/sys/ufs/ufs/dir.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/bootparam.h
==
--- stable/11/stand/libsa/bootparam.h   Wed Feb 20 18:48:36 2019
(r344375)
+++ stable/11/stand/libsa/bootparam.h   Wed Feb 20 19:05:58 2019
(r344376)
@@ -1,4 +1,5 @@
 /* $NetBSD: bootparam.h,v 1.3 1998/01/05 19:19:41 perry Exp $  */
+/* $FreeBSD$ */
 
 int bp_whoami(int sock);
 int bp_getfile(int sock, char *key, struct in_addr *addrp, char *path);

Modified: stable/11/stand/libsa/dosfs.c
==
--- stable/11/stand/libsa/dosfs.c   Wed Feb 20 18:48:36 2019
(r344375)
+++ stable/11/stand/libsa/dosfs.c   Wed Feb 20 19:05:58 2019
(r344376)
@@ -426,7 +426,7 @@ dos_readdir(struct open_file *fd, struct dirent *d)
 u_char fn[261];
 DOS_DIR dd;
 size_t res;
-u_int chk, i, x, xdn;
+u_int chk, x, xdn;
 int err;
 
 x = chk = 0;
@@ -585,7 +585,7 @@ lookup(DOS_FS *fs, u_int clus, const char *name, DOS_D
 u_char lfn[261];
 u_char sfn[13];
 u_int nsec, lsec, xdn, chk, sec, ent, x;
-int err, ok, i;
+int err, ok;
 
 if (!clus)
 for (ent = 0; ent < 2; ent++)

Modified: stable/11/stand/libsa/tftp.h
==
--- stable/11/stand/libsa/tftp.hWed Feb 20 18:48:36 2019
(r344375)
+++ stable/11/stand/libsa/tftp.hWed Feb 20 19:05:58 2019
(r344376)
@@ -30,6 +30,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
+ * $FreeBSD$
  */
 
 

Modified: stable/11/stand/libsa/ufs.c
==
--- stable/11/stand/libsa/ufs.c Wed Feb 20 18:48:36 2019(r344375)
+++ stable/11/stand/libsa/ufs.c Wed Feb 20 19:05:58 2019(r344376)
@@ -24,7 +24,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *may be used to endorse or promote products derived from this software
  *without specific prior written permission.
  *

Modified: stable/11/sys/ufs/ffs/fs.h
==
--- stable/11/sys/ufs/ffs/fs.h  Wed Feb 20 18:48:36 2019(r344375)
+++ stable/11/sys/ufs/ffs/fs.h  Wed Feb 20 19:05:58 2019(r344376)
@@ -10,7 +10,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *may be used to endorse or promote products derived from this software
  *without specific prior written permission.
  *

Modified: stable/11/sys/ufs/ufs/dir.h
==
--- stable/11/sys/ufs/ufs/dir.h Wed Feb 20 18:48:36 2019(r344375)
+++ stable/11/sys/ufs/ufs/dir.h Wed Feb 20 19:05:58 2019(r344376)
@@ -15,7 +15,7 @@
  * 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 distri

svn commit: r344375 - in stable/11/stand/uboot: common fdt

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 18:48:36 2019
New Revision: 344375
URL: https://svnweb.freebsd.org/changeset/base/344375

Log:
  MFC r335869, r335933: stand: uboot behavioral fixes
  
  r335869:
  stand: uboot: Do not panic if we can't find a boot device
  
  It is really anoying to panic when there is no boot device as you
  cannot see the availables ones.
  
  r335933:
  loader: fdt: Try to load every possible DTB from u-boot
  
  U-Boot setup a few variables :
  
   - fdt_addr which is the board static dtb (most of the time loaded before
 u-boot or coming from some hardware like a ROM)
   - fdt_addr_r which is a location in RAM that holds the DTB loaded by
 u-boot or before u-boot
  
  In the case of u-boot + rpi firmware the DTB is loaded in RAM but the location
  still end up in the fdt_addr variable and the fdt_addr_r variable exist.
  
  Change the behavior so we test that a DTB exists for every possible variable :
  
   - fdt_addr_r is checked first as if u-boot needed to modify it the
 correct DTB will live there.
   - fdt_addr is checked second as if we run on a hardware with DTB in ROM
 it means that we what/need to run that
   - fdtaddr looks like a FreeBSD-ism but since I'm not sure leave it.

Modified:
  stable/11/stand/uboot/common/main.c
  stable/11/stand/uboot/fdt/uboot_fdt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/uboot/common/main.c
==
--- stable/11/stand/uboot/common/main.c Wed Feb 20 18:46:31 2019
(r344374)
+++ stable/11/stand/uboot/common/main.c Wed Feb 20 18:48:36 2019
(r344375)
@@ -444,8 +444,10 @@ main(int argc, char **argv)
/*
 * Enumerate U-Boot devices
 */
-   if ((devs_no = ub_dev_enum()) == 0)
-   panic("no U-Boot devices found");
+   if ((devs_no = ub_dev_enum()) == 0) {
+   printf("no U-Boot devices found");
+   goto do_interact;
+   }
printf("Number of U-Boot devices: %d\n", devs_no);
 
get_load_device(&load_type, &load_unit, &load_slice, &load_partition);
@@ -492,6 +494,7 @@ main(int argc, char **argv)
env_setenv("loaddev", EV_VOLATILE, ldev, env_noset, env_nounset);
printf("Booting from %s\n", ldev);
 
+do_interact:
setenv("LINES", "24", 1);   /* optional */
setenv("prompt", "loader>", 1);
 

Modified: stable/11/stand/uboot/fdt/uboot_fdt.c
==
--- stable/11/stand/uboot/fdt/uboot_fdt.c   Wed Feb 20 18:46:31 2019
(r344374)
+++ stable/11/stand/uboot/fdt/uboot_fdt.c   Wed Feb 20 18:48:36 2019
(r344375)
@@ -39,6 +39,30 @@ __FBSDID("$FreeBSD$");
 #define STR(number) #number
 #define STRINGIFY(number) STR(number)
 
+static int
+fdt_platform_load_from_ubenv(const char *var)
+{
+   struct fdt_header *hdr;
+   const char *s;
+   char *p;
+
+   s = ub_env_get(var);
+   if (s == NULL || *s == '\0')
+   return (1);
+
+   hdr = (struct fdt_header *)strtoul(s, &p, 16);
+   if (*p != '\0')
+   return (1);
+
+   if (fdt_load_dtb_addr(hdr) == 0) {
+   printf("Using DTB provided by U-Boot at "
+   "address %p.\n", hdr);
+   return (0);
+   }
+
+   return (1);
+}
+
 int
 fdt_platform_load_dtb(void)
 {
@@ -53,22 +77,12 @@ fdt_platform_load_dtb(void)
 * variable for fdt data loaded into ram is fdt_addr_r, so try that
 * first.  Board vendors also use both fdtaddr and fdt_addr names.
 */
-   s = ub_env_get("fdt_addr_r");
-   if (s == NULL)
-   s = ub_env_get("fdtaddr");
-   if (s == NULL)
-   s = ub_env_get("fdt_addr");
-   if (s != NULL && *s != '\0') {
-   hdr = (struct fdt_header *)strtoul(s, &p, 16);
-   if (*p == '\0') {
-   if (fdt_load_dtb_addr(hdr) == 0) {
-   printf("Using DTB provided by U-Boot at "
-   "address %p.\n", hdr);
-   rv = 0;
-   goto exit;
-   }
-   }
-   }
+   if ((rv = fdt_platform_load_from_ubenv("fdt_addr_r")) == 0)
+   goto exit;
+   if ((rv = fdt_platform_load_from_ubenv("fdt_addr")) == 0)
+   goto exit;
+   if ((rv = fdt_platform_load_from_ubenv("fdtaddr")) == 0)
+   goto exit;
 
rv = 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: r344374 - stable/11/stand/efi/boot1

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 18:46:31 2019
New Revision: 344374
URL: https://svnweb.freebsd.org/changeset/base/344374

Log:
  MFC r335773: Revert preference to be an int.
  
  While in base we use it as a boolean (of the wrong spelling), there's
  at least one out of tree user that needs it to be int since priorirty
  is a small int, not a 0/1. In deference to the time it's wasted me and
  my team, push this up into FreeBSD for whatever short life boot1 may
  have in the tree.

Modified:
  stable/11/stand/efi/boot1/boot_module.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/boot1/boot_module.h
==
--- stable/11/stand/efi/boot1/boot_module.h Wed Feb 20 18:44:09 2019
(r344373)
+++ stable/11/stand/efi/boot1/boot_module.h Wed Feb 20 18:46:31 2019
(r344374)
@@ -51,7 +51,7 @@ typedef struct dev_info
EFI_HANDLE *devhandle;
void *devdata;
uint64_t partoff;
-   BOOLEAN preferred;
+   int preferred;
struct dev_info *next;
 } dev_info_t;
 
___
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: r344373 - in stable/11/stand: . geli i386/gptboot i386/gptzfsboot i386/isoboot i386/loader i386/zfsboot libsa libsa/geli

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 18:44:09 2019
New Revision: 344373
URL: https://svnweb.freebsd.org/changeset/base/344373

Log:
  MFC r335321, r335336: stand: move libgeliboot into libsa
  
  r335321:
  stand: move libgeliboot into libsa.
  
  Reduce by 1 the number of crazy libraries we need in stand by moving
  geli into libsa (where architecturally it belonged all along). This
  just moves things around without any code changes.
  
  r335336:
  Remove now-empty geli directory

Added:
  stable/11/stand/libsa/geli/
 - copied from r335321, head/stand/libsa/geli/
Replaced:
 - copied unchanged from r344372, stable/11/stand/geli/geliboot.c
 - copied unchanged from r344372, stable/11/stand/geli/pwgets.c
Directory Properties:
  stable/11/stand/libsa/geli/geliboot.c   (props changed)
  stable/11/stand/libsa/geli/pwgets.c   (props changed)
Deleted:
  stable/11/stand/geli/
Modified:
  stable/11/stand/Makefile
  stable/11/stand/defs.mk
  stable/11/stand/i386/gptboot/Makefile
  stable/11/stand/i386/gptzfsboot/Makefile
  stable/11/stand/i386/isoboot/Makefile
  stable/11/stand/i386/loader/Makefile
  stable/11/stand/i386/zfsboot/Makefile
  stable/11/stand/libsa/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/Makefile
==
--- stable/11/stand/MakefileWed Feb 20 18:40:14 2019(r344372)
+++ stable/11/stand/MakefileWed Feb 20 18:44:09 2019(r344373)
@@ -21,8 +21,6 @@ S.${MK_ZFS}+= zfs
 S.yes+=defaults
 S.yes+=man
 
-S.${MK_LOADER_GELI}+=  geli
-
 .include 
 
 S.${MK_EFI}+=  efi

Modified: stable/11/stand/defs.mk
==
--- stable/11/stand/defs.mk Wed Feb 20 18:40:14 2019(r344372)
+++ stable/11/stand/defs.mk Wed Feb 20 18:44:09 2019(r344373)
@@ -67,8 +67,7 @@ MK_LOADER_GELI=yes
 .endif
 .if ${MK_LOADER_GELI} == "yes"
 CFLAGS+=   -DLOADER_GELI_SUPPORT
-CFLAGS+=   -I${BOOTSRC}/geli
-LIBGELIBOOT=   ${BOOTOBJ}/geli/libgeliboot.a
+CFLAGS+=   -I${SASRC}/geli
 .endif # MK_LOADER_GELI
 .endif # HAVE_GELI
 

Modified: stable/11/stand/i386/gptboot/Makefile
==
--- stable/11/stand/i386/gptboot/Makefile   Wed Feb 20 18:40:14 2019
(r344372)
+++ stable/11/stand/i386/gptboot/Makefile   Wed Feb 20 18:44:09 2019
(r344373)
@@ -64,7 +64,7 @@ gptboot.bin: gptboot.out
${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
 
 gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS}
-   ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 
${LIBGELIBOOT} ${LIBSA32}
+   ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
 
 .include 
 

Modified: stable/11/stand/i386/gptzfsboot/Makefile
==
--- stable/11/stand/i386/gptzfsboot/MakefileWed Feb 20 18:40:14 2019
(r344372)
+++ stable/11/stand/i386/gptzfsboot/MakefileWed Feb 20 18:44:09 2019
(r344373)
@@ -75,7 +75,7 @@ gptzfsboot.bin: gptzfsboot.out
 
 gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \
${OPENCRYPTO_XTS}
-   ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 
${LIBGELIBOOT} ${LIBZFSBOOT} ${LIBSA32}
+   ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} 
${LIBSA32}
 
 zfsboot.o: ${ZFSSRC}/zfsimpl.c
 

Modified: stable/11/stand/i386/isoboot/Makefile
==
--- stable/11/stand/i386/isoboot/Makefile   Wed Feb 20 18:40:14 2019
(r344372)
+++ stable/11/stand/i386/isoboot/Makefile   Wed Feb 20 18:44:09 2019
(r344373)
@@ -66,6 +66,6 @@ isoboot.bin: isoboot.out
${OBJCOPY} -S -O binary isoboot.out ${.TARGET}
 
 isoboot.out: ${BTXCRT} isoboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS}
-   ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} 
${LIBGELIBOOT} ${LIBSA32}
+   ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
 
 .include 

Modified: stable/11/stand/i386/loader/Makefile
==
--- stable/11/stand/i386/loader/MakefileWed Feb 20 18:40:14 2019
(r344372)
+++ stable/11/stand/i386/loader/MakefileWed Feb 20 18:44:09 2019
(r344373)
@@ -71,8 +71,8 @@ FILESMODE_${LOADER}= ${BINMODE} -b
 # XXX crt0.o needs to be first for pxeboot(8) to work
 OBJS=  ${BTXCRT}
 
-DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} 
${LIBSA32}
-LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} 
${LIBSA32}
+DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32}
+LDADD= ${LDR_INTERP32} ${LIBFIREWIR

svn commit: r344372 - stable/11/stand/libsa

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 18:40:14 2019
New Revision: 344372
URL: https://svnweb.freebsd.org/changeset/base/344372

Log:
  MFC r335337: Remove stray debugging line.

Modified:
  stable/11/stand/libsa/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/Makefile
==
--- stable/11/stand/libsa/Makefile  Wed Feb 20 18:34:20 2019
(r344371)
+++ stable/11/stand/libsa/Makefile  Wed Feb 20 18:40:14 2019
(r344372)
@@ -103,7 +103,6 @@ STAND_H_INC=ctype.h fcntl.h signal.h stdio.h stdlib.h
 OTHER_INC=stdarg.h errno.h stdint.h
 
 beforedepend:
-   echo beforedepend; \
mkdir -p ${FAKE_DIRS}; \
for i in ${SAFE_INCS}; do \
ln -sf ${SRCTOP}/include/$$i $$i; \
___
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: r344316 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-20 Thread Enji Cooper
On Feb 20, 2019, at 09:11, Rodney W. Grimes  
wrote:

> One can personally link ZoL into your own kernel, and a company/corporate
> can even do this and run it on 1000's of servers, you just can not
> distribute it to anyone else, which in the end is not really a big
> deal, unless your in the Linux distribution business.

Very little organizations roll their own Linux kernels in the grand scheme of 
things (run of the mill sysadmins aren’t hackers), and making Linux VFS work 
with ZFS is a nontrivial job (ZoL might work with a kernel version, but it 
won’t work with all target kernel versions). Groups like Facebook, Google, 
Oracle, etc, do it because they have the developer manpower and it’s in their 
vested interest to run a custom kernel config/kernel with 
backports/enhancements. Plus, they don’t need to release their changes, as 
their server platforms won’t be productized (thus skating around the GPLv2).

I couldn’t find gregkh@‘s diatribe about Linux kernel compatibility, but it was 
basically (put nicely), “put your code in the kernel tree, cause we won’t 
necessarily provide backwards compatibility, as we need to break interfaces 
from time to time.”

Given that zfs is licensed under the CDDL (a viral license to Linux), that code 
will never, ever, hit the mainline tree.

This is one of the code reasons why, over time, btrfs has evolved into the file 
system that it is: it fills a niche that ext4 couldn’t and zfs did, while being 
licensed under an acceptable kernel license (GPLv2).

-Enji
___
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: r344371 - in stable/11/stand/efi: include libefi loader

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 18:34:20 2019
New Revision: 344371
URL: https://svnweb.freebsd.org/changeset/base/344371

Log:
  MFC r335228-r335231, r335272: stand: efiloader fixes
  
  r335228:
  Migrate has_keyboard to bool.
  
  r335229:
  Provide a more direct interface to tell ZFS what the preferred handle
  is. We tell the ZFS code now, and it checks rather than having a
  callback to do the checks.
  
  This will allow us to have a more graceful fallback code. In the
  future, it's anticipated that we may fallback to a more global search
  (or implement a command to do so) when reqeusted by the user, or we
  detect a violation of the UEFI Boot Manager protocol severe enough to
  warrant this backstop. For now, it just allows us to get rid of img as
  a global.
  
  r335230:
  Move arg parsing into its own routine for possible later reuse.
  
  r335231:
  There's no need to walk through the tables looking for the smbios
  table if we're just going to ignore it on arm, so expand, slightly,
  the reach of the ifdef. Move the buffer to the inner block so we
  don't have a separate #ifdef far away from these lines.
  
  The issue on arm is that smbios_detect does unaligned accesses, which
  in the u-boot implementing EFI context causes a crash.
  
  r335272:
  Many netboot scenarios don't have /boot/defaults/loader.conf. As
  a fallback, also check /boot/kernel/kernel existing as well, since
  that's the fallback behavior of the loader.

Modified:
  stable/11/stand/efi/include/efizfs.h
  stable/11/stand/efi/libefi/efizfs.c
  stable/11/stand/efi/loader/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/include/efizfs.h
==
--- stable/11/stand/efi/include/efizfs.hWed Feb 20 18:30:54 2019
(r344370)
+++ stable/11/stand/efi/include/efizfs.hWed Feb 20 18:34:20 2019
(r344371)
@@ -44,11 +44,11 @@ typedef struct zfsinfo
 
 extern uint64_t pool_guid;
 
-extern void efi_zfs_probe(void);
-extern zfsinfo_list_t *efizfs_get_zfsinfo_list(void);
-extern bool efi_zfs_is_preferred(EFI_HANDLE *h);
-extern EFI_HANDLE efizfs_get_handle_by_guid(uint64_t);
-extern bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *);
+void efi_zfs_probe(void);
+EFI_HANDLE efizfs_get_handle_by_guid(uint64_t);
+bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *);
+zfsinfo_list_t *efizfs_get_zfsinfo_list(void);
+void efizfs_set_preferred(EFI_HANDLE);
 
 #endif
 

Modified: stable/11/stand/efi/libefi/efizfs.c
==
--- stable/11/stand/efi/libefi/efizfs.c Wed Feb 20 18:30:54 2019
(r344370)
+++ stable/11/stand/efi/libefi/efizfs.c Wed Feb 20 18:34:20 2019
(r344371)
@@ -45,6 +45,14 @@ static zfsinfo_list_t zfsinfo;
 
 uint64_t pool_guid;
 
+static EFI_HANDLE preferred;
+
+void
+efizfs_set_preferred(EFI_HANDLE h)
+{
+   preferred = h;
+}
+
 zfsinfo_list_t *
 efizfs_get_zfsinfo_list(void)
 {
@@ -110,16 +118,13 @@ efi_zfs_probe(void)
 */
STAILQ_FOREACH(hd, hdi, pd_link) {
STAILQ_FOREACH(pd, &hd->pd_part, pd_link) {
-
snprintf(devname, sizeof(devname), "%s%dp%d:",
efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit);
-
-if (zfs_probe_dev(devname, &guid) == 0) {
-insert_zfs(pd->pd_handle, guid);
-
-if (efi_zfs_is_preferred(pd->pd_handle))
-pool_guid = guid;
-}
+   if (zfs_probe_dev(devname, &guid) == 0) {
+   insert_zfs(pd->pd_handle, guid);
+   if (pd->pd_handle == preferred)
+   pool_guid = guid;
+   }
 
}
}

Modified: stable/11/stand/efi/loader/main.c
==
--- stable/11/stand/efi/loader/main.c   Wed Feb 20 18:30:54 2019
(r344370)
+++ stable/11/stand/efi/loader/main.c   Wed Feb 20 18:34:20 2019
(r344371)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 
 #ifdef EFI_ZFS_BOOT
 #include 
-
 #include "efizfs.h"
 #endif
 
@@ -73,8 +72,6 @@ EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID;
 EFI_GUID fdtdtb = FDT_TABLE_GUID;
 EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL;
 
-static EFI_LOADED_IMAGE *img;
-
 /*
  * Number of seconds to wait for a keystroke before exiting with failure
  * in the event no currdev is found. -2 means always break, -1 means
@@ -84,22 +81,14 @@ static EFI_LOADED_IMAGE *img;
  */
 static int fail_timeout = 5;
 
-#ifdef EFI_ZFS_BOOT
-bool
-efi_zfs_is_preferred(EFI_HANDLE *h)
-{
-return (h == img->DeviceHandle);
-}
-#endif
-
-static int
+static bool
 has_keyboard(void)
 {
EFI_STATUS status;
EFI_DEVICE_PATH *path

svn commit: r344370 - stable/11/stand/userboot/userboot

2019-02-20 Thread Kyle Evans
Author: kevans
Date: Wed Feb 20 18:30:54 2019
New Revision: 344370
URL: https://svnweb.freebsd.org/changeset/base/344370

Log:
  MFC r334412: userboot: Fix bad type-punning
  
  Pass a struct devdesc to the format commands. Use proper type rather
  than doing weird type-punning that happened to work because the size
  was right. We copied a zfs devdesc into a disk_devdesc and then after
  passing through a NULL pointer reinterpreted it as a
  zfs_devdesc. Instead, pass the base devdesc around and 'upcase' when
  we know the types are right.
  
  This has the happy side effect of fixing a gcc warning about bad
  type punning.

Modified:
  stable/11/stand/userboot/userboot/devicename.c
  stable/11/stand/userboot/userboot/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/userboot/userboot/devicename.c
==
--- stable/11/stand/userboot/userboot/devicename.c  Wed Feb 20 18:29:52 
2019(r344369)
+++ stable/11/stand/userboot/userboot/devicename.c  Wed Feb 20 18:30:54 
2019(r344370)
@@ -175,30 +175,30 @@ userboot_parsedev(struct disk_devdesc **dev, const cha
 char *
 userboot_fmtdev(void *vdev)
 {
-struct disk_devdesc*dev = (struct disk_devdesc *)vdev;
+struct devdesc *dev = (struct devdesc *)vdev;
 static charbuf[128];   /* XXX device length constant? 
*/
 
-switch(dev->dd.d_dev->dv_type) {
+switch(dev->d_dev->dv_type) {
 case DEVT_NONE:
strcpy(buf, "(no device)");
break;
 
 case DEVT_CD:
-   sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
+   sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
 
 case DEVT_DISK:
return (disk_fmtdev(vdev));
 
 case DEVT_NET:
-   sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
+   sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
 
 case DEVT_ZFS:
 #if defined(USERBOOT_ZFS_SUPPORT)
return (zfs_fmtdev(vdev));
 #else
-   sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
+   sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
 #endif
break;
 }

Modified: stable/11/stand/userboot/userboot/main.c
==
--- stable/11/stand/userboot/userboot/main.cWed Feb 20 18:29:52 2019
(r344369)
+++ stable/11/stand/userboot/userboot/main.cWed Feb 20 18:30:54 2019
(r344370)
@@ -154,19 +154,18 @@ static void
 extract_currdev(void)
 {
struct disk_devdesc dev;
-
-   //bzero(&dev, sizeof(dev));
-
+   struct devdesc *dd;
 #if defined(USERBOOT_ZFS_SUPPORT)
+   struct zfs_devdesc zdev;
+
if (userboot_zfs_found) {
-   struct zfs_devdesc zdev;

/* Leave the pool/root guid's unassigned */
bzero(&zdev, sizeof(zdev));
zdev.dd.d_dev = &zfs_dev;

-   dev = *(struct disk_devdesc *)&zdev;
-   init_zfs_bootenv(zfs_fmtdev(&dev));
+   init_zfs_bootenv(zfs_fmtdev(&zdev));
+   dd = &zdev.dd;
} else
 #endif
 
@@ -183,14 +182,16 @@ extract_currdev(void)
dev.d_slice = -1;
dev.d_partition = -1;
}
+   dd = &dev.dd;
} else {
dev.dd.d_dev = &host_dev;
dev.dd.d_unit = 0;
+   dd = &dev.dd;
}
 
-   env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev),
+   env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(dd),
userboot_setcurrdev, env_nounset);
-   env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev),
+   env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(dd),
env_noset, env_nounset);
 }
 
___
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: r344369 - head/sys/kern

2019-02-20 Thread Mark Johnston
Author: markj
Date: Wed Feb 20 18:29:52 2019
New Revision: 344369
URL: https://svnweb.freebsd.org/changeset/base/344369

Log:
  Remove an obsolete comment.
  
  MFC after:3 days

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cWed Feb 20 18:03:43 2019
(r344368)
+++ head/sys/kern/kern_descrip.cWed Feb 20 18:29:52 2019
(r344369)
@@ -2439,9 +2439,6 @@ fdcheckstd(struct thread *td)
  * Internal form of close.  Decrement reference count on file structure.
  * Note: td may be NULL when closing a file that was being passed in a
  * message.
- *
- * XXXRW: Giant is not required for the caller, but often will be held; this
- * makes it moderately likely the Giant will be recursed in the VFS case.
  */
 int
 closef(struct file *fp, struct thread *td)
___
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: r344368 - head/sys/netinet

2019-02-20 Thread Michael Tuexen
Author: tuexen
Date: Wed Feb 20 18:03:43 2019
New Revision: 344368
URL: https://svnweb.freebsd.org/changeset/base/344368

Log:
  Reduce the TCP initial retransmission timeout from 3 seconds to
  1 second as allowed by RFC 6298.
  
  Reviewed by:  kbowling@, Richard Scheffenegger
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D18941

Modified:
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_timer.h

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Wed Feb 20 17:56:38 2019
(r344367)
+++ head/sys/netinet/tcp_syncache.c Wed Feb 20 18:03:43 2019
(r344368)
@@ -159,7 +159,7 @@ static int   syncookie_cmp(struct in_conninfo *inc, str
  *  tcp_backoff[1] +
  *  tcp_backoff[2] +
  *  tcp_backoff[3]) + 3 * tcp_rexmit_slop,
- * 3000 ms * (1 + 2 + 4 + 8) +  3 * 200 ms = 45600 ms,
+ * 1000 ms * (1 + 2 + 4 + 8) +  3 * 200 ms = 15600 ms,
  * the odds are that the user has given up attempting to connect by then.
  */
 #define SYNCACHE_MAXREXMTS 3

Modified: head/sys/netinet/tcp_timer.h
==
--- head/sys/netinet/tcp_timer.hWed Feb 20 17:56:38 2019
(r344367)
+++ head/sys/netinet/tcp_timer.hWed Feb 20 18:03:43 2019
(r344368)
@@ -77,7 +77,7 @@
 #defineTCPTV_MSL   ( 30*hz)/* max seg lifetime 
(hah!) */
 #defineTCPTV_SRTTBASE  0   /* base roundtrip time;
   if 0, no idea yet */
-#defineTCPTV_RTOBASE   (  3*hz)/* assumed RTO if no 
info */
+#defineTCPTV_RTOBASE   (  1*hz)/* assumed RTO if no 
info */
 
 #defineTCPTV_PERSMIN   (  5*hz)/* minimum persist 
interval */
 #defineTCPTV_PERSMAX   ( 60*hz)/* maximum persist 
interval */
___
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: r344316 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-20 Thread Cy Schubert
On February 20, 2019 9:01:53 AM PST, Enji Cooper  wrote:
>
>> On Feb 19, 2019, at 23:56, Alexey Dokuchaev 
>wrote:
>> 
>>> On Tue, Feb 19, 2019 at 06:43:28PM -0500, Shawn Webb wrote:
>>> At the risk of painting a bikeshed a lovely color of neon purple,
>I'm
>>> curious about if/how these types of commits get merged upstream to
>>> (OpenZFS|Illumos|ZFS On Linux|where ever ZFS upstream is now|I'm
>very
>>> confused|is anyone else confused where upstream is?).
>>> 
>>> Who is upstream? Is work like this going to remain as a downstream
>>> patch to ZFS? Or is FreeBSD going to work to upstream this type of
>>> work?
>> 
>> I've always felt that we should've become upstream to everyone else
>> the moment we knew Oracle would eat Sun (20 April 2009), and never
>> understood why it didn't happen and now, ten years later, we're
>talking
>> about ZFS on fucking Linux becoming our upstream.  Something'd got
>very
>> wrong here and I'd like to know what and why.
>
>As others have pointed out, FreeBSD has less developer inertia than
>Linux, and there are (seemingly) less developers or interested parties
>in running an openindiana based stack.
>
>Also: better OS support for other general purpose
>infrastructure/usecases with items like multitenancy via
>containerization/CGroups2, Java, etc, and mindshare around this and
>other things.
>
>The only thing really holding ZoL back in Linux is the fact that (due
>to licensing) it won’t ever be in the Linux kernel.
>
>-Enji

Exactly. This and the fact that our user base is considerably smaller, we don't 
have the gravitas and must settle being dictated to. POSIX is dead.

I suppose a person could get on top of the soapbox again but ...

A way forward might be two pronged. Yes, maintain ZoF based on ZoL, illumos, or 
both, and a Linux KPI layer to allow ZoL (and anything else for that matter) to 
be imported into ports. However maintaining a great shim to the exclusion of 
good native support is existential.


-- 
Pardon the typos and autocorrect, small keyboard in use.
Cheers,
Cy Schubert 
FreeBSD UNIX:  Web: http://www.FreeBSD.org

The need of the many outweighs the greed of the few.
___
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: r344367 - in head/sys/netinet: . tcp_stacks

2019-02-20 Thread Michael Tuexen
Author: tuexen
Date: Wed Feb 20 17:56:38 2019
New Revision: 344367
URL: https://svnweb.freebsd.org/changeset/base/344367

Log:
  Use exponential backoff for retransmitting SYN segments as specified
  in the TCP RFCs.
  
  Reviewed by:  rrs@, Richard Scheffenegger
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D18974

Modified:
  head/sys/netinet/tcp_stacks/rack.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_timer.c
  head/sys/netinet/tcp_timer.h

Modified: head/sys/netinet/tcp_stacks/rack.c
==
--- head/sys/netinet/tcp_stacks/rack.c  Wed Feb 20 17:10:30 2019
(r344366)
+++ head/sys/netinet/tcp_stacks/rack.c  Wed Feb 20 17:56:38 2019
(r344367)
@@ -2869,7 +2869,7 @@ rack_timeout_rxt(struct tcpcb *tp, struct tcp_rack *ra
TCPSTAT_INC(tcps_rexmttimeo);
if ((tp->t_state == TCPS_SYN_SENT) ||
(tp->t_state == TCPS_SYN_RECEIVED))
-   rexmt = MSEC_2_TICKS(RACK_INITIAL_RTO * 
tcp_syn_backoff[tp->t_rxtshift]);
+   rexmt = MSEC_2_TICKS(RACK_INITIAL_RTO * 
tcp_backoff[tp->t_rxtshift]);
else
rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
TCPT_RANGESET(tp->t_rxtcur, rexmt,

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Wed Feb 20 17:10:30 2019
(r344366)
+++ head/sys/netinet/tcp_syncache.c Wed Feb 20 17:56:38 2019
(r344367)
@@ -155,11 +155,11 @@ static int syncookie_cmp(struct in_conninfo *inc, 
str
 /*
  * Transmit the SYN,ACK fewer times than TCP_MAXRXTSHIFT specifies.
  * 3 retransmits corresponds to a timeout with default values of
- * TCPTV_RTOBASE * ( 1 +
- *  tcp_syn_backoff[1] +
- *  tcp_syn_backoff[2] +
- *  tcp_syn_backoff[3]) + 3 * tcp_rexmit_slop,
- * 3000 ms * (1 + 1 + 1 + 1) +  3 * 200 ms = 12600 ms,
+ * TCPTV_RTOBASE * ( 1 +
+ *  tcp_backoff[1] +
+ *  tcp_backoff[2] +
+ *  tcp_backoff[3]) + 3 * tcp_rexmit_slop,
+ * 3000 ms * (1 + 2 + 4 + 8) +  3 * 200 ms = 45600 ms,
  * the odds are that the user has given up attempting to connect by then.
  */
 #define SYNCACHE_MAXREXMTS 3
@@ -426,7 +426,7 @@ syncache_timeout(struct syncache *sc, struct syncache_
if (sc->sc_rxmits == 0)
rexmt = TCPTV_RTOBASE;
else
-   TCPT_RANGESET(rexmt, TCPTV_RTOBASE * 
tcp_syn_backoff[sc->sc_rxmits],
+   TCPT_RANGESET(rexmt, TCPTV_RTOBASE * tcp_backoff[sc->sc_rxmits],
tcp_rexmit_min, TCPTV_REXMTMAX);
sc->sc_rxttime = ticks + rexmt;
sc->sc_rxmits++;

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cWed Feb 20 17:10:30 2019
(r344366)
+++ head/sys/netinet/tcp_timer.cWed Feb 20 17:56:38 2019
(r344367)
@@ -233,9 +233,6 @@ tcp_slowtimo(void)
VNET_LIST_RUNLOCK_NOSLEEP();
 }
 
-inttcp_syn_backoff[TCP_MAXRXTSHIFT + 1] =
-{ 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, 64, 64, 64 };
-
 inttcp_backoff[TCP_MAXRXTSHIFT + 1] =
 { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, 512, 512 };
 
@@ -671,7 +668,7 @@ tcp_timer_rexmt(void * xtp)
TCPSTAT_INC(tcps_rexmttimeo);
if ((tp->t_state == TCPS_SYN_SENT) ||
(tp->t_state == TCPS_SYN_RECEIVED))
-   rexmt = TCPTV_RTOBASE * tcp_syn_backoff[tp->t_rxtshift];
+   rexmt = TCPTV_RTOBASE * tcp_backoff[tp->t_rxtshift];
else
rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
TCPT_RANGESET(tp->t_rxtcur, rexmt,

Modified: head/sys/netinet/tcp_timer.h
==
--- head/sys/netinet/tcp_timer.hWed Feb 20 17:10:30 2019
(r344366)
+++ head/sys/netinet/tcp_timer.hWed Feb 20 17:56:38 2019
(r344367)
@@ -199,7 +199,6 @@ extern int tcp_rexmit_slop;
 extern int tcp_msl;
 extern int tcp_ttl;/* time to live for TCP segs */
 extern int tcp_backoff[];
-extern int tcp_syn_backoff[];
 extern int tcp_totbackoff;
 extern int tcp_rexmit_drop_options;
 
___
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: r344364 - vendor/illumos/dist/lib/libdtrace/common

2019-02-20 Thread Rodney W. Grimes
> Author: markj
> Date: Wed Feb 20 17:05:13 2019
> New Revision: 344364
> URL: https://svnweb.freebsd.org/changeset/base/344364
> 
> Log:
>   9058 postmortem DTrace frequently broken under vmware
>   
>   illumos/illumos-gate@793bd7e3617ae7d3d24e8c6b7d6befe35f07ec1f
>   
>   Reviewed by: Tim Kordas 
>   Reviewed by: Patrick Mooney 
>   Reviewed by: Yuri Pankov 
>   Reviewed by: Matthew Ahrens 
>   Approved by: Matthew Ahrens 
>   Author: Sam Gwydir 
> 
> Modified:
>   vendor/illumos/dist/lib/libdtrace/common/dt_consume.c
> 
> Modified: vendor/illumos/dist/lib/libdtrace/common/dt_consume.c
> ==
> --- vendor/illumos/dist/lib/libdtrace/common/dt_consume.c Wed Feb 20 
> 14:12:25 2019(r344363)
> +++ vendor/illumos/dist/lib/libdtrace/common/dt_consume.c Wed Feb 20 
> 17:05:13 2019(r344364)
> @@ -24,7 +24,7 @@
>   */
>  
>  /*
> - * Copyright (c) 2013, Joyent, Inc. All rights reserved.
> + * Copyright (c) 2017, Joyent, Inc. All rights reserved.

This change to this copyright is very questionable.
One should always retain the first date of publication
in a copyright statement.

I do understand your just importing a change from illumous,
but I want it on public record that I have raised issue
with this change to a copyright, and this has nothing to
do with you personally, or you wanting to bring this code
over.

>   * Copyright (c) 2012 by Delphix. All rights reserved.
>   */
>  
> @@ -3010,9 +3010,6 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
>   break;
>  
>   timestamp = dt_buf_oldest(buf, dtp);
> - assert(timestamp >= dtp->dt_last_timestamp);
> - dtp->dt_last_timestamp = timestamp;
> -
>   if (timestamp == buf->dtbd_timestamp) {
>   /*
>* We've reached the end of the time covered
> @@ -3026,6 +3023,8 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
>   break;
>   continue;
>   }
> + assert(timestamp >= dtp->dt_last_timestamp);
> + dtp->dt_last_timestamp = timestamp;
>  
>   if ((rval = dt_consume_cpu(dtp, fp,
>   buf->dtbd_cpu, buf, B_TRUE, pf, rf, arg)) != 0)
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r344316 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-20 Thread Rodney W. Grimes
> > On Feb 19, 2019, at 23:56, Alexey Dokuchaev  wrote:
> > 
> >> On Tue, Feb 19, 2019 at 06:43:28PM -0500, Shawn Webb wrote:
> >> At the risk of painting a bikeshed a lovely color of neon purple, I'm
> >> curious about if/how these types of commits get merged upstream to
> >> (OpenZFS|Illumos|ZFS On Linux|where ever ZFS upstream is now|I'm very
> >> confused|is anyone else confused where upstream is?).
> >> 
> >> Who is upstream? Is work like this going to remain as a downstream
> >> patch to ZFS? Or is FreeBSD going to work to upstream this type of
> >> work?
> > 
> > I've always felt that we should've become upstream to everyone else
> > the moment we knew Oracle would eat Sun (20 April 2009), and never
> > understood why it didn't happen and now, ten years later, we're talking
> > about ZFS on fucking Linux becoming our upstream.  Something'd got very
> > wrong here and I'd like to know what and why.
> 
> As others have pointed out, FreeBSD has less developer inertia than Linux,
> and there are (seemingly) less developers or interested parties in running
> an openindiana based stack.
> 
> Also: better OS support for other general purpose infrastructure/usecases
> with items like multitenancy via containerization/CGroups2, Java, etc,
> and mindshare around this and other things.
> 
> The only thing really holding ZoL back in Linux is the fact that (due
> to licensing) it won?t ever be in the Linux kernel.

One can personally link ZoL into your own kernel, and a company/corporate
can even do this and run it on 1000's of servers, you just can not
distribute it to anyone else, which in the end is not really a big
deal, unless your in the Linux distribution business.

-- 
Rod Grimes rgri...@freebsd.org
___
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: r344366 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2019-02-20 Thread Mark Johnston
Author: markj
Date: Wed Feb 20 17:10:30 2019
New Revision: 344366
URL: https://svnweb.freebsd.org/changeset/base/344366

Log:
  MFV r344364:
  9058 postmortem DTrace frequently broken under vmware
  
  illumos/illumos-gate@793bd7e3617ae7d3d24e8c6b7d6befe35f07ec1f
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Wed Feb 
20 17:07:08 2019(r344365)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Wed Feb 
20 17:10:30 2019(r344366)
@@ -24,7 +24,7 @@
  */
 
 /*
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2017, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
@@ -3040,9 +3040,6 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
break;
 
timestamp = dt_buf_oldest(buf, dtp);
-   assert(timestamp >= dtp->dt_last_timestamp);
-   dtp->dt_last_timestamp = timestamp;
-
if (timestamp == buf->dtbd_timestamp) {
/*
 * We've reached the end of the time covered
@@ -3056,6 +3053,8 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
break;
continue;
}
+   assert(timestamp >= dtp->dt_last_timestamp);
+   dtp->dt_last_timestamp = timestamp;
 
if ((rval = dt_consume_cpu(dtp, fp,
buf->dtbd_cpu, buf, B_TRUE, pf, rf, arg)) != 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: r344365 - head/sys/geom

2019-02-20 Thread Mark Johnston
Author: markj
Date: Wed Feb 20 17:07:08 2019
New Revision: 344365
URL: https://svnweb.freebsd.org/changeset/base/344365

Log:
  Define a constant for the maximum number of GEOM_CTL arguments.
  
  Reviewed by:  eugen
  MFC with: r344305
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19271

Modified:
  head/sys/geom/geom_ctl.c
  head/sys/geom/geom_ctl.h

Modified: head/sys/geom/geom_ctl.c
==
--- head/sys/geom/geom_ctl.cWed Feb 20 17:05:13 2019(r344364)
+++ head/sys/geom/geom_ctl.cWed Feb 20 17:07:08 2019(r344365)
@@ -139,7 +139,7 @@ gctl_copyin(struct gctl_req *req)
char *p;
u_int i;
 
-   if (req->narg > 2048) {
+   if (req->narg > GEOM_CTL_ARG_MAX) {
gctl_error(req, "too many arguments");
req->arg = NULL;
return;

Modified: head/sys/geom/geom_ctl.h
==
--- head/sys/geom/geom_ctl.hWed Feb 20 17:05:13 2019(r344364)
+++ head/sys/geom/geom_ctl.hWed Feb 20 17:07:08 2019(r344365)
@@ -78,7 +78,8 @@ struct gctl_req {
 
 #define GEOM_CTL   _IOW('G', GCTL_VERSION, struct gctl_req)
 
-#define PATH_GEOM_CTL  "geom.ctl"
+#define GEOM_CTL_ARG_MAX 2048  /* maximum number of parameters */
 
+#define PATH_GEOM_CTL  "geom.ctl"
 
 #endif /* _GEOM_GEOM_CTL_H_ */
___
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: r344364 - vendor/illumos/dist/lib/libdtrace/common

2019-02-20 Thread Mark Johnston
Author: markj
Date: Wed Feb 20 17:05:13 2019
New Revision: 344364
URL: https://svnweb.freebsd.org/changeset/base/344364

Log:
  9058 postmortem DTrace frequently broken under vmware
  
  illumos/illumos-gate@793bd7e3617ae7d3d24e8c6b7d6befe35f07ec1f
  
  Reviewed by: Tim Kordas 
  Reviewed by: Patrick Mooney 
  Reviewed by: Yuri Pankov 
  Reviewed by: Matthew Ahrens 
  Approved by: Matthew Ahrens 
  Author: Sam Gwydir 

Modified:
  vendor/illumos/dist/lib/libdtrace/common/dt_consume.c

Modified: vendor/illumos/dist/lib/libdtrace/common/dt_consume.c
==
--- vendor/illumos/dist/lib/libdtrace/common/dt_consume.c   Wed Feb 20 
14:12:25 2019(r344363)
+++ vendor/illumos/dist/lib/libdtrace/common/dt_consume.c   Wed Feb 20 
17:05:13 2019(r344364)
@@ -24,7 +24,7 @@
  */
 
 /*
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2017, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
@@ -3010,9 +3010,6 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
break;
 
timestamp = dt_buf_oldest(buf, dtp);
-   assert(timestamp >= dtp->dt_last_timestamp);
-   dtp->dt_last_timestamp = timestamp;
-
if (timestamp == buf->dtbd_timestamp) {
/*
 * We've reached the end of the time covered
@@ -3026,6 +3023,8 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
break;
continue;
}
+   assert(timestamp >= dtp->dt_last_timestamp);
+   dtp->dt_last_timestamp = timestamp;
 
if ((rval = dt_consume_cpu(dtp, fp,
buf->dtbd_cpu, buf, B_TRUE, pf, rf, arg)) != 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"


Re: svn commit: r344316 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-20 Thread Enji Cooper

> On Feb 19, 2019, at 23:56, Alexey Dokuchaev  wrote:
> 
>> On Tue, Feb 19, 2019 at 06:43:28PM -0500, Shawn Webb wrote:
>> At the risk of painting a bikeshed a lovely color of neon purple, I'm
>> curious about if/how these types of commits get merged upstream to
>> (OpenZFS|Illumos|ZFS On Linux|where ever ZFS upstream is now|I'm very
>> confused|is anyone else confused where upstream is?).
>> 
>> Who is upstream? Is work like this going to remain as a downstream
>> patch to ZFS? Or is FreeBSD going to work to upstream this type of
>> work?
> 
> I've always felt that we should've become upstream to everyone else
> the moment we knew Oracle would eat Sun (20 April 2009), and never
> understood why it didn't happen and now, ten years later, we're talking
> about ZFS on fucking Linux becoming our upstream.  Something'd got very
> wrong here and I'd like to know what and why.

As others have pointed out, FreeBSD has less developer inertia than Linux, and 
there are (seemingly) less developers or interested parties in running an 
openindiana based stack.

Also: better OS support for other general purpose infrastructure/usecases with 
items like multitenancy via containerization/CGroups2, Java, etc, and mindshare 
around this and other things.

The only thing really holding ZoL back in Linux is the fact that (due to 
licensing) it won’t ever be in the Linux kernel.

-Enji
___
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: r344316 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-20 Thread Rodney W. Grimes
> On Tue, Feb 19, 2019 at 06:43:28PM -0500, Shawn Webb wrote:
> > At the risk of painting a bikeshed a lovely color of neon purple, I'm
> > curious about if/how these types of commits get merged upstream to
> > (OpenZFS|Illumos|ZFS On Linux|where ever ZFS upstream is now|I'm very
> > confused|is anyone else confused where upstream is?).
> > 
> > Who is upstream? Is work like this going to remain as a downstream
> > patch to ZFS? Or is FreeBSD going to work to upstream this type of
> > work?
> 
> I've always felt that we should've become upstream to everyone else
> the moment we knew Oracle would eat Sun (20 April 2009), and never
> understood why it didn't happen and now, ten years later, we're talking
> about ZFS on fucking Linux becoming our upstream.  Something'd got very
> wrong here and I'd like to know what and why.

I think to answer why ZoL wins out over ZoF in the upstream
selection is that ZoL has many more people working on it
than does ZoF so they innovate much faster than us, that
makes them a good choose in the since that developement
moves faster.  I do, like many, have reservations about
other aspects perhaps not making this an ideal, but if
ZoL develope a good developement model, they well kick ass
over anything the FreeBSD project could ever do with ZFS.
Like it or not, they have a larger critical mass than us,
and that wins in the end game.

Also since we did choose to be downstream from illumous
that put is in the follow mode in many aspects, so we
did not grow a bunch of ZFS developers, where as the
ZoL project kinda grabbed the code and went full tilt
with it, not totally ignoring upstream, but also not
letting upstream stifle there efforts.

> 
> > I hope my curiousity doesn't offend anyone. ;)
> Not at all, I'm also confused and curious.
Now running a ZoL instance just so I can get use to its
look and feel and see how if at all it plays along with
ZoF.

> ./danfe
-- 
Rod Grimes rgri...@freebsd.org
___
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: r344305 - head/sys/geom

2019-02-20 Thread Mark Johnston
On Wed, Feb 20, 2019 at 09:40:45PM +0700, Eugene Grosbein wrote:
> 20.02.2019 4:22, Mark Johnston wrote:
> 
> > Author: markj
> > Date: Tue Feb 19 21:22:22 2019
> > New Revision: 344305
> > URL: https://svnweb.freebsd.org/changeset/base/344305
> > 
> > Log:
> >   Impose a limit on the number of GEOM_CTL arguments.
> >   
> >   Otherwise a privileged user can trigger a memory allocation of
> >   unbounded size, or an integer overflow in the subsequent
> >   geom_alloc_copyin() call, leading to out-of-bounds accesses.
> >   
> >   Hard-code a large limit to circumvent this problem.
> >   
> >   admbug:   854
> >   Reported by:  Anonymous of the Shellphish Grill Team
> >   Reviewed by:  ae
> >   MFC after:1 week
> >   Sponsored by: The FreeBSD Foundation
> >   Differential Revision:https://reviews.freebsd.org/D19251
> > 
> > Modified:
> >   head/sys/geom/geom_ctl.c
> > 
> > Modified: head/sys/geom/geom_ctl.c
> > ==
> > --- head/sys/geom/geom_ctl.cTue Feb 19 21:20:50 2019
> > (r344304)
> > +++ head/sys/geom/geom_ctl.cTue Feb 19 21:22:22 2019
> > (r344305)
> > @@ -139,6 +139,12 @@ gctl_copyin(struct gctl_req *req)
> > char *p;
> > u_int i;
> >  
> > +   if (req->narg > 2048) {
> > +   gctl_error(req, "too many arguments");
> > +   req->arg = NULL;
> > +   return;
> > +   }
> > +
> 
> Could you replace magic constant 2048 with #define symbol, please?
> Something like GEOM_ARG_MAX in sys/sys/limits.h or similar.

Sure.  Here is the proposed diff: https://reviews.freebsd.org/D19271
___
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: r344305 - head/sys/geom

2019-02-20 Thread Eugene Grosbein
20.02.2019 4:22, Mark Johnston wrote:

> Author: markj
> Date: Tue Feb 19 21:22:22 2019
> New Revision: 344305
> URL: https://svnweb.freebsd.org/changeset/base/344305
> 
> Log:
>   Impose a limit on the number of GEOM_CTL arguments.
>   
>   Otherwise a privileged user can trigger a memory allocation of
>   unbounded size, or an integer overflow in the subsequent
>   geom_alloc_copyin() call, leading to out-of-bounds accesses.
>   
>   Hard-code a large limit to circumvent this problem.
>   
>   admbug: 854
>   Reported by:Anonymous of the Shellphish Grill Team
>   Reviewed by:ae
>   MFC after:  1 week
>   Sponsored by:   The FreeBSD Foundation
>   Differential Revision:  https://reviews.freebsd.org/D19251
> 
> Modified:
>   head/sys/geom/geom_ctl.c
> 
> Modified: head/sys/geom/geom_ctl.c
> ==
> --- head/sys/geom/geom_ctl.c  Tue Feb 19 21:20:50 2019(r344304)
> +++ head/sys/geom/geom_ctl.c  Tue Feb 19 21:22:22 2019(r344305)
> @@ -139,6 +139,12 @@ gctl_copyin(struct gctl_req *req)
>   char *p;
>   u_int i;
>  
> + if (req->narg > 2048) {
> + gctl_error(req, "too many arguments");
> + req->arg = NULL;
> + return;
> + }
> +

Could you replace magic constant 2048 with #define symbol, please?
Something like GEOM_ARG_MAX in sys/sys/limits.h or similar.

___
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: r344362 - stable/12/sys/vm

2019-02-20 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Feb 20 14:10:46 2019
New Revision: 344362
URL: https://svnweb.freebsd.org/changeset/base/344362

Log:
  MFC r344042:
  UMA: unsign some variables related to allocation in hash_alloc().
  
  As a followup to r343673, unsign some variables related to allocation
  since the hashsize cannot be negative. This gives a bit more space to
  handle bigger allocations and avoid some implicit casting.
  
  While here also unsign uh_hashmask, it makes little sense to keep it
  signed.
  
  Differential Revision:https://reviews.freebsd.org/D19148

Modified:
  stable/12/sys/vm/uma_core.c
  stable/12/sys/vm/uma_int.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/uma_core.c
==
--- stable/12/sys/vm/uma_core.c Wed Feb 20 13:37:27 2019(r344361)
+++ stable/12/sys/vm/uma_core.c Wed Feb 20 14:10:46 2019(r344362)
@@ -630,7 +630,7 @@ zone_timeout(uma_zone_t zone)
 static int
 hash_alloc(struct uma_hash *hash)
 {
-   int oldsize;
+   u_int oldsize;
size_t alloc;
 
oldsize = hash->uh_hashsize;
@@ -674,8 +674,8 @@ static int
 hash_expand(struct uma_hash *oldhash, struct uma_hash *newhash)
 {
uma_slab_t slab;
-   int hval;
-   int i;
+   u_int hval;
+   u_int idx;
 
if (!newhash->uh_slab_hash)
return (0);
@@ -688,10 +688,10 @@ hash_expand(struct uma_hash *oldhash, struct uma_hash 
 * full rehash.
 */
 
-   for (i = 0; i < oldhash->uh_hashsize; i++)
-   while (!SLIST_EMPTY(&oldhash->uh_slab_hash[i])) {
-   slab = SLIST_FIRST(&oldhash->uh_slab_hash[i]);
-   SLIST_REMOVE_HEAD(&oldhash->uh_slab_hash[i], us_hlink);
+   for (idx = 0; idx < oldhash->uh_hashsize; idx++)
+   while (!SLIST_EMPTY(&oldhash->uh_slab_hash[idx])) {
+   slab = SLIST_FIRST(&oldhash->uh_slab_hash[idx]);
+   SLIST_REMOVE_HEAD(&oldhash->uh_slab_hash[idx], 
us_hlink);
hval = UMA_HASH(newhash, slab->us_data);
SLIST_INSERT_HEAD(&newhash->uh_slab_hash[hval],
slab, us_hlink);

Modified: stable/12/sys/vm/uma_int.h
==
--- stable/12/sys/vm/uma_int.h  Wed Feb 20 13:37:27 2019(r344361)
+++ stable/12/sys/vm/uma_int.h  Wed Feb 20 14:10:46 2019(r344362)
@@ -170,8 +170,8 @@ SLIST_HEAD(slabhead, uma_slab);
 
 struct uma_hash {
struct slabhead *uh_slab_hash;  /* Hash table for slabs */
-   int uh_hashsize;/* Current size of the hash table */
-   int uh_hashmask;/* Mask used during hashing */
+   u_int   uh_hashsize;/* Current size of the hash table */
+   u_int   uh_hashmask;/* Mask used during hashing */
 };
 
 /*
@@ -449,7 +449,7 @@ static __inline uma_slab_t
 hash_sfind(struct uma_hash *hash, uint8_t *data)
 {
 uma_slab_t slab;
-int hval;
+u_int hval;
 
 hval = UMA_HASH(hash, data);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344363 - stable/11/sys/vm

2019-02-20 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Feb 20 14:12:25 2019
New Revision: 344363
URL: https://svnweb.freebsd.org/changeset/base/344363

Log:
  MFC r344042:
  UMA: unsign some variables related to allocation in hash_alloc().
  
  As a followup to r343673, unsign some variables related to allocation
  since the hashsize cannot be negative. This gives a bit more space to
  handle bigger allocations and avoid some implicit casting.
  
  While here also unsign uh_hashmask, it makes little sense to keep it
  signed.
  
  Differential Revision:https://reviews.freebsd.org/D19148

Modified:
  stable/11/sys/vm/uma_core.c
  stable/11/sys/vm/uma_int.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/uma_core.c
==
--- stable/11/sys/vm/uma_core.c Wed Feb 20 14:10:46 2019(r344362)
+++ stable/11/sys/vm/uma_core.c Wed Feb 20 14:12:25 2019(r344363)
@@ -537,7 +537,7 @@ zone_timeout(uma_zone_t zone)
 static int
 hash_alloc(struct uma_hash *hash)
 {
-   int oldsize;
+   u_int oldsize;
size_t alloc;
 
oldsize = hash->uh_hashsize;
@@ -581,8 +581,8 @@ static int
 hash_expand(struct uma_hash *oldhash, struct uma_hash *newhash)
 {
uma_slab_t slab;
-   int hval;
-   int i;
+   u_int hval;
+   u_int idx;
 
if (!newhash->uh_slab_hash)
return (0);
@@ -595,10 +595,10 @@ hash_expand(struct uma_hash *oldhash, struct uma_hash 
 * full rehash.
 */
 
-   for (i = 0; i < oldhash->uh_hashsize; i++)
-   while (!SLIST_EMPTY(&oldhash->uh_slab_hash[i])) {
-   slab = SLIST_FIRST(&oldhash->uh_slab_hash[i]);
-   SLIST_REMOVE_HEAD(&oldhash->uh_slab_hash[i], us_hlink);
+   for (idx = 0; idx < oldhash->uh_hashsize; idx++)
+   while (!SLIST_EMPTY(&oldhash->uh_slab_hash[idx])) {
+   slab = SLIST_FIRST(&oldhash->uh_slab_hash[idx]);
+   SLIST_REMOVE_HEAD(&oldhash->uh_slab_hash[idx], 
us_hlink);
hval = UMA_HASH(newhash, slab->us_data);
SLIST_INSERT_HEAD(&newhash->uh_slab_hash[hval],
slab, us_hlink);

Modified: stable/11/sys/vm/uma_int.h
==
--- stable/11/sys/vm/uma_int.h  Wed Feb 20 14:10:46 2019(r344362)
+++ stable/11/sys/vm/uma_int.h  Wed Feb 20 14:12:25 2019(r344363)
@@ -144,8 +144,8 @@ SLIST_HEAD(slabhead, uma_slab);
 
 struct uma_hash {
struct slabhead *uh_slab_hash;  /* Hash table for slabs */
-   int uh_hashsize;/* Current size of the hash table */
-   int uh_hashmask;/* Mask used during hashing */
+   u_int   uh_hashsize;/* Current size of the hash table */
+   u_int   uh_hashmask;/* Mask used during hashing */
 };
 
 /*
@@ -386,7 +386,7 @@ static __inline uma_slab_t
 hash_sfind(struct uma_hash *hash, uint8_t *data)
 {
 uma_slab_t slab;
-int hval;
+u_int hval;
 
 hval = UMA_HASH(hash, data);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344361 - head/cddl/contrib/opensolaris/cmd/zpool

2019-02-20 Thread Andriy Gapon
Author: avg
Date: Wed Feb 20 13:37:27 2019
New Revision: 344361
URL: https://svnweb.freebsd.org/changeset/base/344361

Log:
  zpool.8: sort zpool status flags in the same order as in illumos manual
  
  Just in case, while I was here.
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool.8

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Feb 20 13:34:16 
2019(r344360)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Feb 20 13:37:27 
2019(r344361)
@@ -1897,14 +1897,6 @@ Display a histogram of deduplication statistics, showi
 and referenced
 .Pq logically referenced in the pool
 block counts and sizes by reference count.
-.It Fl x
-Only display status for pools that are exhibiting errors or are otherwise
-unavailable.
-Warnings about pools not using the latest on-disk format, having non-native
-block size or disabled features will not be included.
-.It Fl v
-Displays verbose data error information, printing out a complete list of all
-data errors since the last complete pool scrub.
 .It Fl T Cm d Ns | Ns Cm u
 Print a timestamp.
 .Pp
@@ -1916,6 +1908,14 @@ Use modifier
 .Cm u
 for unixtime
 .Pq equals Qq Ic date +%s .
+.It Fl v
+Displays verbose data error information, printing out a complete list of all
+data errors since the last complete pool scrub.
+.It Fl x
+Only display status for pools that are exhibiting errors or are otherwise
+unavailable.
+Warnings about pools not using the latest on-disk format, having non-native
+block size or disabled features will not be included.
 .El
 .It Xo
 .Nm
___
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: r344360 - head/cddl/contrib/opensolaris/cmd/zpool

2019-02-20 Thread Andriy Gapon
Author: avg
Date: Wed Feb 20 13:34:16 2019
New Revision: 344360
URL: https://svnweb.freebsd.org/changeset/base/344360

Log:
  zpool.8: document -D flag for zpool status
  
  The description is taken from the illumos manual.
  
  Reported by:  stil...@gmail.com
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool.8

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Feb 20 13:19:08 
2019(r344359)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Feb 20 13:34:16 
2019(r344360)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 27, 2018
+.Dd February 20, 2019
 .Dt ZPOOL 8
 .Os
 .Sh NAME
@@ -187,7 +187,7 @@
 .Op Ar device ...
 .Nm
 .Cm status
-.Op Fl vx
+.Op Fl Dvx
 .Op Fl T Cm d Ns | Ns Cm u
 .Op Ar pool
 .Ar ...
@@ -1862,7 +1862,7 @@ section, above, for more information on the available 
 .It Xo
 .Nm
 .Cm status
-.Op Fl vx
+.Op Fl Dvx
 .Op Fl T Cm d Ns | Ns Cm u
 .Op Ar pool
 .Ar ...
@@ -1891,6 +1891,12 @@ done and the estimated time to completion. Both of the
 because the amount of data in the pool and the other workloads on the system
 can change.
 .Bl -tag -width indent
+.It Fl D
+Display a histogram of deduplication statistics, showing the allocated
+.Pq physically present on disk
+and referenced
+.Pq logically referenced in the pool
+block counts and sizes by reference count.
 .It Fl x
 Only display status for pools that are exhibiting errors or are otherwise
 unavailable.
___
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: r344359 - head/cddl/contrib/opensolaris/lib/libzpool/common

2019-02-20 Thread Andriy Gapon
Author: avg
Date: Wed Feb 20 13:19:08 2019
New Revision: 344359
URL: https://svnweb.freebsd.org/changeset/base/344359

Log:
  fix userland illumos taskq code to pass relative timeout to cv_timedwait
  
  Unlike illumos, FreeBSD cv_timedwait requires a relative timeout.  That
  applies both to the kernel illumos compatibility code and to the
  userland "fake kernel" code.
  
  MFC after:2 weeks
  Sponsored by: Panzura

Modified:
  head/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c

Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c
==
--- head/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c   Wed Feb 20 
11:58:40 2019(r344358)
+++ head/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c   Wed Feb 20 
13:19:08 2019(r344359)
@@ -79,8 +79,13 @@ again:   if ((t = tq->tq_freelist) != NULL && tq->tq_nal
 * immediately retry the allocation.
 */
tq->tq_maxalloc_wait++;
+#ifdef __FreeBSD__
rv = cv_timedwait(&tq->tq_maxalloc_cv,
+   &tq->tq_lock, hz);
+#else
+   rv = cv_timedwait(&tq->tq_maxalloc_cv,
&tq->tq_lock, ddi_get_lbolt() + hz);
+#endif
tq->tq_maxalloc_wait--;
if (rv > 0)
goto again; /* signaled */
___
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: r344358 - stable/12/lib/libc/net

2019-02-20 Thread Sergey Kandaurov
Author: pluknet
Date: Wed Feb 20 11:58:40 2019
New Revision: 344358
URL: https://svnweb.freebsd.org/changeset/base/344358

Log:
  MFC r343967:
  Sync "struct addrinfo" declaration with netdb.h.
  
  PR:   225880

Modified:
  stable/12/lib/libc/net/getaddrinfo.3
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/net/getaddrinfo.3
==
--- stable/12/lib/libc/net/getaddrinfo.3Wed Feb 20 11:56:30 2019
(r344357)
+++ stable/12/lib/libc/net/getaddrinfo.3Wed Feb 20 11:58:40 2019
(r344358)
@@ -18,7 +18,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 13, 2017
+.Dd February 10, 2019
 .Dt GETADDRINFO 3
 .Os
 .Sh NAME
@@ -78,14 +78,14 @@ as defined by
 .Aq Pa netdb.h :
 .Bd -literal
 struct addrinfo {
-   int ai_flags;   /* input flags */
-   int ai_family;  /* address family for socket */
-   int ai_socktype;/* socket type */
-   int ai_protocol;/* protocol for socket */
-   socklen_t ai_addrlen;   /* length of socket-address */
-   struct sockaddr *ai_addr; /* socket-address for socket */
-   char *ai_canonname; /* canonical name for service location */
-   struct addrinfo *ai_next; /* pointer to next in list */
+int ai_flags;   /* AI_PASSIVE, AI_CANONNAME, .. */
+int ai_family;  /* AF_xxx */
+int ai_socktype;/* SOCK_xxx */
+int ai_protocol;/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
+socklen_t ai_addrlen;   /* length of ai_addr */
+char*ai_canonname;  /* canonical name for hostname */
+struct  sockaddr *ai_addr;  /* binary address */
+struct  addrinfo *ai_next;  /* next structure in linked list */
 };
 .Ed
 .Pp
___
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: r344357 - stable/12/lib/libc/sys

2019-02-20 Thread Sergey Kandaurov
Author: pluknet
Date: Wed Feb 20 11:56:30 2019
New Revision: 344357
URL: https://svnweb.freebsd.org/changeset/base/344357

Log:
  MFC r343945:
  Document the ENOBUFS errno in setsockopt(2).
  
  PR:   200649

Modified:
  stable/12/lib/libc/sys/getsockopt.2
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/sys/getsockopt.2
==
--- stable/12/lib/libc/sys/getsockopt.2 Wed Feb 20 10:22:48 2019
(r344356)
+++ stable/12/lib/libc/sys/getsockopt.2 Wed Feb 20 11:56:30 2019
(r344357)
@@ -28,7 +28,7 @@
 .\" @(#)getsockopt.2   8.4 (Berkeley) 5/2/95
 .\" $FreeBSD$
 .\"
-.Dd August 21, 2018
+.Dd February 10, 2019
 .Dt GETSOCKOPT 2
 .Os
 .Sh NAME
@@ -534,7 +534,11 @@ transfer rate to the given unsigned 32-bit value in by
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS
-The call succeeds unless:
+The
+.Fn getsockopt
+and
+.Fn setsockopt
+system calls succeed unless:
 .Bl -tag -width Er
 .It Bq Er EBADF
 The argument
@@ -561,6 +565,15 @@ Installing an
 on a non-listening socket was attempted.
 .It Bq Er ENOMEM
 A memory allocation failed that was required to service the request.
+.El
+.Pp
+The
+.Fn setsockopt
+system call may also return the following error:
+.Bl -tag -width Er
+.It Bq Er ENOBUFS
+Insufficient resources were available in the system
+to perform the operation.
 .El
 .Sh SEE ALSO
 .Xr ioctl 2 ,
___
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: r344356 - stable/12/sys/netinet

2019-02-20 Thread Andrey V. Elsukov
Author: ae
Date: Wed Feb 20 10:22:48 2019
New Revision: 344356
URL: https://svnweb.freebsd.org/changeset/base/344356

Log:
  MFC r344103:
In r335015 PCB destroing was made deferred using epoch_call().
  
But ipsec_delete_pcbpolicy() uses some VNET-virtualized variables,
and thus it needs VNET context, that is missing during gtaskqueue
executing. Use inp_vnet context to set curvnet in in_pcbfree_deferred().
  
PR: 235684

Modified:
  stable/12/sys/netinet/in_pcb.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/in_pcb.c
==
--- stable/12/sys/netinet/in_pcb.c  Wed Feb 20 10:03:03 2019
(r344355)
+++ stable/12/sys/netinet/in_pcb.c  Wed Feb 20 10:22:48 2019
(r344356)
@@ -1566,6 +1566,7 @@ in_pcbfree_deferred(epoch_context_t ctx)
inp = __containerof(ctx, struct inpcb, inp_epoch_ctx);
 
INP_WLOCK(inp);
+   CURVNET_SET(inp->inp_vnet);
 #ifdef INET
struct ip_moptions *imo = inp->inp_moptions;
inp->inp_moptions = NULL;
@@ -1598,6 +1599,7 @@ in_pcbfree_deferred(epoch_context_t ctx)
 #ifdef INET
inp_freemoptions(imo);
 #endif 
+   CURVNET_RESTORE();
 }
 
 /*
___
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: r344355 - head/lib/libc/x86/sys

2019-02-20 Thread Konstantin Belousov
Author: kib
Date: Wed Feb 20 10:03:03 2019
New Revision: 344355
URL: https://svnweb.freebsd.org/changeset/base/344355

Log:
  pkru(3) man page.
  
  Reviewed by:  alc, markj, jilles
  With more input from: pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D19211

Added:
  head/lib/libc/x86/sys/pkru.3   (contents, props changed)
Modified:
  head/lib/libc/x86/sys/Makefile.inc

Modified: head/lib/libc/x86/sys/Makefile.inc
==
--- head/lib/libc/x86/sys/Makefile.inc  Wed Feb 20 09:56:23 2019
(r344354)
+++ head/lib/libc/x86/sys/Makefile.inc  Wed Feb 20 10:03:03 2019
(r344355)
@@ -6,6 +6,9 @@ SRCS+= \
__vdso_gettc.c \
pkru.c
 
+MAN+=  \
+   pkru.3
+
 .if ${MACHINE_CPUARCH} == "amd64" && ${MK_HYPERV} != "no"
 CFLAGS+=   -DWANT_HYPERV
 .endif

Added: head/lib/libc/x86/sys/pkru.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/x86/sys/pkru.3Wed Feb 20 10:03:03 2019
(r344355)
@@ -0,0 +1,206 @@
+.\" Copyright (c) 2019 The FreeBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This documentation was written by
+.\" Konstantin Belousov  under sponsorship
+.\" from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 16, 2019
+.Dt PKRU 3
+.Os
+.Sh NAME
+.Nm Protection Key Rights for User pages
+.Nd provide fast user-managed key-based access control for pages
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In machine/sysarch.h
+.Ft int
+.Fn x86_pkru_get_perm "unsigned int keyidx" "int *access" "int *modify"
+.Ft int
+.Fn x86_pkru_set_perm "unsigned int keyidx" "int access" "int modify"
+.Ft int
+.Fo x86_pkru_protect_range
+.Fa "void *addr"
+.Fa "unsigned long len"
+.Fa "unsigned int keyidx"
+.Fa "int flag"
+.Fc
+.Ft int
+.Fn x86_pkru_unprotect_range "void *addr" "unsigned long len"
+.Sh DESCRIPTION
+The protection keys feature provides an additional mechanism, besides the
+normal page permissions as established by
+.Xr mmap 2
+and
+.Xr mprotect 2 ,
+to control access to user-mode addresses.
+The mechanism gives safety measures which can be used to avoid
+incidental read or modification of sensitive memory,
+or as a debugging feature.
+It cannot guard against conscious accesses since permissions
+are user-controllable.
+.Pp
+If supported by hardware, each mapped user linear address
+has an associated 4-bit protection key.
+A new per-thread PKRU hardware register determines, for each protection
+key, whether user-mode addresses with that protection key may be
+read or written.
+.Pp
+Only one key may apply to a given range at a time.
+The default protection key index is zero, it is used even if no key
+was explicitly assigned to the address, or if the key was removed.
+.Pp
+The protection prevents the system from accessing user addresses as well
+as the user applications.
+When a system call was unable to read or write user memory due to key
+protection, it returns the
+.Er EFAULT
+error code.
+Note that some side effects may have occurred if this error is reported.
+.Pp
+Protection keys require that the system uses 4-level paging
+(also called long mode),
+which means that it is only available on amd64 system.
+Both 64-bit and 32-bit applications can use protection keys.
+More information about the hardware feature is provided in the IA32 Software
+Developer's Manual published by Intel Corp.
+.Pp
+The key indexes written into the page table entries are managed by the
+.Fn sysarch
+syscall.
+P

svn commit: r344354 - in head: lib/libc/amd64 lib/libc/i386 lib/libc/x86/sys sys/x86/include

2019-02-20 Thread Konstantin Belousov
Author: kib
Date: Wed Feb 20 09:56:23 2019
New Revision: 344354
URL: https://svnweb.freebsd.org/changeset/base/344354

Log:
  Add usermode helpers for for Intel userspace protection keys feature.
  
  Reviewed by:  markj
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D18893

Added:
  head/lib/libc/x86/sys/pkru.c   (contents, props changed)
Modified:
  head/lib/libc/amd64/Symbol.map
  head/lib/libc/i386/Symbol.map
  head/lib/libc/x86/sys/Makefile.inc
  head/sys/x86/include/sysarch.h

Modified: head/lib/libc/amd64/Symbol.map
==
--- head/lib/libc/amd64/Symbol.map  Wed Feb 20 09:51:13 2019
(r344353)
+++ head/lib/libc/amd64/Symbol.map  Wed Feb 20 09:56:23 2019
(r344354)
@@ -44,6 +44,13 @@ FBSD_1.0 {
vfork;
 };
 
+FBSD_1.6 {
+x86_pkru_get_perm;
+x86_pkru_set_perm;
+x86_pkru_protect_range;
+x86_pkru_unprotect_range;
+};
+
 /*
  *
  * FreeBSD private ABI

Modified: head/lib/libc/i386/Symbol.map
==
--- head/lib/libc/i386/Symbol.map   Wed Feb 20 09:51:13 2019
(r344353)
+++ head/lib/libc/i386/Symbol.map   Wed Feb 20 09:56:23 2019
(r344354)
@@ -46,6 +46,13 @@ FBSD_1.0 {
___tls_get_addr;
 };
 
+FBSD_1.6 {
+x86_pkru_get_perm;
+x86_pkru_set_perm;
+x86_pkru_protect_range;
+x86_pkru_unprotect_range;
+};
+
 FBSDprivate_1.0 {
/* PSEUDO syscalls */
_getlogin;

Modified: head/lib/libc/x86/sys/Makefile.inc
==
--- head/lib/libc/x86/sys/Makefile.inc  Wed Feb 20 09:51:13 2019
(r344353)
+++ head/lib/libc/x86/sys/Makefile.inc  Wed Feb 20 09:56:23 2019
(r344354)
@@ -3,7 +3,8 @@
 .PATH: ${LIBC_SRCTOP}/x86/sys
 
 SRCS+= \
-   __vdso_gettc.c
+   __vdso_gettc.c \
+   pkru.c
 
 .if ${MACHINE_CPUARCH} == "amd64" && ${MK_HYPERV} != "no"
 CFLAGS+=   -DWANT_HYPERV

Added: head/lib/libc/x86/sys/pkru.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/x86/sys/pkru.cWed Feb 20 09:56:23 2019
(r344354)
@@ -0,0 +1,138 @@
+/*-
+ * Copyright (c) 2019 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#defineMAX_PKRU_IDX0xf
+#ifdef __i386__
+#defineX86_SET_PKRUI386_SET_PKRU
+#defineX86_CLEAR_PKRU  I386_CLEAR_PKRU
+#else
+#defineX86_SET_PKRUAMD64_SET_PKRU
+#defineX86_CLEAR_PKRU  AMD64_CLEAR_PKRU
+#endif
+
+static int
+x86_pkru_get_perm_unsup(u_int keyidx, int *access, int *modify)
+{
+
+   errno = EOPNOTSUPP;
+   return (-1);
+}
+
+static int
+x86_pkru_get_perm_hw(u_int keyidx, int *access, int *modify)
+{
+   uint32_t pkru;
+
+   if (keyidx > MAX_PKRU_IDX) {
+   errno = EINVAL;
+   return (-1);
+   }
+   keyidx *= 2;
+   pkru = rdpkru();
+   *access = (pkru & (1 << keyidx)) == 0;
+   *modify = (pkru & (2 << keyidx)) == 0;
+   return (0);
+}
+
+DEFINE_UIFUNC(, int, x86_pkru_get_perm, (u_int, int *, int *), static)
+{
+
+   return ((cpu_stdext_feature2 & CPUID_STDEXT2_OSPKE) == 0 ?
+   

svn commit: r344353 - in head/sys: amd64/amd64 amd64/include arm/include arm64/include i386/include mips/include powerpc/include riscv/include sparc64/include vm x86/include

2019-02-20 Thread Konstantin Belousov
Author: kib
Date: Wed Feb 20 09:51:13 2019
New Revision: 344353
URL: https://svnweb.freebsd.org/changeset/base/344353

Log:
  Add kernel support for Intel userspace protection keys feature on
  Skylake Xeons.
  
  See SDM rev. 68 Vol 3 4.6.2 Protection Keys and the description of the
  RDPKRU and WRPKRU instructions.
  
  Reviewed by:  markj
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D18893

Modified:
  head/sys/amd64/amd64/initcpu.c
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/amd64/sys_machdep.c
  head/sys/amd64/amd64/trap.c
  head/sys/amd64/include/pmap.h
  head/sys/arm/include/pmap.h
  head/sys/arm64/include/pmap.h
  head/sys/i386/include/pmap.h
  head/sys/mips/include/pmap.h
  head/sys/powerpc/include/pmap.h
  head/sys/riscv/include/pmap.h
  head/sys/sparc64/include/pmap.h
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_map.c
  head/sys/x86/include/sysarch.h

Modified: head/sys/amd64/amd64/initcpu.c
==
--- head/sys/amd64/amd64/initcpu.c  Wed Feb 20 09:46:44 2019
(r344352)
+++ head/sys/amd64/amd64/initcpu.c  Wed Feb 20 09:51:13 2019
(r344353)
@@ -233,6 +233,9 @@ initializecpu(void)
if (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE)
cr4 |= CR4_FSGSBASE;
 
+   if (cpu_stdext_feature2 & CPUID_STDEXT2_PKU)
+   cr4 |= CR4_PKE;
+
/*
 * Postpone enabling the SMEP on the boot CPU until the page
 * tables are switched from the boot loader identity mapping

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Wed Feb 20 09:46:44 2019(r344352)
+++ head/sys/amd64/amd64/pmap.c Wed Feb 20 09:51:13 2019(r344353)
@@ -48,7 +48,7 @@
  */
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
- * Copyright (c) 2014-2018 The FreeBSD Foundation
+ * Copyright (c) 2014-2019 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed for the FreeBSD Project by Jake Burkholder,
@@ -121,6 +121,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -155,6 +156,7 @@ __FBSDID("$FreeBSD$");
 #ifdef SMP
 #include 
 #endif
+#include 
 #include 
 
 static __inline boolean_t
@@ -285,6 +287,13 @@ pmap_modified_bit(pmap_t pmap)
return (mask);
 }
 
+static __inline pt_entry_t
+pmap_pku_mask_bit(pmap_t pmap)
+{
+
+   return (pmap->pm_type == PT_X86 ? X86_PG_PKU_MASK : 0);
+}
+
 #if !defined(DIAGNOSTIC)
 #ifdef __GNUC_GNU_INLINE__
 #define PMAP_INLINE__attribute__((__gnu_inline__)) inline
@@ -424,6 +433,22 @@ static pml4_entry_t *pti_pml4;
 static vm_pindex_t pti_pg_idx;
 static bool pti_finalized;
 
+struct pmap_pkru_range {
+   struct rs_elpkru_rs_el;
+   u_int   pkru_keyidx;
+   int pkru_flags;
+};
+
+static uma_zone_t pmap_pkru_ranges_zone;
+static bool pmap_pkru_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva);
+static pt_entry_t pmap_pkru_get(pmap_t pmap, vm_offset_t va);
+static void pmap_pkru_on_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva);
+static void *pkru_dup_range(void *ctx, void *data);
+static void pkru_free_range(void *ctx, void *node);
+static int pmap_pkru_copy(pmap_t dst_pmap, pmap_t src_pmap);
+static int pmap_pkru_deassign(pmap_t pmap, vm_offset_t sva, vm_offset_t eva);
+static void pmap_pkru_deassign_all(pmap_t pmap);
+
 static int
 pmap_pcid_save_cnt_proc(SYSCTL_HANDLER_ARGS)
 {
@@ -2846,6 +2871,12 @@ pmap_pinit0(pmap_t pmap)
pmap->pm_pcids[i].pm_gen = 1;
}
pmap_activate_boot(pmap);
+
+   if ((cpu_stdext_feature2 & CPUID_STDEXT2_PKU) != 0) {
+   pmap_pkru_ranges_zone = uma_zcreate("pkru ranges",
+   sizeof(struct pmap_pkru_range), NULL, NULL, NULL, NULL,
+   UMA_ALIGN_PTR, 0);
+   }
 }
 
 void
@@ -2934,6 +2965,10 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, i
pmap_pinit_pml4_pti(pml4pgu);
pmap->pm_ucr3 = VM_PAGE_TO_PHYS(pml4pgu);
}
+   if ((cpu_stdext_feature2 & CPUID_STDEXT2_PKU) != 0) {
+   rangeset_init(&pmap->pm_pkru, pkru_dup_range,
+   pkru_free_range, pmap, M_NOWAIT);
+   }
}
 
pmap->pm_root.rt_root = 0;
@@ -3230,6 +3265,9 @@ pmap_release(pmap_t pmap)
vm_page_unwire_noq(m);
vm_page_free(m);
}
+   if (pmap->pm_type == PT_X86 &&
+   (cpu_stdext_feature2 & CPUID_STDEXT2_PKU) != 0)
+   rangeset_fini(&pmap->pm_pkru);
 }
 
 static int
@@ -4060,7 +4098,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, v
 {
pd_entry_t newpde, oldpde;
pt_entry_t *firstpte, newpte;
-   pt_entry_t PG

svn commit: r344352 - in head/sys/amd64: amd64 include

2019-02-20 Thread Konstantin Belousov
Author: kib
Date: Wed Feb 20 09:46:44 2019
New Revision: 344352
URL: https://svnweb.freebsd.org/changeset/base/344352

Log:
  amd64: add defines and decode protection keys and SGX page faults reasons.
  
  Reviewed by:  markj
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D18893

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/amd64/include/pmap.h

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Wed Feb 20 09:38:19 2019(r344351)
+++ head/sys/amd64/amd64/trap.c Wed Feb 20 09:46:44 2019(r344352)
@@ -885,10 +885,12 @@ trap_fatal(frame, eva)
 #endif
if (type == T_PAGEFLT) {
printf("fault virtual address   = 0x%lx\n", eva);
-   printf("fault code  = %s %s %s, %s\n",
+   printf("fault code  = %s %s %s%s%s, %s\n",
code & PGEX_U ? "user" : "supervisor",
code & PGEX_W ? "write" : "read",
code & PGEX_I ? "instruction" : "data",
+   code & PGEX_PK ? " prot key" : " ",
+   code & PGEX_SGX ? " SGX" : " ",
code & PGEX_RSV ? "reserved bits in PTE" :
code & PGEX_P ? "protection violation" : "page not 
present");
}

Modified: head/sys/amd64/include/pmap.h
==
--- head/sys/amd64/include/pmap.h   Wed Feb 20 09:38:19 2019
(r344351)
+++ head/sys/amd64/include/pmap.h   Wed Feb 20 09:46:44 2019
(r344352)
@@ -131,6 +131,8 @@
 #define PGEX_U 0x04/* access from User mode (UPL) */
 #define PGEX_RSV   0x08/* reserved PTE field is non-zero */
 #define PGEX_I 0x10/* during an instruction fetch */
+#definePGEX_PK 0x20/* protection key violation */
+#definePGEX_SGX0x40/* SGX-related */
 
 /* 
  * undef the PG_xx macros that define bits in the regular x86 PTEs that
___
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: r344351 - in head/sys: conf kern sys

2019-02-20 Thread Konstantin Belousov
Author: kib
Date: Wed Feb 20 09:38:19 2019
New Revision: 344351
URL: https://svnweb.freebsd.org/changeset/base/344351

Log:
  Implement rangesets.
  
  The data structure implements non-intersecting intervals over the [0,
  UINT64_MAX] range, and supports fast insert, predicated clearing of
  subrange, and lookup of an interval containing the specified address.
  Internally it is a pctrie over the interval start addresses.
  
  Implementation provides additional guarantees over the structure state
  in case of memory allocation failures.
  
  Reviewed by:  markj
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D18893

Added:
  head/sys/kern/subr_rangeset.c   (contents, props changed)
  head/sys/sys/_rangeset.h   (contents, props changed)
  head/sys/sys/rangeset.h   (contents, props changed)
Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Feb 20 09:33:55 2019(r344350)
+++ head/sys/conf/files Wed Feb 20 09:38:19 2019(r344351)
@@ -3861,6 +3861,7 @@ kern/subr_pidctrl.c   standard
 kern/subr_power.c  standard
 kern/subr_prf.cstandard
 kern/subr_prof.c   standard
+kern/subr_rangeset.c   standard
 kern/subr_rman.c   standard
 kern/subr_rtc.cstandard
 kern/subr_sbuf.c   standard

Added: head/sys/kern/subr_rangeset.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/kern/subr_rangeset.c   Wed Feb 20 09:38:19 2019
(r344351)
@@ -0,0 +1,365 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Konstantin Belousov 
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef DIAGNOSTIC
+static void rangeset_check(struct rangeset *rs);
+#else
+#definerangeset_check(rs)
+#endif
+
+static uma_zone_t rs_node_zone;
+
+static void
+rs_rangeset_init(void *arg __unused)
+{
+
+   rs_node_zone = uma_zcreate("rangeset pctrie nodes",
+   pctrie_node_size(), NULL, NULL, pctrie_zone_init, NULL,
+   UMA_ALIGN_PTR, 0);
+}
+SYSINIT(rs, SI_SUB_LOCK, SI_ORDER_ANY, rs_rangeset_init, NULL);
+
+static void *
+rs_node_alloc(struct pctrie *ptree)
+{
+   struct rangeset *rs;
+
+   rs = __containerof(ptree, struct rangeset, rs_trie);
+   return (uma_zalloc(rs_node_zone, rs->rs_alloc_flags));
+}
+
+static void
+rs_node_free(struct pctrie *ptree __unused, void *node)
+{
+
+   uma_zfree(rs_node_zone, node);
+}
+
+void
+rangeset_init(struct rangeset *rs, rs_dup_data_t dup_data,
+rs_free_data_t free_data, void *data_ctx, u_int alloc_flags)
+{
+
+   pctrie_init(&rs->rs_trie);
+   rs->rs_dup_data = dup_data;
+   rs->rs_free_data = free_data;
+   rs->rs_data_ctx = data_ctx;
+   rs->rs_alloc_flags = alloc_flags;
+}
+
+void
+rangeset_fini(struct rangeset *rs)
+{
+
+   rangeset_check(rs);
+   rangeset_remove_all(rs);
+}
+
+bool
+rangeset_check_empty(struct rangeset *rs, uint64_t start, uint64_t end)
+{
+   struct rs_el *r;
+   uint64_t *r1;
+
+   rangeset_check(rs);
+   r1 = pctrie_lookup_le(&rs->rs_trie, end);
+   if (r1 != NULL) {
+   r = __containerof(r1, struct rs_el, re_start);

Re: svn commit: r344316 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-02-20 Thread Toomas Soome via svn-src-all



> On 20 Feb 2019, at 09:56, Alexey Dokuchaev  wrote:
> 
> On Tue, Feb 19, 2019 at 06:43:28PM -0500, Shawn Webb wrote:
>> At the risk of painting a bikeshed a lovely color of neon purple, I'm
>> curious about if/how these types of commits get merged upstream to
>> (OpenZFS|Illumos|ZFS On Linux|where ever ZFS upstream is now|I'm very
>> confused|is anyone else confused where upstream is?).
>> 
>> Who is upstream? Is work like this going to remain as a downstream
>> patch to ZFS? Or is FreeBSD going to work to upstream this type of
>> work?
> 
> I've always felt that we should've become upstream to everyone else
> the moment we knew Oracle would eat Sun (20 April 2009), and never
> understood why it didn't happen and now, ten years later, we're talking
> about ZFS on fucking Linux becoming our upstream.  Something'd got very
> wrong here and I'd like to know what and why.
> 
>> I hope my curiousity doesn't offend anyone. ;)
> 
> Not at all, I'm also confused and curious.
> 
> ./danfe
> 

The genuine lack of developers and development. If the updates do happen in ZoL 
(for zfs), it only means the developers find it easier to work there.

rgds,
toomas
___
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"