FreeBSD/src 346585projects/runtime-coverage-v2/share/mk

Remove a superfluous `)`

FreeBSD/src 346584projects/runtime-coverage-v2/share/mk

Update the comment above the coverage COMPILER_FEATURES test

FreeBSD/src 346583projects/runtime-coverage-v2/share/mk

Add `coverage` to *COMPILER_FEATURES variable to and test for it

Testing for this value is better than testing for a C++11 capable compiler,
COMPILER_TYPE == clang, etc.

While here, add checks to and to force coverage support
off if not using a coverage capable toolchain.

FreeBSD/src 346582head/usr.bin/ar write.c

ar: shuffle symbol offsets during conversion for 32-bit ar archives

During processing we maintain symbol offsets in the 64-bit s_so array,
and when writing the archive convert to 32-bit if no offsets are greater
than 4GB.  However, this was somewhat inefficient as we looped over the
array twice: first, converting to big endian and second, writing each
32-bit value one at a time (and incorrectly so on big-endian platforms).

Instead, when writing a 32-bit archive shuffle convert symbol data to
big endian (as required by the ar format) and shuffle to the beginning
of the allocation at the same time.

Also correct emission of the symbol count on big endian platforms.

Further changes are planned, but this should fix powerpc64.

Reported by:    jhibbits, mlinimon
Reviewed by:    jhibbits, Gerald Aryeetey (earlier)
Tested by:      jhibbits
MFC after:      10 days
MFC with:       r346079
Sponsored by:   The FreeBSD Foundation
Differential Revision:
+18-191 files

FreeBSD/src 346581head/sys/netinet ip_reass.c, head/sys/netinet6 frag6.c

Revert r346530 until further.

MFC after:             1 week
Sponsored by:          Mellanox Technologies

FreeBSD/src 346580head/lib/libvgl mouse.c simple.c

Fix mouse cursor coloring in depths > 8 (previously, a hack that only
worked right for white interiors and black borders was used).  Advertise
this by changing the default colors to a red interior and a white
border (the same as the kernel default).  Add undocumented env variables
for changing these colors.  Also change to the larger and better-shaped
16x10 cursor sometimes used in the kernel.  The kernel choice is
fancier, but libvgl is closer to supporting the larger cursors needed
in newer modes.

The (n)and-or logic for the cursor doesn't work right for more than 2
colors.  The (n)and part only masks out all color bits for the pixel
under the cursor when all bits are set in the And mask.  With more
complicated logic, the non-masked bits could be used to implement
translucent cursors, but they actually just gave strange colors
(especially in packed and planar modes where the bits are indirect
through 1 or 2 palettes so it is hard to predict the final color).
They also gave a bug for writing pixels under the cursor.  The
non-masked bits under the cursor were not combined in this case.

Drop support for combining with bits under the cursor by making any nonzero
value in the And mask mean all bits set.

Convert the Or mask (which is represented as a half-initialized 256-color
bitmap) to a fully initialized bitmap with the correct number of colors.
The 256-color representation must be as in 3:3:2 direct mode iff the final

    [2 lines not shown]

FreeBSD/src 346579head/share/man/man9 ifnet.9 Makefile, head/sys/dev/cxgbe t4_main.c

Track device's NUMA domain in ifnet & alloc ifnet from NUMA local memory

This commit adds new if_alloc_domain() and if_alloc_dev() methods to
allocate ifnets.  When called with a domain on a NUMA machine,
ifalloc_domain() will record the NUMA domain in the ifnet, and it will
allocate the ifnet struct from memory which is local to that NUMA
node.  Similarly, if_alloc_dev() is a wrapper for if_alloc_domain
which uses a driver supplied device_t to call ifalloc_domain() with
the appropriate domain.

Note that the new if_numa_domain field fits in an alignment pad in
struct ifnet, and so does not alter the size of the structure.

Reviewed by:    glebius, kib, markj
Sponsored by:   Netflix
Differential Revision:

FreeBSD/src 346578head/lib/libclang_rt Makefile

Build libclang_rt/profile on all clang-supported architectures

There's no reason why a special case needs to be added specifically for amd64,
arm, and i386, as the code is written in machine architecture agnostic C/C++.

This will make it possible for all supporting clang architectures to produce
runtime coverage with `--coverage`.

MFC after:      2 weeks
Reviewed by:    dim
Differential Revision:

FreeBSD/src 346577user/ngie fix-up-cxxstd

Prune branch, merged as r346574 and r346576

FreeBSD/src 346576head/share/mk

Fix up CXXSTD support originally added in r345708

r345708 worked for the base system, but unfortunately, caused a lot of
disruption for third-party packages that relied on C++, since is
used by applications outside the base system. The defaults picked didn't match
the compiler's defaults and broke some builds that didn't specify a standard,
as well as some that overrode the value by setting `-std=gnu++14` (for
example) manually.

This change takes a more relaxed approach to appending `-std=${CXXSTD}` to
CXXFLAGS, by only doing so when the value is specified, as opposed to
overriding the standard set by an end-user. This avoids the need for having
to bake NOP default into for supported compiler-toolchain

In order to make this change possible, add CXXSTD to Makefile snippets which
relied on the default value (c++11) added in r345708.

MFC after:      2 weeks
MFC with:       r345708, r346574
Reviewed by:    emaste
Reported by:    jbeich
Differential Revision: (as part of a larger change)

FreeBSD/src 346575head/stand/efi/include efi.h efizfs.h, head/stand/efi/libefi efizfs.c

Create boot_img as a global variable

Get the information from the image that we're booting and store it in
a global variable. Prefer using this to passing it around. Remove the
special case for zfs that set the preferred boot handle by having it
uses this global variable diretly.

Reviewed by: kevans@
Differential Revision:

FreeBSD/src 346574head/lib/libc++ Makefile, head/lib/libc++experimental Makefile

Rework CXXSTD setting via r345708

This change allows the user to once again override the C++ standard, restoring
high-level pre-r345708 behavior.

This also unbreaks building lib/ofed/libibnetdisc/Makefile with a non-C++11
capable compiler, e.g., g++ 4.2.1, as the library supported being built with
older C++ standards.

MFC after:      2 weeks
MFC with:       r345708
Reviewed by:    emaste
Reported by:    jbeich
Differential Revision: (as part of a larger change)

FreeBSD/src 346573head/stand/efi/loader main.c

Move setting of console earlier in boot.

There's no reason we can't setup the console first thing after the
arch flags are setup. We set it undconditionally to efi. This is a
good default, and will get us error messages to at least the efi
console no matter what. This will also prime the pump so that as other
variables are set, they will take effect and the console will be
correct as soon as those env vars are set. Also remove the redundant
setting of the console to efi when we know the console is efi.

Differential Revision:

FreeBSD/src 346572head/lib/libcam/tests libcam_test.c, head/lib/libkvm/tests kvm_close_test.c kvm_geterr_test.c

Update the spelling of my name (continuation of r346571)

Previous spellings of my name (NGie, Ngie) weren't my legal spelling. Use Enji
instead for clarity.

While here, remove "All Rights Reserved" from copyrights I "own".

MFC after:      1 week

FreeBSD/src 346571head/share/examples/tests/tests/tap, head/share/man/man4 cfiscsi.4

Update the spelling of my name

Previous spellings of my name (NGie, Ngie) weren't my legal spelling. Use Enji
instead for clarity.

While here, remove "All Rights Reserved" from copyrights I "own".

MFC after:      1 week

FreeBSD/src 346570head/sys/dev/cxgbe/common t4_msg.h, head/sys/dev/cxgbe/tom t4_tom.c t4_tom.h

cxgbe/t4_tom: Add a "TCB history" feature that samples hardware state
for a tid and maintains a running history of some interesting events.

Service TCP_INFO queries from the history when the tid is being tracked

FreeBSD/src 346569head/usr.bin/ar write.c

ar: use array notation to access s_so

This is somewhat more readable than pointer arithmetic.  Also remove an
unnecessary cast while here.

MFC after:      1 week
Sponsored by:   The FreeBSD Foundation

FreeBSD/src 346568head/usr.bin/ar write.c

ar: test for writing 64-bit format only if symbol count is nonzero

This is a minor simplification; if we do not have any symbols the empty
symbol table can be in 32-bit format.

MFC after:      1 week
Sponsored by:   The FreeBSD Foundation

FreeBSD/src 346567head/sys/dev/cxgbe t4_main.c

cxgbe(4): Make sure bundled_fw is always initialized before use.

This fixes a bug that prevented the driver from auto-flashing the
firmware when it didn't see one on the card.  This feature was
introduced in r321390 and this bug was introduced in r343269.

Reported by:    gallatin@
MFC after:      1 week
Sponsored by:   Chelsio Communications

FreeBSD/src 346566head/lib/libc/stdlib random.3

random.3: Remove obsolete BUGS section

Relative performance to rand(3) is sort of irrelevant; they do different things
and a user with sensitivity to RNG performance won't use libc random(3) anyway.

The historical note about bad seeding is long obsolete, referring to a 1996 or
earlier version of FreeBSD.

Sponsored by:   Dell EMC Isilon

FreeBSD/src 346565head/lib/libc/stdlib rand.3

rand.3: Match better recommendation language from random.3

Sponsored by:   Dell EMC Isilon

FreeBSD/src 346564vendor/wpa 2.8

Tag wpa_supplicant/hostapd 2.8.
+0-01 files

FreeBSD/src 346563vendor/wpa/dist/src/ap dpp_hostapd.c, vendor/wpa/dist/src/common dpp.c

Import wpa_supplicant/hostapd 2.8

FreeBSD/src 346562stable 11, stable/11/share/man/man7 arch.7

MFC r337364:

Document 64-bit arm in terms of arch name (aarch64) not machine (arm64).
Other architectures are documented in terms of the name that is displayed by
'uname -p', aka MACHINE_ARCH and TARGET_ARCH in the build system, now
aarch64 matches the rest of them.

PR:            220297

FreeBSD/src 346561stable 11, stable/11/sys/arm/arm generic_timer.c

MFC r346312:

Only set up the interrupts that will actually be used in arm generic_timer.

The code previously set up interrupt handlers for all the interrupt
resources available, including for timers that are not in use.  That could
lead to interrupt storms.  For example, if boot firmware enabled the virtual
timer but the kernel is using the physical timer, it could get flooded with
interrupts on the virtual timer which it cannot shut off.  By only setting
up an interrupt handler for the hardware that will actually be used, any
interrupts from other timer units will remain masked in the interrupt

Differential Revision:

FreeBSD/src 346560stable 11, stable/11/sys/kern kern_intr.c

MFC r345475-r345476

Truncate a too-long interrupt handler name when there is only one handler.

There are only 19 bytes available for the name of an interrupt plus the
name(s) of handlers/drivers using it. There is a mechanism from the days of
shared interrupts that replaces some of the handler names with '+' when they
don't all fit into 19 bytes.

In modern times there is typically only one device on an interrupt, but long
device names are the norm, especially with embedded systems. Also, in systems
with multiple interrupt controllers, the names of the interrupts themselves
can be long. For example, 'gic0,s54: imx6_anatop0' doesn't fit, and
replacing the device driver name with a '+' provides no useful info at all.

When there is only one handler but its name was too long to fit, this
change truncates enough leading chars of the handler name (replacing them
with a '-' char to indicate that some chars are missing) to use all 19
bytes, preserving the unit number typically on the end of the name. Using
the prior example, this results in: 'gic0,s54:-6_anatop0' which provides
plenty of info to figure out which device is involved.

PR:            211946
Reviewed by:    gonzo@ (prior version without the '-' char)

    [6 lines not shown]

FreeBSD/src 346559stable/11/sys/conf files, stable/11/sys/geom geom_flashmap.h geom_flashmap.c

MFC r345480, r346013

Support device-independent labels for geom_flashmap slices.

While geom_flashmap has always supported label names for its slices, it does
so by appending "s.labelname" to the provider device name, meaning you still
have to know the name and unit of the hardware device to use the labels.

These changes add support for device-independent geom_flashmap labels, using
the standard geom_label infrastructure. geom_flashmap now creates a softc
struct attached to its geom, and as it creates slices it stores the label
into an array in the softc. The new geom_label_flashmap uses those labels
when tasting a geom_flashmap provider.

Differential Revision:

Add g_label_flashmap.c to the module, should have been part of r345480.

FreeBSD/src 346558stable 11, stable/11/sys/arm/freescale/imx imx_spi.c

MFC r345000:

Mark the imx_spi device busy while transfers are in progress, so that the
module can't be unloaded while interrupts are pending.

FreeBSD/src 346557stable/11/share/man/man4 mx25l.4 at45d.4, stable/11/sys/conf files

MFC r335159, r344505-r344507, r344523, r344525-r344526, r344529, r344556,
r344606-r344612, r344614-r344616, r344681, r344684-r344686, r344728,
r344733-r344734, r344981

A large set of changes that collectively modernize the at45d and mx25l
(DataFlash and SpiFlash) drivers, add FDT support, and add geom_flashmap
support to them.

r335159 by manu:
mx25l: Add pnp info

Add a functional detach() implementation to make module unloading possible.

Add support for probing/attaching on FDT-based systems.

Switch to using config_intrhook_oneshot().  That allows the error handling
in the delayed attach to use early returns, which allows reducing the level
of indentation.  So all in all, what looks like a lot of changes is really
no change in behavior, mostly just moving whitespace around.

Include the jedec "extended device information string" in the criteria used

    [160 lines not shown]

FreeBSD/src 346556head/sys/netinet udp_usrreq.c

r297225 move the assignment of sin from add to the top of the function.
sin is not changed after the initial assignment, so no need to set it again.

MFC after:      10 days

FreeBSD/src 346555svnadmin/conf mentors

Release ngie@ from mentorship

They've demonstrated they're back up to speed on current FreeBSD
conventions and tooling.

Discussed with: jtl

FreeBSD/src 346554head/sys/netinet udp_usrreq.c

Remove some excessive brackets.

No functional change.

MFC after:      10 days

FreeBSD/src 346553stable 11, stable/11/sys/arm/ti ti_spi.c

MFC r342652:

Support the SPI mode and bus clock frequency parameters set by the devices
requesting SPI transfers.

Reported by:    SAITOU Toshihide <toshi at>

FreeBSD/src 346552stable 11, stable/11/sys/arm/freescale/imx imx6_snvs.c

MFC r344267:

Add a compatible string to match recent changes in the upstream dts.

FreeBSD/src 346551stable 11, stable/11/sys/arm/arm mpcore_timer.c

MFC r342850:

Add a missing \n to a bootverbose printf.

FreeBSD/src 346550head/usr.sbin/bhyve uart_emul.c

Use separate descriptors in bhyve's stdio uart backend.

bhyve was previously using stdin for both reading and writing to the
console, which made it difficult to redirect console output.  Use
stdin for reading and stdout for writing.  This makes it easier to use
bhyve as a backend for syzkaller.

As a side effect, the change fixes a minor bug which would cause bhyve
to fail with ENOTCAPABLE if configured to use nmdm for com1 and stdio
for com2.

bhyveload already uses separate descriptors, as does the bvmcons driver.

Reviewed by:    jhb
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Differential Revision:

FreeBSD/src 346549stable 11, stable/11/sys/dev/vt vt_core.c

MFC r342639:

When allocating a new keyboard at vt_upgrade() time, unwind any cngrabs
done on the old keyboard and then do the corresponding number of grabs
on the new keyboard.

This fixes a race that can leave the system with a non-functioning
keyboard.  It goes like this...

 - The bios claims there is an AT keyboard, atkbd attaches.
 - USB probes devices. Devices begin attaching, including disks.
 - GELI prompts for a password for a just-attached disk, which results
   in a cngrab() while atkbd is the keyboard.
 - A USB keyboard attaches.
 - vt_upgrade() runs and switches the keyboard to the new USB keyboard,
   but because cngrab was never called for it, it's not activated and
   keystrokes are ignored.
 - Now there is no functional keyboard and no way to get one; even
   plugging in a different USB keyboard doesn't help, because the console
   is still grabbed, still waiting for a GELI pw.

FreeBSD/src 346548stable 11, stable/11/sys/dev/iicbus icee.c

MFC r337731:

Export the eeprom device size via readonly sysctl.  Also export the write
page size and address size, although they are likely to be inherently
less-interesting values outside of the driver.

FreeBSD/src 346547stable 11, stable/11/share/man/man4 Makefile

MFC r336137-r336138, r336202, r336214, r336216

Add a manpage for the imx_spi driver.

Add pnp info to the imx_spi driver.

Enhancements and fixes for the spigen(4) driver...

- Resources used by spigen_mmap_single() are now tracked using
  devfs_set_cdevpriv() rather than in the softc.

- Since resources are now tracked per-open-fd, there is no need to try to
  impose any exclusive-open logic, so flags related to that are removed.

- Flags used to track open status to prevent detach() when the device is
  open are replaced with calls to device_busy()/device_unbusy().  That
  extends the protection up the hierarchy so that the spibus and hardware
  controller drivers also can't be detached while the device is open/in use.

- Arbitrary limits on the maximum size of a transfer are removed, along with
  the sysctl variables that allowed the limits to be changed.  There is just
  no reason to limit the size of a spi transfer to the machine's page size.

    [14 lines not shown]

FreeBSD/src 346546head/etc/mtree BSD.tests.dist, head/lib/libbe Makefile tests

libbe(3): Add a test for be creation

Submitted by:   Rob Fairbanks <rob.fx907 gmail com>
MFC after:      1 week
Differential Revision:

FreeBSD/src 346545head/lib/libbe be.c libbe.3

libbe(3): allow creation of arbitrary depth boot environments

libbe currently only provides an API to create a recursive boot environment,
without any formal support for intentionally limiting the depth. This
changeset adds an API, be_create_depth, that may be used to arbitrarily
restrict the depth of the new BE.

Submitted by:   Rob Fairbanks <rob.fx907 gmail com>
MFC after:      1 week
Differential Revision:

FreeBSD/src 346544head/sys/conf NOTES

Clarify the relationship between INVARIANTS and DIAGNOSTIC a bit.

MFC after:      1 week
Sponsored by:   The FreeBSD Foundation

FreeBSD/src 346543head/sys/vm vm_map.c

Disable vm map consistency checking by default on INVARIANTS kernels.

The checks are too expensive for a general-purpose kernel.  Enable the
checks when DIAGNOSTIC is defined and provide a sysctl to enable the
checks in a non-DIAGNOSTIC INVARIANTS kernel.

Reviewed by:    kib
Discussed with: Doug Moore <dougm at>
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:
+12-11 files

FreeBSD/src 346542head/tests/sys/kern

Fix sys.kern.coredump_phnum_test.coredump_phnum on i386

The zero-padding when printing out the Size field is on 32-bit architectures is
5, not 15. Adjust the regular expression to work with both the 32-bit and
64-bit case.

MFC after:      1 week
Reviewed by:    lwhsu, markj
Approved by:    emaste (mentor, implicit)
Differential Revision:

FreeBSD/src 346541stable 11, stable/11/sys/kern kern_exit.c

MFC r346009:
Set the p_oppid field of orphans when exiting.

FreeBSD/src 346540stable 12, stable/12/sys/kern kern_exit.c

MFC r346009:
Set the p_oppid field of orphans when exiting.

FreeBSD/src 346539head/lib/libc/tests/sys sendfile_test.c

Fix `get_int_via_sysctlbyname(..)` on Jenkins

Initialize `oldlen` to the size of the value, instead of leaving the value
unitialized. Leaving it unitialized seems to work by accident on amd64 when
running 64-bit programs, but not on i386.

This matches patterns in use in other programs.

PR:            237458
Approved by:    emaste (mentor; implicit)
MFC after:      1 week
Tested on:      ^/head (amd64), ^/stable/11 (i386)

FreeBSD/src 346538stable 11, stable/11/lib/libc/stdlib atexit.c

MFC r346225:
Fix order of destructors between main binary and libraries.

FreeBSD/src 346537stable 12, stable/12/lib/libc/stdlib atexit.c

MFC r346225:
Fix order of destructors between main binary and libraries.

FreeBSD/src 346536stable/12/contrib/elftoolchain README.rst, stable/12/contrib/elftoolchain/libdwarf dwarf_get_ranges.3 dwarf_expand_frame_instructions.3

MFC r339473,r340075,r342918,r343592,r343593,r343614,r343665,r343669:

MFC a number of changes to elftoolchain/readelf(1). This brings the copy of
elftoolchain more in line with the version in ^/head and partially fixes
the issue with `sys.kern.coredump_phnum_test.coredump_phnum` on ^/stable/12.

Tested with:    make tinderbox

r339473 (by emaste):

libelf: also test for 64-bit ELF in _libelf_is_mips64el

Although _libelf_is_mips64el is only called in contexts where we've
already checked that e_class is ELFCLASS64 but this may change in the
future.  Add a safety belt so that we don't access an invalid e_ehdr64
union member if it does.

r340075 (by emaste):

readelf: decode R_MIPS_HIGHER and R_MIPS_HIGHEST relocation types

r342918 (by emaste):

Update to ELF Tool Chain r3668

    [63 lines not shown]