HardenedBSD/hardenedbsd 32a0cebsys/compat/lindebugfs lindebugfs.c, sys/compat/linuxkpi/common/src linux_seq_file.c

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

* origin/hardened/current/master:
  Free some space in struct ctl_io_hdr for better use.
  Further refine r336195: do not even attempt to verify/update interface's MTU if we've 
set it once and there were no changes on the DHCP server side since the last refresh. This 
is consistent I believe with how dhclient handles other settings like IP address, mask 
etc.
  gcov support
  Change seq_read to seq_load to avoid namespace conflicts with lkpi
  import linux debugfs support
  linux/fs: simplify interop and correct definition of loff_t

HardenedBSD/hardenedbsd d1caecasys/compat/lindebugfs lindebugfs.c, sys/compat/linuxkpi/common/src linux_seq_file.c

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

* freebsd/current/master:
  Free some space in struct ctl_io_hdr for better use.
  Further refine r336195: do not even attempt to verify/update interface's MTU if we've 
set it once and there were no changes on the DHCP server side since the last refresh. This 
is consistent I believe with how dhclient handles other settings like IP address, mask 
etc.
  gcov support
  Change seq_read to seq_load to avoid namespace conflicts with lkpi
  import linux debugfs support
  linux/fs: simplify interop and correct definition of loff_t

HardenedBSD/hardenedbsd d4e764esys/cam/ctl ctl.c ctl_io.h

Free some space in struct ctl_io_hdr for better use.

 - Collapse original_sc and serializing_sc fields into one, since they
are never used simultanously, we have only one local I/O and one remote.

 - Move remote_sglist and local_sglist fields into CTL_PRIV_BACKEND,
since they are used only on Originating SC in XFER mode, where requests
don't ever reach backends, so we can reuse backend's private storage.

MFC after:      2 weeks
Sponsored by:   iXsystems, Inc.

HardenedBSD/hardenedbsd 034bc5dsbin/dhclient dhclient.c

Further refine r336195: do not even attempt to verify/update interface's
MTU if we've set it once and there were no changes on the DHCP server
side since the last refresh. This is consistent I believe with how dhclient
handles other settings like IP address, mask etc.

Approved by:    cem, eugen
Differential Revision:  https://reviews.freebsd.org/D18546

HardenedBSD/hardenedbsd 87196b2sys/conf files kern.pre.mk, sys/gnu/gcov gcov_fs.c gcc_4_7.c

gcov support

add gcov support and export results as files in debugfs

Reviewed by:    hps@
MFC after:      1 week
Sponsored by:   iX Systems
Differential Revision:  https://reviews.freebsd.org/D19260

HardenedBSD/hardenedbsd ba1160dsys/kern kern_descrip.c, sys/sys seq.h

Change seq_read to seq_load to avoid namespace conflicts with lkpi

MFC after:      1 week
Sponsored by:   iX Systems

HardenedBSD/hardenedbsd d37c02fsys/compat/lindebugfs lindebugfs.c, sys/compat/linuxkpi/common/include/linux seq_file.h debugfs.h

import linux debugfs support

Reviewed by:    hps@
MFC after:      1 week
Sponsored by:   iX Systems
Differential Revision:  https://reviews.freebsd.org/D19258

HardenedBSD/hardenedbsd d75b15dsys/compat/linuxkpi/common/include/linux fs.h types.h

linux/fs: simplify interop and correct definition of loff_t

- offsets can be negative, loff_t needs to be signed, it also simplifies
  interop with the rest of the code base to use off_t than the actual linux
  definition "long long"
- don't rely on the defining "file" to "linux_file" in interface definitions
  as that causes heartache with includes

Reviewed by:    hps@
MFC after:      1 week
Sponsored by:   iX Systems
Differential Revision:  https://reviews.freebsd.org/D19274

HardenedBSD/hardenedbsd 435d7d0contrib/libc++/include __locale

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

* origin/hardened/11-stable/master:
  MFC r344386:

HardenedBSD/hardenedbsd 250e793contrib/libc++/include __locale

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

* freebsd/11-stable/master:
  MFC r344386:

HardenedBSD/hardenedbsd 44f3d19contrib/libc++/include __locale

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

* freebsd/12-stable/master:
  MFC r344386:

HardenedBSD/hardenedbsd e1160a4contrib/libc++/include __locale

MFC r344386:

