FreeBSD/src 344491head/usr.sbin/syslogd syslogd.c

An IPv6 address matching should be fixed.  Specifying an IPv6
address by the -a option was broken since r309933.

Reported by:    "O. Hartmann" <ohartmann [...]>
MFC after:      1 week

FreeBSD/src 344490stable 11 12, stable/11/sbin/fdisk fdisk.c

MFC r339707: Allow fdisk(8) to deal with sectors larger than 2048
especially for 4Kn drives with PMBR's

Approved by:    bde (mentor, implicit)

FreeBSD/src 344489head/sys/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.

FreeBSD/src 344488head/sbin/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:

FreeBSD/src 344487head/sys/conf files, head/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:

FreeBSD/src 344486head/sys/kern kern_descrip.c, head/sys/sys seq.h

Change seq_read to seq_load to avoid namespace conflicts with lkpi

MFC after:      1 week
Sponsored by:   iX Systems

FreeBSD/src 344485head/sys/compat lindebugfs, head/sys/compat/lindebugfs lindebugfs.c

import linux debugfs support

Reviewed by:    hps@
MFC after:      1 week
Sponsored by:   iX Systems
Differential Revision:

FreeBSD/src 344484head/sys/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:

FreeBSD/src 344483stable 11 12, stable/11/contrib/libc++/include __locale

MFC r344386:

Pull in r354515 from upstream libc++ trunk:

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


  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

  Signed-off-by: Enji Cooper <yaneurabeya at>

  Reviewers: kristina, MaskRay, EricWF, ldionne, ngie

  Reviewed By: EricWF

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

    [5 lines not shown]

FreeBSD/src 344482head/share/man/man4 siftr.4 smartpqi.4

Fix a slew of mdoc errors and warnings.

MFC after:      1 week

FreeBSD/src 344481head/share/man/man4 ip.4, head/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

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:

FreeBSD/src 344480head/sys/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

FreeBSD/src 344479head/sys/mips/conf WZR-HPAG300H WZR-300HP

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.

FreeBSD/src 344478head/sys/compat/linuxkpi/common/include/linux compat.h, head/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:

FreeBSD/src 344477head/sys/dev/usb usbdevs, head/sys/dev/usb/quirk usb_quirk.c

Add new USB quirk.

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

FreeBSD/src 344476head/sys/dev/nvdimm nvdimm_ns.c nvdimm_var.h, head/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>
Discussed with: kib
MFC after:      1 week
Sponsored by:   Intel Corporation
Differential Revision:

FreeBSD/src 344475head/sys/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>
Discussed with: kib
MFC after:      1 week
Sponsored by:   Intel Corporation
Differential Revision:

FreeBSD/src 344474head/sys/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>
Reviewed by:    bwidawsk
MFC after:      1 week
Sponsored by:   Intel Corporation
Differential Revision:

FreeBSD/src 344473head/sys/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:, vangyzen
Sponsored by:   Dell EMC Isilon
Differential Revision:

FreeBSD/src 344472stable 11, stable/11/sys/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> (this version of patch)
Submitted by: Matthew Macy <mmacy at> (early version of leak fix)

FreeBSD/src 344471stable 12, stable/12/sys/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>
Reviewed by:    marius, gallatin
Obtained from:  Haiku (a84bb9, 4947d1)
Sponsored by:   Limelight Networks
Differential Revision:

FreeBSD/src 344470head/usr.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]

FreeBSD/src 344469head/sbin/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:

FreeBSD/src 344468head/usr.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

FreeBSD/src 344467stable 12, stable/12/usr.bin/mkuzip mkuzip.8

MFC r344303:
Minor cleanup for mkuzip(8) man page.

FreeBSD/src 344466stable 12, stable/12/sys/amd64/include cpufunc.h

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

FreeBSD/src 344465stable 12, stable/12/sys/x86/include specialreg.h

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

FreeBSD/src 344464head/sys/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

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.

FreeBSD/src 344463stable 12, stable/12/lib/libc Makefile

Revert r344436, which was the merge of r344120.

Currently stable/12 i386 installs old ld.bfd as ld (WITHOUT_LLD_IS_LD),
which prevents ifunc relocations from working properly.  If a static
binary is linked, then it looses libc relocations needed.

The stable i386 branch uses ld.lld for the world build (WITH_LLD_BOOTSTRAP),
which is why static binaries from the base do not have the issue.

Reported and diagnosted by:     antoine

FreeBSD/src 344462stable 11, stable/11/tools/build/mk

MFC r344214:
Refresh for MK_PMC:

- Add missing pmc.haswellxeon.3 to the list.
- Correct man page section for pmcstudy.8.

FreeBSD/src 344461stable 12, stable/12/tools/build/mk

MFC r344214:
Refresh for MK_PMC:

- Add missing /usr/sbin/pmc, pmcformat.h, libpmcstat.h and pmc.haswellxeon.3
to the list.
- Correct man page section for pmcstudy.8.
- Include recently added libipt and libopencsd for corresponding TARGET_ARCH

FreeBSD/src 344460head/usr.sbin/vidcontrol vidcontrol.c

Oops, actually fix warnings from -Wpointer-sign.

FreeBSD/src 344459head/usr.sbin/vidcontrol vidcontrol.c

Fix warnings from -Wpointer-sign.

FreeBSD/src 344458head/share/man/man4 syscons.4, head/sys/conf files options

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).

The dumb emulator is almost usable.  libedit and libreadline handle
dumb terminals perfectly for at least shell history.  less(1) works
as well as possible except on exit.  But curses programs make messes.
The dumb emulator has strange color support, with 2 dumb colors for
normal output but fancy colorization for the cursor, mouse pointer and
(with a non-dumb initial emulator) for low-level console output.

Using the sc emulator instead of the default of scteken fixes at least
the following bugs:
- NUL is a printing character in cons25 but not in teken
- teken doesn't support fixed colors for "reverse" video.
- The best versions of sc are about 10 times faster than scteken (for
  printing to the frame buffer).  This version is only about 5 times

Fix configuration features:
- make SC_DFLT_TERM (for setting the initial emulator) a normal option.

Add configuration features:
- negative options SC_NO_TERM_* for omitting emulators in the static config.

    [3 lines not shown]

FreeBSD/src 344457projects/import-googletest-1.8.1/share/mk

Remove redundant CXXFLAGS and fix constant names

- Specifying -std=c++11 and -frtti tweaks those flags with clang/gcc.
- The constants are prefixed with `GTEST_`, not `GTESTS_`.

FreeBSD/src 344456head/sys/arm/allwinner axp81x.c

Add base to the warning threshold.

FreeBSD/src 344455stable/11 UPDATING, stable/11/stand

Direct commit for some clarification/correction

The notice in UPDATING stated the wrong direction for the link.

Additionally, it's decidedly not a bad idea to throw in a comment mandating
that the ordering of LOADER_DEFAULT_INTERP bits remains the same in this
branch. This makes it even more obvious from diff review (against head) that
this difference is intentional and creates merge conflicts if someone tries
to apply the original commit manually.  I suspect this won't be a problem
given the set of people that maintain loader bits in stable/11, but it does
offer a peace of mind.

Reported by:    rgrimes

FreeBSD/src 344454stable 11 12, stable/11/tools/build/mk

MFC r344201:
Remove vi(1)-related files via 'make delete-old' when WITHOUT_VI=1 is set.

FreeBSD/src 344453head/sys/cddl/contrib/opensolaris/uts/intel/dtrace fasttrap_isa.c

Commit a missing piece of r344452.

MFC with:       r344452

FreeBSD/src 344452head/sys/cddl/contrib/opensolaris/uts/common/dtrace fasttrap.c, head/sys/cddl/contrib/opensolaris/uts/intel/dtrace fasttrap_isa.c

Fix a tracepoint lookup race in fasttrap_pid_probe().

fasttrap hooks the userspace breakpoint handler; the hook looks up the
breakpoint address in a hash table of tracepoints.  It is possible for
the tracepoint to be removed by a different thread in between the
breakpoint trap and the hash table lookup, in which case SIGTRAP gets
delivered to the target process.  Fix the problem by adding a
per-process generation counter that gets incremented when a tracepoint
belonging to that process is removed.  Then, when a lookup fails, the
trapping instruction is restarted if the thread's counter doesn't match
that of the process.

Reviewed by:    cem
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:

FreeBSD/src 344451head/usr.sbin/nfsd nfsd.c

Fix the usage error I introduced in r344192.

Specifically, I put the new option line in the wrong place, and then fixed
up the rest without realizing it.  This puts the usage statement back to
what it was, with an additional line for the new -V option.

Reported by:    mav
Sponsored by:   iXsystems Inc.

FreeBSD/src 344450head/sys/modules/dtrace Makefile

Disconnect fasttrap from the 32-bit powerpc build.

