]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoiflib: Better control over queue core assignment
shurd [Thu, 25 Apr 2019 21:24:56 +0000 (21:24 +0000)]
iflib: Better control over queue core assignment

By default, cores are now assigned to queues in a sequential
manner rather than all NICs starting at the first core. On a four-core
system with two NICs each using two queue pairs, the nic:queue -> core
mapping has changed from this:

0:0 -> 0, 0:1 -> 1
1:0 -> 0, 1:1 -> 1

To this:

0:0 -> 0, 0:1 -> 1
1:0 -> 2, 1:1 -> 3

Additionally, a device can now be configured to use separate cores for TX
and RX queues.

Two new tunables have been added, dev.X.Y.iflib.separate_txrx and
dev.X.Y.iflib.core_offset. If core_offset is set, the NIC is not part
of the auto-assigned sequence.

Reviewed by: marius
MFC after: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D20029

5 years agolibbe(3): Fix libcompat build
kevans [Thu, 25 Apr 2019 20:48:25 +0000 (20:48 +0000)]
libbe(3): Fix libcompat build

SHLIBDIR should still be optionally set, just before src.opts.mk is included
so that libcompat can properly override it. This fixes lib32 failures
reported by both Jenkins and Michael Butler.

Reported by: Michael Butler <imb@protected-networks.net>
MFC after: 3 days
X-MFC-With: r346546

5 years agoAdd the proper range of years for Netflix's copyright on this
imp [Thu, 25 Apr 2019 20:23:13 +0000 (20:23 +0000)]
Add the proper range of years for Netflix's copyright on this
file. Note that I wrote it.

5 years agoMove initialization of the block device handles earlier (we're just
imp [Thu, 25 Apr 2019 20:10:02 +0000 (20:10 +0000)]
Move initialization of the block device handles earlier (we're just
snagging them from UEFI BIOS). Call the device type init routines
earlier as well, as they don't depend on how the console is
setup. This will allow us to read files earlier in boot, so any rare
error messages that this might move only to the EFI console will be an
acceptable price to pay. Also tweak the order of has_kbd so it resides
next to the rest of the console code. It needs to be after we initialize
the buffer cache.

5 years agoAdd efi_freebsd_delenv
imp [Thu, 25 Apr 2019 20:09:49 +0000 (20:09 +0000)]
Add efi_freebsd_delenv

Add a wrapper around efi_delenv akin to efi_freebsd_getenv and
efi_getenv.

5 years agoloader: fdt: Add fdt_is_setup function
manu [Thu, 25 Apr 2019 20:08:43 +0000 (20:08 +0000)]
loader: fdt: Add fdt_is_setup function

When efi_autoload is called it will call fdt_setup_fdtp which setup the
dtb and overlays. If a user already loaded at dtb or overlays or just
printed the efi provided dtb, this will re-setup everything and also
re-applying the overlays.
Test that everything is setup before doing it again.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D20059

5 years agolibbe(3): Fix mis-application of patch (SHLIBDIR)
kevans [Thu, 25 Apr 2019 20:02:11 +0000 (20:02 +0000)]
libbe(3): Fix mis-application of patch (SHLIBDIR)

Rob's patch in D18564 cemented the SHLIBDIR because bsd.own.mk (included by
src.opts.mk) sets it to /usr/lib. r346546 did somehow not apply this part of
the patch, leaving it to get installed to the wrong place and subsequently
removed via ObsoleteFiles.

Reported by: jkim
MFC after: 3 days
X-MFC-With: r346546

5 years agoarm: allwinner: aw_pwm: compile it as module too
manu [Thu, 25 Apr 2019 18:44:03 +0000 (18:44 +0000)]
arm: allwinner: aw_pwm: compile it as module too

MFC after: 1 month

5 years agoarm: allwinner: Add pnp info to aw_rsb and compile it as module too
manu [Thu, 25 Apr 2019 18:43:01 +0000 (18:43 +0000)]
arm: allwinner: Add pnp info to aw_rsb and compile it as module too

MFC after: 1 month

5 years agoarm: allwinner: Add pnp info to if_awg and compile it as module too
manu [Thu, 25 Apr 2019 18:42:27 +0000 (18:42 +0000)]
arm: allwinner: Add pnp info to if_awg and compile it as module too

While here make it depend on aw_sid as it's needed for mac generation.

MFC after: 1 month

5 years agoRemove p_code from struct proc.
jhb [Thu, 25 Apr 2019 18:42:07 +0000 (18:42 +0000)]
Remove p_code from struct proc.

Contrary to the comments, it was never used by core dumps or
debuggers.  Instead, it used to hold the signal code of a pending
signal, but that was replaced by the 'ksi_code' member of ksiginfo_t
when signal information was reworked in 7.0.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D20047

5 years agoarm: allwinner: Add pnp info to aw_rtc and compile it as module too
manu [Thu, 25 Apr 2019 18:41:05 +0000 (18:41 +0000)]
arm: allwinner: Add pnp info to aw_rtc and compile it as module too

MFC after: 1 month

5 years agoarm: allwinner: Add pnp info to axp81x and compile it as module too
manu [Thu, 25 Apr 2019 18:40:23 +0000 (18:40 +0000)]
arm: allwinner: Add pnp info to axp81x and compile it as module too

MFC after: 1 month

5 years agoarm: allwinner: Add pnp info to aw_thermal and compile it as module too
manu [Thu, 25 Apr 2019 18:39:41 +0000 (18:39 +0000)]
arm: allwinner: Add pnp info to aw_thermal and compile it as module too

MFC after: 1 month

5 years agoarm: allwinner: Add pnpinfo for aw_sid and add module Makefile
manu [Thu, 25 Apr 2019 18:38:38 +0000 (18:38 +0000)]
arm: allwinner: Add pnpinfo for aw_sid and add module Makefile

MFC after: 1 month

5 years agotap(4): Correct driver name...
kevans [Thu, 25 Apr 2019 18:26:34 +0000 (18:26 +0000)]
tap(4): Correct driver name...

Reported by: rgrimes
Pointy hat to: kevans
MFC after: 3 days
X-MFC-With: r346688

5 years agotap(4): Add a MODULE_VERSION
kevans [Thu, 25 Apr 2019 18:22:22 +0000 (18:22 +0000)]
tap(4): Add a MODULE_VERSION

Otherwise tap(4) can be loaded by loader despite being compiled into the
kernel, causing a panic as things try to double-initialize.

PR: 220867
MFC after: 3 days

5 years agoLinuxKPI buildfix for ppc64 after r346645.
tychon [Thu, 25 Apr 2019 18:13:55 +0000 (18:13 +0000)]
LinuxKPI buildfix for ppc64 after r346645.

Proposed by: hselasky
Sponsored by: Dell EMC Isilon

5 years agobsdinstall: up the interface before calling dhclient
manu [Thu, 25 Apr 2019 16:47:15 +0000 (16:47 +0000)]
bsdinstall: up the interface before calling dhclient

MFC after: 1 week

5 years agomtree: Add more runtime package tag
manu [Thu, 25 Apr 2019 16:45:24 +0000 (16:45 +0000)]
mtree: Add more runtime package tag

When using pkgbase those empty directories aren't packaged otherwise.

Reviewed by: bapt
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20056

5 years agolibbe(3): Copy received properties as well
kevans [Thu, 25 Apr 2019 15:51:09 +0000 (15:51 +0000)]
libbe(3): Copy received properties as well

This was inherently broken on send|recv datasets.

Reported and tested by: Wes Maag <jwmaag gmail com>
MFC after: 3 days

5 years agoRestore doing nothing for calls to VGLEnd() after the first. I broke this
bde [Thu, 25 Apr 2019 15:48:23 +0000 (15:48 +0000)]
Restore doing nothing for calls to VGLEnd() after the first. I broke this
in r346631.  VGLEnd() clears some state variables as it restores state,
but not all of them, so it still needs to clear a single state variable
to indicate that it has completed.  Put this clearing back where it was
(at the start instead of the end) to avoid moving bugs in the signal
handling.

5 years agoTrack TCP connection's NUMA domain in the inpcb
gallatin [Thu, 25 Apr 2019 15:37:28 +0000 (15:37 +0000)]
Track TCP connection's NUMA domain in the inpcb

Drivers can now pass up numa domain information via the
mbuf numa domain field.  This information is then used
by TCP syncache_socket() to associate that information
with the inpcb. The domain information is then fed back
into transmitted mbufs in ip{6}_output(). This mechanism
is nearly identical to what is done to track RSS hash values
in the inp_flowid.

Follow on changes will use this information for lacp egress
port selection, binding TCP pacers to the appropriate NUMA
domain, etc.

Reviewed by: markj, kib, slavash, bz, scottl, jtl, tuexen
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20028

5 years agoRestore the ability to open a raw disk or partition in loader(8).
ian [Thu, 25 Apr 2019 15:09:21 +0000 (15:09 +0000)]
Restore the ability to open a raw disk or partition in loader(8).

The disk_open() function searches for "the best partition" when slice and
partition information is not provided as part of the device name.  As of
r345477 the slice and partition fields of a disk_devdesc are initialized to
D_SLICEWILD and D_PARTWILD; in the past they were initialized to -1, which
was sometimes interpreted as meaning 'wildcard' and sometimes as 'open the
raw partition' depending on the context.  So as an unintended side effect of
r345477 it became basically impossible to ever open a disk or partition
without doing the 'best partition' search.  One visible effect of that was
the inability to open the raw disk to read the partition table correctly in
zfs_probe_dev(), leading to failures to find the zfs pool unless it was on
the first partition.

Now instead of always initializing slice and partition to wildcards, the
disk_parsedev() function initializes them based on the presence of a
path/file name following the device.  If there is any path or filename
following the ':' that ends the device name, then slice and partition are
initialized to D_SLICEWILD and D_PARTWILD.  If there is nothing after the
':' then it is considered to be a request to open the raw device or
partition itself (not a file stored within it), and the fields are
initialized to D_SLICENONE and D_PARTNONE.

With this change in place, all the tests in src/tools/boot are succesful
again, including the recently-added cases of booting from a zfs pool on
a partition other than slice 1 of the device.

PR: 236981

5 years agotun(4): Don't allow open of open or dying devices
kevans [Thu, 25 Apr 2019 13:46:12 +0000 (13:46 +0000)]
tun(4): Don't allow open of open or dying devices

Previously, a pid check was used to prevent open of the tun(4); this works,
but may not make the most sense as we don't prevent the owner process from
opening the tun device multiple times.

The potential race described near tun_pid should not be an issue: if a
tun(4) is to be handed off, its fd has to have been sent via control message
or some other mechanism that duplicates the fd to the receiving process so
that it may set the pid. Otherwise, the pid gets cleared when the original
process closes it and you have no effective handoff mechanism.

Close up another potential issue with handing a tun(4) off by not clobbering
state if the closer isn't the controller anymore. If we want some state to
be cleared, we should do that a little more surgically.

Additionally, nothing prevents a dying tun(4) from being "reopened" in the
middle of tun_destroy as soon as the mutex is unlocked, quickly leading to a
bad time. Return EBUSY if we're marked for destruction, as well, and the
consumer will need to deal with it. The associated character device will be
destroyed in short order.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20033

