svn commit: r367581 - head/sys/conf

2020-11-10 Thread Warner Losh
Author: imp
Date: Tue Nov 10 23:25:16 2020
New Revision: 367581
URL: https://svnweb.freebsd.org/changeset/base/367581

Log:
  Add INIT_ALL_ZERO and INIT_ALL_PATTERN to kern.opts.mk
  
  These options need to be in the kern.opts.mk file to be alive for kernel
  and module builds. This also reverts r367579 since that's not needed with
  this fix: the host's bsd.opts.mk is irrelevant.
  
  Reviewed by: brooks@
  Differential Revision:  https://reviews.freebsd.org/D27170

Modified:
  head/sys/conf/kern.mk
  head/sys/conf/kern.opts.mk

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Tue Nov 10 21:29:10 2020(r367580)
+++ head/sys/conf/kern.mk   Tue Nov 10 23:25:16 2020(r367581)
@@ -230,15 +230,15 @@ CFLAGS+=  -mretpoline
 #
 # Initialize stack variables on function entry
 #
-.if defined(MK_INIT_ALL_ZERO) && ${MK_INIT_ALL_ZERO} == "yes"
-.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all}
+.if ${MK_INIT_ALL_ZERO} == "yes"
+.if ${COMPILER_FEATURES:Minit-all}
 CFLAGS+= -ftrivial-auto-var-init=zero \
 -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
 .else
 .warning InitAll (zeros) requested but not support by compiler
 .endif
-.elif defined(MK_INIT_ALL_PATTERN) && ${MK_INIT_ALL_PATTERN} == "yes"
-.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all}
+.elif ${MK_INIT_ALL_PATTERN} == "yes"
+.if ${COMPILER_FEATURES:Minit-all}
 CFLAGS+= -ftrivial-auto-var-init=pattern
 .else
 .warning InitAll (pattern) requested but not support by compiler

Modified: head/sys/conf/kern.opts.mk
==
--- head/sys/conf/kern.opts.mk  Tue Nov 10 21:29:10 2020(r367580)
+++ head/sys/conf/kern.opts.mk  Tue Nov 10 23:25:16 2020(r367581)
@@ -52,6 +52,8 @@ __DEFAULT_YES_OPTIONS = \
 __DEFAULT_NO_OPTIONS = \
 BHYVE_SNAPSHOT \
 EXTRA_TCP_STACKS \
+INIT_ALL_PATTERN \
+INIT_ALL_ZERO \
 KERNEL_RETPOLINE \
 OFED \
 RATELIMIT \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Brooks Davis
On Tue, Nov 10, 2020 at 02:44:45PM -0500, Shawn Webb wrote:
> On Tue, Nov 10, 2020 at 07:17:29PM +, Brooks Davis wrote:
> > On Tue, Nov 10, 2020 at 07:15:14PM +, Brooks Davis wrote:
> > > Author: brooks
> > > Date: Tue Nov 10 19:15:13 2020
> > > New Revision: 367577
> > > URL: https://svnweb.freebsd.org/changeset/base/367577
> > > 
> > > Log:
> > >   Support initializing stack variables on function entry
> > >   
> > >   There are two options:
> > >- WITH_INIT_ALL_ZERO: Zero all variables on the stack.
> > >- WITH_INIT_ALL_PATTERN: Initialize variables with well-defined 
> > > patterns.
> > >   
> > >   The exact pattern are a compiler implementation detail and vary by type.
> > >   They are somewhat documented in the LLVM commit message:
> > >   https://reviews.llvm.org/rL349442
> > >   I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
> > >   than naming them after the LLVM specific compiler flags.
> > >   
> > >   In a range of consumer products, options like these are used in
> > >   both debug and production builds with debugs builds using patterns
> > >   (intended to provoke crashes on use of uninitialized values) and
> > >   production using zeros (deemed more likely to lead to harmless
> > >   misbehavior or NULL-pointer dereferences).
> > 
> > We've tested this extensively in CheriBSD on RISC-V, in the wild it's
> > probably most tested on Arm64 and x86.
> > 
> > Despite the silly compiler flag you'll spot in the code, the zeroing
> > option isn't going away in practice as Apple, Google, and Microsoft all
> > ship with this feature in some of their products.
> 
> HardenedBSD's testing of this last year on amd64 have (privately)
> shown the feature to really hinder performance on more complex
> applications (like when applied to clang/lld). A build of base
> without init all zero applied to clang/lld would take around 1.5
> hours on my system. A build with it applied to clang/lld took around
> four hours, if my memory serves correctly. I would probably advise
> against applying it system-wide. But YMMV.

I agree a more nuanced approach is likely useful in practice, but this
does work and is part of the configuration we shipped for DARPA's FETT bug
bounty.  Hopefully this provides a starting point for further
exploration.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Brooks Davis
Sorry about that.  I've fixed it in r367579.

-- Brooks

On Tue, Nov 10, 2020 at 12:46:45PM -0800, Matthew Macy wrote:
> These flags aren't defined by default when building external kernel modules:
> 
> gmake[2]: Entering directory '/usr/home/matt/devel/ZoF/module'
> env -u MAKEFLAGS make -C /home/matt/devel/ZoF/module -f Makefile.bsd -w
> make[3]: Entering directory `/home/matt/devel/ZoF/module'
> make[3]: "/usr/home/matt/devel/freebsd/sys/conf/kern.mk" line 233:
> Malformed conditional (${MK_INIT_ALL_ZERO} == "yes")
> make[3]: Fatal errors encountered -- cannot continue
> make[3]: stopped in /home/matt/devel/ZoF/module
> gmake[2]: *** [Makefile:53: modules-FreeBSD] Error 1
> gmake[2]: Leaving directory '/usr/home/matt/devel/ZoF/module'
> 
> On Tue, Nov 10, 2020 at 11:15 AM Brooks Davis  wrote:
> >
> > Author: brooks
> > Date: Tue Nov 10 19:15:13 2020
> > New Revision: 367577
> > URL: https://svnweb.freebsd.org/changeset/base/367577
> >
> > Log:
> >   Support initializing stack variables on function entry
> >
> >   There are two options:
> >- WITH_INIT_ALL_ZERO: Zero all variables on the stack.
> >- WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns.
> >
> >   The exact pattern are a compiler implementation detail and vary by type.
> >   They are somewhat documented in the LLVM commit message:
> >   https://reviews.llvm.org/rL349442
> >   I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
> >   than naming them after the LLVM specific compiler flags.
> >
> >   In a range of consumer products, options like these are used in
> >   both debug and production builds with debugs builds using patterns
> >   (intended to provoke crashes on use of uninitialized values) and
> >   production using zeros (deemed more likely to lead to harmless
> >   misbehavior or NULL-pointer dereferences).
> >
> >   Reviewed by:  emaste
> >   Obtained from:CheriBSD
> >   Sponsored by: DARPA
> >   Differential Revision:https://reviews.freebsd.org/D27131
> >
> > Added:
> >   head/tools/build/options/WITH_INIT_ALL_PATTERN   (contents, props changed)
> >   head/tools/build/options/WITH_INIT_ALL_ZERO   (contents, props changed)
> > Modified:
> >   head/share/mk/bsd.compiler.mk
> >   head/share/mk/bsd.lib.mk
> >   head/share/mk/bsd.opts.mk
> >   head/share/mk/bsd.prog.mk
> >   head/sys/conf/kern.mk
> >
> > Modified: head/share/mk/bsd.compiler.mk
> > ==
> > --- head/share/mk/bsd.compiler.mk   Tue Nov 10 19:09:35 2020
> > (r367576)
> > +++ head/share/mk/bsd.compiler.mk   Tue Nov 10 19:15:13 2020
> > (r367577)
> > @@ -24,6 +24,7 @@
> >  # - c++11: supports full (or nearly full) C++11 programming 
> > environment.
> >  # - retpoline: supports the retpoline speculative execution vulnerability
> >  #  mitigation.
> > +# - init-all:  supports stack variable initialization.
> >  #
> >  # These variables with an X_ prefix will also be provided if XCC is set.
> >  #
> > @@ -214,7 +215,7 @@ ${X_}COMPILER_FEATURES= c++11 c++14
> >  ${X_}COMPILER_FEATURES+=   c++17
> >  .endif
> >  .if ${${X_}COMPILER_TYPE} == "clang"
> > -${X_}COMPILER_FEATURES+=   retpoline
> > +${X_}COMPILER_FEATURES+=   retpoline init-all
> >  .endif
> >
> >  .else
> >
> > Modified: head/share/mk/bsd.lib.mk
> > ==
> > --- head/share/mk/bsd.lib.mkTue Nov 10 19:09:35 2020(r367576)
> > +++ head/share/mk/bsd.lib.mkTue Nov 10 19:15:13 2020(r367577)
> > @@ -85,6 +85,25 @@ LDFLAGS+= -Wl,-zretpolineplt
> >  .endif
> >  .endif
> >
> > +# Initialize stack variables on function entry
> > +.if ${MK_INIT_ALL_ZERO} == "yes"
> > +.if ${COMPILER_FEATURES:Minit-all}
> > +CFLAGS+= -ftrivial-auto-var-init=zero \
> > +
> > -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> > +CXXFLAGS+= -ftrivial-auto-var-init=zero \
> > +
> > -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> > +.else
> > +.warning InitAll (zeros) requested but not support by compiler
> > +.endif
> > +.elif ${MK_INIT_ALL_PATTERN} == "yes"
> > +.if ${COMPILER_FEATURES:Minit-all}
> > +CFLAGS+= -ftrivial-auto-var-init=pattern
> > +CXXFLAGS+= -ftrivial-auto-var-init=pattern
> > +.else
> > +.warning InitAll (pattern) requested but not support by compiler
> > +.endif
> > +.endif
> > +
> >  .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
> >  empty(DEBUG_FLAGS:M-gdwarf*)
> >  CFLAGS+= ${DEBUG_FILES_CFLAGS}
> >
> > Modified: head/share/mk/bsd.opts.mk
> > ==
> > --- head/share/mk/bsd.opts.mk   Tue Nov 10 19:09:35 2020(r367576)
> > +++ head/share/mk/bsd.opts.mk   Tue Nov 10 19:15:13 2020(r367577)
> > @@ -71,6 +71,8 @@ __DEFAULT_NO_OPTIONS = \
> >  BIND_NOW \
> >  

svn commit: r367580 - head/sys/kern

2020-11-10 Thread Mateusz Guzik
Author: mjg
Date: Tue Nov 10 21:29:10 2020
New Revision: 367580
URL: https://svnweb.freebsd.org/changeset/base/367580

Log:
  thread: tidy up r367543
  
  "locked" variable is spurious in the committed version.

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Tue Nov 10 21:12:32 2020(r367579)
+++ head/sys/kern/kern_proc.c   Tue Nov 10 21:29:10 2020(r367580)
@@ -2748,7 +2748,6 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS)
struct stack *st;
struct sbuf sb;
struct proc *p;
-   bool locked;
 
name = (int *)arg1;
error = pget((pid_t)name[0], PGET_NOTINEXEC | PGET_WANTREAD, );
@@ -2789,14 +2788,12 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS)
i++;
}
PROC_UNLOCK(p);
-   locked = false;
numthreads = i;
for (i = 0; i < numthreads; i++) {
td = tdfind(lwpidarray[i], p->p_pid);
if (td == NULL) {
continue;
}
-   locked = true;
bzero(kkstp, sizeof(*kkstp));
(void)sbuf_new(, kkstp->kkst_trace,
sizeof(kkstp->kkst_trace), SBUF_FIXEDLEN);
@@ -2810,7 +2807,6 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS)
kkstp->kkst_state = KKST_STATE_RUNNING;
thread_unlock(td);
PROC_UNLOCK(p);
-   locked = false;
stack_sbuf_print(, st);
sbuf_finish();
sbuf_delete();
@@ -2818,10 +2814,7 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS)
if (error)
break;
}
-   if (!locked)
-   PROC_LOCK(p);
-   _PRELE(p);
-   PROC_UNLOCK(p);
+   PRELE(p);
if (lwpidarray != NULL)
free(lwpidarray, M_TEMP);
stack_destroy(st);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367579 - head/sys/conf

2020-11-10 Thread Brooks Davis
Author: brooks
Date: Tue Nov 10 21:12:32 2020
New Revision: 367579
URL: https://svnweb.freebsd.org/changeset/base/367579

Log:
  Be more tolerant of share/mk and kern.mk mismatch
  
  When building out-of-tree modules, it appears that the system share/mk
  is used, but sys/conf/kern.mk is used.  That results in MK_INIT_ALL_ZERO
  being undefined.  In the interest of maximum compatability, check
  that MK_INIT_ALL_* and COMPILER_FEATURES are defined before comparing
  their values.
  
  Reported by:  mmacy
  Sponsored by: DARPA

Modified:
  head/sys/conf/kern.mk

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Tue Nov 10 19:54:39 2020(r367578)
+++ head/sys/conf/kern.mk   Tue Nov 10 21:12:32 2020(r367579)
@@ -230,15 +230,15 @@ CFLAGS+=  -mretpoline
 #
 # Initialize stack variables on function entry
 #
-.if ${MK_INIT_ALL_ZERO} == "yes"
-.if ${COMPILER_FEATURES:Minit-all}
+.if defined(MK_INIT_ALL_ZERO) && ${MK_INIT_ALL_ZERO} == "yes"
+.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all}
 CFLAGS+= -ftrivial-auto-var-init=zero \
 -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
 .else
 .warning InitAll (zeros) requested but not support by compiler
 .endif
-.elif ${MK_INIT_ALL_PATTERN} == "yes"
-.if ${COMPILER_FEATURES:Minit-all}
+.elif defined(MK_INIT_ALL_PATTERN) && ${MK_INIT_ALL_PATTERN} == "yes"
+.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all}
 CFLAGS+= -ftrivial-auto-var-init=pattern
 .else
 .warning InitAll (pattern) requested but not support by compiler
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Matthew Macy
These flags aren't defined by default when building external kernel modules:

gmake[2]: Entering directory '/usr/home/matt/devel/ZoF/module'
env -u MAKEFLAGS make -C /home/matt/devel/ZoF/module -f Makefile.bsd -w
make[3]: Entering directory `/home/matt/devel/ZoF/module'
make[3]: "/usr/home/matt/devel/freebsd/sys/conf/kern.mk" line 233:
Malformed conditional (${MK_INIT_ALL_ZERO} == "yes")
make[3]: Fatal errors encountered -- cannot continue
make[3]: stopped in /home/matt/devel/ZoF/module
gmake[2]: *** [Makefile:53: modules-FreeBSD] Error 1
gmake[2]: Leaving directory '/usr/home/matt/devel/ZoF/module'