An upcoming bug fix requires 64-bit atomics, which aren't implemented on
powerpc.  The powerpc port of fasttrap is incomplete anyway and doesn't
get loaded by dtraceall.ko on powerpc because of a missing dependency;
it's presumed that it's effectively unused.

Discussed with: jhibbits
MFC after:      2 weeks

FreeBSD/src 344449head/crypto openssh, head/crypto/openssh scp.c scp.1

scp: validate filenames provided by server against wildcard in client

OpenSSH-portable commits:

check in scp client that filenames sent during remote->local directory
copies satisfy the wildcard specified by the user.

This checking provides some protection against a malicious server
sending unexpected filenames, but it comes at a risk of rejecting wanted
files due to differences between client and server wildcard expansion rules.

For this reason, this also adds a new -T flag to disable the check.

reported by Harry Sintonen
fix approach suggested by markus@;
has been in snaps for ~1wk courtesy deraadt@

OpenBSD-Commit-ID: 00f44b50d2be8e321973f3c6d014260f8f7a8eda

Minor patch conflict (getopt) resolved.

Obtained from: OpenSSH-portable 391ffc4b9d31fa1f4ad566499fef9176ff8a07dc

scp: add -T to usage();

    [10 lines not shown]

FreeBSD/src 344448head/sys/contrib/dev acpica, head/sys/contrib/dev/acpica/components/utilities utdecode.c

MFV:    r344447

Fix missing comma in array declaration.

FreeBSD/src 344447vendor-sys/acpica/dist/source/components/utilities utdecode.c

Fix missing comma in array declaration.

FreeBSD/src 344446head/usr.sbin/bhyve acpi.c

Catch up with ACPICA 20190215.

PR:            235922

FreeBSD/src 344445head/sys/dev/syscons scterm-dumb.c scterm-sc.c

Fix the dumb and sc terminal emulators to compile and work.

First remove ifdefs of the unsupported option SC_DUMB_TERMINAL which
prevented building using both in the same kernel and broke regression
tests.  This option will be replaced by per-emulator supported options.

The dumb emulator rotted with KSE in r83366, but usually compiled since
it is ifdefed to nothing unless SC_DUMB_TERMINAL is defined.  The type
of an unused function parameter changed.

Both emulators rotted when 2 new methods were added while the emulators
were removed.  Only null methods are needed, but null function pointers
give panics instead.

The wildcard in the default for the unsupported option SC_DFLT_TERM
never really worked.  It tends to prefer the dumb emulator when multiple
emulators are configured.  Change it to prefer scteken for compatibility.

FreeBSD/src 344444head/contrib/llvm/tools/lld/ELF Config.h SyntheticSections.cpp, head/contrib/llvm/tools/lld/ELF/Arch X86.cpp X86_64.cpp

Pull in r353299 from upstream lld trunk (by George Rimar):

  Recommit r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."

  With the following changes:
  1) Compilation fix:
  std::atomic<bool> HasStaticTlsModel = false; ->
  std::atomic<bool> HasStaticTlsModel{false};

  2) Adjusted the comment in code.

  Initial commit message:

  DF_STATIC_TLS flag indicates that the shared object or executable
  contains code using a static thread-local storage scheme.

  Patch checks if IE/LE relocations were used to check if the code uses
  a static model. If so it sets the DF_STATIC_TLS flag.

  Differential revision:

Pull in r353378 from upstream lld trunk (by George Rimar):

  [LLD][ELF] - Set DF_STATIC_TLS flag for X64 target

    [15 lines not shown]

FreeBSD/src 344443head/sys/conf files.sparc64 files

Move scterm_teken.c from 6 MD files lists to the MI files list so that it
is easier to configure.  It is MI, unlike some of the other syscons files
already in the MI list.

Move scvtb.c similarly.  It is needed whenever sc is configured, and is
more MI than most of the files already in the MI list.

This only changes the combined list for arm64 and mips.  These arches
already cannot build sc or even NOTES.

FreeBSD/src 344442stable/11/release/arm BEAGLEBONE.conf CUBIEBOARD.conf

Update the stable/11 arm SoC IMAGE_SIZE to 3072M as build
failures were encountered due to the target filesystem
running out of space during the installkernel target.

The 3072M size is used as it is consistent with head and
stable/12 image sizes, and build failures due to a full
filesystem have been common enough to justify making the
default size the same across all supported branches in
order to avoid such surprises.

This is a direct commit to stable/11, as there are several
changes between several size bumps that are unrelated or
unnecessary in this branch.

Sponsored by:   The FreeBSD Foundation