HardenedBSD/hardenedbsd f1dfe5acontrib/openntpd configure ltmain.sh, contrib/openntpd/m4 libtool.m4

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

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

HardenedBSD/hardenedbsd d7ed480usr.sbin Makefile

HBSD: Traverse into usr.sbin/ntp if OpenNTPd is enabled

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
Sponsored-by:   SoldierX
DeltaFile
+1-0usr.sbin/Makefile
+1-01 files

HardenedBSD/hardenedbsd afbbe41

Merge remote-tracking branch 'origin/hardened/current/log' into hardened/current/unstable
DeltaFile
+0-00 files

HardenedBSD/hardenedbsd 91d32d3

Merge remote-tracking branch 'origin/hardened/current/segvguard-ng' into 
hardened/current/unstable
DeltaFile
+0-00 files

HardenedBSD/hardenedbsd 59c8677sbin/nvmecontrol util.c logpage.c, sys/dev/nvme nvme.h

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

HardenedBSD/hardenedbsd aa7d550sbin/nvmecontrol util.c logpage.c, sys/dev/nvme nvme.h

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

HardenedBSD/hardenedbsd 87d7eb2sbin/nvmecontrol util.c logpage.c, sys/dev/nvme nvme.h

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

HardenedBSD/hardenedbsd 5ebfcd8sbin/nvmecontrol util.c logpage.c, sys/dev/nvme nvme.h

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

HardenedBSD/hardenedbsd 7b14575sbin/nvmecontrol identify.c

Report some aspects of namespaces and namespace support in identify
command.

Sponsored by: Netflix
Submitted by: Matt Williams (via D11330)

HardenedBSD/hardenedbsd 7e0ae72sys/dev/nvme nvme.h

Add new definitions for namespaces.

Sponsored by: Netflix
Submitted by: Matt Williams (via D11330)
DeltaFile
+23-7sys/dev/nvme/nvme.h
+23-71 files

HardenedBSD/hardenedbsd 7b28766sbin/nvmecontrol util.c logpage.c

Move 128-bit integer routines to util.c so they can be used by more
than just the log page code.

Sponsored by: Netflix, Inc
Submitted by: Matt Williams (via D11330)

HardenedBSD/hardenedbsd adc5ef3sys/kern uipc_shm.c

Do not ignore an error from vm_mmap_object().

Found and reviewed by:  alc
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

HardenedBSD/hardenedbsd 19454c2sys/cam cam_periph.c

Fix a panic in camperiphfree().

If a peripheral driver (e.g. da, sa, cd) is added or removed from the
peripheral driver list while an unrelated peripheral driver instance (e.g.
da0, sa5, cd2) is going away and is inside camperiphfree(), we could
dereference an invalid pointer.

When peripheral drivers are added or removed (see periphdriver_register()
and periphdriver_unregister()), the peripheral driver array is resized
and existing entries are moved.

Although we hold the topology lock while we traverse the peripheral driver
list, we retain a pointer to the location of the peripheral driver pointer
and then drop the topology lock.  So we are still vulnerable to the list
getting moved around while the lock is dropped.

To solve the problem, cache a copy of the peripheral driver pointer.  If
its storage location in the list changes while we have the lock dropped, it
won't have any effect.

This doesn't solve the issue that peripheral drivers ("da", "cd", as opposed
to individual instances like "da0", "cd0") are not generally part of a
reference counting scheme to guard against deregistering them while there
are instances active.  The caller (generally the person unloading a module)
has to be aware of active drivers and not unload something that is in use.

    [11 lines not shown]
DeltaFile
+12-2sys/cam/cam_periph.c
+12-21 files

HardenedBSD/hardenedbsd 7092f4fsys/cam/scsi scsi_da.c

In scsi_zbc_in(), fill in the length in the ZBC IN CDB.

Without the allocation length set, the target will either reject
the command or complete it without transferring any data.

This fixes the REPORT ZONES command for SCSI ZBC protocol devices,
as well as ATA ZAC protocol devices that are behind a SCSI to ATA
translation layer.  (LSI/Broadcom's 12Gb SAS adapters translate ZBC
commands to ZAC commands.)  Those are Host Aware and Host Managed SMR
drives.

This will fix REPORT ZONE commands sent to the da(4) driver via the
GEOM bio interface and zonectl, and REPORT ZONE commands sent from
camcontrol(8).

Note that in the case of camcontrol(8), we currently only send
SCSI ZBC commands to native SCSI protocol devices, not ATA devices
behind a SAT layer.

sys/cam/scsi/scsi_da.c:
        Fill in the length field in scsi_zbc_in().

MFC after:      3 days
Sponsored by:   Spectra Logic

HardenedBSD/hardenedbsd 8c737c4sys/dev/cxgbe/iw_cxgbe cm.c

cxgbe/iw_cxgbe: Disable debug output by default.  The help text for the sysctl
already says that the default is 0.

Sponsored by:   Chelsio Communications

HardenedBSD/hardenedbsd 7852610sys/dev/cxgbe/iw_cxgbe cm.c

cxgbe/iw_cxgbe: Catch up with r319722.  The socket lock is not the same as the
lock for the receive buffer any more.

Sponsored by:   Chelsio Communications

HardenedBSD/hardenedbsd 535efc8sys/kern subr_blist.c

Address the remaining integer overflow issues with the "skip" parameters
and "next_skip" variables.  The "skip" value in struct blist has long been
a 64-bit quantity but various functions have implicitly truncated this
value to 32 bits.  Now, all arithmetic involving the "skip" value is 64
bits wide.  (This should allow us to relax the size limit on a swap device
in the swap pager.)

Maintain the ability to test this allocator as a user-space application by
including <stdbool.h>.

Remove an unused variable from blst_radix_print().

Reviewed by:    kib, markj
MFC after:      4 weeks
Differential Revision:  https://reviews.freebsd.org/D11358
DeltaFile
+41-58sys/kern/subr_blist.c
+41-581 files

HardenedBSD/hardenedbsd e4cbf2bsys/dev/cxgbe/tom t4_listen.c

cxgbe/t4_tom: sbspace on listening sockets is no longer supported (as of
r319722), use sol_sbrcv_hiwat instead.

Sponsored by:   Chelsio Communications

HardenedBSD/hardenedbsd 3521ec0sys/kern uipc_mbuf.c

Fix one more place uio_resid is truncated to int

A follow-up to r231949 and r194990.

Reported by:    pho@
Reviewed by:    kib@, markj@
Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D11373

HardenedBSD/hardenedbsd 8441709contrib/netbsd-tests/usr.bin/grep t_grep.sh

Expect :mmap_eof_not_eol to fail

It relies on a jemalloc feature (opt.redzone) no longer available after
r319971.

MFC with:       r318908, r319971
PR:            220309

HardenedBSD/hardenedbsd 8e6605dlib/libprocstat libprocstat.3, share/vt/fonts terminus-b32.hex

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

HardenedBSD/hardenedbsd d942d21sys/fs/pseudofs pseudofs_vnops.c

Fix LINT, broken by a -Wformat warning in r320329 with PFS_DELEN being
changed from %d to a long-width type.

Use uintmax_t casting and %ju to futureproof the format string against
potential changes with either the #define or the implementation-specific
definition for offsetof(..).

HardenedBSD/hardenedbsd c09db1bsys/cam/nvme nvme_da.c

Namespace is 32-bits, don't cast it to 16 here

HardenedBSD/hardenedbsd f03abdbsys/arm64/include endian.h

Add parentheses missed in r320388

Sponsored by:   DARPA, AFRL

HardenedBSD/hardenedbsd e82ccc4

Merge remote-tracking branch 'origin/hardened/current/log' into hardened/current/unstable
DeltaFile
+0-00 files

HardenedBSD/hardenedbsd ed01953

Merge remote-tracking branch 'origin/hardened/current/segvguard-ng' into 
hardened/current/unstable
DeltaFile
+0-00 files

HardenedBSD/hardenedbsd 35affaelib/libthr/thread thr_init.c, libexec/rshd rshd.c

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

HardenedBSD/hardenedbsd f811ef1lib/libthr/thread thr_init.c, libexec/rshd rshd.c

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

HardenedBSD/hardenedbsd c758fe5lib/libthr/thread thr_init.c, libexec/rshd rshd.c

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

HardenedBSD/hardenedbsd a0f0ffclibexec/rshd rshd.c, release/arm64 RPI3.conf

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

HardenedBSD/hardenedbsd f7fc898lib/libc/sys mmap.2, lib/libthr/thread thr_init.c

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

HardenedBSD/hardenedbsd 6420cfalib/libc/sys mmap.2, lib/libthr/thread thr_init.c

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

HardenedBSD/hardenedbsd 9a4b236lib/libc/sys mmap.2, sys/cam/scsi scsi_sa.c

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

HardenedBSD/hardenedbsd 39d09c7sys/fs/nfs nfs_commonsubs.c

Revert part of r320359, as suggested by rmacklem@.  That case is only used
for nfsuserd -manage-gids and shouldn't depend on sysctl.

MFC after:      2 weeks
Sponsored by:   DARPA, AFRL

HardenedBSD/hardenedbsd c040266sys/fs/ext2fs ext2_inode_cnv.c

ext2fs: Support e2di_uid_high and e2di_gid_high.

The fields exist on all versions of the filesystem and using them is a mount
option on linux. For FreeBSD, the corresponding i_uid and i_gid are always
long enough so use them by default.

Reviewed by:    Fedor Uporov
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D11354

HardenedBSD/hardenedbsd c9f7319release/arm64 RPI3.conf

Remove CHROOT_MAKEENV from the RPI3 configuration file, to avoid
assuming the build host is amd64.

MFC after:      3 days
X-MFC-With:     r320252, r320253, r320254
X-MFC-Note:     maybe
Sponsored by:   The FreeBSD Foundation

HardenedBSD/hardenedbsd 5a95533libexec/rshd rshd.c

A little tweak for performance

Reviewed by: adrian
Approved by: rmacklem (mentor)
MFC after: 3 weeks

HardenedBSD/hardenedbsd 022ed95sys/cam/scsi scsi_sa.c

MFC r320123:

  Fix a potential sleep while holding a mutex in the sa(4) driver.

  If the user issues a MTIOCEXTGET ioctl, and the tape drive in question has
  a serial number that is longer than 80 characters, we malloc a buffer in
  saextget() to hold the output of cam_strvis().

  Since a mutex is held in that codepath, doing a M_WAITOK malloc could lead
  to sleeping while holding a mutex.  Change it to a M_NOWAIT malloc and bail
  out if we fail to allocate the memory.  Devices with serial numbers longer
  than 80 bytes are very rare (I don't recall seeing one), so this
  should be a very unusual case to hit.  But it is a bug that should be fixed.

  sys/cam/scsi/scsi_sa.c:
        In saextget(), if we need to malloc a buffer to hold the output of
        cam_strvis(), don't wait for the memory.  Fail and return an error
        if we can't allocate the memory immediately.

PR:            kern/220094
Submitted by:   Jia-Ju Bai <baijiaju1990 at 163.com>
Sponsored by:   Spectra Logic
Approved by:    re (gjb)

HardenedBSD/hardenedbsd 622ad84sys/i386/isa npx.c

MFC r320307:
Fix indent.

Approved by:    re (marius)
DeltaFile
+1-1sys/i386/isa/npx.c
+1-11 files

HardenedBSD/hardenedbsd 20ce0f4sys/arm64/include atomic.h

Some of the atomic_clear_* functions were incorrectly defined to be an
atomic add. Correct these, fixing a NULL-pointer dereference in netgraph.

PR:            220273
MFC after:      3 days
Sponsored by:   DARPA, AFRL

HardenedBSD/hardenedbsd c550b5dlib/libc/sys mmap.2

MFC r320314:
Remove the description of MAP_HASSEMAPHORE.

Approved by:    re (marius)

HardenedBSD/hardenedbsd 9beb563

Merge remote-tracking branch 'origin/hardened/current/log' into hardened/current/unstable
DeltaFile
+0-00 files

HardenedBSD/hardenedbsd 2652aa7

Merge remote-tracking branch 'origin/hardened/current/segvguard-ng' into 
hardened/current/unstable
DeltaFile
+0-00 files

HardenedBSD/hardenedbsd 263a9accontrib/ipfilter/tools ippool_y.y, lib/libprocstat libprocstat.3 libprocstat.c

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

HardenedBSD/hardenedbsd 160687dlib/libthr/thread thr_init.c

HBSD: Backout libthr stack guard hardening entirely

This causes funky behavior with the virtual memory subsystem.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
Sponsored-by:   SoldierX
(cherry picked from commit 9a08b8eaeba7ae63ab17bc62b6cd50d31089a5f3)

HardenedBSD/hardenedbsd c0ebd89contrib/ipfilter/tools ippool_y.y, lib/libprocstat libprocstat.3 libprocstat.c

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

HardenedBSD/hardenedbsd 413ad30lib/libc/sys mmap.2

MFC r320313:
Fix typo.

Approved by:    re (marius)

HardenedBSD/hardenedbsd a82284dcontrib/ipfilter/tools ippool_y.y, lib/libprocstat libprocstat.3 libprocstat.c

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

HardenedBSD/hardenedbsd e72379ccontrib/ipfilter/tools ippool_y.y, lib/libprocstat libprocstat.3 libprocstat.c

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

HardenedBSD/hardenedbsd 9a08b8elib/libthr/thread thr_init.c

HBSD: Backout libthr stack guard hardening entirely

This causes funky behavior with the virtual memory subsystem.

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