Pull in r354515 from upstream libc++ trunk:

  Fix the build with gcc when `-Wredundant-decls` is passed

  Summary:

  gcc warns that `__throw_runtime_error` is declared both in
  `<__locale>` and `<stdexcept>`, if `-Wredundant-decls` is passed on
  the command line; this is the case with FreeBSD when ${WARNS} == 6.

  Since `<__locale>` gets its first declaration via a transitive
  include of `<stdexcept>`, and the second declaration is after the
  first invocation of `__throw_runtime_error`, delete that second
  declaration.

  Signed-off-by: Enji Cooper <yaneurabeya at gmail.com>

  Reviewers: kristina, MaskRay, EricWF, ldionne, ngie

  Reviewed By: EricWF

  Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits


    [5 lines not shown]

HardenedBSD/hardenedbsd be4d0e9contrib/libc++/include __locale

MFC r344386:

Pull in r354515 from upstream libc++ trunk:

  Fix the build with gcc when `-Wredundant-decls` is passed

  Summary:

  gcc warns that `__throw_runtime_error` is declared both in
  `<__locale>` and `<stdexcept>`, if `-Wredundant-decls` is passed on
  the command line; this is the case with FreeBSD when ${WARNS} == 6.

  Since `<__locale>` gets its first declaration via a transitive
  include of `<stdexcept>`, and the second declaration is after the
  first invocation of `__throw_runtime_error`, delete that second
  declaration.

  Signed-off-by: Enji Cooper <yaneurabeya at gmail.com>

  Reviewers: kristina, MaskRay, EricWF, ldionne, ngie

  Reviewed By: EricWF

  Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits


    [5 lines not shown]

HardenedBSD/hardenedbsd 92f7ff6share/man/man4 siftr.4 smartpqi.4

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

* origin/hardened/current/master:
  Fix a slew of mdoc errors and warnings.

HardenedBSD/hardenedbsd 51857b6share/man/man4 siftr.4 smartpqi.4

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

* freebsd/current/master:
  Fix a slew of mdoc errors and warnings.

HardenedBSD/hardenedbsd 4b8675dshare/man/man4 siftr.4 smartpqi.4

Fix a slew of mdoc errors and warnings.

MFC after:      1 week

HardenedBSD/hardenedbsd 5067e6cshare/man/man4 ip.4, sys/cam/ctl ctl.c ctl_ioctl.h

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

* origin/hardened/current/master:
  Support struct ip_mreqn as argument for IP_ADD_MEMBERSHIP. Legacy support for struct 
ip_mreq remains in place.
  Remove disabled CTL_LEGACY_STATS support.

HardenedBSD/hardenedbsd 49865bcshare/man/man4 ip.4, sys/cam/ctl ctl.c ctl_ioctl.h

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

* freebsd/current/master:
  Support struct ip_mreqn as argument for IP_ADD_MEMBERSHIP. Legacy support for struct 
ip_mreq remains in place.
  Remove disabled CTL_LEGACY_STATS support.

HardenedBSD/hardenedbsd 13a1011share/man/man4 ip.4, sys/netinet in_mcast.c

Support struct ip_mreqn as argument for IP_ADD_MEMBERSHIP. Legacy support
for struct ip_mreq remains in place.

The struct ip_mreqn is Linux extension to classic BSD multicast API. It
has extra field allowing to specify the interface index explicitly. In
Linux it used as argument for IP_MULTICAST_IF and IP_ADD_MEMBERSHIP.
FreeBSD kernel also declares this structure and supports it as argument
to IP_MULTICAST_IF since r170613. So, we have structure declared but
not fully supported, this confused third party application configure
scripts.

Code handling IP_ADD_MEMBERSHIP was mixed together with code for
IP_ADD_SOURCE_MEMBERSHIP.  Bringing legacy and new structure support
into the mess would made the "argument switcharoo" intolerable, so
code was separated into its own switch case clause.

MFC after:      3 months
Differential Revision:  https://reviews.freebsd.org/D19276

HardenedBSD/hardenedbsd e3f86b5sys/cam/ctl ctl.c ctl_ioctl.h

Remove disabled CTL_LEGACY_STATS support.

It was not only disabled for quite a while, but also appeared to be broken
at r325517, when maximum number of ports was made configurable.

MFC after:      1 week

HardenedBSD/hardenedbsd bf269bbsys/dev/nvdimm nvdimm_spa.c nvdimm.c, usr.bin/svn Makefile.inc

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

* origin/hardened/current/master:
  o Get rid of silly comment which seems to have got life of its own via   copy-and-paste 