5 years agotun/tap: close race between destroy/ioctl handler
kevans [Thu, 25 Apr 2019 12:44:08 +0000 (12:44 +0000)]
tun/tap: close race between destroy/ioctl handler

It seems that there should be a better way to handle this, but this seems to
be the more common approach and it should likely get replaced in all of the
places it happens... Basically, thread 1 is in the process of destroying the
tun/tap while thread 2 is executing one of the ioctls that requires the
tun/tap mutex and the mutex is destroyed before the ioctl handler can
acquire it.

This is only one of the races described/found in PR 233955.

PR: 233955
Reviewed by: ae
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20027

5 years agoLinuxKPI buildfix for 32-bit DMA architectures after r346645.
hselasky [Thu, 25 Apr 2019 09:13:15 +0000 (09:13 +0000)]
LinuxKPI buildfix for 32-bit DMA architectures after r346645.

The <sys/pctrie.h> APIs expect a 64-bit DMA key.
This is fine as long as the DMA is less than or equal to 64 bits, which
is currently the case.

Sponsored by: Mellanox Technologies

5 years agoACPI SPCR: handle BaudRate=0
bcran [Thu, 25 Apr 2019 02:16:48 +0000 (02:16 +0000)]
ACPI SPCR: handle BaudRate=0

From https://github.com/tianocore/edk2-platforms/commit/7d8dc6544c93a5f5a03c83316489ba8700946e9f

"The mcbin (and likely others) have a nonstandard uart clock. This means
that the earlycon programming will incorrectly set the baud rate if it is
specified. The way around this is to tell the kernel to continue using the
preprogrammed baud rate. This is done by setting the baud to 0."

Our drivers (uart_dev_ns8250) do respect zero, but SPCR would error. Let's
not error.

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: mw, imp, bcran
Differential Revision: https://reviews.freebsd.org/D19914

5 years agoFor the geli-gpt-zfs test images, both bios and uefi flavors, add a dummy
ian [Thu, 25 Apr 2019 00:08:15 +0000 (00:08 +0000)]
For the geli-gpt-zfs test images, both bios and uefi flavors, add a dummy
ufs partition as p2, and put the zfs partition at p3, to test the ability
of the zfs probe code to find a zfs pool on something other than the first
partition.

5 years agoThe zfs module has grown a dependency on zcl_nfs4.ko, so copy it into all
ian [Wed, 24 Apr 2019 23:52:38 +0000 (23:52 +0000)]
The zfs module has grown a dependency on zcl_nfs4.ko, so copy it into all
the test images.

5 years agoComplain and exit the script if the 'make install' phase fails. Also,
ian [Wed, 24 Apr 2019 23:51:12 +0000 (23:51 +0000)]
Complain and exit the script if the 'make install' phase fails.  Also,
there is no need to install any debug files.

5 years agoParse MIPS relocations to unbreak kldxref on MIPS.
jhb [Wed, 24 Apr 2019 23:35:10 +0000 (23:35 +0000)]
Parse MIPS relocations to unbreak kldxref on MIPS.

Parse the R_MIPS_32 and R_MIPS_64 relocations.  Both Elf_Rel and
Elf_Rela relocations are handled since O32 MIPS uses Elf_Rel while N64
uses Elf_Rela.  Note that R_MIPS_32 is only handled for 32-bit mips
and R_MIPS_64 for 64-bit.  N32 is untested.

Reviewed by: imp
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D19870

5 years agoAdd support for AES-CCM to ccr(4).
jhb [Wed, 24 Apr 2019 23:31:46 +0000 (23:31 +0000)]
Add support for AES-CCM to ccr(4).

This is fairly similar to the AES-GCM support in ccr(4) in that it will
fall back to software for certain cases (requests with only AAD and
requests that are too large).

Tested by: cryptocheck, cryptotest.py
MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agoDon't panic for empty CCM requests.
jhb [Wed, 24 Apr 2019 23:27:39 +0000 (23:27 +0000)]
Don't panic for empty CCM requests.

A request to encrypt an empty payload without any AAD is unusual, but
it is defined behavior.  Removing this assertion removes a panic and
instead returns the correct tag for an empty buffer.

Reviewed by: cem, sef
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D20043

5 years agoFix requests for "plain" SHA digests of an empty buffer.
jhb [Wed, 24 Apr 2019 23:18:10 +0000 (23:18 +0000)]
Fix requests for "plain" SHA digests of an empty buffer.

To workaround limitations in the crypto engine, empty buffers are
handled by manually constructing the final length block as the payload
passed to the crypto engine and disabling the normal "final" handling.
For HMAC this length block should hold the length of a single block
since the hash is actually the hash of the IPAD digest, but for
"plain" SHA the length should be zero instead.

Reported by: NIST SHA1 test failure
MFC after: 2 weeks
Sponsored by: Chelsio Communications

5 years ago[acpi_ibm] Add support for newer Thinkpad models
gonzo [Wed, 24 Apr 2019 23:10:19 +0000 (23:10 +0000)]
[acpi_ibm] Add support for newer Thinkpad models

Add support for newer Thinkpad models with id LEN0268. Was tested on
Thinkpad T480 and ThinkPad X1 Yoga 2nd gen.

PR: 229120
Submitted by: Ali Abdallah <aliovx@gmail.com>
MFC after: 1 week

5 years agoFix install-boot.sh and rootgen.sh UEFI bugs
bcran [Wed, 24 Apr 2019 22:35:29 +0000 (22:35 +0000)]
Fix install-boot.sh and rootgen.sh UEFI bugs

tools/boot/install-boot.sh was assuming that if a device was passed in,
it should operate on the current system and run efibootmgr etc. to
update the boot manager. However, rootgen.sh passes a md(4) device and
not a fixed disk.

