]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r346847:
Alan Somers [Fri, 31 May 2019 16:23:51 +0000 (16:23 +0000)]
MFC r346847:

fsx: seed more randomly with the -S0 option

When using -S0, seed the PRNG with the current time in nanoseconds, not
seconds, so consecutive runs don't accidentally use the same seed.

Also, rename some variables for clarity.

Reviewed by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20078

4 years agoMFC r346750:
Alan Somers [Fri, 31 May 2019 16:23:13 +0000 (16:23 +0000)]
MFC r346750:

[skip ci] fix typo in comment from r59840

Sponsored by: The FreeBSD Foundation

4 years agoMFC r346078:
Alan Somers [Fri, 31 May 2019 16:22:29 +0000 (16:22 +0000)]
MFC r346078:

fix cache_lookup's documentation

cache_lookup's documentation got dislocated by r324378. Relocate and expand
it.

Reviewed by: jhb, kib
Sponsored by: The FreeBSD Foundation

4 years agoMFC r345677:
Alan Somers [Fri, 31 May 2019 16:21:38 +0000 (16:21 +0000)]
MFC r345677:

Add man page for VOP_FDATASYNC(9)

Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D19678

4 years agoMFC r345202:
Alan Somers [Fri, 31 May 2019 16:20:50 +0000 (16:20 +0000)]
MFC r345202:

VOP_INACTIVE(9): clarify wording

Reviewed by: kib, 0mp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19596

4 years agoMFC r345034:
Alan Somers [Fri, 31 May 2019 16:20:00 +0000 (16:20 +0000)]
MFC r345034:

Drop "All rights reserved" from the files I own

Also, add SPDX tags where needed.

4 years agoMFC r348241:
Mark Johnston [Fri, 31 May 2019 15:05:54 +0000 (15:05 +0000)]
MFC r348241:
Modernize the MAKE_JUST_KERNELS hint in the top-level makefile.

4 years agoMFC r348236:
Andrey V. Elsukov [Fri, 31 May 2019 11:21:30 +0000 (11:21 +0000)]
MFC r348236:
  Restore IPV6_NEXTHOP option support that seem was partially broken
  since r286195.

  Do not forget results of route lookup and initialize rt and ifp pointers.

  PR: 238098
  Submitted by: Masse Nicolas <nicolas.masse at stormshield eu>

4 years agoficl pfopen: verify file
Simon J. Gerraty [Thu, 30 May 2019 23:43:54 +0000 (23:43 +0000)]
ficl pfopen: verify file

If the file is verified - do not allow write
otherwise do not allow read.

Add O_ACCMODE to stand.h

MFC of r348249

Reviewed by: stevek, mindal_semihalf.com
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D20387

4 years agoMFC 346650: Add support for AES-CCM to ccr(4).
John Baldwin [Thu, 30 May 2019 18:44:19 +0000 (18:44 +0000)]
MFC 346650: 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).

4 years agoMFC 347964:
John Baldwin [Thu, 30 May 2019 16:40:21 +0000 (16:40 +0000)]
MFC 347964:
Expose the MD_CLEAR capability used by Intel MDS mitigations to guests.

4 years agoMFC r346932, r347159:
Mark Johnston [Thu, 30 May 2019 15:23:43 +0000 (15:23 +0000)]
MFC r346932, r347159:
Optimize lseek(SEEK_DATA) on UFS.

4 years agoMFC r348080, r348081:
Mark Johnston [Thu, 30 May 2019 15:20:20 +0000 (15:20 +0000)]
MFC r348080, r348081:
Add platform-dependent DTrace tests.

4 years agoMFC r348082:
Mark Johnston [Thu, 30 May 2019 15:17:35 +0000 (15:17 +0000)]
MFC r348082:
Provide an example of using dhclient-script(5) to configure netdump.

4 years agoMFC r348167, r348168, r348359, r348361:
Konstantin Belousov [Thu, 30 May 2019 15:15:47 +0000 (15:15 +0000)]
MFC r348167, r348168, r348359, r348361:
Add posixshmcontrol(1) utility.

4 years agoMFC r348158:
Konstantin Belousov [Thu, 30 May 2019 15:13:23 +0000 (15:13 +0000)]
MFC r348158:
Add a kern.ipc.posix_shm_list sysctl.

4 years agoMFC r348157:
Konstantin Belousov [Thu, 30 May 2019 15:12:20 +0000 (15:12 +0000)]
MFC r348157:
Report ref count of the backing object as st_nlink for posix shm fd.

4 years agoMFC r348156:
Konstantin Belousov [Thu, 30 May 2019 15:10:41 +0000 (15:10 +0000)]
MFC r348156:
Make pack_kinfo() available for external callers.

4 years agoMFC r347974, r348001, r348006, r348013, r348016, r348018, r348020
Ian Lepore [Thu, 30 May 2019 14:40:23 +0000 (14:40 +0000)]
MFC r347974, r348001, r348006, r348013, r348016, r348018, r348020

FDT support for if_muge and if_smsc drivers...

r347974:
Add common support functions for USB devices configured via FDT data.

FDT data is sometimes used to configure usb devices which are hardwired into
an embedded system. Because the devices are instantiated by the usb
enumeration process rather than by ofwbus iterating through the fdt data, it
is somewhat difficult for a usb driver to locate fdt data that belongs to
it. In the past, various ad-hoc methods have been used, which can lead to
errors such applying configuration that should apply only to a hardwired
device onto a similar device attached by the user at runtime. For example,
if the user adds an ethernet device that uses the same driver as the builtin
ethernet, both devices might end up with the same MAC address.

These changes add a new usb_fdt_get_node() helper function that a driver can
use to locate FDT data that belongs to a single unique instance of the
device. This function locates the proper FDT data using the mechanism
detailed in the standard "usb-device.txt" binding document [1].

There is also a new usb_fdt_get_mac_addr() function, used to retrieve the
mac address for a given device instance from the fdt data. It uses
usb_fdt_get_node() to locate the right node in the FDT data, and attempts to
obtain the mac-address or local-mac-address property (in that order, the
same as linux does it).

