Commit Graph

241527 Commits

Author SHA1 Message Date
Conrad Meyer
64e7d18f34 netdump: Ref the interface we're attached to
Serialize netdump configuration / deconfiguration, and discard our
configuration when the affiliated interface goes away by monitoring
ifnet_departure_event.

Reviewed by:	markj, with input from vangyzen@ (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D20206
2019-05-10 23:12:59 +00:00
Doug Moore
12cd7ded68 Don't use _Generic, as many systems don't know about it. Go back to a lo-tech switch statement.
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20235
2019-05-10 23:12:37 +00:00
Conrad Meyer
070e7bf95e netdump: Fix boot-time configuration typo
Boot-time netdump configuration is much more useful if one can configure the
client and gateway addresses.  Fix trivial typo.

(Long-standing bug, I believe it dates to the original netdump commit.)

Spotted by:	one of vangyzen@ or markj@
Sponsored by:	Dell EMC Isilon
2019-05-10 23:10:22 +00:00
Johannes Lundberg
5098ed5f3b Implement linux_pci_unregister_drm_driver in linuxkpi so that drm drivers
can be unloaded.

This patch is a part of D19565.

Reviewed by:	hps
Approved by:	imp (mentor), hps
MFC after:	1 week
2019-05-10 23:10:22 +00:00
Doug Moore
4ab18ea23a When bitpos can't be implemented with an inline ffs* instruction,
change the binary search so that it does not depend on a single bit
only being set in the bitmask. Use bitpos more generally, and avoid
some clearing of bits to accommodate its current behavior.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20232
2019-05-10 22:49:01 +00:00
Doug Moore
d4808c4403 Add a (q)uit option to the subr_blist test program.
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20234
2019-05-10 22:02:29 +00:00
Conrad Meyer
6144b50f8b netdump: Don't store sensitive key data we don't need
Prior to this revision, struct diocskerneldump_arg (and struct netdump_conf
with embedded diocskerneldump_arg before r347192), were copied in their
entirety to the global 'nd_conf' variable.  Also prior to this revision,
de-configuring netdump would *not* remove the the key material from global
nd_conf.

As part of Encrypted Kernel Crash Dumps (EKCD), which was developed
contemporaneously with netdump but happened to land first, the
diocskerneldump_arg structure will contain sensitive key material
(kda_key[]) when encrypted dumps are configured.

Netdump doesn't have any use for the key data -- encryption is handled in
the core dumper code -- so in this revision, we no longer store it.

Unfortunately, I think this leak dates to the initial import of netdump in
r333283; so it's present in FreeBSD 12.0.

Fortunately, the impact *seems* relatively minor.  Any new *netdump*
configuration would overwrite the key material; for active encrypted netdump
configurations, the key data stored was just a duplicate of the key material
already in the core dumper code; and no user interface (other than
/dev/kmem) actually exposed the leaked material to userspace.

Reviewed by:	markj, rpokala (earlier commit message)
MFC after:	2 weeks
Security:	yes (minor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D20233
2019-05-10 21:55:11 +00:00
Gleb Smirnoff
54bb7ac0c4 Fix regression from r347375: do not panic when sending an IP multicast
packet from an interface that doesn't have IPv4 address.

Reported by:	Michael Butler <imb protected-networks.net>
2019-05-10 21:51:17 +00:00
John Baldwin
c9d337083f Apply r280991 to ip6_fragment.
This uses m_dup_pkthdr() to copy all of the metadata about a packet to
each of its fragments including VLAN tags, mbuf tags, etc. instead of
hand-copying a few fields.

Reviewed by:	bz
MFC after:	1 month
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20117
2019-05-10 20:15:40 +00:00
Doug Moore
09b380a1ff Replace the expression "-mask & ~mask" with a function call that does
the same thing, but is commented so that it might be better
understood.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20231
2019-05-10 19:55:29 +00:00
Justin Hibbits
f04019c3c6 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
Submitted by:	Mark Millard (partial)
Reported by:	Mark Millard
MFC after:	2 weeks
2019-05-10 19:36:14 +00:00
Doug Moore
d1c34a6b76 blist_next_leaf_alloc walks over all the meta-nodes between one leaf
and the next one, and if blocks are allocated from the next leaf, it
walks back toward where it started, as long as there are interleaving
meta-nodes to be updated on account of the last free blocks under
those meta-nodes being allocated. Only if the walk goes all the way
back to the starting point must we calculate the position of the
meta-node that is the least-comment parent of one leaf and the next,
and update a bit in that meta-node to indicate the allocation of its
last free block.

There's no need to start calculating the position of that least-common
parent until the walk back reaches the original starting point, and
there's no need for a calculation that updates 'radius' to tell us
when we've walked back to the beginning, since comparing scan to next
suffices for that.

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20229
2019-05-10 18:25:06 +00:00
Doug Moore
b1f59c92d8 Replace panic() with KASSERT() and provide more useful information when failure happens.
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20226
2019-05-10 18:22:40 +00:00
Bryan Drewery
29317e6a0e Fix build race with machine links and genoffset.o.
Generate the ilinks for all dependency objects not just the ones
in the CLEAN list.

Possibly related to r345351

Reported by:	kmoore
MFC after:	2 weeks
X-MFC-with:	r345351
Sponsored by:	Dell EMC Isilon
2019-05-10 18:09:27 +00:00
Leandro Lupori
8edae83905 Fix build issue with clang 8.0.1
The algorithm header is needed to use std::remove_if
2019-05-10 17:05:40 +00:00
Emmanuel Vadot
595d5338fa arm64: rockchip: Don't always put PLL to normal mode
We used to put every PLL in normal mode (meaning that the output would
be the result of the PLL configuration) instead of slow mode (the output
is equal to the external oscillator frequency, 24-26Mhz) but this doesn't
work for most of the PLLs as when we put them into normal mode the registers
configuring the output frequency haven't been set.
Add a normal_mode member in clk_pll_def/clk_pll_sc struct and if it's true
we then set the PLL to normal mode.
For now only set it to the LPLL and BPLL (Little cluster PLL and Big cluster
PLL respectively).

Reviewed by:	ganbold
Differential Revision:	https://reviews.freebsd.org/D20174
2019-05-10 16:45:17 +00:00
Emmanuel Vadot
67a5e53398 efibootmgr: Do not add the new boot entry in dry-run is specified
While here fix a typo.

Sponsored-by: Ampere Computing, LLC
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D20212
2019-05-10 16:44:35 +00:00
Emmanuel Vadot
73f707e259 ahci: Check if bus is cache-coherent
We do this for FDT systems but not for ACPI ones.
Check the presence of the _CCA attribute.

Sponsored by: Ampere Computing, LLC
Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D20144
2019-05-10 16:43:53 +00:00
Mark Johnston
7f75bbd066 Atomically update the global gMsgId in libnetgraph.
Otherwise concurrently running threads may inadvertently use the same
token for different messages.

Preserve the behaviour of disallowing negative message tokens, but allow
a message token value of zero since this simplifies the code a bit and
tokens are documented to be non-negative.

PR:		234442
Reported and tested by:	eugen
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2019-05-10 16:43:47 +00:00
Doug Moore
0f78871d44 A major change to subr_blist.c failed to update all the comments about
changes to struct fields. Update those now.

Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20227
2019-05-10 16:01:25 +00:00
Andrew Gallatin
4e255d7479 Bind TCP HPTS (pacer) threads to NUMA domains
Bind the TCP pacer threads to NUMA domains and build per-domain
pacer-thread lookup tables. These tables allow us to use the
inpcb's NUMA domain information to match an inpcb with a pacer
thread on the same domain.

The motivation for this is to keep the TCP connection local to a
NUMA domain as much as possible.

Thanks to jhb for pre-reviewing an earlier version of the patch.

Reviewed by:	rrs
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20134
2019-05-10 13:41:19 +00:00
Kyle Evans
6a68e95de8 ifconfig(8): Add kld mappings for ipsec/enc
Additionally, providing mappings makes the comparison for already loaded
modules a little more strict. This should have been done at initial
introduction, but there was no real reason- however, it proves necessary for
enc which has a standard enc -> if_enc mapping but there also exists an
'enc' module that's actually CAM. The mapping lets us unambiguously
determine the correct module.

Discussed with:	ae
MFC after:	4 days
2019-05-10 13:18:22 +00:00
Ruslan Bukin
ef68f03ec2 RISC-V ISA does not specify how to manage physical memory attributes (PMA).
So do nothing in pmap_page_set_memattr() and don't panic.

Reviewed by:	markj
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D20209
2019-05-10 11:21:57 +00:00
Edward Tomasz Napierala
16e55b9e0e Try to unbreak the build after r347425.
MFC after:	2 weeks
2019-05-10 08:16:29 +00:00
Edward Tomasz Napierala
36a040183e Add simple regression tests for tree(3). Those are ATF-ified versions
of OpenBSD's regress/sys/sys/tree/.

Reviewed by:	ngie
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D20186
2019-05-10 07:46:14 +00:00
Mark Johnston
b870199522 Avoid returning a NULL pointer from the Intel hw PRNG ifunc resolver.
DTrace expects kernel function symbols of a non-zero size to have an
implementation, which is a reasonable invariant to preserve.

Reported and tested by:	ler
Reviewed by:	cem, kib
Approved by:	so (delphij)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20218
2019-05-10 04:28:17 +00:00
Ian Lepore
0eba88cf91 Allow dcons(4) to be unloaded when loaded as a module.
When the module is unloaded, the tty devices are destroyed.  That requires
implementing the tsw_free callback to avoid a panic.  This driver requires
no particular cleanup to be done from the callback, but the module itself
must remain in memory until the deferred tsw_free callbacks are invoked.
These changes implement that by incrementing a reference count variable in
the detach routine, and decrementing it in the tsw_free callback.  The
MOD_UNLOAD event handler doesn't return until the count drops to zero.

PR: 237758
2019-05-10 02:30:16 +00:00
Eric Joyner
afb7737237 iflib: use default ntxd and nrxd when user value is not power of 2
From Jake:
A user may set a sysctl to override the default number of Tx or Rx
descriptors. However, certain calculations in the iflib core expect the
number of descriptors to be a power of 2.

Update _iflib_assert to verify that all of the shared context parameters
for the number of descriptors are powers of 2.

Modify iflib_reset_qvalues to check that the provided isc_nrxd value is
a power of 2. If it's not, print a warning message and then use the
default value.

An alternative might be to try rounding the number down instead.
However, this creates problems in case the rounded down value is below
the minimum value that the driver would support.

Submitted by:	Jacob Keller <jacob.e.keller@intel.com>
Reviewed by:	marius@
MFC after:	1 week
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D19880
2019-05-10 00:41:42 +00:00
Enji Cooper
16f35864df 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
MFC after:	1 week
2019-05-10 00:03:32 +00:00
Jung-uk Kim
9ad8b64eb4 MFV: r347413
Import ACPICA 20190509.
2019-05-09 23:03:10 +00:00
Jung-uk Kim
08f4234e06 Import ACPICA 20190509. 2019-05-09 22:49:10 +00:00
Andrew Gallatin
542970fa2d Remove IPSEC from GENERIC due to performance issues
Having IPSEC compiled into the kernel imposes a non-trivial
performance penalty on multi-threaded workloads due to IPSEC
refcounting. In my benchmarks of multi-threaded UDP
transmit (connected sockets), I've seen a roughly 20% performance
penalty when the IPSEC option is included in the kernel (16.8Mpps
vs 13.8Mpps with 32 senders on a 14 core / 28 HTT Xeon
2697v3)). This is largely due to key_addref() incrementing and
decrementing an atomic reference count on the default
policy. This cause all CPUs to stall on the same cacheline, as it
bounces between different CPUs.

Given that relatively few users use ipsec, and that it can be
loaded as a module, it seems reasonable to ask those users to
load the ipsec module so as to avoid imposing this penalty on the
GENERIC kernel. Its my hope that this will make FreeBSD look
better in "out of the box" benchmark comparisons with other
operating systems.

Many thanks to ae for fixing auto-loading of ipsec.ko when
ifconfig tries to configure ipsec, and to cy for volunteering
to ensure the the racoon ports will load the ipsec.ko module

Reviewed by:	cem, cy, delphij, gnn, jhb, jpaetzel
Differential Revision:	https://reviews.freebsd.org/D20163
2019-05-09 22:38:15 +00:00
Simon J. Gerraty
9bee6a6083 libsecureboot: make it easier to customize trust anchors
Avoid making hash self-tests depend on X.509 certs.
Include OpenPGP keys in trust store count.

Reviewed by:	stevek
MFC after:	1 week
Sponsored by:	Juniper Networks
Differential Revision:	https://reviews.freebsd.org/D20208
2019-05-09 22:25:12 +00:00
Michael Tuexen
b5a154d8e3 Don't use C++ style comments.
These where introduced in r347382.
Reported by:		ngie@
2019-05-09 21:00:15 +00:00
Mateusz Piotrowski
bc562d41f2 nfsd.8: Fix mandoc -Tlint and igor warnings
- Remove Tn macros
- Refernce sysctl(8) instead of sysctl(1)
- Start new sentences on new lines
- Capitalize NFS where needed
- Use Fx for FreeBSD
- Remove a list block (Bl) that was added to the manual page
  by accident in r335174

Reviewed by:	bcr
Approved by:	doc (bcr)
Differential Revision:	https://reviews.freebsd.org/D20215
2019-05-09 19:03:52 +00:00
Kyle Evans
16760d8e28 tuntap: Don't down tap interfaces if LINK0 is set 2019-05-09 18:54:29 +00:00
Andrey V. Elsukov
30de137493 Add if_ipsec.ko symlink to ipsec.ko kernel module.
This add ability to automatically load ipsec kernel module, when
if_ipsec(4) virtual interface is created using ifconfig(8).

Reviewed by:	gallatin
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20169
2019-05-09 18:06:11 +00:00
Kyle Evans
a6fa049545 tuntap: Properly detach tap ifp 2019-05-09 14:06:24 +00:00
Toomas Soome
82c29d4fde loader: use DPRINTF in biosdisk.c and define safe DPRINTF
r345066 did miss biosdisk.c.

Also define DPRINTF as ((void)0) for case we do not want debug printouts.

MFC after:	1 week
2019-05-09 13:12:43 +00:00
Kyle Evans
56f76a10c6 ifconfig(8): Partial revert of r347241
r347241 introduced an ifname <-> kld mapping table, mostly so tun/tap/vmnet
can autoload the correct module on use. It also inadvertently made bogus
some previously valid uses of sizeof().

Revert back to ifkind on the stack for simplicity sake. This reduces the
diff from the previous version of ifmaybeload for easiser auditing.
2019-05-09 12:58:33 +00:00
Toomas Soome
2a0e2c88db loader: no-TERM_EMU is broken now
If TERM_EMU is not defined, we do not have curx variable. Use conout mode
for efi and expose get_pos() for i386.
2019-05-09 12:14:52 +00:00
Marius Strobl
14e0010729 - Merge r338254 from cxgbe(4):
Use fcmpset instead of cmpset when appropriate.
- Revert r277226 of cxgbe(4), obsolete since r334320.
2019-05-09 11:34:46 +00:00
Toomas Soome
41a1c642e4 loader: ptable_print() needs two tabs sometimes
Since the partition/slice names do vary in length, check the length
of the fixed part of the line against 3 * 8, if the lenth is less than
3 tab stops, print out extra tab.

use snprintf() instead of sprintf.
2019-05-09 11:04:10 +00:00
Toomas Soome
686d524bc9 loader: implement proper 8 char tab stops
The current console code is printing out 8 spaces for tab, calculate
the amount of spaces based on tab stops.
2019-05-09 10:37:57 +00:00
Hans Petter Selasky
e2eb11e577 Fix memory leak of PCI BUS structure in the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-05-09 10:23:42 +00:00
Hans Petter Selasky
eb6f534241 Fix regression issue after r346645 in the LinuxKPI.
Make sure LinuxKPI PCI devices get a default BUSDMA tag.

Found by:	Thomas Laus <lausts@acm.org>
Sponsored by:	Mellanox Technologies
2019-05-09 09:45:19 +00:00
Andrey V. Elsukov
50ec8b3b3e 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
MFC after:	2 weeks
2019-05-09 07:57:33 +00:00
Michael Tuexen
5acfd95cbc Receiver side DSACK implemenation.
This adds initial support for RFC 2883.

Submitted by:		Richard Scheffenegger
Reviewed by:		rrs@
Differential Revision:	https://reviews.freebsd.org/D19334
2019-05-09 07:34:15 +00:00
Michael Tuexen
5cc11a89db Prevent cwnd to collapse down to 1 MSS after exiting recovery.
This is descrined in RFC 6582, which updates RFC 3782.

Submitted by:		Richard Scheffenegger
Reviewed by:		lstewart@
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D17614
2019-05-09 07:11:08 +00:00
Gleb Smirnoff
6ca363eb7b Existense of PCB route caching doesn't allow us to use new fast route
lookup KPI in ip_output() like it is already used in ip_forward().
However, when there is no PCB provided we can use fast KPI, gaining
performance advantage.

Typical case when ip_output() is called without a PCB pointer is a
sendto(2) on a not connected UDP socket. In practice DNS servers do
this.

Reviewed by:	melifaro
Differential Revision:	https://reviews.freebsd.org/D19804
2019-05-08 23:39:24 +00:00