Add a -u option to install-boot.sh to tell it to update the system
in-place and run efibootmgr etc.

Also, source install-boot.sh in rootgen.sh to allow it to find and
call make_esp_file etc. And pass the loader file to make_esp_file instead
of a directory name.

Reported by: ian
Reviewed by: ian,imp,tsoome
Differential Revision: https://reviews.freebsd.org/D19992

5 years agoLinuxKPI should use bus_dma(9) to be compatible with an IOMMU
tychon [Wed, 24 Apr 2019 20:30:45 +0000 (20:30 +0000)]
LinuxKPI should use bus_dma(9) to be compatible with an IOMMU

Reviewed by: hselasky, kib
Tested by: greg@unrelenting.technology
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19845

5 years agoCall delist_dev() before destroy_dev_sched_cb().
mav [Wed, 24 Apr 2019 19:56:02 +0000 (19:56 +0000)]
Call delist_dev() before destroy_dev_sched_cb().

destroy_dev_sched_cb() is excessively asynchronous, and during media change
retaste new provider may appear sooner then device of the previous one get
destroyed.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

5 years agox86: Halt non-BSP CPUs on panic IPI_STOP
cem [Wed, 24 Apr 2019 18:24:22 +0000 (18:24 +0000)]
x86: Halt non-BSP CPUs on panic IPI_STOP

We may need the BSP to reboot, but we don't need any AP CPU that isn't the
panic thread.  Any CPU landing in this routine during panic isn't the panic
thread, so we can just detect !BSP && panic and shut down the logical core.

The savings can be demonstrated in a bhyve guest with multiple cores; before
this change, N guest threads would spin at 100% CPU.  After this change,
only one or two threads spin (depending on if the panicing CPU was the BSP
or not).

Konstantin points out that this may break any future patches which allow
switching ddb(4) CPUs after panic and examining CPU-local state that cannot
be inspected remotely.  In the event that such a mechanism is incorporated,
this behavior could be made configurable by tunable/sysctl.

Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20019

5 years agoAvoid hiding and unhiding the mouse cursor when copying bitmaps to the
bde [Wed, 24 Apr 2019 16:03:35 +0000 (16:03 +0000)]
Avoid hiding and unhiding the mouse cursor when copying bitmaps to the
screen.  Instead, copy a merged bitmap 1 line at a time.

This fixes flashing of the cursor and is faster in all modes (especially
in planar modes).

5 years agoRefactor mouse freezing and fix some minor bugs.
bde [Wed, 24 Apr 2019 15:35:29 +0000 (15:35 +0000)]
Refactor mouse freezing and fix some minor bugs.

VGLMouseFreeze() now only defers mouse signals and leaves it to higher
levels to hide and unhide the mouse cursor if necessary.  (It is never
necessary, but is done to simplify the implementation.  It is slow and
flashes the cursor.  It is still done for copying bitmaps and clearing.)

VGLMouseUnFreeze() now only undoes 1 level of freezing.  Its old
optimization to reduce mouse redrawing is too hard to do with unhiding
in higher levels, and its undoing of multiple levels was a historical
mistake.

VGLMouseOverlap() determines if a region overlaps the (full) mouse region.

VGLMouseFreezeXY() is the freezing and a precise overlap check combined
for the special case of writing a single pixel.  This is the single-pixel
case of the old VGLMouseFreeze() with cleanups.

Fixes:
- check in more cases that the application didn't pass an invalid VIDBUF
- check for errors from copying a bitmap to the shadow buffer
- freeze the mouse before writing to the shadow buffer in all cases.  This
  was not done for the case of writing a single pixel (there was a race)
- don't spell the #defined values for VGLMouseShown as 0, 1 or boolean.

5 years agoAdd support for Cadence network controller found in HiFive Unleashed board.
br [Wed, 24 Apr 2019 13:44:30 +0000 (13:44 +0000)]
Add support for Cadence network controller found in HiFive Unleashed board.

Reviewed by: markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19798

5 years agoImplement pic_pre_ithread(), pic_post_ithread().
br [Wed, 24 Apr 2019 13:41:46 +0000 (13:41 +0000)]
Implement pic_pre_ithread(), pic_post_ithread().

Reviewed by: markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19819

5 years agoiflib: Add pfil hooks
gallatin [Wed, 24 Apr 2019 13:32:04 +0000 (13:32 +0000)]
iflib: Add pfil hooks

As with mlx5en, the idea is to drop unwanted traffic as early
in receive as possible, before mbufs are allocated and anything
is passed up the stack.  This can save considerable CPU time
when a machine is under a flooding style DOS attack.

The major change here is to remove the unneeded abstraction where
callers of rxd_frag_to_sd() get back a pointer to the mbuf ring, and
are responsible for NULL'ing that mbuf themselves. Now this happens
directly in rxd_frag_to_sd(), and it returns an mbuf. This allows us
to use the decision (and potentially mbuf) returned by the pfil
hooks. The driver can now recycle mbufs to avoid re-allocation when
packets are dropped.

Reviewed by: marius  (shurd and erj also provided feedback)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19645

5 years agoFix some races and screeen clearing in VGLEnd().
bde [Wed, 24 Apr 2019 13:15:56 +0000 (13:15 +0000)]
Fix some races and screeen clearing in VGLEnd().

The mouse signal SIGUSR2 was not turned off for normal termination and
in some other cases.  Thus mouse signals arriving after the frame
buffer was unmapped always caused fatal traps.  The fatal traps occurred
about 1 time in 5 if the mouse was wiggled while vgl is ending.