The existing if_smsc driver is modified to use the new functions, both as an
example and for testing the new functions. Rpi and rpi2 boards use this
driver and provide the mac address via the fdt data.

[1] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/usb/usb-device.txt

Differential Revision: https://reviews.freebsd.org/D20262

r348001 by emaste:
muge: configure LEDs per dtb (for Raspberry Pi 3B+)

Also apply some style(9) and remove the message about EEPROM configuration
(if there's an EEPROM the hardware handles LED configuration itself).

PR: 237325
Reviewed by: ian
Submitted by: Ralf <iz-rpi03@hs-karlsruhe.de>

r348006 by emaste:
muge: update FDT LED configuration

Also use LED mode settings from the FDT to set the PHY.
From v3 of the patch submitted in the PR.

I moved the sc_led_modes and sc_led_modes_mask default setting outside
of the #ifdef FDT case.

PR: 237325
Submitted by: Ralf <iz-rpi03@hs-karlsruhe.de>
Reviewed by: ian
MFC with: r348001
Event: Waterloo Hackathon 2019
Differential Revision: https://reviews.freebsd.org/D20325

r348013:
Use the new usb fdt support functions to locate the proper fdt node for
the device instance, and to get the MAC address for the device instance.
The ad-hoc code this replaces could find the wrong instance if multiple
devices were present.

r348016:
Don't detour through sc->sc_ue when we have a direct pointer to ue in hand
already.  Also, shorten a variable name for nicer line-wrapping.

No functional changes.

r348018:
A MAC adddress from FDT data should override anything stored in eeprom or
OTP registers (because the user is in control of the fdt data).  Remove the
early returns from the code that tries to find a good mac address, so that
the execution always flows through the routine to get an address from FDT
data last, when on FDT-enabled systems.

r348020:
Reverse the bit logic of sc_led_modes_mask.  Instead of initializing it to
all-ones then carving out blocks of zeroes where specified values go, init
it to all-zeroes, put in ones where values need to be masked, then use it
as value &= ~sc_led_modes_mask.  In addition to being more idiomatic, this
means everything related to FDT data is initialized to zero along with the
rest of the softc, and that allows removing some #ifdef FDT sections and
wrapping the whole muge_set_leds() function in a single ifdef block.

This also deletes the early-out from muge_set_leds() when an eeprom exists.
Even if there is an eeprom with led config in it, the fdt data (if present)
should override that, because the user is in control of the fdt data.

5 years agoMFC r348290:
Michael Tuexen [Thu, 30 May 2019 13:51:11 +0000 (13:51 +0000)]
MFC r348290:
When an ACK segment as the third message of the three way handshake is
received and support for time stamps was negotiated in the SYN/SYNACK
exchange, perform the PAWS check and only expand the syn cache entry if
the check is passed.
Without this check, endpoints may get stuck on the incomplete queue.

Reviewed by: jtl@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D20374

5 years agoMFC r348302:
Xin LI [Thu, 30 May 2019 04:09:45 +0000 (04:09 +0000)]
MFC r348302:

Chase r261913: hardcoded default crypt(3) algorithm is SHA-512 when DES
is not available.

Submitted by: Ali Mashtizadeh <ali mashtizadeh.com>

5 years agoMFC 347033:
John Baldwin [Wed, 29 May 2019 23:05:26 +0000 (23:05 +0000)]
MFC 347033:
Increase the VirtIO segment count to support modern Windows guests.

The Windows virtio driver ignores the advertized seg_max field and
assumes the host can accept up to 67 segments in indirect descriptors,
triggering an assert in the bhyve process.

This brings back r282922 but with a couple of changes:
- It raises the block interface segment limit to 128 instead of 67.
- Linux's virtio driver assumes that the segment limit is no
  larger than the ring size.  To avoid breaking Linux guests,
  raise the VirtIO ring size to 128, and cap the VirtIO segment
  limit at ring size - 2 (effectively 126).

5 years agoMFC r348288:
Dimitry Andric [Wed, 29 May 2019 18:23:18 +0000 (18:23 +0000)]
MFC r348288:

Pull in r361696 from upstream llvm trunk (by Sanjay Patel):

  [SelectionDAG] soften assertion when legalizing narrow vector FP ops

  The test based on PR42010:
  https://bugs.llvm.org/show_bug.cgi?id=42010

  ...may show an inaccuracy for PPC's target defs, but we should not be
  so aggressive with an assert here. There's no telling what
  out-of-tree targets look like.

This fixes an assertion when building the graphics/mesa-dri port for
PowerPC64.

Reported by: Mark Millard <marklmi26-fbsd@yahoo.com>
PR: 238082

5 years agoMFC r348052:
Konstantin Belousov [Wed, 29 May 2019 13:47:10 +0000 (13:47 +0000)]
MFC r348052:
NDFREE(): Fix unlocking for LOCKPARENT|LOCKLEAF and ndp->ni_dvp == ndp->ni_vp.

5 years agoMFC r348075:
Konstantin Belousov [Wed, 29 May 2019 13:33:29 +0000 (13:33 +0000)]
MFC r348075:
Do not call hw_mds_recalculate() from initializecpu().

5 years agoMFC r348111: Simplify math added in r310524.
Alexander Motin [Wed, 29 May 2019 13:17:58 +0000 (13:17 +0000)]
MFC r348111: Simplify math added in r310524.

Should be no functional change.

5 years agoMFC r345405,345406,346228,346657,348195,348198: UART SPCR fixes.
Colin Percival [Tue, 28 May 2019 22:22:40 +0000 (22:22 +0000)]
MFC r345405,345406,346228,346657,348195,348198: UART SPCR fixes.

r345405: Obey SPCR AccessWidth parameter.
r345406: Initialize uart_bus_space_mem on arm64.
r346228: Add quirk to ignore AccessWidth on PL011 UART.
r346657: Handle SPCR BaudRate = 0.
r348195: Extract arm64 SPCR code and make it MI; use on x86 too.
r348198: Fix for r348195.

This unbreaks the console on EC2 a1.* and *.metal instances.

Sponsored by: https://www.patreon.com/cperciva

5 years agoMFC: r348340
Jung-uk Kim [Tue, 28 May 2019 21:57:01 +0000 (21:57 +0000)]
MFC: r348340

Merge OpenSSL 1.1.1c.

5 years agoMFC r348066, r348090:
Mark Johnston [Tue, 28 May 2019 14:17:03 +0000 (14:17 +0000)]
MFC r348066, r348090:
bootpd: Add an option to skip modifications to the ARP table.

PR: 30854

5 years agoMFC r348069: bootpd: avoid the same error indication for different issues
Ed Maste [Tue, 28 May 2019 13:14:53 +0000 (13:14 +0000)]
MFC r348069: bootpd: avoid the same error indication for different issues

There were several (apparently) copy-pasted NEED validation macros,
leading to the same error string for different issues.  Change the
YP and NTP tags so they are distinct.

PR: 30863
Submitted by: Dan Lukes <dan@obluda.cz>
Reviewed by: markj

5 years agoMFC r347642:
Cy Schubert [Tue, 28 May 2019 02:00:09 +0000 (02:00 +0000)]
MFC r347642:

The driver list prints "(null)" for the NDIS driver when -h (help) or
an unknown switch is passed outputting the command usage. This is
because the NDIS driver is uninitialized when usage help is printed.
To resolve this we initialize the driver prior to the possibility of
printing the usage help message.

Obtained from: The wpa_supplicant port

5 years agoMFC r348215, r348219: fix bectl(8) jail w/ numeric BE names
Kyle Evans [Mon, 27 May 2019 02:18:33 +0000 (02:18 +0000)]
MFC r348215, r348219: fix bectl(8) jail w/ numeric BE names

r348215:
jail_getid(3): validate jid string input

Currently, if jail_getid(3) is passed in a numeric string, it assumes that
this is a jid string and passes it back converted to an int without checking
that it's a valid/existing jid. This breaks consumers that might use
jail_getid(3) to see if it can trivially grab a jid from a name if that name
happens to be numeric but not actually the name/jid of the jail. Instead of
returning -1 for the jail not existing, it'll return the int version of the
input and the consumer will not fallback to trying other methods.

Pass the numeric input to jail_get(2) as the jid for validation, rather than
the name. This works well- the kernel enforces that jid=name if name is
numeric, so doing the safe thing and checking numeric input as a jid will
still DTRT based on the description of jail_getid.

r348219:
bectl(8): Add a test for jail/unjail of numeric BE names

Fixed by r348215, bectl ujail first attempts the trivial fetch of a jid by
passing the first argument to 'ujail' to jail_getid(3) in case a jid/name
have been passed in instead of a BE name. For numerically named BEs, this
was doing the wrong thing: instead of failing to locate the jid specified
and falling back to mountpath search, jail_getid(3) would return the input
as-is.

While here, I've fixed bectl_jail_cleanup which still used a hard-coded pool
name that was overlooked w.r.t. other work that was in-flight around the
same time.

5 years agoMFC r348127: bectl(8): add description for create subcommand
Kyle Evans [Mon, 27 May 2019 02:17:41 +0000 (02:17 +0000)]
MFC r348127: bectl(8): add description for create subcommand

In commit r345845, a portion of documentation for the create subcommand was
removed. Specifically, for creating a snapshot of an existing boot
environment. bectl even has a test-case for this functionality.

Removing the sub-command description was discussed in PR 235850.

This patch brings back the second "create" description that was originally
in place. Albeit, with a few wording/clarifying changes.

5 years agoMFC r347975:
Michael Tuexen [Sun, 26 May 2019 16:43:06 +0000 (16:43 +0000)]
MFC r347975:
Improve input validation for the IPPROTO_SCTP level socket options
SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED.

MFC r347976:
Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state.
This issue was found by running syzkaller.

5 years agoLinuxKPI: Revert MFC of r347892
Johannes Lundberg [Sat, 25 May 2019 20:53:23 +0000 (20:53 +0000)]
LinuxKPI: Revert MFC of r347892

Revert until we can figure out how to keep compatibility with drm-kmod
ports between 12.0 and 12-STABLE/12.1.

5 years agoMFC r344385:
Johannes Lundberg [Sat, 25 May 2019 20:24:51 +0000 (20:24 +0000)]
MFC r344385:
PFS: Bump NAMELEN and don't require clients to be sleepable

- debugfs consumers expect to be able to export names more than 48 characters

- debugfs consumers expect to be able to hold locks across calls and are able
  to handle allocation failures

Reviewed by: hps@
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D19256

5 years agoMFC r344384:
Johannes Lundberg [Sat, 25 May 2019 19:59:59 +0000 (19:59 +0000)]
MFC r344384:
Add non-sleepable strdup variant strdup_flags

debugfs expects to do non-sleepable allocations

Reviewed by: hps@
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D19259

5 years agoMFC r347892:
Johannes Lundberg [Sat, 25 May 2019 18:36:38 +0000 (18:36 +0000)]
MFC r347892:
LinuxKPI: Finalize import of seq_file.

seq_file.h and linux_seq_file.c was imported form ports earlier but
linux_seq_file.c was never compiled in with the module. With this
commit base seq_file will replace ports seq_file and it required a
few modifications to not break functionality and build.

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r344486:
Johannes Lundberg [Sat, 25 May 2019 18:23:32 +0000 (18:23 +0000)]
MFC r344486:
Change seq_read to seq_load to avoid namespace conflicts with lkpi

Sponsored by: iX Systems

5 years agoLinuxKPI: Register new linuxkpi and lindebugfs source files.
Johannes Lundberg [Sat, 25 May 2019 18:03:17 +0000 (18:03 +0000)]
LinuxKPI: Register new linuxkpi and lindebugfs source files.

This change is a partial MFC of r344487.

Reviewed by: hps
Approved by: imp (mentor), hps
Obtained from: mmacy

5 years agoMFC r344485:
Johannes Lundberg [Sat, 25 May 2019 17:17:08 +0000 (17:17 +0000)]
MFC r344485:
import linux debugfs support

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

5 years agoMFC of 348074
Kirk McKusick [Fri, 24 May 2019 23:07:32 +0000 (23:07 +0000)]
MFC of 348074

Rewrite fsck_readdir() and dircheck() for clarity and correctness.

5 years agoMFC r347596:
Johannes Lundberg [Fri, 24 May 2019 17:14:07 +0000 (17:14 +0000)]
MFC r347596:
LinuxKPI: Add context member to ww_mutex and bump FreeBSD version.

This patch is part of https://reviews.freebsd.org/D19565.

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347891:
Johannes Lundberg [Fri, 24 May 2019 17:06:10 +0000 (17:06 +0000)]
MFC r347891:
LinuxKPI: Add in_task macro.

This patch is part of D19565

Reviewed by: hps, bwidawsk
Approved by: imp (mentor), hps
Obtained from: bwidawsk

5 years agoMFC r347843:
Johannes Lundberg [Fri, 24 May 2019 17:04:27 +0000 (17:04 +0000)]
MFC r347843:
LinuxKPI: Add group_leader member to struct task_struct.

Assign self as group leader at creation to act as the only member of a
new process group.
Bump FreeBSD version.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347852:
Johannes Lundberg [Fri, 24 May 2019 17:01:05 +0000 (17:01 +0000)]
MFC r347852:
LinuxKPI: Updates to tasklets for Linux 5.0.

DRM drivers expect tasklets to have a counter for enable/disable calls.
Also, add a few more tasklet locking functions.
MFC also includes powerpc build fix from r347889.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347837:
Johannes Lundberg [Fri, 24 May 2019 15:37:54 +0000 (15:37 +0000)]
MFC r347837:
LinuxKPI: Update access_ok macro for v5.0.

Check LINUXKPI_VERSION macro for backwards compatibility.
It's recommended to update any drivers that depend on the older KPI
so we can deprecate < 5.0 code as we update to newer Linux version.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r348002:
Mark Johnston [Fri, 24 May 2019 14:38:31 +0000 (14:38 +0000)]
MFC r348002:
Typo.

5 years agoMFC r346598: Enable Mellanox drivers (modules) on AArch64
Ed Maste [Fri, 24 May 2019 13:39:56 +0000 (13:39 +0000)]
MFC r346598: Enable Mellanox drivers (modules) on AArch64

PR: 237055
Submitted by: Greg V <greg@unrelenting.technology>

5 years agoFix the build. Use NET_EPOCH_ENTER_ET() and NET_EPOCH_EXIT_ET().
Andrey V. Elsukov [Fri, 24 May 2019 09:01:54 +0000 (09:01 +0000)]
Fix the build. Use NET_EPOCH_ENTER_ET() and NET_EPOCH_EXIT_ET().

This is direct commit to stable/12, since macros are different in stable/12
and head/ branches.

5 years agoMFC r346630:
Andrey V. Elsukov [Fri, 24 May 2019 08:42:34 +0000 (08:42 +0000)]
MFC r346630:
  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
  Relnotes: yes
  Differential Revision: https://reviews.freebsd.org/D19921

5 years agoMFC r347383:
Andrey V. Elsukov [Fri, 24 May 2019 08:40:37 +0000 (08:40 +0000)]
MFC r347383:
  In mld_v2_cancel_link_timers() check number of references and disconnect
  inm before releasing the last reference. This fixes possible panics and
  assertion.

  PR: 237329
  Reviewed by: mmacy

5 years agoMerge r344481:
Gleb Smirnoff [Fri, 24 May 2019 06:27:11 +0000 (06:27 +0000)]
Merge r344481:
  Support struct ip_mreqn as argument for IP_ADD_MEMBERSHIP. Legacy support
  for struct ip_mreq remains in place.

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

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

5 years agoMFC: r346717: Make bhyve SMBIOS table topology aware
Rodney W. Grimes [Fri, 24 May 2019 05:47:16 +0000 (05:47 +0000)]
MFC: r346717: Make bhyve SMBIOS table topology aware

When the CPU Topology was added to bhyve in r332298 the SMBIOS table was
missed, this table passes topology information to the system and was still
using the old concept of each vCPU is a socket with 1 core and 1 thread.
This code did not even try to use the old sysctl information to adjust
this data.

Correct that by building a proper SMBios table, mapping the > 254 cases to
0 per the SMBios 2.6 specification that is claimed by the structure.

Approved by: bde (implicit/mentor)

5 years agoMFC: r346714: Add accessor function for vm->maxcpus
Rodney W. Grimes [Fri, 24 May 2019 04:15:38 +0000 (04:15 +0000)]
MFC: r346714: Add accessor function for vm->maxcpus

Replace most VM_MAXCPU constant useses with an accessor function to
vm->maxcpus which for now is initialized and kept at the value of
VM_MAXCPUS.

This is a rework of Fabian Freyer (fabian.freyer_physik.tu-berlin.de)
work from D10070 to adjust it for the cpu topology changes that
occured in r332298

Approved by: bde (implicit)

5 years agoMFC r347463:
Justin Hibbits [Fri, 24 May 2019 01:51:58 +0000 (01:51 +0000)]
MFC r347463:

powerpc: Initialize the Hardware Interrupt Offset Register (HIOR) earlier for
ppc970

Since we now have a much larger KVA on powerpc64, it's possible to get SLB
traps earlier in boot, possibly even before the HIOR is properly configured
for us.  Move the HIOR setup to immediately after reset, so that we use our
exception handlers instead of Open Firmware's.

PR: 233863

5 years agoMFC 340486: Consolidate on a single set of constants for SCMD fields.
John Baldwin [Fri, 24 May 2019 00:44:31 +0000 (00:44 +0000)]
MFC 340486: Consolidate on a single set of constants for SCMD fields.

Both ccr(4) and the TOE TLS code had separate sets of constants for
fields in SCMD messages.

5 years agoMFC 346617: Test the AES-CCM test vectors from the NIST Known Answer Tests.
John Baldwin [Thu, 23 May 2019 21:57:58 +0000 (21:57 +0000)]
MFC 346617: 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.

5 years agoMFC 346649: Don't panic for empty CCM requests.
John Baldwin [Thu, 23 May 2019 21:52:24 +0000 (21:52 +0000)]
MFC 346649: 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.

5 years agoMFC 346648: Fix requests for "plain" SHA digests of an empty buffer.
John Baldwin [Thu, 23 May 2019 21:05:05 +0000 (21:05 +0000)]
MFC 346648: 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.

5 years agoMFC 346616: Run the plain SHA digest tests from NIST.
John Baldwin [Thu, 23 May 2019 19:20:37 +0000 (19:20 +0000)]
MFC 346616: 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.

5 years agoMFC 346615: Use more descriptive algorithm names in skip messages.
John Baldwin [Thu, 23 May 2019 19:19:09 +0000 (19:19 +0000)]
MFC 346615: Use more descriptive algorithm names in skip messages.

5 years agoMFC 346614: Skip tests with missing test vectors instead of failing.
John Baldwin [Thu, 23 May 2019 19:18:21 +0000 (19:18 +0000)]
MFC 346614: 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.

5 years agoMFC 346421: Test SHA2-224-HMAC now that OCF supports it.
John Baldwin [Thu, 23 May 2019 19:13:38 +0000 (19:13 +0000)]
MFC 346421: Test SHA2-224-HMAC now that OCF supports it.

5 years agoMFC 346419: Sync cryptographic algorithm constants with current cryptodev.h.
John Baldwin [Thu, 23 May 2019 19:12:47 +0000 (19:12 +0000)]
MFC 346419: Sync cryptographic algorithm constants with current cryptodev.h.

5 years agoMFC: r347960: bhyve virtio needs barriers
Rodney W. Grimes [Thu, 23 May 2019 18:48:46 +0000 (18:48 +0000)]
MFC: r347960: bhyve virtio needs barriers

Under certain tight race conditions, we found that the lack of a memory
barrier in bhyve's virtio handling causes it to miss a NO_NOTIFY state
transition on block devices, resulting in guest stall. The investigation
is recorded in OS-7613. As part of the examination into bhyve's use of
barriers, one other section was found to be problematic, but only on
non-x86 ISAs with less strict memory ordering. That was addressed in
this patch as well, although it was not at all a problem on x86.

PR: 231117
Submitted by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: jhb, kib, rgrimes
Approved by: jhb
Differential Revision: https://reviews.freebsd.org/D19501

5 years agoMFC r347698:
Konstantin Belousov [Thu, 23 May 2019 13:05:47 +0000 (13:05 +0000)]
MFC r347698:
amd64 pmap: sysctl vm.pmap.pcid_save_cnt should be read-only.

5 years agoMFC r347694:
Konstantin Belousov [Thu, 23 May 2019 13:03:10 +0000 (13:03 +0000)]
MFC r347694:
subr_turnstile: Extract some common  code to a helper.

5 years agoMFC r347693:
Konstantin Belousov [Thu, 23 May 2019 12:52:19 +0000 (12:52 +0000)]
MFC r347693:
rtld_malloc.c: cleanup morepages().

5 years agoMFC r347692:
Konstantin Belousov [Thu, 23 May 2019 12:51:29 +0000 (12:51 +0000)]
MFC r347692:
Remove more dead definitions from rtld_malloc.c after r347019.

5 years agoMFC r347244:
Xin LI [Thu, 23 May 2019 05:49:43 +0000 (05:49 +0000)]
MFC r347244:

Move contrib/zlib to sys/contrib/zlib so that we can use it in kernel.
This is a prerequisite of unifying kernel zlib instances.

Submitted by: Yoshihiro Ota <ota at j.email.ne.jp>

5 years agoMFC r346652-r346654
Ian Lepore [Thu, 23 May 2019 02:12:00 +0000 (02:12 +0000)]
MFC r346652-r346654

r346652:
Complain and exit the script if the 'make install' phase fails.  Also,
there is no need to install any debug files.

r346653:
The zfs module has grown a dependency on zcl_nfs4.ko, so copy it into all
the test images.

r346654:
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 agoMFC r346431,r347417,r348019:
Enji Cooper [Thu, 23 May 2019 01:25:34 +0000 (01:25 +0000)]
MFC r346431,r347417,r348019:

r346431 (by lwhsu):

Specify using Python2, these .py files have not been converted to use Python3
yet, but the default Python version in ports has been switched to 3.

r347417:

Refactor tests/sys/opencrypto/runtests

* Convert from plain to TAP for slightly improved introspection when skipping
  the tests due to requirements not being met.
* Test for the net/py-dpkt (origin) package being required when running the
  tests, instead of relying on a copy of the dpkt.py module from 2014. This
  enables the tests to work with py3. Subsequently, remove
  `tests/sys/opencrypto/dpkt.py(c)?` via `make delete-old`.
* Parameterize out `python2` as `$PYTHON`.

PR: 237403

r348019:

Allow the end-user to pass along arguments to cryptotest.py via `$CRYPTOTEST_ARGS`

This allows someone to use `-v` to dump out standard output.

5 years agoRegenerate src.conf(5) after r348138
Enji Cooper [Thu, 23 May 2019 01:13:12 +0000 (01:13 +0000)]
Regenerate src.conf(5) after r348138

5 years agoMFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346081,r346270...
Enji Cooper [Thu, 23 May 2019 01:09:10 +0000 (01:09 +0000)]
MFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346081,r346270,r346574,r346576:

r345203:

Initial googlemock/googletest integration into the build/FreeBSD test suite

This initial integration takes googlemock/googletest release 1.8.1, integrates
the library, tests, and sample unit tests into the build.

googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`.
`MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when
built with a C++11 capable toolchain.

Google tests can be specified via the `GTESTS` variable, which, in comparison
with the other test drivers, is more simplified/streamlined, as Googletest only
supports C++ tests; not raw C or shell tests (C tests can be written in C++
using the standard embedding methods).

No dependent libraries are assumed for the tests. One must specify `gmock`,
`gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program.

More information about googlemock and googletest can be found on the
Googletest [project page](https://github.com/google/googletest), and the
[GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md)
and
[GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs)
docs.

These tests are originally integrated into the build as plain driver tests, but
will be natively integrated into Kyua in a later version.

Known issues/Errata:
* [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172)

r345205:

Integrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite

This change integrates the unit tests for zfsd into the test suite using the
integration method described in r345203.

This change removes the `LOCALBASE` includes added for the port version of
googlemock/googletest, as well as unnecessary `LIBADD`/`DPADD` and `CXXFLAGS`
defines, which are included in the `GTEST_CXXFLAGS` variable, as part of
r345203.

r345353 (by asomers):

googletest: backport GTEST_SKIP to googletest 1.8.1

This commit backports revisions 00938b2b228f3b70d3d9e51f29a1505bdad43f1e and
59f90a338bce2376b540ee239cf4e269bf6d68ad from googletest's master branch to
our included version of googletest, which is based on 1.8.1. It adds the
GTEST_SKIP feature, which is very useful for a project like FreeBSD where
some tests depend on particular system configurations.

Obtained from: github.com/google/googletest

r345645:

Spam CXXFLAGS with `-I${DESTDIR}/usr/include/private`, instead of GTEST_CXXFLAGS

This makes it easier for googletest users to leverage googletest, instead of
forcing them to plug GTEST_CXXFLAGS into CXXFLAGS manually (resulting in
unnecessary duplication).

I will be following this up with a more proper fix in src.libnames.mk, as
src.libnames.mk should be automatically adding this directory to
CFLAGS/CXXFLAGS when private libraries are referenced. Not doing so can result
in mismatches between base-provided private library's and ports-provided
library's headers.

While here, tweak the comment to clarify what the intent is behind spamming
CXXFLAGS.

r345708:

Standardize `-std=c++* as `CXXSTD`

CXXSTD was added as the C++ analogue to CSTD.

CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+= -std=c++14
```

After this commit:
```
CXXSTD= c++14
```

Relnotes: yes
Tested with: make tinderbox

r345709:

Allow users to override CSTD/CXXSTD on a per-prog basis

The current logic for CSTD/CXXSTD requires homogenity as far as the
supported C/C++ standards, which is a sensible default. However, when
dealing with differing versions of C++, some code may compile with C++11, but
not C++17 (for instance). So in order to avoid having people convert over their
code to the new standard, give the users the ability to specify the standard on
a per-program basis.

This will allow a user to override the supporting standard for a set of
programs, mixing C++11 with C++14 (for instance).

Apprved by: emaste (mentor)

r345735:

Allow programs to set `NO_SHARED` on a per-PROG basis

This is particularly useful when installing programs for tests that need to be
linked statically, e.g., mini-me from capsicum-test, which is linked statically
to avoid the dynamic library lookup in the upstream project.

r345770:

Import proof-of-concept for handling `GTEST_SKIP()` in `Environment::SetUp`

Per the upstream pull-request [1]:

```
  gtest prior to this change would completely ignore `GTEST_SKIP()` if
  called in `Environment::SetUp()`, instead of bailing out early, unlike
  `Test::SetUp()`, which would cause the tests themselves to be skipped.
  The only way (prior to this change) to skip the tests would be to
  trigger a fatal error via `GTEST_FAIL()`.

  Desirable behavior, in this case, when dealing with
  `Environment::SetUp()` is to check for prerequisites on a system
  (example, kernel supports a particular featureset, e.g., capsicum), and
  skip the tests. The alternatives prior to this change would be
  undesirable:

  - Failing sends the wrong message to the test user, as the result of the
    tests is indeterminate, not failed.
  - Having to add per-test class abstractions that override `SetUp()` to
    test for the capsicum feature set, then skip all of the tests in their
    respective SetUp fixtures, would be a lot of human and computational
    work; checking for the feature would need to be done for all of the
    tests, instead of once for all of the tests.

  For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`,
  by not executing the testcases, is the most desirable solution.

  In order to properly diagnose what happened when running the tests if
  they are skipped, print out the diagnostics in an ad hoc manner.

  Update the documentation to note this change and integrate a new test,
  gtest_skip_in_environment_setup_test, into the test suite.

  This change addresses #2189.

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

The goal with my merging in this change is to avoid requiring extensive
refactoring/retesting of test suites when ensuring prerequisites are met,
e.g., checking for a CAPABILITIES-enabled kernel before running capsicum-test
(see D19758 for more details).

The proof-of-concept is being imported before accepted by the upstream
project due to the fact that the upstream project is undergoing a potential
development freeze and the maintainers aren't responding to my PR.

1. https://github.com/google/googletest/pull/2203

r346081 (by trasz):

Make zfsd(8) build obey CFLAGS.

Obtained from: CheriBSD

r346270 (by trasz):

Drop -g from CFLAGS for zfsd(8).  No idea why it was ever there.

r346574:

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.

r346576:

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.

5 years agoRevert r348136
Enji Cooper [Thu, 23 May 2019 00:59:05 +0000 (00:59 +0000)]
Revert r348136

I accidentally committed some unrelated local changes to
`.../tests/sys/opencrypto` along with this MFC set.

5 years agoMFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346574,r346576:
Enji Cooper [Thu, 23 May 2019 00:55:28 +0000 (00:55 +0000)]
MFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346574,r346576:

r345203:

Initial googlemock/googletest integration into the build/FreeBSD test suite

This initial integration takes googlemock/googletest release 1.8.1, integrates
the library, tests, and sample unit tests into the build.

googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`.
`MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when
built with a C++11 capable toolchain.

Google tests can be specified via the `GTESTS` variable, which, in comparison
with the other test drivers, is more simplified/streamlined, as Googletest only
supports C++ tests; not raw C or shell tests (C tests can be written in C++
using the standard embedding methods).

No dependent libraries are assumed for the tests. One must specify `gmock`,
`gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program.

More information about googlemock and googletest can be found on the
Googletest [project page](https://github.com/google/googletest), and the
[GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md)
and
[GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs)
docs.

These tests are originally integrated into the build as plain driver tests, but
will be natively integrated into Kyua in a later version.

Known issues/Errata:
* [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172)

r345205:

Integrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite

This change integrates the unit tests for zfsd into the test suite using the
integration method described in r345203.

This change removes the `LOCALBASE` includes added for the port version of
googlemock/googletest, as well as unnecessary `LIBADD`/`DPADD` and `CXXFLAGS`
defines, which are included in the `GTEST_CXXFLAGS` variable, as part of
r345203.

r345353 (by asomers):

googletest: backport GTEST_SKIP to googletest 1.8.1

This commit backports revisions 00938b2b228f3b70d3d9e51f29a1505bdad43f1e and
59f90a338bce2376b540ee239cf4e269bf6d68ad from googletest's master branch to
our included version of googletest, which is based on 1.8.1. It adds the
GTEST_SKIP feature, which is very useful for a project like FreeBSD where
some tests depend on particular system configurations.

Obtained from: github.com/google/googletest

r345645:

Spam CXXFLAGS with `-I${DESTDIR}/usr/include/private`, instead of GTEST_CXXFLAGS

This makes it easier for googletest users to leverage googletest, instead of
forcing them to plug GTEST_CXXFLAGS into CXXFLAGS manually (resulting in
unnecessary duplication).

I will be following this up with a more proper fix in src.libnames.mk, as
src.libnames.mk should be automatically adding this directory to
CFLAGS/CXXFLAGS when private libraries are referenced. Not doing so can result
in mismatches between base-provided private library's and ports-provided
library's headers.

While here, tweak the comment to clarify what the intent is behind spamming
CXXFLAGS.

r345708:

Standardize `-std=c++* as `CXXSTD`

CXXSTD was added as the C++ analogue to CSTD.

CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`,
otherwise for older versions of g++.

This change standardizes the CXXSTD variable, originally added to
googletest.test.inc.mk as part of r345203.

As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`.

Notes:

This value is not sanity checked in bsd.sys.mk, however, given the two
most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is
likely to work with both toolchains. This method will be refined in the future
to support more variants of C++, as not all versions of clang++ and g++ (for
instance) support C++14, C++17, etc.

Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD.
Example:

Before this commit:
```
CXXFLAGS+= -std=c++14
```

After this commit:
```
CXXSTD= c++14
```

Relnotes: yes
Tested with: make tinderbox

r345709:

Allow users to override CSTD/CXXSTD on a per-prog basis

The current logic for CSTD/CXXSTD requires homogenity as far as the
supported C/C++ standards, which is a sensible default. However, when
dealing with differing versions of C++, some code may compile with C++11, but
not C++17 (for instance). So in order to avoid having people convert over their
code to the new standard, give the users the ability to specify the standard on
a per-program basis.

This will allow a user to override the supporting standard for a set of
programs, mixing C++11 with C++14 (for instance).

Approved by: emaste (mentor)

r345735:

Allow programs to set `NO_SHARED` on a per-PROG basis

This is particularly useful when installing programs for tests that need to be
linked statically, e.g., mini-me from capsicum-test, which is linked statically
to avoid the dynamic library lookup in the upstream project.

r345770:

Import proof-of-concept for handling `GTEST_SKIP()` in `Environment::SetUp`

Per the upstream pull-request [1]:

```
  gtest prior to this change would completely ignore `GTEST_SKIP()` if
  called in `Environment::SetUp()`, instead of bailing out early, unlike
  `Test::SetUp()`, which would cause the tests themselves to be skipped.
  The only way (prior to this change) to skip the tests would be to
  trigger a fatal error via `GTEST_FAIL()`.

  Desirable behavior, in this case, when dealing with
  `Environment::SetUp()` is to check for prerequisites on a system
  (example, kernel supports a particular featureset, e.g., capsicum), and
  skip the tests. The alternatives prior to this change would be
  undesirable:

  - Failing sends the wrong message to the test user, as the result of the
    tests is indeterminate, not failed.
  - Having to add per-test class abstractions that override `SetUp()` to
    test for the capsicum feature set, then skip all of the tests in their
    respective SetUp fixtures, would be a lot of human and computational
    work; checking for the feature would need to be done for all of the
    tests, instead of once for all of the tests.

  For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`,
  by not executing the testcases, is the most desirable solution.

  In order to properly diagnose what happened when running the tests if
  they are skipped, print out the diagnostics in an ad hoc manner.

  Update the documentation to note this change and integrate a new test,
  gtest_skip_in_environment_setup_test, into the test suite.

  This change addresses #2189.

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

The goal with my merging in this change is to avoid requiring extensive
refactoring/retesting of test suites when ensuring prerequisites are met,
e.g., checking for a CAPABILITIES-enabled kernel before running capsicum-test
(see D19758 for more details).

The proof-of-concept is being imported before accepted by the upstream
project due to the fact that the upstream project is undergoing a potential
development freeze and the maintainers aren't responding to my PR.

1. https://github.com/google/googletest/pull/2203

r346574:

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.

r346576:

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.

5 years agoload_key_buf do not free data from dearmor
Simon J. Gerraty [Wed, 22 May 2019 23:23:16 +0000 (23:23 +0000)]
load_key_buf do not free data from dearmor

The data returned by dearmor is referenced by the key
leave it alone!

MFC r347980

Reviewed by: stevek

5 years agolibsecureboot: allow control of when pseudo pcr is updated
Simon J. Gerraty [Wed, 22 May 2019 23:19:20 +0000 (23:19 +0000)]
libsecureboot: allow control of when pseudo pcr is updated

During boot we only want to measure things which *must*
be verified - this should provide more deterministic ordering.

MFC r347981

Reviewed by: stevek
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D20297

5 years agoMFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none
Kyle Evans [Wed, 22 May 2019 22:55:27 +0000 (22:55 +0000)]
MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none

These datasets will generally be canmount=noauto,mountpoint=none (e.g.
zroot/var) but have children that may need to be mounted. Instead of
skipping that segment for no good reason, descend.

5 years agoMFC r347578: tun/tap: Defer clearing if_softc until after if_detach
Kyle Evans [Wed, 22 May 2019 22:34:35 +0000 (22:34 +0000)]
MFC r347578: tun/tap: Defer clearing if_softc until after if_detach

(Commit massaged to match stable structure; tun and tap have been merged in
head)

r346670 added an sx to close a race between the ifioctl handler and
interface destruction. Unfortunately, it clears if_softc immediately after
the interface is closed, but before if_detach has been invoked.

Any time before detachment, an interface that's part of a bridge may still
receive traffic that's pushed through tunstart/tunstart_l2 and promptly
lead to a panic because if_softc is now NULL.

Fix it by deferring the clearing of if_softc until after the interface has
detached and thus been removed from the bridge. if_softc still gets cleared
in case another thread has already entered the ioctl handler before it's
replaced with ifdead_ioctl.

5 years agoMFC r347978:
Dimitry Andric [Wed, 22 May 2019 17:42:22 +0000 (17:42 +0000)]
MFC r347978:

Fix OptionalObsoleteFiles copy/paste mistake from r345236, which
connected libomp to the build.  The comparison should not have been
against ${MK_OPENSSH}, but against ${MK_OPENMP}, obviously.

MFC r347979:

To avoid unnecessarily modifying ports, add a -lgomp symlink, since GCC
does not ship a -lomp symlink.  Also update OptionalObsoleteFiles for
this, and add 32-bit variants while here.

Submitted by: jbeich
PR: 237975

5 years agoMFC r347204:
Dmitry Chagin [Wed, 22 May 2019 05:37:29 +0000 (05:37 +0000)]
MFC r347204:

Adds sys/class/net devices to linsysfs.

Only two interfaces are created eth0 and lo and they expose
the following properties:
address, addr_len, flags, ifindex, mty, tx_queue_len and type.

Initial patch developed by Carlos Neira in 2017 and finished by me.

MFC r347218:

Remove wrong copyright line. Discussed with Carlos Neira.

5 years agoMFC r347203:
Dmitry Chagin [Wed, 22 May 2019 05:35:35 +0000 (05:35 +0000)]
MFC r347203:

Rewrite linux_ifflags() in more readable Linuxulator style.

5 years agoMFC r347202:
Dmitry Chagin [Wed, 22 May 2019 05:34:44 +0000 (05:34 +0000)]
MFC r347202:

Complete r347052 (https://reviews.freebsd.org/D20137) as it it was not
a final revision.

Fix style issues and change bool-like variables from int to bool.

5 years agoMFC r347196:
Dmitry Chagin [Wed, 22 May 2019 05:33:47 +0000 (05:33 +0000)]
MFC r347196:

The build process generates assym.inc from genassym.o, so don't forget
to clean genassym.o

5 years agoMFC r347052:
Dmitry Chagin [Wed, 22 May 2019 05:32:39 +0000 (05:32 +0000)]
MFC r347052:

In order to reduce duplication between MD parts of the Linuxulator
move bits that are MI out into the headers in compat/linux.
For that remove bogus _packed attribute from struct l_sockaddr
and use MI types for struct members.

And continue to move into the linux_common module a code that is
intended for both Linuxulator modules (both instruction set - 32 & 64 bit)
or for external modules like linsysfs or linprocfs.

To avoid header pollution introduce new sys/compat/linux_common.h header.

5 years agoMFC r347621:
Johannes Lundberg [Wed, 22 May 2019 04:10:24 +0000 (04:10 +0000)]
MFC r347621:
LinuxKPI: Add get_random_u32 function.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347619:
Johannes Lundberg [Wed, 22 May 2019 04:08:45 +0000 (04:08 +0000)]
MFC r347619:
LinuxKPI: Expand ktime functionality.

Also, make ktime_get_raw call getnanouptime instead of getnanotime
to match (the correct) ktime_get_raw_ns.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347623:
Johannes Lundberg [Wed, 22 May 2019 04:02:10 +0000 (04:02 +0000)]
MFC r347623:
LinuxKPI: Move {lower|upper}_32_bits macros from port to base.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347626:
Johannes Lundberg [Wed, 22 May 2019 04:00:13 +0000 (04:00 +0000)]
MFC r347626:
LinuxKPI: Add helper macros IS_ALIGNED and DIV_ROUND_DOWN_ULL.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347620:
Johannes Lundberg [Wed, 22 May 2019 03:58:41 +0000 (03:58 +0000)]
MFC r347620:
LinuxKPI: Update user_access_begin for Linux v5.0.

Check the new LINUXKPI_VERSION macro for backwards compatibility.
This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347622:
Johannes Lundberg [Wed, 22 May 2019 03:54:25 +0000 (03:54 +0000)]
MFC r347622:
LinuxKPI: Include asm/atomic-long.h from atomic.h.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoRevert r348012, MFC r347963.
Brooks Davis [Tue, 21 May 2019 16:36:28 +0000 (16:36 +0000)]
Revert r348012, MFC r347963.

Several of the changes touch actual defaults. These defaults are all
mistakes and no one should rely on them, but changing them in a stable
branch is clearly inappropriate.

Reported by: rgrimes

5 years agoMFC r347216:
Konstantin Belousov [Tue, 21 May 2019 15:19:49 +0000 (15:19 +0000)]
MFC r347216:
amd64: fix BUS_SPACE_MAXSIZE to 64bit max value.

5 years agoBump FreeBSD version after change to struct in linuxkpi from r348035.
Johannes Lundberg [Tue, 21 May 2019 02:42:42 +0000 (02:42 +0000)]
Bump FreeBSD version after change to struct in linuxkpi from r348035.

5 years agoMFC r347601:
Johannes Lundberg [Tue, 21 May 2019 02:38:21 +0000 (02:38 +0000)]
MFC r347601:
LinuxKPI: Add prepare to pm_ops and bump FreeBSD version.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347600:
Johannes Lundberg [Tue, 21 May 2019 02:36:12 +0000 (02:36 +0000)]
MFC r347600:
LinuxKPI: Add vm_fault_t type.

This patch is part of D19565

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347592:
Johannes Lundberg [Tue, 21 May 2019 02:31:34 +0000 (02:31 +0000)]
MFC r347592:
LinuxKPI: Let del_timer return a value to match Linux.

This patch is part of https://reviews.freebsd.org/D19565.

Reviewed by: hps
Approved by: imp (mentor), hps

5 years agoMFC r347570:
Mark Johnston [Tue, 21 May 2019 01:27:08 +0000 (01:27 +0000)]
MFC r347570:
Specify -z notext when building with -z ifunc-noplt.