process;
  lkpi: allow late binding of linux_alloc_current
  HBSD: Revert "svn: support building with WITH_PIE"
  Add new USB quirk.
  nvdimm: Simple namespace support
  nvdimm: Read NVDIMM namespace labels
  nvdimm: split spa dev into a separate entity
  CID 1332000: Logically dead code in sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c

HardenedBSD/hardenedbsd fbcec56sys/dev/nvdimm nvdimm_spa.c nvdimm.c, sys/kern init_main.c

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

* freebsd/current/master:
  o Get rid of silly comment which seems to have got life of its own via   copy-and-paste 
process;
  lkpi: allow late binding of linux_alloc_current
  Add new USB quirk.
  nvdimm: Simple namespace support
  nvdimm: Read NVDIMM namespace labels
  nvdimm: split spa dev into a separate entity
  CID 1332000: Logically dead code in sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c

HardenedBSD/hardenedbsd 01ebff2sys/mips/conf WZR-300HP WZR-HPAG300H

o Get rid of silly comment which seems to have got life of its own via
  copy-and-paste process;

o Return geom_uzip(4) usage back to how manual page prescribes it to be
  used while I am here.

HardenedBSD/hardenedbsd eaf53e8sys/net iflib.c

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

* origin/hardened/11-stable/master:
  MFC r333131:
DeltaFile
+15-6sys/net/iflib.c
+15-61 files

HardenedBSD/hardenedbsd 15f6ed3sys/net iflib.c

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

* freebsd/11-stable/master:
  MFC r333131:
DeltaFile
+15-6sys/net/iflib.c
+15-61 files

HardenedBSD/hardenedbsd cd0e324sys/compat/linuxkpi/common/include/linux compat.h, sys/compat/linuxkpi/common/src linux_current.c

lkpi: allow late binding of linux_alloc_current

Some consumers may be loosely coupled with the lkpi.
This allows them to call linux_alloc_current without
having a static dependency.

Reviewed by:    hps@
MFC after:      1 week
Sponsored by:   iX Systems
Differential Revision:  https://reviews.freebsd.org/D19257

HardenedBSD/hardenedbsd 9796ea2sys/net iflib.c

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

* freebsd/12-stable/master:
  MFC r344162:
DeltaFile
+22-10sys/net/iflib.c
+22-101 files

HardenedBSD/hardenedbsd f7dfa1fusr.bin/svn Makefile.inc, usr.bin/svn/svn Makefile

HBSD: Revert "svn: support building with WITH_PIE"

This reverts commit 0514659c04d60e80d67c421eba9cee2c388229e3. Given that
we support PIE already, we do not need this commit from FreeBSD.

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

HardenedBSD/hardenedbsd 23be74asys/dev/usb usbdevs, sys/dev/usb/quirk usb_quirk.c

Add new USB quirk.

PR:                   235897
MFC after:             1 week
Sponsored by:          Mellanox Technologies

HardenedBSD/hardenedbsd 4442c99sys/dev/nvdimm nvdimm_ns.c nvdimm_var.h, sys/modules/nvdimm Makefile

nvdimm: Simple namespace support

Add support for simple NVDIMM v1.2 namespaces from the UEFI
version 2.7 specification. The combination of NVDIMM regions and
labels can lead to a wide variety of namespace layouts. Here we
support a simple subset of namespaces where each NVDIMM SPA range
is composed of a single region per member dimm.

Submitted by:   D Scott Phillips <d.scott.phillips at intel.com>
Discussed with: kib
MFC after:      1 week
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D18736

HardenedBSD/hardenedbsd 5063ce2sys/dev/nvdimm nvdimm.c nvdimm_var.h

nvdimm: Read NVDIMM namespace labels

When attaching to NVDIMM devices, read and verify the namespace
labels from the special namespace label storage area. A later
change will expose NVDIMM namespaces derived from this label data.

Submitted by:   D Scott Phillips <d.scott.phillips at intel.com>
Discussed with: kib
MFC after:      1 week
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D18735

HardenedBSD/hardenedbsd badbd82sys/dev/nvdimm nvdimm_spa.c nvdimm_var.h

nvdimm: split spa dev into a separate entity

Separate code for exposing a device backed by a system physical
address range away from the NVDIMM spa code. This will allow a
future patch to add support for NVDIMM namespaces while using the
same device code.

Submitted by:   D Scott Phillips <d.scott.phillips at intel.com>
Reviewed by:    bwidawsk
MFC after:      1 week
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D18736