The screen switch signal SIGUSR1 was turned off after clearing the
flag that it sets.  Unlike the mouse signal, this signal is handled
synchronously, but VGLEnd() does screen clearing which does the
synchronous handling.  This race is harder to lose.  I think it can
get vgl into deadlocked state (waiting in the screen switch handler
with SIGUSR1 to leave that state already turned off).

Turn off the mouse cursor before clearing the screen in VGLEnd().
Otherwise, clearing is careful to not clear the mouse cursor.  Undrawing
an active mouse cursor uses a lot of state, so is dangerous for abnormal
termination, but so is clearing.  Clearing is slow and is usually not
needed, since the kernel also does it (not quite right).

5 years agoAdd GRE-in-UDP encapsulation support as defined in RFC8086.
ae [Wed, 24 Apr 2019 09:05:45 +0000 (09:05 +0000)]
Add GRE-in-UDP encapsulation support as defined in RFC8086.

This GRE-in-UDP encapsulation allows the UDP source port field to be
used as an entropy field for load-balancing of GRE traffic in transit
networks. Also most of multiqueue network cards are able distribute
incoming UDP datagrams to different NIC queues, while very little are
able do this for GRE packets.

When an administrator enables UDP encapsulation with command
`ifconfig gre0 udpencap`, the driver creates kernel socket, that binds
to tunnel source address and after udp_set_kernel_tunneling() starts
receiving of all UDP packets destined to 4754 port. Each kernel socket
maintains list of tunnels with different destination addresses. Thus
when several tunnels use the same source address, they all handled by
single socket.  The IP[V6]_BINDANY socket option is used to be able bind
socket to source address even if it is not yet available in the system.
This may happen on system boot, when gre(4) interface is created before
source address become available. The encapsulation and sending of packets
is done directly from gre(4) into ip[6]_output() without using sockets.

Reviewed by: eugen
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D19921

5 years agoKeep two versions of the FreeBSD.conf pkg configuration file; one which
cperciva [Wed, 24 Apr 2019 06:25:21 +0000 (06:25 +0000)]
Keep two versions of the FreeBSD.conf pkg configuration file; one which
points at the "latest" branch and one which points at the "quarterly"
branch.  Install the "latest" version unless overridden via the newly
added PKGCONFBRANCH variable.

This does not change user-visible behaviour (assuming said vairable is
not set) but will make it easier to change the defaults in the future --
on stable branches we will want "latest" on x86 but "quarterly" elsewhere.

Discussed with: gjb
MFC after: 3 days
X-MFC: After MFCing this I'll make a direct commit to stable/* to
switch non-x86 architectures to "quarterly".

5 years agoUse `range` instead of `xrange`
ngie [Wed, 24 Apr 2019 05:52:24 +0000 (05:52 +0000)]
Use `range` instead of `xrange`

`xrange` is a pre-python 2.x compatible idiom. Use `range` instead. The values
being iterated over are sufficiently small that using range on python 2.x won't
be a noticeable issue.

MFC after: 2 months

5 years agoFix typo: `Plen` should be `plen`
ngie [Wed, 24 Apr 2019 05:49:48 +0000 (05:49 +0000)]
Fix typo: `Plen` should be `plen`

MFC after: 1 month
MFC with: r346617
Reported by: pylint -E

5 years agoDon't leak `fd` when manipulating the device via `_getdev()`
ngie [Wed, 24 Apr 2019 05:47:09 +0000 (05:47 +0000)]
Don't leak `fd` when manipulating the device via `_getdev()`

Close the file descriptor when done calling ioctl with a try-finally block so
it doesn't get leaked.

MFC after: 2 months

5 years agoRestore the -n flag parsing, but ignore it.
imp [Wed, 24 Apr 2019 05:24:10 +0000 (05:24 +0000)]
Restore the -n flag parsing, but ignore it.

Since D19668 was done, new users of the -n flag have surfaced. Parse
and ignore it on the command line until they can be updated.

Suggested by: rgrimes (in D19668).

5 years agoChase PEP-3110
ngie [Wed, 24 Apr 2019 04:50:03 +0000 (04:50 +0000)]
Chase PEP-3110

Replace `except Environment, e:` with `except Environment as e` for
compatibility between python 2.x and python 3.x.

While here, fix a bad indentation change from r346620 by reindenting the code
properly.

MFC after: 2 months

5 years agoReapply whitespace style changes from r346443 after recent changes to tests/sys/openc...
ngie [Wed, 24 Apr 2019 04:40:24 +0000 (04:40 +0000)]
Reapply whitespace style changes from r346443 after recent changes to tests/sys/opencrypto

From r346443:
"""
Replace hard tabs with four-character indentations, per PEP8.

This is being done to separate stylistic changes from the tests from functional
ones, as I accidentally introduced a bug to the tests when I used four-space
indentation locally.

No functional change.
"""

MFC after: 2 months
Discussed with: jhb

5 years agopowerpc: Add a couple missing isyncs
jhibbits [Wed, 24 Apr 2019 02:51:58 +0000 (02:51 +0000)]
powerpc: Add a couple missing isyncs

mtmsr and mtsr require context synchronizing instructions to follow.  Without
a CSI, there's a chance for a machine check exception.  This reportedly does
occur on a MPC750 (PowerMac G3).

Reported by: Mark Millard

5 years agofdt: stop installing FDT_DTS_FILE
kevans [Wed, 24 Apr 2019 01:11:50 +0000 (01:11 +0000)]
fdt: stop installing FDT_DTS_FILE

r346307 inadvertently started installing FDT_DTS_FILE along with the kernel.
While this isn't necessarily bad, it was not intended or discussed and it
actively breaks some current setups that don't anticipate any .dtb being
installed when it's using static fdt. This change could be reconsidered down
the line, but it needs to be done with prior discussion.