On Tue, Nov 10, 2020 at 11:15 AM Brooks Davis  wrote:
>
> Author: brooks
> Date: Tue Nov 10 19:15:13 2020
> New Revision: 367577
> URL: https://svnweb.freebsd.org/changeset/base/367577
>
> Log:
>   Support initializing stack variables on function entry
>
>   There are two options:
>- WITH_INIT_ALL_ZERO: Zero all variables on the stack.
>- WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns.
>
>   The exact pattern are a compiler implementation detail and vary by type.
>   They are somewhat documented in the LLVM commit message:
>   https://reviews.llvm.org/rL349442
>   I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
>   than naming them after the LLVM specific compiler flags.
>
>   In a range of consumer products, options like these are used in
>   both debug and production builds with debugs builds using patterns
>   (intended to provoke crashes on use of uninitialized values) and
>   production using zeros (deemed more likely to lead to harmless
>   misbehavior or NULL-pointer dereferences).
>
>   Reviewed by:  emaste
>   Obtained from:CheriBSD
>   Sponsored by: DARPA
>   Differential Revision:https://reviews.freebsd.org/D27131
>
> Added:
>   head/tools/build/options/WITH_INIT_ALL_PATTERN   (contents, props changed)
>   head/tools/build/options/WITH_INIT_ALL_ZERO   (contents, props changed)
> Modified:
>   head/share/mk/bsd.compiler.mk
>   head/share/mk/bsd.lib.mk
>   head/share/mk/bsd.opts.mk
>   head/share/mk/bsd.prog.mk
>   head/sys/conf/kern.mk
>
> Modified: head/share/mk/bsd.compiler.mk
> ==
> --- head/share/mk/bsd.compiler.mk   Tue Nov 10 19:09:35 2020
> (r367576)
> +++ head/share/mk/bsd.compiler.mk   Tue Nov 10 19:15:13 2020
> (r367577)
> @@ -24,6 +24,7 @@
>  # - c++11: supports full (or nearly full) C++11 programming environment.
>  # - retpoline: supports the retpoline speculative execution vulnerability
>  #  mitigation.
> +# - init-all:  supports stack variable initialization.
>  #
>  # These variables with an X_ prefix will also be provided if XCC is set.
>  #
> @@ -214,7 +215,7 @@ ${X_}COMPILER_FEATURES= c++11 c++14
>  ${X_}COMPILER_FEATURES+=   c++17
>  .endif
>  .if ${${X_}COMPILER_TYPE} == "clang"
> -${X_}COMPILER_FEATURES+=   retpoline
> +${X_}COMPILER_FEATURES+=   retpoline init-all
>  .endif
>
>  .else
>
> Modified: head/share/mk/bsd.lib.mk
> ==
> --- head/share/mk/bsd.lib.mkTue Nov 10 19:09:35 2020(r367576)
> +++ head/share/mk/bsd.lib.mkTue Nov 10 19:15:13 2020(r367577)
> @@ -85,6 +85,25 @@ LDFLAGS+= -Wl,-zretpolineplt
>  .endif
>  .endif
>
> +# Initialize stack variables on function entry
> +.if ${MK_INIT_ALL_ZERO} == "yes"
> +.if ${COMPILER_FEATURES:Minit-all}
> +CFLAGS+= -ftrivial-auto-var-init=zero \
> +-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> +CXXFLAGS+= -ftrivial-auto-var-init=zero \
> +-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> +.else
> +.warning InitAll (zeros) requested but not support by compiler
> +.endif
> +.elif ${MK_INIT_ALL_PATTERN} == "yes"
> +.if ${COMPILER_FEATURES:Minit-all}
> +CFLAGS+= -ftrivial-auto-var-init=pattern
> +CXXFLAGS+= -ftrivial-auto-var-init=pattern
> +.else
> +.warning InitAll (pattern) requested but not support by compiler
> +.endif
> +.endif
> +
>  .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
>  empty(DEBUG_FLAGS:M-gdwarf*)
>  CFLAGS+= ${DEBUG_FILES_CFLAGS}
>
> Modified: head/share/mk/bsd.opts.mk
> ==
> --- head/share/mk/bsd.opts.mk   Tue Nov 10 19:09:35 2020(r367576)
> +++ head/share/mk/bsd.opts.mk   Tue Nov 10 19:15:13 2020(r367577)
> @@ -71,6 +71,8 @@ __DEFAULT_NO_OPTIONS = \
>  BIND_NOW \
>  CCACHE_BUILD \
>  CTF \
> +INIT_ALL_PATTERN \
> +INIT_ALL_ZERO \
>  INSTALL_AS_USER \
>  PIE \
>  RETPOLINE \
> @@ -84,6 +86,10 @@ __DEFAULT_DEPENDENT_OPTIONS = \
>
>
>  .include 
> +
> +.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes"
> +.error WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive.
> +.endif
>
>  #