HardenedBSD/hardenedbsd d70ff1dsbin/nvmecontrol logpage.c nvmecontrol.c, usr.sbin/newsyslog newsyslog.c

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

* origin/hardened/current/master:
  Fix several Coverity-detected issues in newsyslog.
  Rework logpage extensibility.
  Revert r344389 & r343906 - Fix Coverity errors in newsyslog

HardenedBSD/hardenedbsd c782cfesys/dev/pms/RefTisa/tisa/sassata/sas/ini itdio.c

CID 1332000: Logically dead code in sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c

A pointer is first tested for NULL. If non-NULL, another pointer is
set equal to the first. The second pointer is then checked for NULL
and an error path taken if so. This second test and the associated
path is dead code as the pointer value, having just been checked for
NULL, cannot be NULL at this point. Remove the dead code.

Reported by:    Coverity
Reviewed by:    daniel.william.ryan_gmail.com, vangyzen
Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D19165

HardenedBSD/hardenedbsd c12e0d6sbin/nvmecontrol logpage.c nvmecontrol.c, usr.sbin/newsyslog newsyslog.c

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

* freebsd/current/master:
  Fix several Coverity-detected issues in newsyslog.
  Rework logpage extensibility.
  Revert r344389 & r343906 - Fix Coverity errors in newsyslog

HardenedBSD/hardenedbsd 452513dsys/net iflib.c

MFC r333131:

Fix iflib_encap() EFBIG handling bugs

1) Don't give up if m_collapse() fails.  Rather than giving up, try
m_defrag() immediately.

2) Fix a leak where, if the NIC driver rejected the defrag'ed chain
as having too many segments, we would fail to free the chain.

Reviewed by:  Matthew Macy <mmacy at mattmacy.io> (this version of patch)
Submitted by: Matthew Macy <mmacy at mattmacy.io> (early version of leak fix)
DeltaFile
+15-6sys/net/iflib.c
+15-61 files

HardenedBSD/hardenedbsd 2bac26asys/net iflib.c

MFC r344162:

iflib: Improve return values of interrupt handlers.

iflib was returning FILTER_HANDLED, in cases where FILTER_STRAY was more
correct. This potentially caused issues with shared legacy interrupts.

Driver filters returning FILTER_STRAY are now properly handled.

Submitted by:   Augustin Cavalier <waddlesplash at gmail.com>
Reviewed by:    marius, gallatin
Obtained from:  Haiku (a84bb9, 4947d1)
Sponsored by:   Limelight Networks
Differential Revision:  https://reviews.freebsd.org/D19201
DeltaFile
+22-10sys/net/iflib.c
+22-101 files

HardenedBSD/hardenedbsd abaf135sys/amd64/include cpufunc.h, sys/i386/include cpufunc.h

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

* freebsd/12-stable/master:
  MFC r344303: Minor cleanup for mkuzip(8) man page.
  MFC r344296: Provide convenience C wrappers for RDPKRU and WRPKRU instructions.
  MFC r344293: Add definition for %cr4 PKRU enable bit.

HardenedBSD/hardenedbsd 5a174e4usr.sbin/newsyslog newsyslog.c

Fix several Coverity-detected issues in newsyslog.

- CID 1394815, CID 1305673: Dereference before null check - memory was
  allocated and the allocation checked for NULL with a call to errx()
  if it failed. Code below that was guaranteed that the pointer was
  non-NULL, but there was another check for NULL at the exit of the
  function (after the memory had already been referenced). Eliminate
  the useless NULL check.

- CID 1007452: Resource leak - Storage intended to be allocated and
  returned to the caller was never freed. This was the result of a
  regression in the function signature introduced in r208648 (2010)
  (thanks for that find, @cem!). Fixed by altering the function
  signature and passing the allocated memory to the caller as
  intended. This also fixes PR158794.

- CID 1008620: Logically dead code in newsyslog.c - This was a direct
  result of CID 1007452. Since the memory allocated as described there
  was not returned to the caller, a subsequent check for the memory
  having been allocated was dead code. Returning the memory
  re-animates the code that is the subject of this CID.

- CID 1006131: Unused value - in parsing a configuration file, a
  pointer to the end of the last field was saved, but not used after
  that. Rewrite to use the pointer value. This could have been fixed

    [8 lines not shown]

HardenedBSD/hardenedbsd 90eaca2sbin/nvmecontrol logpage.c nvmecontrol.c