Fix it by pushing FDT_DTS_FILE build down into the raw dtb.build.mk bits.
This technically allows modules building DTS to accidentally specify an
FDT_DTS_FILE that gets built but isn't otherwise useful (since it's not
installed), but I suspect this isn't a big deal and would get caught with
any kind of testing -- and perhaps this might end up useful in some other
way, for example by some module wanting to embed fdt in some other way than
our current/normal mechanism.

Reported by: Mori Hiroki <yamori813@yahoo.co.jp>
MFC after: 3 days
X-MFC-With: r346307

5 years agoTest the AES-CCM test vectors from the NIST Known Answer Tests.
jhb [Wed, 24 Apr 2019 00:23:06 +0000 (00:23 +0000)]
Test the AES-CCM test vectors from the NIST Known Answer Tests.

The CCM test vectors use a slightly different file format in that
there are global key-value pairs as well as section key-value pairs
that need to be used in each test.  In addition, the sections can set
multiple key-value pairs in the section name.  The CCM KAT parser
class is an iterator that returns a dictionary once per test where the
dictionary contains all of the relevant key-value pairs for a given
test (global, section name, section, test-specific).

Note that all of the CCM decrypt tests use nonce and tag lengths that
are not supported by OCF (OCF only supports a 12 byte nonce and 16
byte tag), so none of the decryption vectors are actually tested.

Reviewed by: ngie
MFC after: 1 month
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D19978

5 years agoRun the plain SHA digest tests from NIST.
jhb [Wed, 24 Apr 2019 00:16:39 +0000 (00:16 +0000)]
Run the plain SHA digest tests from NIST.

Pass in an explicit digest length to the Crypto constructor since it
was assuming only sessions with a MAC key would have a MAC.  Passing
an explicit size allows us to test the full digest in HMAC tests as
well.

Reviewed by: cem
MFC after: 1 month
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D19884

5 years agoUse more descriptive algorithm names in skip messages.
jhb [Wed, 24 Apr 2019 00:14:37 +0000 (00:14 +0000)]
Use more descriptive algorithm names in skip messages.

Reviewed by: cem, ngie
MFC after: 1 month
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D19977

5 years agoSkip tests with missing test vectors instead of failing.
jhb [Wed, 24 Apr 2019 00:10:21 +0000 (00:10 +0000)]
Skip tests with missing test vectors instead of failing.

This copes more gracefully when older version of the nist-kat package
are intalled that don't have newer test vectors such as CCM or plain
SHA.

If the nist-kat package is not installed at all, this still fails with
an error.

Reviewed by: cem
MFC after: 1 month
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D20034

5 years agoSkip test component_selection:run_latest_genid if gmirror/gnop GEOM classes
olivier [Tue, 23 Apr 2019 21:07:47 +0000 (21:07 +0000)]
Skip test component_selection:run_latest_genid if gmirror/gnop GEOM classes
aren't available

PR: 237051
Reviewed by: asomers, imp, ngie, emaste (IRC)
Approved by: ngie
MFC after:  1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19958

5 years agoAllow no_hash to appear in manifest.
sjg [Tue, 23 Apr 2019 20:25:25 +0000 (20:25 +0000)]
Allow no_hash to appear in manifest.

sbin/veriexec will ignore entries that have no hash anyway,
but loader needs to be explicitly told that such files are
ok to ignore (not verify).

We will report as Unverified depending on verbose level,
but with no reason - because we are not rejecting the file.

Reviewed by: imp, mindal_semihalf
Sponsored by:   Juniper Networks
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org//D20018

5 years agoSince r339624 HEAD does not need for backslashes in syscalls.master,
dchagin [Tue, 23 Apr 2019 18:10:46 +0000 (18:10 +0000)]
Since r339624 HEAD does not need for backslashes in syscalls.master,
however to make a merge r345471 to the stable add backslashes
to the syscalls.master.

MFC after: 3 days

5 years agotun(4): Defer clearing TUN_OPEN until much later
kevans [Tue, 23 Apr 2019 17:28:28 +0000 (17:28 +0000)]
tun(4): Defer clearing TUN_OPEN until much later

tun destruction will not continue until TUN_OPEN is cleared. There are brief
moments in tunclose where the mutex is dropped and we've already cleared
TUN_OPEN, so tun_destroy would be able to proceed while we're in the middle
of cleaning up the tun still. tun_destroy should be blocked until these
parts (address/route purges, mostly) are complete.

PR: 233955
MFC after: 2 weeks

5 years agoip6_randomflowlabel: Avoid blocking if random(4) is not available
cem [Tue, 23 Apr 2019 17:18:20 +0000 (17:18 +0000)]
ip6_randomflowlabel: Avoid blocking if random(4) is not available

If kern.random.initial_seeding.bypass_before_seeding is disabled, random(4)
and arc4random(9) will block indefinitely until enough entropy is available
to initially seed Fortuna.

It seems that zero flowids are perfectly valid, so avoid blocking on random
until initial seeding takes place.

Discussed with: bz (earlier revision)
Reviewed by: thj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20011

5 years ago[PPC64] Fix wrong KASSERT in mphyp_pte_insert()
luporl [Tue, 23 Apr 2019 17:11:45 +0000 (17:11 +0000)]
[PPC64] Fix wrong KASSERT in mphyp_pte_insert()

As mphyp_pte_unset() can also remove PTE entries, and as this can
happen in parallel with PTEs evicted by mphyp_pte_insert(), there
is a (rare) chance the PTE being evicted gets removed before
mphyp_pte_insert() is able to do so. Thus, the KASSERT should
check wether the result is H_SUCCESS or H_NOT_FOUND, to avoid
panics if the situation described above occurs.

More details about this issue can be found in PR 237470.

PR: 237470
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D20012

5 years agonetdump: Fix !COMPAT_FREEBSD11 unused variable warning
cem [Tue, 23 Apr 2019 17:05:57 +0000 (17:05 +0000)]
netdump: Fix !COMPAT_FREEBSD11 unused variable warning

Reported by: Ralf Wenk <iz-rpi03_hs-karlsruhe.de>
Sponsored by: Dell EMC Isilon

5 years agoEnable Mellanox drivers (modules) on AArch64
emaste [Tue, 23 Apr 2019 15:11:01 +0000 (15:11 +0000)]
Enable Mellanox drivers (modules) on AArch64

Tested by Greg V with mlx5en on an Ampere eMAG instance at Packet.com on
c2.large.arm (with some additional uncommitted PCIe WIP).

PR: 237055
Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: hselasky
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19983

5 years agopoib: assign link-local address according to RFC
kib [Tue, 23 Apr 2019 12:23:44 +0000 (12:23 +0000)]
poib: assign link-local address according to RFC

RFC 4391 specifies that the IB interface GID should be re-used as IPv6
link-local address.  Since the code in in6_get_hw_ifid() ignored
IFT_INFINIBAND case, ibX interfaces ended up with the local address
borrowed from some other interface, which is non-compliant.

Use lowest eight bytes from GID for filling the link-local address,
same as Linux.

Reviewed by: bz (previous version), ae, hselasky, slavash,
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20006

5 years agoiFix udp_output() lock inconsistency.
bz [Tue, 23 Apr 2019 10:12:33 +0000 (10:12 +0000)]
iFix udp_output() lock inconsistency.

In r297225 the initial INP_RLOCK() was replaced by an early
acquisition of an r- or w-lock depending on input variables
possibly extending the write locked area for reasons not entirely
clear but possibly to avoid a later case of unlock and relock
leading to a possible race condition and possibly in order to
allow the route cache to work for connected sockets.

Unfortunately the conditions were not 1:1 replicated (probably
because of the route cache needs). While this would not be a
problem the legacy IP code compared to IPv6 has an extra case
when dealing with IP_SENDSRCADDR. In a particular case we were
holding an exclusive inp lock and acquired the shared udbinfo
lock (now epoch).
When then running into an error case, the locking assertions
on release fired as the udpinfo and inp lock levels did not match.

Break up the special case and in that particular case acquire
and udpinfo lock depending on the exclusitivity of the inp lock.

MFC After: 9 days
Reported-by: syzbot+1f5c6800e4f99bdb1a48@syzkaller.appspotmail.com
Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D19594

5 years agoAdd ATA power mode support to camcontrol
smh [Tue, 23 Apr 2019 07:46:38 +0000 (07:46 +0000)]
Add ATA power mode support to camcontrol

Add the ability to report ATA device power mode with the cmmand 'powermode'
to compliment the existing ability to set it using idle, standby and sleep
commands.

MFC after: 2 weeks
Sponsored by: Multiplay

5 years agoThis patch offers a workaround to buf_ring reordering
wma [Tue, 23 Apr 2019 06:36:32 +0000 (06:36 +0000)]
This patch offers a workaround to buf_ring reordering
visible on armv7 and armv8. Similar issue to rS302292.

Obtained from:         Semihalf
Authored by:           Michal Krawczyk <mk@semihalf.com>
Approved by:           wma
Differential Revision: https://reviews.freebsd.org/D19932

5 years agoMFV r346563:
cy [Tue, 23 Apr 2019 03:52:43 +0000 (03:52 +0000)]
MFV r346563:

Update wpa_supplicant/hostapd 2.7 --> 2.8

Upstream documents the following advisories:

- https://w1.fi/security/2019-1/sae-side-channel-attacks.txt
- https://w1.fi/security/2019-2/eap-pwd-side-channel-attack.txt
- https://w1.fi/security/2019-3/sae-confirm-missing-state-validation.txt
- https://w1.fi/security/2019-4/eap-pwd-missing-commit-validation.txt
- https://w1.fi/security/2019-5/eap-pwd-message-reassembly-issue-\
  with-unexpected-fragment.txt

Relnotes: yes
MFC after: 1 week (or less)
Security: CVE-2019-9494, VU#871675, CVE-2019-9495, CVE-2019-9496,
CVE-2019-9497, CVE-2019-9498, CVE-2019-9499

5 years ago[PowerPC64] pseries-llan: increment packet output counters on error and success
jhibbits [Tue, 23 Apr 2019 03:19:03 +0000 (03:19 +0000)]
[PowerPC64] pseries-llan: increment packet output counters on error and success

Summary: when using pseries-llan driver, Opkts and Oerrs counters (netstat
-i) are always zero. This patch adds an small error handling to increment
these counters.

Submitted by: alfredo.junior_eldorado.org.br
Differential Revision: https://reviews.freebsd.org/D20009

5 years agopowerpc64/pseries: Fix hypervisor call with extra arguments
jhibbits [Tue, 23 Apr 2019 03:05:26 +0000 (03:05 +0000)]
powerpc64/pseries: Fix hypervisor call with extra arguments

Some hypervisor calls, such as H_SEND_LOGICAL_LAN, take more arguments than
are traditionally passed in registers.  The HCALL ABI will accept these
arguments in r11 and r12.  With ELFv2 ABI, these arguments are 2
double-words lower than ELFv1 ABI, as two double-words in the stack frame
are no longer used, and therefore removed from the frame.  Fix the offsets
for loading the registers for the HCALL.  This fixes the phyp_llan driver
with ELFv2 kernel.

Submitted by: alfredo.junior_eldorado.org.br
Differential Revision: https://reviews.freebsd.org/D20008

5 years agopowerpc64: Rewrite strcmp in asm to take advantage of word size
jhibbits [Tue, 23 Apr 2019 02:53:53 +0000 (02:53 +0000)]
powerpc64: Rewrite strcmp in asm to take advantage of word size

Summary:
Optimize strcmp for powerpc64.
Data is loaded by double words and cmpb intruction is used to find '\0'.

Some performance gain rates between the current and the optimized solution:

String size (bytes) Gain rate
<=8 0.59%
<=16 1.92%
32 3.02%
64 5.60%
128 10.16%
256 18.05%
512 30.18%
1024 42.82%

Submitted by: alexandre.yamashita_eldorado.org.br,
leonardo.bianconi_eldorado.org.br
Differential Revision: https://reviews.freebsd.org/D15220

5 years agoar: shuffle symbol offsets during conversion for 32-bit ar archives
emaste [Mon, 22 Apr 2019 19:55:47 +0000 (19:55 +0000)]
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: https://reviews.freebsd.org/D20007

5 years agoRevert r346530 until further.
hselasky [Mon, 22 Apr 2019 19:36:19 +0000 (19:36 +0000)]
Revert r346530 until further.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix mouse cursor coloring in depths > 8 (previously, a hack that only
bde [Mon, 22 Apr 2019 19:31:16 +0000 (19:31 +0000)]
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
bitmap has more than 256 colors.  The conversion of colors is not very
efficient, so convert at initialization time.

5 years agoTrack device's NUMA domain in ifnet & alloc ifnet from NUMA local memory
gallatin [Mon, 22 Apr 2019 19:24:21 +0000 (19:24 +0000)]
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: https://reviews.freebsd.org/D19930

5 years agoBuild libclang_rt/profile on all clang-supported architectures
ngie [Mon, 22 Apr 2019 19:21:35 +0000 (19:21 +0000)]
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: https://reviews.freebsd.org/D20003

5 years agoFix up CXXSTD support originally added in r345708
ngie [Mon, 22 Apr 2019 18:40:46 +0000 (18:40 +0000)]
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 bsd.sys.mk 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 bsd.sys.mk for supported compiler-toolchain
versions.

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: https://reviews.freebsd.org/D19895 (as part of a larger change)

5 years agoCreate boot_img as a global variable
imp [Mon, 22 Apr 2019 18:40:24 +0000 (18:40 +0000)]
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: https://reviews.freebsd.org/D20015

5 years agoRework CXXSTD setting via r345708
ngie [Mon, 22 Apr 2019 18:38:54 +0000 (18:38 +0000)]
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: https://reviews.freebsd.org/D19895 (as part of a larger change)

5 years agoMove setting of console earlier in boot.
imp [Mon, 22 Apr 2019 18:33:32 +0000 (18:33 +0000)]
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: https://reviews.freebsd.org/D20014

5 years agoUpdate the spelling of my name (continuation of r346571)
ngie [Mon, 22 Apr 2019 18:05:33 +0000 (18:05 +0000)]
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

5 years agoUpdate the spelling of my name
ngie [Mon, 22 Apr 2019 17:52:46 +0000 (17:52 +0000)]
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

5 years agocxgbe/t4_tom: Add a "TCB history" feature that samples hardware state
np [Mon, 22 Apr 2019 17:48:10 +0000 (17:48 +0000)]
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
there.

5 years agoar: use array notation to access s_so
emaste [Mon, 22 Apr 2019 17:29:26 +0000 (17:29 +0000)]
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

5 years agoar: test for writing 64-bit format only if symbol count is nonzero
emaste [Mon, 22 Apr 2019 17:25:00 +0000 (17:25 +0000)]
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

5 years agocxgbe(4): Make sure bundled_fw is always initialized before use.
np [Mon, 22 Apr 2019 17:00:30 +0000 (17:00 +0000)]
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

5 years agorandom.3: Remove obsolete BUGS section
cem [Mon, 22 Apr 2019 16:29:34 +0000 (16:29 +0000)]
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

5 years agorand.3: Match better recommendation language from random.3
cem [Mon, 22 Apr 2019 16:26:39 +0000 (16:26 +0000)]
rand.3: Match better recommendation language from random.3

Sponsored by: Dell EMC Isilon

5 years agoImport wpa_supplicant/hostapd 2.8
cy [Mon, 22 Apr 2019 15:42:53 +0000 (15:42 +0000)]
Import wpa_supplicant/hostapd 2.8

5 years agor297225 move the assignment of sin from add to the top of the function.
bz [Mon, 22 Apr 2019 14:53:53 +0000 (14:53 +0000)]
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

5 years agoRemove some excessive brackets.
bz [Mon, 22 Apr 2019 14:20:49 +0000 (14:20 +0000)]
Remove some excessive brackets.

No functional change.

MFC after: 10 days

5 years agoUse separate descriptors in bhyve's stdio uart backend.
markj [Mon, 22 Apr 2019 13:57:52 +0000 (13:57 +0000)]
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: https://reviews.freebsd.org/D19788

5 years agolibbe(3): Add a test for be creation
kevans [Mon, 22 Apr 2019 13:45:08 +0000 (13:45 +0000)]
libbe(3): Add a test for be creation

Submitted by: Rob Fairbanks <rob.fx907 gmail com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18564

5 years agolibbe(3): allow creation of arbitrary depth boot environments
kevans [Mon, 22 Apr 2019 13:43:38 +0000 (13:43 +0000)]
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: https://reviews.freebsd.org/D18564

5 years agoClarify the relationship between INVARIANTS and DIAGNOSTIC a bit.
markj [Mon, 22 Apr 2019 11:31:13 +0000 (11:31 +0000)]
Clarify the relationship between INVARIANTS and DIAGNOSTIC a bit.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation