HardenedBSD/hardenedbsd 25db914lib/libc Makefile, sbin/ifconfig ifipsec.c

Merge remote-tracking branch 'origin/hardened/current/master' into 
hardened/current/unstable

* origin/hardened/current/master:
  HBSD: Revert "libc: require ifunc-capable linker for amd64/i386"
  Set the default loader for powerpc(32- and 64-bit) back to to forth. There are some 
issues with the lua-loader. To be on the safe side, use a well known and working loader.
  Correct panic messages.
  Further reorganize pmap_invalidate TLB code.
  Update ifr_name before invoking IPSECSREQID ioctl, this fixes the case, when `ifconfig 
ipsec create reqid N` command invoked without interface unit number. The "name" global 
variable is updated after interface cloning in the ifclonecreate() and contains actual 
interface name.

HardenedBSD/hardenedbsd ade4f8dsbin/ifconfig ifipsec.c, share/mk src.opts.mk

Merge branch 'freebsd/current/master' into hardened/current/master

* freebsd/current/master:
  Set the default loader for powerpc(32- and 64-bit) back to to forth. There are some 
issues with the lua-loader. To be on the safe side, use a well known and working loader.
  Correct panic messages.
  Further reorganize pmap_invalidate TLB code.
  Update ifr_name before invoking IPSECSREQID ioctl, this fixes the case, when `ifconfig 
ipsec create reqid N` command invoked without interface unit number. The "name" global 
variable is updated after interface cloning in the ifclonecreate() and contains actual 
interface name.

HardenedBSD/hardenedbsd a0f86fcsys/amd64/amd64 pmap.c

Merge remote-tracking branch 'origin/hardened/11-stable/master' into 
hardened/11-stable/unstable

* origin/hardened/11-stable/master:
  MFC r338801: amd64 pmap: remove tautological assert.

HardenedBSD/hardenedbsd bc71fedsys/amd64/amd64 pmap.c

Merge branch 'freebsd/11-stable/master' into hardened/11-stable/master

* freebsd/11-stable/master:
  MFC r338801: amd64 pmap: remove tautological assert.

HardenedBSD/hardenedbsd 208c75alib/libc Makefile

HBSD: Revert "libc: require ifunc-capable linker for amd64/i386"

This reverts commit ef8030831eccec4e481a1766fc1c67f7cadadac9, which
breaks building 12-CURRENT from 11-STABLE. I'm hoping this revert is
only temporary.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-5lib/libc/Makefile
+0-51 files

HardenedBSD/hardenedbsd 75c7e3bshare/mk src.opts.mk

Set the default loader for powerpc(32- and 64-bit) back to to forth.
There are some issues with the lua-loader. To be on the safe side, use a well
known and working loader.

Approved by: re (glen)

HardenedBSD/hardenedbsd 1d18e5fsys/ufs/ffs ffs_softdep.c

Correct panic messages.

Reviewed by:    mckusick
Sponsored by:   The FreeBSD Foundation
Approved by:    re (rgrimes)
MFC after:      1 week

HardenedBSD/hardenedbsd 5d09d9csys/amd64/amd64 pmap.c

Further reorganize pmap_invalidate TLB code.

Split calculation of mask for shootdown IPI and local
invalidation. Reorder IPI before local.

Suggested by:   alc
Reviewed by:    alc, markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
Approved by:    re (rgrimes)
Differential revision:  https://reviews.freebsd.org/D17277
DeltaFile
+10-11sys/amd64/amd64/pmap.c
+10-111 files

HardenedBSD/hardenedbsd 9a27fbbetc hosts.allow, lib/libwrap hosts.allow

Merge remote-tracking branch 'origin/hardened/current/master' into 
hardened/current/unstable

* origin/hardened/current/master:
  We don't need shell protection for when we're expanding matches. Don't add it. This 
should fix when we do regepx matches against variables we've set and fix wifi bring up.
  Move hosts.allow to lib/libwrap/
  Improve loader passwords:
  vfs: __predict common case in VFS_EPILOGUE/PROLOGUE

HardenedBSD/hardenedbsd a171addsbin/ifconfig ifipsec.c

Update ifr_name before invoking IPSECSREQID ioctl, this fixes the case,
when `ifconfig ipsec create reqid N` command invoked without interface
unit number. The "name" global variable is updated after interface
cloning in the ifclonecreate() and contains actual interface name.

Reported by:    lev
Approved by:    re (kib)
MFC after:      1 week

HardenedBSD/hardenedbsd af180cbetc hosts.allow, lib/libwrap hosts.allow

Merge branch 'freebsd/current/master' into hardened/current/master

* freebsd/current/master:
  We don't need shell protection for when we're expanding matches. Don't add it. This 
should fix when we do regepx matches against variables we've set and fix wifi bring up.
  Move hosts.allow to lib/libwrap/
  Improve loader passwords:
  vfs: __predict common case in VFS_EPILOGUE/PROLOGUE

HardenedBSD/hardenedbsd fa96b46sys/amd64/amd64 pmap.c

MFC r338801:
amd64 pmap: remove tautological assert.

HardenedBSD/hardenedbsd 7642357sbin/devd devd.cc devd.hh

We don't need shell protection for when we're expanding matches.
Don't add it. This should fix when we do regepx matches against
variables we've set and fix wifi bring up.

PR: 231441
Approved by: re@ (kib)
Differential Revision: https://reviews.freebsd.org/D17267

HardenedBSD/hardenedbsd 87d48baetc hosts.allow Makefile, lib/libwrap hosts.allow Makefile

Move hosts.allow to lib/libwrap/

This leverages CONFS to handle the install.

Approved by:    re (blanket, pkgbase), bapt (mentor)
Differential Revision:  https://reviews.freebsd.org/D17240

HardenedBSD/hardenedbsd 52a50ffstand/lua password.lua

Improve loader passwords:

1. Be clear about which password is being requested
2. Remove extraneous whitespace between the prompt and the cursor
3. Move the twiddle to where the prompt is, instead of two characters to the right
4. Fix erasing the 'incorrect password' message when retrying; previously it was erased 
partially
5. Remove the unneeded exclamation mark

Reviewed by:    kevans
Approved by:    re (gjb)
MFC after:      2 weeks
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D17236

HardenedBSD/hardenedbsd 8e277desys/sys signalvar.h

vfs: __predict common case in VFS_EPILOGUE/PROLOGUE

NFS is the only in-tree filesystem using the feature, but all ops test
for it.

Currently the resulting sigdefer calls have to be jumped over in the
common case.

This is a bandaid, longer term fix will move this feature away.

Approved by:    re (kib)

HardenedBSD/hardenedbsd 92245d6sys/dev/cxgbe t4_l2t.c t4_filter.c, usr.sbin/cxgbetool cxgbetool.c cxgbetool.8

Merge remote-tracking branch 'origin/hardened/current/master' into 
hardened/current/unstable

* origin/hardened/current/master:
  cxgbe(4): Reuse existing "switching" L2T entries when possible.
  cxgbetool(8): The VLAN tag provided in the action for a filter must be prefixed with 
either '=' or '+'.  Fix the description of the parameter in the man page while here.

HardenedBSD/hardenedbsd 6856f26sys/dev/cxgbe t4_l2t.c t4_filter.c, usr.sbin/cxgbetool cxgbetool.c cxgbetool.8

Merge branch 'freebsd/current/master' into hardened/current/master

* freebsd/current/master:
  cxgbe(4): Reuse existing "switching" L2T entries when possible.
  cxgbetool(8): The VLAN tag provided in the action for a filter must be prefixed with 
either '=' or '+'.  Fix the description of the parameter in the man page while here.

HardenedBSD/hardenedbsd df173d1sys/net if_media.h iflib.c

Merge remote-tracking branch 'origin/hardened/11-stable/master' into 
hardened/11-stable/unstable

* origin/hardened/11-stable/master:
  Revert MFC of r334231 in r338871.
  MFC r334231, r334779, r335322, and r338208 to stable/11 from head

HardenedBSD/hardenedbsd ed3cd9bsys/net if_media.h iflib.c