Rework logpage extensibility.

Move from using a linker set to a constructor function that's
called. This simplifies the code and is slightly more obvious.  We now
keep a list of page decoders rather than having an array we managed
before. Commands will move to something similar in the future.

Reviewed by: jhb@
Differential Revision: https://reviews.freebsd.org/D19275

HardenedBSD/hardenedbsd b9af2aausr.sbin/newsyslog newsyslog.c

Revert r344389 & r343906 - Fix Coverity errors in newsyslog

It was pointed out that a couple of the "memory leak" CIDs that I
fixed were arguably Coverity errors rather than errors in the
newsyslog code and the cure was worse than the disease. Revert both
changes. The first change, which included fixes for other Coverity
errors, will be re-worked to omit the troublesome changes and then
re-committed with the remaining fixes.

Reported by:    bde
Sponsored by:   Dell EMC Isilon

HardenedBSD/hardenedbsd 320a80bshare/man/man4 syscons.4, sys/conf files NOTES

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

* origin/hardened/current/master:
  Quick fix for building LINT on i386.  A fix is needed on all arches and this one should 
also work on amd64 and sparc64.
  Oops, actually fix warnings from -Wpointer-sign.
  Fix warnings from -Wpointer-sign.
  Connect the restored dumb and sc terminal emulators to the kernel build. Add or fix 
options to control static and dynamic configuration.  Keep the default of scteken, but 
default to statically configuring all available emulators (now 3 instead of 1).

HardenedBSD/hardenedbsd 0a64d62share/man/man4 syscons.4, sys/conf NOTES files

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

* freebsd/current/master:
  Quick fix for building LINT on i386.  A fix is needed on all arches and this one should 
also work on amd64 and sparc64.
  Oops, actually fix warnings from -Wpointer-sign.
  Fix warnings from -Wpointer-sign.
  Connect the restored dumb and sc terminal emulators to the kernel build. Add or fix 
options to control static and dynamic configuration.  Keep the default of scteken, but 
default to statically configuring all available emulators (now 3 instead of 1).

HardenedBSD/hardenedbsd f475b23usr.bin/mkuzip mkuzip.8

MFC r344303:
Minor cleanup for mkuzip(8) man page.
DeltaFile
+33-33usr.bin/mkuzip/mkuzip.8
+33-331 files

HardenedBSD/hardenedbsd 575327dsys/amd64/include cpufunc.h, sys/i386/include cpufunc.h

MFC r344296:
Provide convenience C wrappers for RDPKRU and WRPKRU instructions.

HardenedBSD/hardenedbsd 18e8f11sys/x86/include specialreg.h

MFC r344293:
Add definition for %cr4 PKRU enable bit.

HardenedBSD/hardenedbsd 1e1408asys/conf NOTES

Quick fix for building LINT on i386.  A fix is needed on all arches and
this one should also work on amd64 and sparc64.

LINT was broken in r312910 with the removal of pc98 support, by changing
the pathname in UKBD_DFLT_KEYBAP from a removed pc98 file to a nonexistent
file.

There are many bugs nearby.  Some are:
- the error is not properly detected and handled by make(1), because
  kbdcontrol(8) exits with status 0 after failing to find the keymap file
- UKBD_DFLT_KEYBAP is supposed to be MI, and is in MI NOTES to try enforce
  this, but 5 out of 8 arches don't support it
- LINT seems to have been broken by this in only 7 out of 8 arches.  mips
  breaks test coverage instead, by killing this option in its MD NOTES.
  arm kills ukbd but that is not enough to configure an unsupported option
  used only by ukbd.
DeltaFile
+1-1sys/conf/NOTES
+1-11 files

HardenedBSD/hardenedbsd db67ccctools/build/mk OptionalObsoleteFiles.inc

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

* origin/hardened/11-stable/master:
  MFC r344214: Refresh OptionalObsoleteFiles.inc for MK_PMC:

HardenedBSD/hardenedbsd 4248161tools/build/mk OptionalObsoleteFiles.inc

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

* freebsd/11-stable/master:
  MFC r344214: Refresh OptionalObsoleteFiles.inc for MK_PMC:

HardenedBSD/hardenedbsd dcb6b20lib/libc/amd64/gen getcontextx.c, lib/libc/i386/gen getcontextx.c Makefile.inc

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

* freebsd/12-stable/master:
  Revert r344436, which was the merge of r344120.
  MFC r344214: Refresh OptionalObsoleteFiles.inc for MK_PMC: