HardenedBSD/hardenedbsd 57f436detc/defaults rc.conf, etc/periodic/weekly 340.noid

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

* freebsd/11-stable/master:
  MFC r340322-r340324,r340327: periodic/etc/weekly/340.noid
  MFC r340321: Move definition of $jail_conf variable to /etc/defaults/rc.conf from jail 
startup script so it can be successfully queried with the command "sysrc jail_conf".
  MFC r340319: jail(8): introduce new command option -e to exhibit a list of configured 
non-wildcard jails with their parameters, no matter running or not.

HardenedBSD/hardenedbsd bae2615etc/periodic/weekly 340.noid

MFC r340322-r340324,r340327: periodic/etc/weekly/340.noid

Prevent periodic/etc/weekly/340.noid from descending into root directories
of jails. Jails have their own user/group databases and this script
can produce multiple false warnings, not to mention significant extra
load in case of large jailed subtrees. Leave this check for jailed
invocations of the same script.

HardenedBSD/hardenedbsd 3b185deetc/defaults rc.conf, etc/rc.d jail

MFC r340321: Move definition of $jail_conf variable to /etc/defaults/rc.conf
from jail startup script so it can be successfully queried
with the command "sysrc jail_conf".

HardenedBSD/hardenedbsd ec12841usr.sbin/jail jail.c jail.8

MFC r340319: jail(8): introduce new command option -e to exhibit
a list of configured non-wildcard jails with their parameters,
no matter running or not.

The option -e takes separator argument that is used
to separate printed parameters. It will be used with following
additions to system periodic scripts to differentiate parts
of directory tree belonging jails as opposed to host's.

HardenedBSD/hardenedbsd 64ad435sys/dev/sfxge sfxge_tx.c sfxge_ev.c, sys/dev/sfxge/common efx_nic.c

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

* origin/hardened/current/master:
  rtwn, rsu: add more USB ids.
  sfxge(4): use n Tx queues instead of n + 2 on EF10 HW
  sfxge(4): prepare the number of Tx queues on event queue 0 to become variable
  sfxge(4): report support for Tx checksum op descriptors
  sfxge(4): populate per-event queue stats in sysctl
  powerpc/booke: Replace a logical equivalent of pmap_kextract() with a real call

HardenedBSD/hardenedbsd 051c655sys/dev/sfxge sfxge_tx.c sfxge_ev.c, sys/dev/sfxge/common efx_nic.c

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

* freebsd/current/master:
  rtwn, rsu: add more USB ids.
  sfxge(4): use n Tx queues instead of n + 2 on EF10 HW
  sfxge(4): prepare the number of Tx queues on event queue 0 to become variable
  sfxge(4): report support for Tx checksum op descriptors
  sfxge(4): populate per-event queue stats in sysctl
  powerpc/booke: Replace a logical equivalent of pmap_kextract() with a real call

HardenedBSD/hardenedbsd 2d987basys/dev/rtwn/usb rtwn_usb_attach.h, sys/dev/usb usbdevs

rtwn, rsu: add more USB ids.

PR:            233638
Submitted by:   cezary.sliwa at gmail.com
MFC after:      3 days

HardenedBSD/hardenedbsd 9aa88ecsys/dev/sfxge sfxge_tx.c sfxge_ev.c

sfxge(4): use n Tx queues instead of n + 2 on EF10 HW

On EF10 HW we can avoid sending packets without checksum offload
or with IP-only checksum offload to dedicated queues. Instead, we
can use option descriptors to change offload policy on any queue
during runtime. Thus, we don't need to create two dedicated queues.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18390

HardenedBSD/hardenedbsd b3dce2dsys/dev/sfxge sfxge.c sfxge_tx.c

sfxge(4): prepare the number of Tx queues on event queue 0 to become variable

The number of Tx queues on event queue 0 can depend on the NIC family type,
and this property will be leveraged by future patches.
This patch prepares the code for this change.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18389

HardenedBSD/hardenedbsd 641fe35sys/dev/sfxge/common efx_nic.c efx.h

sfxge(4): report support for Tx checksum op descriptors

FreeBSD driver needs a patch to provide a means for packets
which do not need checksum offload but have flow ID set
to avoid hitting only the first Tx queue (which has been used
for packets not needing checksum offload).

This should be possible on Huntington, Medford or Medford2 chips
since these support toggling checksum offload on any given queue
dynamically by means of pushing option descriptors.

The patch for FreeBSD driver will then need a means to figure out
whether the feature can be used, and testing adapter family might
not be a good solution.

This patch adds a feature bit specifically to indicate support
for checksum option descriptors. The new feature bits may have
more users in future, apart from the mentioned FreeBSD patch.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18388

HardenedBSD/hardenedbsd 61f3f70sys/dev/sfxge sfxge_ev.c sfxge.h

sfxge(4): populate per-event queue stats in sysctl

In order to find out why the first event queue and corresponding
interrupt is triggered more frequent, it is useful to know which
events go to each event queue.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18418

HardenedBSD/hardenedbsd 4002ee2stand/powerpc/uboot ppc64_elf_freebsd.c Makefile

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

* origin/hardened/current/master:
  powerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels

HardenedBSD/hardenedbsd e1c2b59stand/powerpc/uboot ppc64_elf_freebsd.c Makefile

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

* freebsd/current/master:
  powerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels

HardenedBSD/hardenedbsd 3983d16lib/libprocstat libprocstat.c, libexec/rtld-elf rtld.c rtld.h

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

* freebsd/12-stable/master:
  MFC r341448: Print type designator 'D' for the KF_TYPE_DEV files.
  MFC r341447: Improve procstat reporting for the linux cdev file descriptors.
  MFC r341439: Provide naive but self-contained implementations of memset(3) and bzero(3) 
for rtld.
  MFC r341441: Some fixes for LD_BIND_NOW + ifuncs.

HardenedBSD/hardenedbsd b37cd86lib/libprocstat libprocstat.c, libexec/rtld-elf rtld.c

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

* origin/hardened/11-stable/master:
  MFC r341448: Print type designator 'D' for the KF_TYPE_DEV files.
  MFC r341447: Improve procstat reporting for the linux cdev file descriptors.
  MFC r341439: Provide naive but self-contained implementations of memset(3) and bzero(3) 
for rtld.
  MFC r341441: Some fixes for LD_BIND_NOW + ifuncs.

HardenedBSD/hardenedbsd 13e24bblib/libprocstat libprocstat.c libprocstat.h, libexec/rtld-elf rtld.c

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

* freebsd/11-stable/master:
  MFC r341448: Print type designator 'D' for the KF_TYPE_DEV files.
  MFC r341447: Improve procstat reporting for the linux cdev file descriptors.
  MFC r341439: Provide naive but self-contained implementations of memset(3) and bzero(3) 
for rtld.
  MFC r341441: Some fixes for LD_BIND_NOW + ifuncs.

HardenedBSD/hardenedbsd b73b2f4sys/powerpc/mpc85xx platform_mpc85xx.c

powerpc/booke: Replace a logical equivalent of pmap_kextract() with a real call

No sense in reinventing the wheel here.  AP bringup is not a time-critical
point.

HardenedBSD/hardenedbsd f71d2bdstand/powerpc/uboot ppc64_elf_freebsd.c conf.c

powerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels

This is just a copy of powerpc/ofw's ppc64_elf_freebsd.c modified to fit
ubldr's boot format.

MFC after:      1 week

HardenedBSD/hardenedbsd 312f8ddlib/libprocstat libprocstat.c libprocstat.h, usr.bin/fstat fstat.c

MFC r341448:
Print type designator 'D' for the KF_TYPE_DEV files.

HardenedBSD/hardenedbsd 0cd3828sys/compat/linuxkpi/common/src linux_compat.c, sys/sys user.h

MFC r341447:
Improve procstat reporting for the linux cdev file descriptors.

HardenedBSD/hardenedbsd 29db5cclib/libprocstat libprocstat.c libprocstat.h, usr.bin/fstat fstat.c

MFC r341448:
Print type designator 'D' for the KF_TYPE_DEV files.

HardenedBSD/hardenedbsd 784155fsys/compat/linuxkpi/common/src linux_compat.c, sys/sys user.h

MFC r341447:
Improve procstat reporting for the linux cdev file descriptors.

HardenedBSD/hardenedbsd 19c397elibexec/rtld-elf rtld.c

MFC r341439:
Provide naive but self-contained implementations of memset(3) and
bzero(3) for rtld.

HardenedBSD/hardenedbsd 65520f2libexec/rtld-elf rtld.c rtld.h

MFC r341441:
Some fixes for LD_BIND_NOW + ifuncs.

HardenedBSD/hardenedbsd 7b874d5libexec/rtld-elf rtld.c

MFC r341439:
Provide naive but self-contained implementations of memset(3) and
bzero(3) for rtld.

HardenedBSD/hardenedbsd 5e3ab38libexec/rtld-elf rtld.c rtld.h

MFC r341441:
Some fixes for LD_BIND_NOW + ifuncs.

HardenedBSD/hardenedbsd 22ca31fcontrib/wpa/src/ap wpa_auth_ft.c dpp_hostapd.c, contrib/wpa/src/common dpp.c qca-vendor.h

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

* origin/hardened/current/master: (22 commits)
  Fix typo in powerpcspe name.
  Send a START UNIT command when a disk responds with an ASC of 04/1C. This will hopefully 
spin up a disk that's in low-power mode.
  ping(8): remove needless comparision with LONG_MAX after unsigned long ultmp changed to 
long ltmp in r340245.
  HBSD: Resolve merge conflicts
  blst_leaf_alloc updates bighint for a leaf when an allocation is successful and includes 
the last block represented by the leaf.  The reasoning is that, if the last block is 
included, then there must be no solution before that one in the leaf, so the leaf cannot 
provide an allocation that big again; indeed, the leaf cannot provide a solution bigger 
than range1.
  Fix devstat on md devices.
  I missed powerpcspe in the previous commit for excluding mps and mpr. I also learned 
that 'mips' is overly broad and covers 64bit architectures too.  However, it's not worth 
the fight right now, so any refinements will have to come another day.
  Don't allocate the config_intrhook separately from the softc, it's small enough that it 
costs more code to handle the malloc/free than it saves.
  Copy and clear the reply descriptor atomically.  This prevents concurrency in the 
interrupt handlers (usually due to timeout/error recovery) from seeing and processing the 
same descriptor twice.
  Remove the mps driver from powerpc 32bit GENERIC, and don't build it and mpr as a module 

    [19 lines not shown]

HardenedBSD/hardenedbsd a52b349sbin/ping ping.c, sys/cam/scsi scsi_all.c

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

* freebsd/current/master:
  Fix typo in powerpcspe name.
  Send a START UNIT command when a disk responds with an ASC of 04/1C. This will hopefully 
spin up a disk that's in low-power mode.
  ping(8): remove needless comparision with LONG_MAX after unsigned long ultmp changed to 
long ltmp in r340245.
  blst_leaf_alloc updates bighint for a leaf when an allocation is successful and includes 
the last block represented by the leaf.  The reasoning is that, if the last block is 
included, then there must be no solution before that one in the leaf, so the leaf cannot 
provide an allocation that big again; indeed, the leaf cannot provide a solution bigger 
than range1.

HardenedBSD/hardenedbsd e0e4c77bin/sh expand.c, bin/sh/tests/expansion question2.0 Makefile

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

* freebsd/12-stable/master:
  MFC r341164: sh: Fix ${param?} default error message

HardenedBSD/hardenedbsd 0887da2sys/modules Makefile

Fix typo in powerpcspe name.

HardenedBSD/hardenedbsd 568f85fsys/cam/scsi scsi_all.c

Send a START UNIT command when a disk responds with an ASC of 04/1C.
This will hopefully spin up a disk that's in low-power mode.

Sponsored by: Netflix
Submitted by: scottl@

HardenedBSD/hardenedbsd bac3d63sbin/ping ping.c

ping(8): remove needless comparision with LONG_MAX
after unsigned long ultmp changed to long ltmp in r340245.

MFC after:      1 week
DeltaFile
+1-1sbin/ping/ping.c
+1-11 files

HardenedBSD/hardenedbsd b5466c0bin/sh expand.c, bin/sh/tests/expansion question2.0 Makefile

MFC r341164: sh: Fix ${param?} default error message

If word in ${param?word} is missing, the shell shall write a default error
message. So expanding ${param?} when param is not set should write an error
message like

sh: param: parameter not set

This was broken by r316417.

PR:            233585

HardenedBSD/hardenedbsd 0a42a88contrib/wpa/src/crypto crypto_openssl.c tls_openssl.c

HBSD: Resolve merge conflicts

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

HardenedBSD/hardenedbsd 5ee5565contrib/wpa/src/ap wpa_auth_ft.c dpp_hostapd.c, contrib/wpa/src/common dpp.c qca-vendor.h

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

Conflicts:
        contrib/wpa/src/crypto/crypto_openssl.c (unresolved)
        contrib/wpa/src/crypto/tls_openssl.c (unresolved)

HardenedBSD/hardenedbsd af34503sys/kern subr_blist.c

blst_leaf_alloc updates bighint for a leaf when an allocation is successful
and includes the last block represented by the leaf.  The reasoning is that,
if the last block is included, then there must be no solution before that
one in the leaf, so the leaf cannot provide an allocation that big again;
indeed, the leaf cannot provide a solution bigger than range1.

Which is all correct, except that if the value of blk passed in did not
represent the first block of the leaf, because the cursor was pointing to
the middle of the leaf, then a possible solution before the cursor may have
been ignored, and bighint cannot be updated.

Consider the sequence allocate 63 (returning address 0), free 0,63 (freeing
that same block, and allocate 1 (returning 63).  The result is that one
block is allocated from the first leaf, and the value of bighint is 0, so
that nothing can be allocated from that leaf until the only block allocated
from that leaf is freed.  This change detects that skipped-over solution,
and when there is one it makes sure that the value of bighint is not changed
when the last block is allocated.

Submitted by:   Doug Moore <dougm at rice.edu>
Tested by:      pho
X-MFC with:     r340402
Differential Revision:  https://reviews.freebsd.org/D18474
DeltaFile
+29-16sys/kern/subr_blist.c
+29-161 files

HardenedBSD/hardenedbsd 7173dd8sys/dev/md md.c

Fix devstat on md devices.

devstat_end_transaction() was called before the i/o was actually ended
(by delivering it to GEOM), so at least the i/o length was messed up.
It was always recorded as 0, so the average transaction size and the
average transfer rate was always displayed as 0.

devstat_end_transaction() was not called at all for the error case, so
there were sometimes multiple starts per end.  I didn't observe this in
practice and don't know if it did much damage.  I think it extended the
length of the i/o to the next transaction.

Reviewed by:    kib
DeltaFile
+2-2sys/dev/md/md.c
+2-21 files

HardenedBSD/hardenedbsd aae6180sys/arm/arm physmem.c, usr.sbin/bhyve ps2kbd.c pci_nvme.c

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

* freebsd/12-stable/master:
  MFC r340211:
  MFC r341393:
  MFC r340046, r340050

HardenedBSD/hardenedbsd ef03cealib/lib80211 lib80211_regdomain.c, usr.sbin/bhyve ps2kbd.c

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

* origin/hardened/11-stable/master:
  MFC r340046, r340050
  MFC r316939: [lib80211] fix a missing cleanup path.

HardenedBSD/hardenedbsd dbb432flib/lib80211 lib80211_regdomain.c, usr.sbin/bhyve ps2kbd.c

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

* freebsd/11-stable/master:
  MFC r340046, r340050
  MFC r316939: [lib80211] fix a missing cleanup path.

HardenedBSD/hardenedbsd b252165sys/modules Makefile

I missed powerpcspe in the previous commit for excluding mps and mpr.
I also learned that 'mips' is overly broad and covers 64bit architectures
too.  However, it's not worth the fight right now, so any refinements
will have to come another day.

HardenedBSD/hardenedbsd ffc505fusr.sbin/bhyve pci_nvme.c

MFC r340211:

Comestic change to try to inline the memset with SSE/AVX instructions.
Also switch from int to size_t to keep portability.

Reviewed by:    brooks
Sponsored by:   iXsystems Inc.
Differential Revision:  https://reviews.freebsd.org/D17795

HardenedBSD/hardenedbsd 9c64b7bsys/arm/arm physmem.c

MFC r341393:

  Return computed real memory size, not a value from similarly named global
  variable.

HardenedBSD/hardenedbsd b53b242contrib/wpa/src/ap wpa_auth_ft.c dpp_hostapd.c, contrib/wpa/src/common dpp.c qca-vendor.h

MFV r341618:

Update wpa 2.6 --> 2.7.

HardenedBSD/hardenedbsd c321d53usr.sbin/bhyve ps2kbd.c

MFC r340046, r340050

r340046:
Add support ps/2 scancodes for NumLock, ScrollLock and numerical keypad
keys.

PR:            213835
Submitted by:   Vasily Postnicov <ivan.zhmudo at gmail.com>
Relnotes:       Yes
Sponsored by:   iXsystems Inc.

r340050:
Remove printf for debug purpose forgotten on r340046.

Reported by:    Dmitry Luhtionov <dmitryluhtionov at gmail.com>
DeltaFile
+130-227usr.sbin/bhyve/ps2kbd.c
+130-2271 files

HardenedBSD/hardenedbsd 4b31d93usr.sbin/bhyve ps2kbd.c

MFC r340046, r340050

r340046:
Add support ps/2 scancodes for NumLock, ScrollLock and numerical keypad
keys.

PR:            213835
Submitted by:   Vasily Postnicov <ivan.zhmudo at gmail.com>
Relnotes:       Yes
Sponsored by:   iXsystems Inc.

r340050:
Remove printf for debug purpose forgotten on r340046.

Reported by:    Dmitry Luhtionov <dmitryluhtionov at gmail.com>
DeltaFile
+130-227usr.sbin/bhyve/ps2kbd.c
+130-2271 files

HardenedBSD/hardenedbsd a4498f7sys/cam cam_xpt.c

Don't allocate the config_intrhook separately from the softc, it's small
enough that it costs more code to handle the malloc/free than it saves.
DeltaFile
+4-15sys/cam/cam_xpt.c
+4-151 files

HardenedBSD/hardenedbsd c81180fshare/man/man4 Makefile, sys/modules/netgraph Makefile

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

* origin/hardened/current/master:
  Hook up ng_checksum(4) module and appropriate manpage to the build. The module was added 
back in 2016, but has never been connected.

HardenedBSD/hardenedbsd b0d1efesys/dev/mpr mpr.c, sys/dev/mps mps.c

Copy and clear the reply descriptor atomically.  This prevents concurrency
in the interrupt handlers (usually due to timeout/error recovery) from
seeing and processing the same descriptor twice.

HardenedBSD/hardenedbsd 050d2d6sys/modules Makefile, sys/powerpc/conf GENERIC

Remove the mps driver from powerpc 32bit GENERIC, and don't build it and
mpr as a module for powerpc or mips.  An upcoming commit will cause these
drivers to rely on the presence of 64bit atomic operations.  Discussed
with jhibbits.