Merge branch 'freebsd/11-stable/master' into hardened/11-stable/master

* freebsd/11-stable/master:
  Revert MFC of r334231 in r338871.
  MFC r334231, r334779, r335322, and r338208 to stable/11 from head

HardenedBSD/hardenedbsd 850cf04sys/dev/cxgbe t4_l2t.c t4_filter.c

cxgbe(4): Reuse existing "switching" L2T entries when possible.

Approved by:    re@ (rgrimes@)
Sponsored by:   Chelsio Communications

HardenedBSD/hardenedbsd b1c0049sys/net iflib.h iflib.c

Revert MFC of r334231 in r338871.

It did not apply cleanly and was causing build errors.

HardenedBSD/hardenedbsd 1ea393cusr.sbin/cxgbetool cxgbetool.c cxgbetool.8

cxgbetool(8): The VLAN tag provided in the action for a filter must be prefixed
with either '=' or '+'.  Fix the description of the parameter in the man page
while here.

Approved by:    re@ (kib@)
Sponsored by:   Chelsio Communications

HardenedBSD/hardenedbsd 2495295sys/net if_media.h iflib.c

MFC r334231, r334779, r335322, and r338208 to stable/11 from head

These include:
r334231: iflib: Add new shared flag: IFLIB_ADMIN_ALWAYS_RUN
r334779: iflib: Record TCP checksum info in iflib when TCP checksum is requested
r335322: iflib: Style fixes
r338208: if_media: Add new 2.5G/5G/25G/40G/50G/100G/200G/400G media types

Sponsored by:   Intel Corporation

HardenedBSD/hardenedbsd 18b3f22lib/libc Makefile, share/man/man5 src.conf.5

Merge remote-tracking branch 'origin/hardened/current/master' into 
hardened/current/unstable

* origin/hardened/current/master:
  HBSD: Regen src.conf.5
  HBSD: Disable reproducible builds by default
  MFV r338866: 9700 ZFS resilvered mirror does not balance reads
  HBSD: Resolve merge conflict
  Use the GNU as-compatible .endm instead of .endmacro.
  Convert x86 TLB top-level invalidation functions to ifuncs.
  libc: require ifunc-capable linker for amd64/i386
  Disable sbrk() use in GNU tools.
  amd64: even up copyin/copyout with memcpy + other cleanup
  Fix possible NULL pointer dereference in ffec_alloc_mbufcl().
  Include kernel ident in uname
  select: stop doing zero-sized memsets
  remove double space between branch and version in kernel ident
  amd64: check for small size in memmove, memcpy and memset
  Add an installer option to disable destructive dtrace.
  Mention setting $lines to 0 in ddb can disable paging

HardenedBSD/hardenedbsd f918500gnu/usr.bin/gdb/arch/powerpc64 config.h, gnu/usr.bin/gdb/arch/sparc64 config.h

Merge branch 'freebsd/current/master' into hardened/current/master

* freebsd/current/master:
  MFV r338866: 9700 ZFS resilvered mirror does not balance reads
  Use the GNU as-compatible .endm instead of .endmacro.
  Convert x86 TLB top-level invalidation functions to ifuncs.
  libc: require ifunc-capable linker for amd64/i386
  Disable sbrk() use in GNU tools.

HardenedBSD/hardenedbsd 73ea219share/man/man5 src.conf.5

HBSD: Regen src.conf.5

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
Sponsored-by:   SoldierX
Reported-by:    Oliver Pinter <oliver.pinter at hardenedbsd.org>
github-issue:   #343

HardenedBSD/hardenedbsd 259891asys/amd64/amd64 elf_machdep.c, sys/arm/arm elf_machdep.c

Merge remote-tracking branch 'origin/hardened/11-stable/master' into 
hardened/11-stable/unstable

* origin/hardened/11-stable/master:
  HBSD: Disable SMT by default
  Include stdbool.h so that we can use bool in linker.h.
  MFC r338211: Prepare the kernel linker to handle PC-relative ifunc relocations.
  MFC r338754:  Update the pkg-stage.sh script used to populate packages on the  dvd1.iso 
installation medium from including KDE4 to KDE5, as the  KDE4-based ports have been marked 
as deprecated in the Ports  Collection.

HardenedBSD/hardenedbsd 36ce31ashare/mk src.opts.mk

HBSD: Disable reproducible builds by default

I don't believe reproducible builds increase the security of a system.
Having version info is much more important.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
Sponsored-by:   SoldierX
Reported-by:    Oliver Pinter <oliver.pinter at hardenedbsd.org>
github-issue:   #343

HardenedBSD/hardenedbsd 70e728dsys/x86/x86 mp_x86.c

HBSD: Disable SMT by default

Due to the various Intel microarchitecture vulnerabilities, setting the
tunable `machdep.hyperthreading_allowed` to 0 by default will help
mitigate known and (potentially) unknown microarchitecture
vulnerabilities.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
Sponsored-by:   SoldierX
github-issue:   #340
MFC-to:        11-STABLE
(cherry picked from commit 9349379e6f3de268c91a59e5277272092fe7a570)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>

HardenedBSD/hardenedbsd 2fd9c7asys/amd64/amd64 elf_machdep.c, sys/arm64/arm64 elf_machdep.c

Merge branch 'freebsd/11-stable/master' into hardened/11-stable/master

* freebsd/11-stable/master:
  Include stdbool.h so that we can use bool in linker.h.
  MFC r338211: Prepare the kernel linker to handle PC-relative ifunc relocations.
  MFC r338754:  Update the pkg-stage.sh script used to populate packages on the  dvd1.iso 
installation medium from including KDE4 to KDE5, as the  KDE4-based ports have been marked 
as deprecated in the Ports  Collection.

HardenedBSD/hardenedbsd f9be2a2sys/cddl/contrib/opensolaris/uts/common/fs/zfs spa.c

MFV r338866: 9700 ZFS resilvered mirror does not balance reads

illumos/illumos-gate at 82f63c3c2bf5e4378706e8dcfccf717d67371be9

Reviewed by: Toomas Soome <tsoome at me.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni at nexenta.com>
Reviewed by: George Wilson <george.wilson at delphix.com>
Approved by: Matthew Ahrens <mahrens at delphix.com>
Author:     Jerry Jelinek <jerry.jelinek at joyent.com>

Approved by:    re (delphij)

HardenedBSD/hardenedbsd ea1b1b8release/scripts pkg-stage.sh

Merge branch 'freebsd/10-stable/master' into hardened/10-stable/master

* freebsd/10-stable/master:
  MFC r338754:  Update the pkg-stage.sh script used to populate packages on the  dvd1.iso 
installation medium from including KDE4 to KDE5, as the  KDE4-based ports have been marked 
as deprecated in the Ports  Collection.

HardenedBSD/hardenedbsd 0cb8d83usr.sbin/asf asf_kvm.c

Include stdbool.h so that we can use bool in linker.h.

As asf(8) is gone in head, this is a direct commit to stable/11.

HardenedBSD/hardenedbsd e0d7668sys/conf newvers.sh

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>

HardenedBSD/hardenedbsd 090f421share/man/man4 ddb.4, sys/amd64/amd64 support.S

Merge remote-tracking branch 'origin/freebsd/current/master' into hardened/current/master

Conflicts:
        sys/conf/newvers.sh (unresolved)

HardenedBSD/hardenedbsd 4fb9339sys/amd64/amd64 elf_machdep.c, sys/i386/i386 elf_machdep.c

MFC r338211:
Prepare the kernel linker to handle PC-relative ifunc relocations.

HardenedBSD/hardenedbsd 4b176b0sys/amd64/amd64 support.S

Use the GNU as-compatible .endm instead of .endmacro.

Approved by:    re (gjb)

HardenedBSD/hardenedbsd 6e51b54sys/amd64/amd64 pmap.c

Convert x86 TLB top-level invalidation functions to ifuncs.

Note that shootdown IPI handlers are already per-mode.

Suggested by:   alc
Reviewed by:    alc, markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
Approved by:    re (gjb)
Differential revision:  https://reviews.freebsd.org/D17184
DeltaFile
+240-137sys/amd64/amd64/pmap.c
+240-1371 files

HardenedBSD/hardenedbsd ef80308lib/libc Makefile

libc: require ifunc-capable linker for amd64/i386

We expect to introduce optimized libc routines in the near future,
which requires use of a linker that supports ifuncs.

Approved by:    re (gjb, kib)
Sponsored by:   The FreeBSD Foundation
DeltaFile
+5-0lib/libc/Makefile
+5-01 files

HardenedBSD/hardenedbsd 7c1dc0fgnu/usr.bin/gdb/arch/arm config.h, gnu/usr.bin/gdb/arch/i386 config.h

Disable sbrk() use in GNU tools.

We're studing the possibility of deprecating sbrk().  To make it easier
we're removing unnecessicary uses in the base system.  None of these
tools require sbrk(), but they agressively prefer it for no good reason.

Reviewed by:    andrew
Approved by:    re (kib)
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D16141

HardenedBSD/hardenedbsd a8eb32frelease/scripts pkg-stage.sh

MFC r338754:
 Update the pkg-stage.sh script used to populate packages on the
 dvd1.iso installation medium from including KDE4 to KDE5, as the
 KDE4-based ports have been marked as deprecated in the Ports
 Collection.

Sponsored by:   The FreeBSD Foundation

HardenedBSD/hardenedbsd 3a6c35frelease/scripts pkg-stage.sh

MFC r338754:
 Update the pkg-stage.sh script used to populate packages on the
 dvd1.iso installation medium from including KDE4 to KDE5, as the
 KDE4-based ports have been marked as deprecated in the Ports
 Collection.

Sponsored by:   The FreeBSD Foundation

HardenedBSD/hardenedbsd cc5efa9sys/amd64/amd64 support.S

amd64: even up copyin/copyout with memcpy + other cleanup

- _fault handlers for both primitives are identical, provide just one
- change the copying scheme to match memcpy (in particular jump
avoidance for the most common case of multiply of 8)
- stop re-reading pcb address on exit, just store it locally (in r9)

Reviewed by:    kib
Approved by:    re (gjb)
Differential Revision:  https://reviews.freebsd.org/D17265

HardenedBSD/hardenedbsd 0bdedeasys/dev/ffec if_ffec.c

Fix possible NULL pointer dereference in ffec_alloc_mbufcl().

PR:            231514
Approved by:    re (kib)
MFC after:      1 week

HardenedBSD/hardenedbsd f236b8esys/conf newvers.sh

Include kernel ident in uname

In non-reproducible mode we have the kernel ident as a side effect of
including the build directory.  Explicitly add it to the ident string in
reproducible mode.

Reported by:    mjg
Approved by:    re (gjb)
Sponsored by:   The FreeBSD Foundation

HardenedBSD/hardenedbsd 00ab828sys/kern sys_generic.c

select: stop doing zero-sized memsets

Approved by:    re (kib)

HardenedBSD/hardenedbsd 78fb428sys/conf newvers.sh

remove double space between branch and version in kernel ident

Reported by:    dim
Approved by:    re (kib)
Sponsored by:   The FreeBSD Foundation

HardenedBSD/hardenedbsd 36c0c43sys/amd64/amd64 support.S

amd64: check for small size in memmove, memcpy and memset

If the size is 15 bytes or less avoid spinning up rep just to copy the 8
bytes. In my tests on EPYC and old Intel microarchs without ERMS (like
Westmere) it provided a nice win over the current version (e.g. for EPYC
memset with 15 bytes of size goes from 59712651 ops/s to 70600095) all
while almost not pessimizing the other cases.

Data collected during package building shows that < 16 sizes are pretty
common.

Verified with the glibc test suite.

Approved by:    re (kib)

HardenedBSD/hardenedbsd 59e98bdusr.sbin/bsdinstall/scripts hardening

Add an installer option to disable destructive dtrace.

Submitted by:          Jörg Pernfuß <code.jpe at gmail.com>
Approved by:           re (kib)
MFC after:             1 week
Differential Revision:  https://reviews.freebsd.org/D12474