svn commit: r367578 - head/sys/dev/cxgbe/tom

2020-11-10 Thread John Baldwin
Author: jhb
Date: Tue Nov 10 19:54:39 2020
New Revision: 367578
URL: https://svnweb.freebsd.org/changeset/base/367578

Log:
  Clear tp->tod in t4_pcb_detach().
  
  Otherwise, a socket can have a non-NULL tp->tod while TF_TOE is clear.
  In particular, if a newly accepted socket falls back to non-TOE due to
  an active open failure, the non-TOE socket will still have tp->tod set
  even though TF_TOE is clear.
  
  Reviewed by:  np
  MFC after:2 weeks
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D27028

Modified:
  head/sys/dev/cxgbe/tom/t4_tom.c

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Tue Nov 10 19:15:13 2020
(r367577)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Nov 10 19:54:39 2020
(r367578)
@@ -382,6 +382,7 @@ t4_pcb_detach(struct toedev *tod __unused, struct tcpc
}
 #endif
 
+   tp->tod = NULL;
tp->t_toe = NULL;
tp->t_flags &= ~TF_TOE;
toep->flags &= ~TPF_ATTACHED;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Shawn Webb
On Tue, Nov 10, 2020 at 07:17:29PM +, Brooks Davis wrote:
> On Tue, Nov 10, 2020 at 07:15:14PM +, Brooks Davis wrote:
> > Author: brooks
> > Date: Tue Nov 10 19:15:13 2020
> > New Revision: 367577
> > URL: https://svnweb.freebsd.org/changeset/base/367577
> > 
> > Log:
> >   Support initializing stack variables on function entry
> >   
> >   There are two options:
> >- WITH_INIT_ALL_ZERO: Zero all variables on the stack.
> >- WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns.
> >   
> >   The exact pattern are a compiler implementation detail and vary by type.
> >   They are somewhat documented in the LLVM commit message:
> >   https://reviews.llvm.org/rL349442
> >   I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
> >   than naming them after the LLVM specific compiler flags.
> >   
> >   In a range of consumer products, options like these are used in
> >   both debug and production builds with debugs builds using patterns
> >   (intended to provoke crashes on use of uninitialized values) and
> >   production using zeros (deemed more likely to lead to harmless
> >   misbehavior or NULL-pointer dereferences).
> 
> We've tested this extensively in CheriBSD on RISC-V, in the wild it's
> probably most tested on Arm64 and x86.
> 
> Despite the silly compiler flag you'll spot in the code, the zeroing
> option isn't going away in practice as Apple, Google, and Microsoft all
> ship with this feature in some of their products.

HardenedBSD's testing of this last year on amd64 have (privately)
shown the feature to really hinder performance on more complex
applications (like when applied to clang/lld). A build of base
without init all zero applied to clang/lld would take around 1.5
hours on my system. A build with it applied to clang/lld took around
four hours, if my memory serves correctly. I would probably advise
against applying it system-wide. But YMMV.

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc


signature.asc
Description: PGP signature


Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Brooks Davis
On Tue, Nov 10, 2020 at 07:15:14PM +, Brooks Davis wrote:
> Author: brooks
> Date: Tue Nov 10 19:15:13 2020
> New Revision: 367577
> URL: https://svnweb.freebsd.org/changeset/base/367577
> 
> Log:
>   Support initializing stack variables on function entry
>   
>   There are two options:
>- WITH_INIT_ALL_ZERO: Zero all variables on the stack.
>- WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns.
>   
>   The exact pattern are a compiler implementation detail and vary by type.
>   They are somewhat documented in the LLVM commit message:
>   https://reviews.llvm.org/rL349442
>   I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
>   than naming them after the LLVM specific compiler flags.
>   
>   In a range of consumer products, options like these are used in
>   both debug and production builds with debugs builds using patterns
>   (intended to provoke crashes on use of uninitialized values) and
>   production using zeros (deemed more likely to lead to harmless
>   misbehavior or NULL-pointer dereferences).

We've tested this extensively in CheriBSD on RISC-V, in the wild it's
probably most tested on Arm64 and x86.

Despite the silly compiler flag you'll spot in the code, the zeroing
option isn't going away in practice as Apple, Google, and Microsoft all
ship with this feature in some of their products.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Brooks Davis
Author: brooks
Date: Tue Nov 10 19:15:13 2020
New Revision: 367577
URL: https://svnweb.freebsd.org/changeset/base/367577

Log:
  Support initializing stack variables on function entry
  
  There are two options:
   - WITH_INIT_ALL_ZERO: Zero all variables on the stack.
   - WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns.
  
  The exact pattern are a compiler implementation detail and vary by type.
  They are somewhat documented in the LLVM commit message:
  https://reviews.llvm.org/rL349442
  I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
  than naming them after the LLVM specific compiler flags.
  
  In a range of consumer products, options like these are used in
  both debug and production builds with debugs builds using patterns
  (intended to provoke crashes on use of uninitialized values) and
  production using zeros (deemed more likely to lead to harmless
  misbehavior or NULL-pointer dereferences).
  
  Reviewed by:  emaste
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27131

Added:
  head/tools/build/options/WITH_INIT_ALL_PATTERN   (contents, props changed)
  head/tools/build/options/WITH_INIT_ALL_ZERO   (contents, props changed)
Modified:
  head/share/mk/bsd.compiler.mk
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.opts.mk
  head/share/mk/bsd.prog.mk
  head/sys/conf/kern.mk

Modified: head/share/mk/bsd.compiler.mk
==
--- head/share/mk/bsd.compiler.mk   Tue Nov 10 19:09:35 2020
(r367576)
+++ head/share/mk/bsd.compiler.mk   Tue Nov 10 19:15:13 2020
(r367577)
@@ -24,6 +24,7 @@
 # - c++11: supports full (or nearly full) C++11 programming environment.
 # - retpoline: supports the retpoline speculative execution vulnerability
 #  mitigation.
+# - init-all:  supports stack variable initialization.
 #
 # These variables with an X_ prefix will also be provided if XCC is set.
 #
@@ -214,7 +215,7 @@ ${X_}COMPILER_FEATURES= c++11 c++14
 ${X_}COMPILER_FEATURES+=   c++17
 .endif
 .if ${${X_}COMPILER_TYPE} == "clang"
-${X_}COMPILER_FEATURES+=   retpoline
+${X_}COMPILER_FEATURES+=   retpoline init-all
 .endif
 
 .else

Modified: head/share/mk/bsd.lib.mk
==
--- head/share/mk/bsd.lib.mkTue Nov 10 19:09:35 2020(r367576)
+++ head/share/mk/bsd.lib.mkTue Nov 10 19:15:13 2020(r367577)
@@ -85,6 +85,25 @@ LDFLAGS+= -Wl,-zretpolineplt
 .endif
 .endif
 
+# Initialize stack variables on function entry
+.if ${MK_INIT_ALL_ZERO} == "yes"
+.if ${COMPILER_FEATURES:Minit-all}
+CFLAGS+= -ftrivial-auto-var-init=zero \
+-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+CXXFLAGS+= -ftrivial-auto-var-init=zero \
+-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+.else
+.warning InitAll (zeros) requested but not support by compiler
+.endif
+.elif ${MK_INIT_ALL_PATTERN} == "yes"
+.if ${COMPILER_FEATURES:Minit-all}
+CFLAGS+= -ftrivial-auto-var-init=pattern
+CXXFLAGS+= -ftrivial-auto-var-init=pattern
+.else
+.warning InitAll (pattern) requested but not support by compiler
+.endif
+.endif
+
 .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
 empty(DEBUG_FLAGS:M-gdwarf*)
 CFLAGS+= ${DEBUG_FILES_CFLAGS}

Modified: head/share/mk/bsd.opts.mk
==
--- head/share/mk/bsd.opts.mk   Tue Nov 10 19:09:35 2020(r367576)
+++ head/share/mk/bsd.opts.mk   Tue Nov 10 19:15:13 2020(r367577)
@@ -71,6 +71,8 @@ __DEFAULT_NO_OPTIONS = \
 BIND_NOW \
 CCACHE_BUILD \
 CTF \
+INIT_ALL_PATTERN \
+INIT_ALL_ZERO \
 INSTALL_AS_USER \
 PIE \
 RETPOLINE \
@@ -84,6 +86,10 @@ __DEFAULT_DEPENDENT_OPTIONS = \
 
 
 .include 
+
+.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes"
+.error WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive.
+.endif
 
 #
 # Supported NO_* options (if defined, MK_* will be forced to "no",

Modified: head/share/mk/bsd.prog.mk
==
--- head/share/mk/bsd.prog.mk   Tue Nov 10 19:09:35 2020(r367576)
+++ head/share/mk/bsd.prog.mk   Tue Nov 10 19:15:13 2020(r367577)
@@ -60,6 +60,25 @@ LDFLAGS+= -Wl,-zretpolineplt
 .endif
 .endif
 
+# Initialize stack variables on function entry
+.if ${MK_INIT_ALL_ZERO} == "yes"
+.if ${COMPILER_FEATURES:Minit-all}
+CFLAGS+= -ftrivial-auto-var-init=zero \
+-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+CXXFLAGS+= -ftrivial-auto-var-init=zero \
+-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+.else
+.warning InitAll (zeros) requested but not support by compiler
+.endif
+.elif ${MK_INIT_ALL_PATTERN} == 

svn commit: r367576 - in head/lib/csu/tests: . dynamic dynamicpie

2020-11-10 Thread John Baldwin
Author: jhb
Date: Tue Nov 10 19:09:35 2020
New Revision: 367576
URL: https://svnweb.freebsd.org/changeset/base/367576

Log:
  Add C startup code tests for PIE binaries.
  
  - Force dynamic to be a non-PIE binary.
  
  - Add a dynamicpie test which uses a PIE binary.
  
  Reviewed by:  andrew
  Obtained from:CheriBSD
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27127

Added:
  head/lib/csu/tests/dynamicpie/
  head/lib/csu/tests/dynamicpie/Makefile
 - copied, changed from r367573, head/lib/csu/tests/dynamic/Makefile
Modified:
  head/lib/csu/tests/Makefile
  head/lib/csu/tests/dynamic/Makefile

Modified: head/lib/csu/tests/Makefile
==
--- head/lib/csu/tests/Makefile Tue Nov 10 19:07:30 2020(r367575)
+++ head/lib/csu/tests/Makefile Tue Nov 10 19:09:35 2020(r367576)
@@ -3,6 +3,7 @@
 SUBDIR=dso
 TESTS_SUBDIRS= dynamic
 TESTS_SUBDIRS+=dynamiclib
+TESTS_SUBDIRS+=dynamicpie
 TESTS_SUBDIRS+=static
 
 SUBDIR_DEPEND_dynamiclib=dso

Modified: head/lib/csu/tests/dynamic/Makefile
==
--- head/lib/csu/tests/dynamic/Makefile Tue Nov 10 19:07:30 2020
(r367575)
+++ head/lib/csu/tests/dynamic/Makefile Tue Nov 10 19:09:35 2020
(r367576)
@@ -2,5 +2,8 @@
 
 .PATH: ${.CURDIR:H}
 
+.include 
+MK_PIE=no
+
 .include "../Makefile.tests"
 .include 

Copied and modified: head/lib/csu/tests/dynamicpie/Makefile (from r367573, 
head/lib/csu/tests/dynamic/Makefile)
==
--- head/lib/csu/tests/dynamic/Makefile Tue Nov 10 18:12:09 2020
(r367573, copy source)
+++ head/lib/csu/tests/dynamicpie/Makefile  Tue Nov 10 19:09:35 2020
(r367576)
@@ -2,5 +2,8 @@
 
 .PATH: ${.CURDIR:H}
 
+.include 
+MK_PIE=yes
+
 .include "../Makefile.tests"
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367575 - head/lib/csu/tests

2020-11-10 Thread John Baldwin
Author: jhb
Date: Tue Nov 10 19:07:30 2020
New Revision: 367575
URL: https://svnweb.freebsd.org/changeset/base/367575

Log:
  Fix dso_handle_check for PIE executables.
  
  PIE executables use crtbeginS.o and have a non-NULL dso_handle as a
  result.
  
  Reviewed by:  andrew, emaste
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27126

Modified:
  head/lib/csu/tests/fini_test.c

Modified: head/lib/csu/tests/fini_test.c
==
--- head/lib/csu/tests/fini_test.c  Tue Nov 10 19:04:54 2020
(r367574)
+++ head/lib/csu/tests/fini_test.c  Tue Nov 10 19:07:30 2020
(r367575)
@@ -141,9 +141,9 @@ dso_handle_check(void)
 {
void *dso = __dso_handle;
 
-#ifdef DSO_LIB
+#if defined(DSO_LIB) || defined(__PIE__)
ATF_REQUIRE_MSG(dso != NULL,
-   "Null __dso_handle in DSO");
+   "Null __dso_handle in DSO/PIE");
 #else
ATF_REQUIRE_MSG(dso == NULL,
"Invalid __dso_handle in non-DSO");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367574 - head/lib/csu/common

2020-11-10 Thread John Baldwin
Author: jhb
Date: Tue Nov 10 19:04:54 2020
New Revision: 367574
URL: https://svnweb.freebsd.org/changeset/base/367574

Log:
  Rename __JCR_LIST__ to __JCR_END__ in crtend.c.
  
  This is more consistent with the names used for .ctor and .dtor
  symbols and better reflects __JCR_END__'s role.
  
  Reviewed by:  andrew
  Obtained from:CheriBSD
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27125

Modified:
  head/lib/csu/common/crtend.c

Modified: head/lib/csu/common/crtend.c
==
--- head/lib/csu/common/crtend.cTue Nov 10 18:12:09 2020
(r367573)
+++ head/lib/csu/common/crtend.cTue Nov 10 19:04:54 2020
(r367574)
@@ -28,7 +28,7 @@ __FBSDID("$FreeBSD$");
 
 typedef void (*crt_func)(void);
 
-static crt_func __JCR_LIST__[] __section(".jcr") __used = {
+static crt_func __JCR_END__[] __section(".jcr") __used = {
(crt_func)0
 };
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367573 - head/sys/vm

2020-11-10 Thread Jonathan T. Looney
Author: jtl
Date: Tue Nov 10 18:12:09 2020
New Revision: 367573
URL: https://svnweb.freebsd.org/changeset/base/367573

Log:
  When destroying a UMA zone which has a reserve (set with
  uma_zone_reserve()), messages like the following appear on the console:
  "Freed UMA keg (Test zone) was not empty (0 items). Lost 528 pages of
  memory."
  
  When keg_drain_domain() is draining the zone, it tries to keep the number
  of items specified in the reservation. However, when we are destroying the
  UMA zone, we do not need to keep those items. Therefore, when destroying a
  non-secondary and non-cache zone, we should reset the keg reservation to 0
  prior to draining the zone.
  
  Reviewed by:  markj
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D27129

Modified:
  head/sys/vm/uma_core.c

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Tue Nov 10 18:10:50 2020(r367572)
+++ head/sys/vm/uma_core.c  Tue Nov 10 18:12:09 2020(r367573)
@@ -2791,6 +2791,10 @@ zone_dtor(void *arg, int size, void *udata)
rw_wlock(_rwlock);
LIST_REMOVE(zone, uz_link);
rw_wunlock(_rwlock);
+   if ((zone->uz_flags & (UMA_ZONE_SECONDARY | UMA_ZFLAG_CACHE)) == 0) {
+   keg = zone->uz_keg;
+   keg->uk_reserve = 0;
+   }
zone_reclaim(zone, M_WAITOK, true);
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367572 - head/sys/kern

2020-11-10 Thread Mateusz Guzik
Author: mjg
Date: Tue Nov 10 18:10:50 2020
New Revision: 367572
URL: https://svnweb.freebsd.org/changeset/base/367572

Log:
  Allow rtprio_thread to operate on threads of any process
  
  This in particular unbreaks rtkit.
  
  The limitation was a leftover of previous state, to quote a
  comment:
  
  /*
   * Though lwpid is unique, only current process is supported
   * since there is no efficient way to look up a LWP yet.
   */
  
  Long since then a global tid hash was introduced to remedy
  the problem.
  
  Permission checks still apply.
  
  Submitted by: greg_unrelenting.technology (Greg V)
  Differential Revision:https://reviews.freebsd.org/D27158

Modified:
  head/sys/kern/kern_resource.c

Modified: head/sys/kern/kern_resource.c
==
--- head/sys/kern/kern_resource.c   Tue Nov 10 18:07:13 2020
(r367571)
+++ head/sys/kern/kern_resource.c   Tue Nov 10 18:10:50 2020
(r367572)
@@ -315,8 +315,7 @@ sys_rtprio_thread(struct thread *td, struct rtprio_thr
td1 = td;
PROC_LOCK(p);
} else {
-   /* Only look up thread in current process */
-   td1 = tdfind(uap->lwpid, curproc->p_pid);
+   td1 = tdfind(uap->lwpid, -1);
if (td1 == NULL)
return (ESRCH);
p = td1->td_proc;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367570 - head/share/mk

2020-11-10 Thread Bryan Drewery
Author: bdrewery
Date: Tue Nov 10 18:05:17 2020
New Revision: 367570
URL: https://svnweb.freebsd.org/changeset/base/367570

Log:
  makeman: Don't require filemon with MK_DIRDEPS_BUILD.
  
  MFC after:2 weeks
  Reviewed by:  sjg, dim (tested earlier version)
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D27134

Modified:
  head/share/mk/local.meta.sys.mk

Modified: head/share/mk/local.meta.sys.mk
==
--- head/share/mk/local.meta.sys.mk Tue Nov 10 14:23:46 2020
(r367569)
+++ head/share/mk/local.meta.sys.mk Tue Nov 10 18:05:17 2020
(r367570)
@@ -178,6 +178,10 @@ LDFLAGS_LAST+= -L${STAGE_LIBDIR}
 # we can use this but should not update it.
 UPDATE_DEPENDFILE= NO
 .endif
+# Don't require filemon for makeman.
+.if make(showconfig)
+UPDATE_DEPENDFILE= NO
+.endif
 
 # define the list of places that contain files we are responsible for
 .MAKE.META.BAILIWICK = ${SB} ${OBJROOT} ${STAGE_ROOT}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367569 - head/sys/contrib/openzfs/module/zfs

2020-11-10 Thread Mateusz Guzik
Author: mjg
Date: Tue Nov 10 14:23:46 2020
New Revision: 367569
URL: https://svnweb.freebsd.org/changeset/base/367569

Log:
  zfs: combine zio caches if possible
  
  This deduplicates 2 sets of caches using the same sizes.
  
  Memory savings fluctuate a lot, one sample result is buildworld on zfs
  saving ~180MB RAM in reduced page count associated with zio caches.

Modified:
  head/sys/contrib/openzfs/module/zfs/zio.c

Modified: head/sys/contrib/openzfs/module/zfs/zio.c
==
--- head/sys/contrib/openzfs/module/zfs/zio.c   Tue Nov 10 14:21:23 2020
(r367568)
+++ head/sys/contrib/openzfs/module/zfs/zio.c   Tue Nov 10 14:23:46 2020
(r367569)
@@ -204,6 +204,19 @@ zio_init(void)
 
if (align != 0) {
char name[36];
+   if (cflags == data_cflags) {
+   /*
+* Resulting kmem caches would be identical.
+* Save memory by creating only one.
+*/
+   (void) snprintf(name, sizeof (name),
+   "zio_buf_comb_%lu", (ulong_t)size);
+   zio_buf_cache[c] = kmem_cache_create(name,
+   size, align, NULL, NULL, NULL, NULL, NULL,
+   cflags);
+   zio_data_buf_cache[c] = zio_buf_cache[c];
+   continue;
+   }
(void) snprintf(name, sizeof (name), "zio_buf_%lu",
(ulong_t)size);
zio_buf_cache[c] = kmem_cache_create(name, size,
@@ -234,37 +247,55 @@ zio_init(void)
 void
 zio_fini(void)
 {
-   size_t c;
-   kmem_cache_t *last_cache = NULL;
-   kmem_cache_t *last_data_cache = NULL;
+   size_t i, j, n;
+   kmem_cache_t *cache;
 
-   for (c = 0; c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; c++) {
-#ifdef _ILP32
-   /*
-* Cache size limited to 1M on 32-bit platforms until ARC
-* buffers no longer require virtual address space.
-*/
-   if (((c + 1) << SPA_MINBLOCKSHIFT) > zfs_max_recordsize)
-   break;
-#endif
+   n = SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT;
+
 #if defined(ZFS_DEBUG) && !defined(_KERNEL)
-   if (zio_buf_cache_allocs[c] != zio_buf_cache_frees[c])
+   for (i = 0; i < n; i++) {
+   if (zio_buf_cache_allocs[i] != zio_buf_cache_frees[i])
(void) printf("zio_fini: [%d] %llu != %llu\n",
-   (int)((c + 1) << SPA_MINBLOCKSHIFT),
-   (long long unsigned)zio_buf_cache_allocs[c],
-   (long long unsigned)zio_buf_cache_frees[c]);
+   (int)((i + 1) << SPA_MINBLOCKSHIFT),
+   (long long unsigned)zio_buf_cache_allocs[i],
+   (long long unsigned)zio_buf_cache_frees[i]);
+   }
 #endif
-   if (zio_buf_cache[c] != last_cache) {
-   last_cache = zio_buf_cache[c];
-   kmem_cache_destroy(zio_buf_cache[c]);
+
+   /*
+* The same kmem cache can show up multiple times in both zio_buf_cache
+* and zio_data_buf_cache. Do a wasteful but trivially correct scan to
+* sort it out.
+*/
+   for (i = 0; i < n; i++) {
+   cache = zio_buf_cache[i];
+   if (cache == NULL)
+   continue;
+   for (j = i; j < n; j++) {
+   if (cache == zio_buf_cache[j])
+   zio_buf_cache[j] = NULL;
+   if (cache == zio_data_buf_cache[j])
+   zio_data_buf_cache[j] = NULL;
}
-   zio_buf_cache[c] = NULL;
+   kmem_cache_destroy(cache);
+   }
 
-   if (zio_data_buf_cache[c] != last_data_cache) {
-   last_data_cache = zio_data_buf_cache[c];
-   kmem_cache_destroy(zio_data_buf_cache[c]);
+   for (i = 0; i < n; i++) {
+   cache = zio_data_buf_cache[i];
+   if (cache == NULL)
+   continue;
+   for (j = i; j < n; j++) {
+   if (cache == zio_data_buf_cache[j])
+   zio_data_buf_cache[j] = NULL;
}
-   zio_data_buf_cache[c] = NULL;
+   kmem_cache_destroy(cache);
+   }
+
+   for (i = 0; i < n; i++) {
+   if (zio_buf_cache[i] != NULL)
+   panic("zio_fini: zio_buf_cache[%d] != NULL", (int)i);
+   if (zio_data_buf_cache[i] != NULL)
+   panic("zio_fini: zio_data_buf_cache[%d] != 

svn commit: r367568 - head/sys/contrib/openzfs/module/zfs

2020-11-10 Thread Mateusz Guzik
Author: mjg
Date: Tue Nov 10 14:21:23 2020
New Revision: 367568
URL: https://svnweb.freebsd.org/changeset/base/367568

Log:
  zfs: g/c unused data_alloc_arena

Modified:
  head/sys/contrib/openzfs/module/zfs/zio.c

Modified: head/sys/contrib/openzfs/module/zfs/zio.c
==
--- head/sys/contrib/openzfs/module/zfs/zio.c   Tue Nov 10 14:17:05 2020
(r367567)
+++ head/sys/contrib/openzfs/module/zfs/zio.c   Tue Nov 10 14:21:23 2020
(r367568)
@@ -144,7 +144,6 @@ void
 zio_init(void)
 {
size_t c;
-   vmem_t *data_alloc_arena = NULL;
 
zio_cache = kmem_cache_create("zio_cache",
sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
@@ -213,8 +212,7 @@ zio_init(void)
(void) snprintf(name, sizeof (name), "zio_data_buf_%lu",
(ulong_t)size);
zio_data_buf_cache[c] = kmem_cache_create(name, size,
-   align, NULL, NULL, NULL, NULL,
-   data_alloc_arena, data_cflags);
+   align, NULL, NULL, NULL, NULL, NULL, data_cflags);
}
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367567 - head/sbin/reboot

2020-11-10 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Tue Nov 10 14:17:05 2020
New Revision: 367567
URL: https://svnweb.freebsd.org/changeset/base/367567

Log:
  Address a mandoc warning
  
  MFC after:3 days

Modified:
  head/sbin/reboot/boot_i386.8

Modified: head/sbin/reboot/boot_i386.8
==
--- head/sbin/reboot/boot_i386.8Tue Nov 10 13:36:07 2020
(r367566)
+++ head/sbin/reboot/boot_i386.8Tue Nov 10 14:17:05 2020
(r367567)
@@ -89,7 +89,7 @@ from partition
 of either the floppy or the hard disk.
 This boot may be aborted by typing any character on the keyboard
 at the
-.Ql boot:
+.Ql boot\&:
 prompt.
 At this time, the following input will be accepted:
 .Bl -tag -width indent
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367555 - head/sys/dev/mlx4/mlx4_ib

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 12:58:25 2020
New Revision: 367555
URL: https://svnweb.freebsd.org/changeset/base/367555

Log:
  Include GID type when deleting GIDs from HW table under RoCE in mlx4ib.
  Refer to the Linux commit mentioned below for a more detailed description.
  
  Linux commit:
  a18177925c252da7801149abe217c05b80884798
  
  Requested by: Isilon
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c

Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
==
--- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cTue Nov 10 12:45:59 2020
(r367554)
+++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cTue Nov 10 12:58:25 2020
(r367555)
@@ -371,8 +371,13 @@ static int mlx4_ib_del_gid(struct ib_device *device,
if (!gids) {
ret = -ENOMEM;
} else {
-   for (i = 0; i < MLX4_MAX_PORT_GIDS; i++)
-   memcpy([i].gid, 
_gid_table->gids[i].gid, sizeof(union ib_gid));
+   for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) {
+   memcpy([i].gid,
+  _gid_table->gids[i].gid,
+  sizeof(union ib_gid));
+   gids[i].gid_type =
+   port_gid_table->gids[i].gid_type;
+   }
}
}
spin_unlock_bh(>lock);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367552 - head/share/man/man7

2020-11-10 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Tue Nov 10 11:32:01 2020
New Revision: 367552
URL: https://svnweb.freebsd.org/changeset/base/367552

Log:
  Do not document MOTIFLIB in ports(7)
  
  Perhaps it made sense in 1998 (r32836), but now it feels a bit out of
  place.  We tend to avoid documenting non-essential ports variables in
  the manual page (we try to document them in the Porter's Handbook instead).
  
  MFC after:1 week

Modified:
  head/share/man/man7/ports.7

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Tue Nov 10 10:40:44 2020(r367551)
+++ head/share/man/man7/ports.7 Tue Nov 10 11:32:01 2020(r367552)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 3, 2020
+.Dd November 10, 2020
 .Dt PORTS 7
 .Os
 .Sh NAME
@@ -509,9 +509,6 @@ Normally
 .Xr fetch 1 .
 .It Va FORCE_PKG_REGISTER
 If set, overwrite any existing package registration on the system.
-.It Va MOTIFLIB
-Location of
-.Pa "libXm\&." Ns Brq Pa a , Ns Pa so .
 .It Va INTERACTIVE
 If defined, only operate on a port if it requires interaction.
 .It Va BATCH
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367551 - head

2020-11-10 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Tue Nov 10 10:40:44 2020
New Revision: 367551
URL: https://svnweb.freebsd.org/changeset/base/367551

Log:
  Add an entry for r351863 (honoring ${name}_env in rc(8) scripts)
  
  PR:   239692
  Requested by: koobs

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Tue Nov 10 10:19:55 2020(r367550)
+++ head/RELNOTES   Tue Nov 10 10:40:44 2020(r367551)
@@ -157,6 +157,13 @@ r352304:
ntpd is no longer by default locked in memory. rlimit memlock 32
or rlimit memlock 0 can be used to restore this behaviour.
 
+r351863:
+   rc.subr(8) now honors ${name}_env in all rc(8) scripts.  Previously,
+   environment variables set by a user via ${name}_env were ignored
+   if the service defined a custom *_cmd variable to control the behavior
+   of the run_rc_command function, e.g., start_cmd, instead of relying on
+   the variables like command and command_args,
+
 r351770,r352920,r352922,r352923:
dd(1) now supports conv=fsync, conv=fdatasync, oflag=fsync, oflag=sync,
and iflag=fullblock flags, compatible with illumos and GNU.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367549 - head

2020-11-10 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Tue Nov 10 10:17:11 2020
New Revision: 367549
URL: https://svnweb.freebsd.org/changeset/base/367549

Log:
  Add an entry to RELNOTES about renaming ACPI_DMAR to IOMMU
  
  Reviewed by:  br (earlier version)
  Differential Revision:https://reviews.freebsd.org/D26813

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Tue Nov 10 08:59:55 2020(r367548)
+++ head/RELNOTES   Tue Nov 10 10:17:11 2020(r367549)
@@ -10,6 +10,11 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r366267:
+Kernel option ACPI_DMAR was renamed to IOMMU.  amd64's IOMMU subsystem
+was split out from amd64 DMAR support and is now generic, i.e., it can
+be used by all architectures.
+
 r364896:
A series of commits ending with r364896 added NFS over TLS
to the kernel.  This is believed to be compatible with
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"