]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoreadelf: return error in case of invalid file
Ed Maste [Mon, 5 Apr 2021 01:01:28 +0000 (21:01 -0400)]
readelf: return error in case of invalid file

GNU readelf exits with an error for a number of invalid file cases.
Previously ELF Tool Chain readelf always exited with 0.  Now we exit 1
upon detecting an error with one or more input files, but in any case
all of them are processed.

This should catch common failure cases.  We still do not report an error
for some types of malformed ELF files, but this is consistent with GNU
readelf.

PR: 252727
Reviewed by: jkoshy, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29377

3 years agonfsd: fix BindConnectionToSession so that it clears "cb path down"
Rick Macklem [Sun, 4 Apr 2021 22:05:39 +0000 (15:05 -0700)]
nfsd: fix BindConnectionToSession so that it clears "cb path down"

Commit 01ae8969a9ee stopped the NFSv4.1/4.2 server from implicitly
binding the back channel to a new TCP connection so that it
conforms to RFC5661, for NFSv4.1/4.2. An effect of this
for the Linux NFS client is that it will do a
BindConnectionToSession when it sees NFSV4SEQ_CBPATHDOWN
set in a sequence reply. It will do this for every RPC
reply until it no longer sees the flag.
Without that patch, this will happen until the client does
an Open, which will clear LCL_CBDOWN.

This patch clears LCL_CBDOWN right away, so that
NFSV4SEQ_CBPATHDOWN will no longer be sent to the client
in Sequence replies and the Linux client will not repeat
the BindConnectionToSession RPCs.

This is not critical for correct behaviour, but reduces
RPC overheads for cases where the Open will not be done
for a while.

MFC after: 2 weeks

3 years agoamd64 fabs.S: use '.section .rodata' instead of '.rodata'
Konstantin Belousov [Sun, 4 Apr 2021 19:25:43 +0000 (22:25 +0300)]
amd64 fabs.S: use '.section .rodata' instead of '.rodata'

Seems to be an issue with older gnu as

Reported by: rscheff
Sponsored by: The FreeBSD Foundation
MFC after: 6 days

3 years agojail: fix jail(8) synposis and usage message to match reality.
Jamie Gritton [Sun, 4 Apr 2021 17:49:38 +0000 (10:49 -0700)]
jail: fix jail(8) synposis and usage message to match reality.

Reported by: yuri
PR: 254741
MFC after: 5 days

3 years agoAdd sysctl debug.uma_reclaim
Konstantin Belousov [Sun, 4 Apr 2021 16:28:14 +0000 (19:28 +0300)]
Add sysctl debug.uma_reclaim

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoStyle
Konstantin Belousov [Sun, 4 Apr 2021 16:27:42 +0000 (19:27 +0300)]
Style

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agostress2: Added a new regression test
Peter Holm [Sun, 4 Apr 2021 08:36:09 +0000 (10:36 +0200)]
stress2: Added a new regression test

3 years agostress2: update the list of test not to run
Peter Holm [Sun, 4 Apr 2021 08:31:52 +0000 (10:31 +0200)]
stress2: update the list of test not to run

3 years agostress2: Add note about problems found.
Peter Holm [Sun, 4 Apr 2021 08:27:53 +0000 (10:27 +0200)]
stress2: Add note about problems found.

3 years agoloader: we should support pools without features
Toomas Soome [Fri, 2 Apr 2021 23:40:51 +0000 (02:40 +0300)]
loader: we should support pools without features

nvlist_check_features_for_read() does return error when there
are no features for read.

MFC after: 5 days

3 years agoamd64 fabs.S: put signbit into rodata instead of text
Konstantin Belousov [Sun, 4 Apr 2021 01:36:32 +0000 (04:36 +0300)]
amd64 fabs.S: put signbit into rodata instead of text

Noted by: jrtc27
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agolibc/<arch>/sys/cerror.S: fix typo
Konstantin Belousov [Sat, 3 Apr 2021 01:36:41 +0000 (04:36 +0300)]
libc/<arch>/sys/cerror.S: fix typo

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoamd64 fabs(3): move signbit to .text
Konstantin Belousov [Sat, 3 Apr 2021 01:32:10 +0000 (04:32 +0300)]
amd64 fabs(3): move signbit to .text

There is no reason for signbit quad to be writeable.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoRemove kgmon(8)
Konstantin Belousov [Fri, 2 Apr 2021 22:00:20 +0000 (01:00 +0300)]
Remove kgmon(8)

Follow-up to the removal of the mcov from kernel.

Noted by: mckusick
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D29563

3 years agoffsinfo: Update example to avoid to-be-deprecated vinum
Ed Maste [Mon, 29 Mar 2021 00:04:29 +0000 (20:04 -0400)]
ffsinfo: Update example to avoid to-be-deprecated vinum

Reviewed by: mckusick
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29478

3 years agolibc: use standard LF line endings, not CRLF
Ed Maste [Wed, 31 Mar 2021 17:04:36 +0000 (13:04 -0400)]
libc: use standard LF line endings, not CRLF

3 years agolock_delay(9): improve interaction with restrict_starvation
Edward Tomasz Napierala [Sat, 3 Apr 2021 12:08:45 +0000 (13:08 +0100)]
lock_delay(9): improve interaction with restrict_starvation

After e7a5b3bd058, the la->delay value was adjusted after
being set by the starvation_limit code block, which is wrong.

Reported By: avg
Reviewed By: avg
Fixes: e7a5b3bd058
Sponsored By: NetApp, Inc.
Sponsored By: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D29513

3 years agopam: add option to not prompt for password if it's set to empty
Edward Tomasz Napierala [Sat, 3 Apr 2021 12:01:45 +0000 (13:01 +0100)]
pam: add option to not prompt for password if it's set to empty

Add a new option to pam_unix(8), "emptyok", which makes it not prompt
for password, if it's set to an empty one.  It is similar to "nullok",
which makes it not prompt for password if the hash itself is empty.

Reviewed By: markj
Sponsored By: NetApp, Inc.
Sponsored By: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27569

3 years agoFix typo in xhci nvlist node name, and also increment device counter.
Peter Grehan [Sat, 3 Apr 2021 04:32:54 +0000 (14:32 +1000)]
Fix typo in xhci nvlist node name, and also increment device counter.

This allows the xhci tablet device to be recognized and a PCI device
instantiated.

Reviewed by: jhb
Fixes: 621b5090487d Refactor configuration management in bhyve.
MFC after: 3 months.

3 years agofbt: Remove some handling for multiple CTF containers
Mark Johnston [Fri, 2 Apr 2021 21:42:26 +0000 (17:42 -0400)]
fbt: Remove some handling for multiple CTF containers

This was ported from illumos but not completely done.  Currently we do
not perform type deduplication between KLDs and the kernel, i.e., kernel
modules have a complete type graph.  So, remove it for now since it's
not functional and complicates the task of modifying various CTF type
definitions, and we are hitting some limits in the current format which
necessitate an update.

No functional change intended.

MFC after: 2 weeks

3 years agodtrace: Document the libdir, nolibs and syslibdir options
Domagoj Stolfa [Fri, 2 Apr 2021 21:19:47 +0000 (17:19 -0400)]
dtrace: Document the libdir, nolibs and syslibdir options

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29541

3 years agosendfile: Fix error initialization in sendfile_getobj()
Mark Johnston [Fri, 2 Apr 2021 21:12:56 +0000 (17:12 -0400)]
sendfile: Fix error initialization in sendfile_getobj()

Reviewed by: chs, kib
Reported by: jhb
Fixes: faa998f6ff695
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D29540

3 years agoEnsure that all allocated data structures in fsck_ffs are freed.
Kirk McKusick [Fri, 2 Apr 2021 18:57:34 +0000 (11:57 -0700)]
Ensure that all allocated data structures in fsck_ffs are freed.

Several large data structures are allocated by fsck_ffs to track
resource usage. Most but not all were deallocated at the end of
checking each filesystem. This commit consolidates the freeing
of all data structures in one place and adds one that had previously
been missing.

It is important to clean up these data structures as they can be
large. If the previous allocations have not been freed, fsck_ffs
can run out of address space when many large filesystems are being
checked. An alternative would be to fork a new instance of fsck_ffs
for each filesystem to be checked, but we choose to free the small
set of large structures to save the fork overhead.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    7 days
Sponsored by: Netflix

3 years agofix typo in 38ea2bd0698e
Richard Scheffenegger [Fri, 2 Apr 2021 18:34:33 +0000 (20:34 +0200)]
fix typo in 38ea2bd0698e

3 years agoUse sbuf_drain unconditionally
Richard Scheffenegger [Fri, 2 Apr 2021 18:26:48 +0000 (20:26 +0200)]
Use sbuf_drain unconditionally

After making sbuf_drain safe for external use,
there is no need to protect the call.

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29545

3 years agoMake sbuf_drain safe for external use
Richard Scheffenegger [Fri, 2 Apr 2021 18:11:45 +0000 (20:11 +0200)]
Make sbuf_drain safe for external use

While sbuf_drain was an internal function, two
KASSERTS checked the sanity of it being called.
However, an external caller may be ignorant if
there is any data to drain, or if an error has
already accumulated. Be nice and return immediately
with the accumulated error.

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29544

3 years agonetmap: update unit tests with libnetmap tests
Vincenzo Maffione [Fri, 2 Apr 2021 14:39:30 +0000 (14:39 +0000)]
netmap: update unit tests with libnetmap tests

3 years agolibnetmap: reset errno in nmreq_register_decode()
Vincenzo Maffione [Fri, 2 Apr 2021 14:31:57 +0000 (14:31 +0000)]
libnetmap: reset errno in nmreq_register_decode()

The reset is necessary at the beginning of the function, because of
the errno logic in the error path (set errno to EINVAL if not set).
If errno is already set when calling the function, and the function
fails, the previous errno value will be inherited.

3 years agoconfig(8): remove support for -p
Konstantin Belousov [Thu, 1 Apr 2021 01:16:32 +0000 (04:16 +0300)]
config(8): remove support for -p

and other equivalent ways to request mcount-based profiling, like
'profile N' in kernel config.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D29529

3 years agox86: remove gcov kernel support
Konstantin Belousov [Wed, 31 Mar 2021 21:04:55 +0000 (00:04 +0300)]
x86: remove gcov kernel support

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D29529

3 years agonullfs: protect against user creating inconsistent state
Konstantin Belousov [Thu, 1 Apr 2021 17:42:14 +0000 (20:42 +0300)]
nullfs: protect against user creating inconsistent state

The VFS conventions is that VOP_LOOKUP() methods do not need to handle
ISDOTDOT lookups for VV_ROOT vnodes (since they cannot, after all).  Nullfs
bypasses VOP_LOOKUP() to lower filesystem, and there, due to user actions,
it is possible to get into situation where
- upper vnode does not have VV_ROOT set
- lower vnode is root
- ISDOTDOT is requested
User just needs to nullfs-mount non-root of some filesystem, and then move
some directory under mount, out of mount, using lower filesystem.

In this case, nullfs cannot do much, but we still should and can ensure
internal kernel structures are consistent.  Avoid ISDOTDOT lookup forwarding
when VV_ROOT is set on lower dvp, return somewhat arbitrary ENOENT.

PR: 253593
Reported by: Gregor Koscak <elogin41@gmail.com>
Test by: Patrick Sullivan <sulli00777@gmail.com>
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agonetmap: restore commit a56e6334d1b7ed6e6faaa8b4612d948005ba74f5
Vincenzo Maffione [Fri, 2 Apr 2021 10:43:19 +0000 (10:43 +0000)]
netmap: restore commit a56e6334d1b7ed6e6faaa8b4612d948005ba74f5

The fix in a56e6334d1b7ed6e6faaa8b4612d948005ba74f5
was accidentally reverted by commit 45c67e8f6b56b9744f01142747fadf291fe3fad2.

3 years agoLinuxKPI: treat firmware file names more lenient
Bjoern A. Zeeb [Wed, 31 Mar 2021 15:25:01 +0000 (15:25 +0000)]
LinuxKPI: treat firmware file names more lenient

A lot of firmware files have a "-" in the name.  That "-" is a problem
when dealing with shell variables or loader (e.g., auto-loading .ko).
It may thus often be convenient to generate firmware kernel object files
with s/-/_/g in the name.  In order to automatically find them from
drivers using LinuxKPI also substitue the '-' for a '_' like we do
for '/' and '.' already.

Reviewed-by: hselasky, manu (ok)
MFC-after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29514

3 years agomlx5: remove dependency on ifnet specifics of linux/netdevice.h
Bjoern A. Zeeb [Tue, 30 Mar 2021 15:58:55 +0000 (15:58 +0000)]
mlx5: remove dependency on ifnet specifics of linux/netdevice.h

Rename the last remaining bits depending on ifnet from linux/netdevice.h
instead of using the compat macros. This helps clearing up
struct netdevice being struct ifnet from linux/netdevice.h.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky, kib
X-D-R: D29366
Differential Revision: https://reviews.freebsd.org/D29497

3 years agoPartially revert r248770.
Dmitry Chagin [Fri, 2 Apr 2021 08:43:17 +0000 (11:43 +0300)]
Partially revert r248770.

Under geom(4) nvme_ns_bio_process() is on the path where sleep
is prohibited as g_io_shedule_down() calls THREAD_NO_SLEEPNG()
before geom->start().

Reviewed By: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29539

3 years agonetmap: several typo fixes
Vincenzo Maffione [Fri, 2 Apr 2021 07:01:20 +0000 (07:01 +0000)]
netmap: several typo fixes

No functional changes intended.

3 years agonetmap: fix typo bug in netmap_compute_buf_len
Vincenzo Maffione [Fri, 2 Apr 2021 06:42:34 +0000 (06:42 +0000)]
netmap: fix typo bug in netmap_compute_buf_len

3 years agocache: add high level overview
Mateusz Guzik [Thu, 11 Feb 2021 15:39:28 +0000 (16:39 +0100)]
cache: add high level overview

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

3 years agocache: fix resizing in face of lockless lookup
Mateusz Guzik [Mon, 29 Mar 2021 19:17:57 +0000 (21:17 +0200)]
cache: fix resizing in face of lockless lookup

Reported by: pho
Tested by: pho

3 years agovfs: add vfs_smr_quiesce
Mateusz Guzik [Tue, 30 Mar 2021 14:44:10 +0000 (16:44 +0200)]
vfs: add vfs_smr_quiesce

This can be used to observe all CPUs not executing while within
vfs_smr_enter.

3 years agostats(3): Improve t-digest merging of samples which result in mu adjustment underflow.
Lawrence Stewart [Fri, 2 Apr 2021 01:29:29 +0000 (12:29 +1100)]
stats(3): Improve t-digest merging of samples which result in mu adjustment underflow.

Allow the calculation of the mu adjustment factor to underflow instead of
rejecting the VOI sample from the digest and logging an error. This trades off
some (currently unquantified) additional centroid error in exchange for better
fidelity of the distribution's density, which is the right trade off at the
moment until follow up work to better handle and track accumulated error can be
undertaken.

Obtained from: Netflix
MFC after: immediately

3 years agoRemove bt.4 man page.
Cy Schubert [Mon, 29 Mar 2021 05:14:36 +0000 (22:14 -0700)]
Remove bt.4 man page.

r339568 (a1db7455b75d7557fd171a537e2d95aceb20846e) removed bt(4).
This revision removes the man page

Reviewed by: emaste (previous version)
Differential Revision: https://reviews.freebsd.org/D29480

3 years agoACPICA: Fix build with options ACPI_DEBUG
Jung-uk Kim [Fri, 2 Apr 2021 01:18:49 +0000 (21:18 -0400)]
ACPICA: Fix build with options ACPI_DEBUG

3 years agoMerge ACPICA 20210331.
Jung-uk Kim [Thu, 1 Apr 2021 22:01:03 +0000 (18:01 -0400)]
Merge ACPICA 20210331.

(cherry picked from commit 1e02e5b0ba8634758c128dcb43c67342c7219cd4)

3 years agocryptocheck: Expand the set of sizes tested by -z.
John Baldwin [Thu, 1 Apr 2021 22:42:30 +0000 (15:42 -0700)]
cryptocheck: Expand the set of sizes tested by -z.

Test individual sizes up to the max encryption block length as well as
a few sizes that include 1 full block and a partial block before
doubling the size.

Reviewed by: cem, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29518

3 years agoossl: Don't encryt/decrypt too much data for chacha20.
John Baldwin [Thu, 1 Apr 2021 22:42:18 +0000 (15:42 -0700)]
ossl: Don't encryt/decrypt too much data for chacha20.

The loops for Chacha20 and Chacha20+Poly1305 which encrypted/decrypted
full blocks of data used the minimum of the input and output segment
lengths to determine the size of the next chunk ('todo') to pass to
Chacha20_ctr32().  However, the input and output segments could extend
past the end of the ciphertext region into the tag (e.g.  if a "plain"
single mbuf contained an entire TLS record).  If the length of the tag
plus the length of the last partial block together were at least as
large as a full Chacha20 block (64 bytes), then an extra block was
encrypted/decrypted overlapping with the tag.  Fix this by also
capping the amount of data to encrypt/decrypt by the amount of
remaining data in the ciphertext region ('resid').

Reported by: gallatin
Reviewed by: cem, gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29517

3 years agonfsv4 client: factor loop contents out into a separate function
Rick Macklem [Thu, 1 Apr 2021 22:36:37 +0000 (15:36 -0700)]
nfsv4 client: factor loop contents out into a separate function

Commit fdc9b2d50fe9 replaced a couple of while loops with LIST_FOREACH()
loops.  This patch factors the body of that loop out into a separate
function called nfscl_checkown().
This prepares the code for future changes to use a hash table of
lists for open searches via file handle.

This patch should not result in a semantics change.

MFC after: 2 weeks

3 years agonfsd: silence rpcb_unset noise for NFSv4 only servers
Rick Macklem [Thu, 1 Apr 2021 22:09:03 +0000 (15:09 -0700)]
nfsd: silence rpcb_unset noise for NFSv4 only servers

An NFSv4 only configuration does not register with
rpcbind(). Without this patch a failure to rpcb_unset()
is reported when the daemon is terminated for this case.

This is harmless noise, but this patch avoids calling
rpcb_unset() for the NFSv4 only case, avoiding the noise.

When called with "-d", it still does the rpcb_unset(),
assuming that the configuration might have been
changed to NFSv4 only and unregistering with
rpcbind() might still be needed.

Reviewed by: freqlabs
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29449

3 years agocxgbe(4): Always use the per-VI callout to read interface stats.
Navdeep Parhar [Thu, 1 Apr 2021 07:57:19 +0000 (00:57 -0700)]
cxgbe(4): Always use the per-VI callout to read interface stats.

There is no change in the source of the stats (t4_get_port_stats or
t4_get_vi_stats) but the per-port callout is gone.

Sponsored by: Chelsio Communications
Reviewed by: jhb@
Differential Revision: https://reviews.freebsd.org/D29527

3 years agolibfetch: Retry with proxy auth when server returns 407
Renato Botelho [Thu, 1 Apr 2021 21:02:57 +0000 (18:02 -0300)]
libfetch: Retry with proxy auth when server returns 407

PR: 220468
Submitted by: Egil Hasting <egil.hasting@higen.org> (based on)
Reviewed by: kevans, kp
Approved by: kp
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29533

3 years agotcp: Shouldn't drain empty sbuf
Richard Scheffenegger [Thu, 1 Apr 2021 15:18:04 +0000 (17:18 +0200)]
tcp: Shouldn't drain empty sbuf

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29524

3 years agopowernv: Include NUMA locality information in the CPU topology
Mark Johnston [Thu, 1 Apr 2021 14:25:57 +0000 (10:25 -0400)]
powernv: Include NUMA locality information in the CPU topology

ULE uses this topology to try and preserve locality when migrating
threads between CPUs and when performing work stealing.  Ensure that on
NUMA systems it will at least take the NUMA topology into account.

Reviewed by: bdragon, jhibbits (previous version)
Tested by: bdragon
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28580

3 years agotraceroute6: Fix Capsicum rights for rcvsock
Mark Johnston [Thu, 1 Apr 2021 13:58:32 +0000 (09:58 -0400)]
traceroute6: Fix Capsicum rights for rcvsock

- Always use distinct sockets for send and recv
- Limit rights on the recv socket

For ICMP6 we were using the same socket for both send and receive, and
we limited rights on the socket such that it's impossible to receive
anything.

PR: 254623
Diagnosed by: Zhenlei Huang <zlei.huang@gmail.com>
Reviewed by: oshogbo
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29523

3 years agotcp: Add hash histogram output and validate bucket length accounting
Richard Scheffenegger [Thu, 1 Apr 2021 12:44:05 +0000 (14:44 +0200)]
tcp: Add hash histogram output and validate bucket length accounting

Provide a histogram output to check, if the hashsize or
bucketlimit could be optimized. Also add some basic sanity
checks around the accounting of the hash utilization.

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29506

3 years agotcp: For hostcache performance, use atomics instead of counters
Richard Scheffenegger [Thu, 1 Apr 2021 08:00:32 +0000 (10:00 +0200)]
tcp: For hostcache performance, use atomics instead of counters

As accessing the tcp hostcache happens frequently on some
classes of servers, it was recommended to use atomic_add/subtract
rather than (per-CPU distributed) counters, which have to be
summed up at high cost to cache efficiency.

PR: 254333
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Reviewed By: #transport, tuexen, jtl
Differential Revision: https://reviews.freebsd.org/D29522

3 years agoAMD-vi: Mixed format IVHD block should replace fixed format IVHD block
Ka Ho Ng [Thu, 1 Apr 2021 01:15:19 +0000 (09:15 +0800)]
AMD-vi: Mixed format IVHD block should replace fixed format IVHD block

This fixes double IVHD_SETUP_INTR calls on the same IOMMU device.

Sponsored by: The FreeBSD Foundation
MFC with: 74ada297e897
Reported by: Oleg Ginzburg <olevole@olevole.ru>
Reviewed by: grehan
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29521

3 years agosh: silence sanitizer
Piotr Pawel Stefaniak [Thu, 1 Apr 2021 05:31:03 +0000 (07:31 +0200)]
sh: silence sanitizer

Don't add 0 to a null pointer.
Reviewed by: jilles

3 years agoluaboot: visible must be a function
Warner Losh [Thu, 1 Apr 2021 04:34:50 +0000 (22:34 -0600)]
luaboot: visible must be a function

Visible needs to be a function. Looks like I tested the wrong thing.

3 years agoloader: create a generic vendor sub-menu place holder
Warner Losh [Wed, 31 Mar 2021 00:35:29 +0000 (18:35 -0600)]
loader: create a generic vendor sub-menu place holder

Add a dummy vendor menu entry on the main welcome menu. Vendors can override
this in their local.lua file to create whatever sub-menu they need for their
products.

Also fix the adding a 'welcome' entry as well based on a suggestion from Kyle.
Silly option menu code also from Kyle. They seem to work for me, but any
transcription error is likely mine.

Reviewed by: kevans@ (the vendor stuff)

3 years agoFix `netstat -rs` reporting.
Alexander V. Chernikov [Wed, 31 Mar 2021 20:56:26 +0000 (20:56 +0000)]
Fix `netstat -rs` reporting.

rttrash (unused but not yet delete entries) were eliminated
 during routing rework. Remove reading these symbols from the kernel.

PR: 254681
Reported by: rashey@superbox.pl
MFC after: immediately

3 years agoAMD-vi: Fix mismatched NULL checking in amdiommu teardown path
Ka Ho Ng [Wed, 31 Mar 2021 19:30:21 +0000 (03:30 +0800)]
AMD-vi: Fix mismatched NULL checking in amdiommu teardown path

Sponsored by: The FreeBSD Foundation
Approved by: lwhsu (mentor)
MFC with: 74ada297e897

3 years agopowerpc/aim: Update timebase directly on resume instead of through platform
Justin Hibbits [Wed, 31 Mar 2021 16:54:27 +0000 (11:54 -0500)]
powerpc/aim: Update timebase directly on resume instead of through platform

This only works on single-CPU G4 systems, and more work is needed for
dual-CPU systems.  That said, platform sleep does not work, and this is
currently only used for PMU-based CPU speed change.

The elimination of the platform_smp_timebase_sync() call is so that the
timebase sync rendezvous can be enhanced to perform better
synchronization, which requires a full rendezvous.  This would be
impossible to do on this single-threaded run.

3 years agopowerpc/powermac: Constrain 'cpu_sleep()' for AIM to mpc745x
Justin Hibbits [Wed, 31 Mar 2021 16:54:11 +0000 (11:54 -0500)]
powerpc/powermac: Constrain 'cpu_sleep()' for AIM to mpc745x

Rename cpu_sleep() to mpc745x_sleep() to denote what it's actually
intended for.  This function is very G4-specific, and will not work on
any other CPU.  This will afterward eliminate a
platform_smp_timebase_sync() call by directly updating the timebase
instead.

3 years agotcp: Make hostcache.cache_count MPSAFE by using a counter_u64_t
Richard Scheffenegger [Wed, 31 Mar 2021 17:30:20 +0000 (19:30 +0200)]
tcp: Make hostcache.cache_count MPSAFE  by using a counter_u64_t

Addressing the underlying root cause for cache_count to
show unexpectedly high  values, by protecting all arithmetic on
that global variable by using counter(9).

PR: 254333
Reviewed By: tuexen, #transport
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29510

3 years agocxgbe/t4_tom: restore socket's protosw before entering TIME_WAIT.
Navdeep Parhar [Tue, 30 Mar 2021 04:35:05 +0000 (21:35 -0700)]
cxgbe/t4_tom: restore socket's protosw before entering TIME_WAIT.

This fixes a panic due to stale so->so_proto if t4_tom is unloaded and
one or more connections that were previously offloaded are still around
in TIME_WAIT state.

Reviewed by: jhb@
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29503

3 years agotcp: drain tcp_hostcache_list in between per-bucket locks
Richard Scheffenegger [Wed, 31 Mar 2021 17:24:01 +0000 (19:24 +0200)]
tcp: drain tcp_hostcache_list in between per-bucket locks

Explicitly drain the sbuf after completing each hash bucket
to minimize the work performed while holding the hash
bucket lock.

PR: 254333
MFC after: 2 weeks
Reviewed By: tuexen, jhb, #transport
Sponsored by:  NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29483

3 years agoExport sbuf_drain to orchestrate lock and drain action
Richard Scheffenegger [Wed, 31 Mar 2021 16:25:53 +0000 (18:25 +0200)]
Export sbuf_drain to orchestrate lock and drain action

While exporting large amounts of data to a sysctl
request, datastructures may need to be locked.

Exporting the sbuf_drain function allows the
coordination between drain events and held
locks, to avoid stalls.

PR: 254333
Reviewed By: jhb
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29481

3 years agovxlan: correct interface MTU when using hw offloads
Konstantin Belousov [Mon, 29 Mar 2021 09:03:07 +0000 (12:03 +0300)]
vxlan: correct interface MTU when using hw offloads

Otherwise it breaks when offloading like checksum or TSO are used,
because second (encapsulated) ip_output() processing passes fragments of
the encapsulated packet down to the hardware interface.

Diagnosed by: hselasky
Reviewed by: np
Sponsored by: Nvidia Networking / Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29501

3 years agombuf: add a way to mark flowid as calculated from the internal headers
Konstantin Belousov [Fri, 12 Feb 2021 13:38:07 +0000 (15:38 +0200)]
mbuf: add a way to mark flowid as calculated from the internal headers

In some settings offload might calculate hash from decapsulated packet.
Reserve a bit in packet header rsstype to indicate that.

Add m_adj_decap() that acts similarly to m_adj, but also either clear
flowid if it is not marked as inner, or transfer it to the decapsulated
header, clearing inner indicator. It depends on the internals of m_adj()
that reuses the argument packet header for the result.

Use m_adj_decap() for decapsulating vxlan(4) and gif(4) input packets.

Reviewed by: ae, hselasky, np
Sponsored by: Nvidia Networking / Mellanox Technologies
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28773

3 years agofortune/freebsd-tips: Fix markup and wording
Daniel Ebdrup Jensen [Wed, 31 Mar 2021 11:10:30 +0000 (13:10 +0200)]
fortune/freebsd-tips: Fix markup and wording

'ps' is not a word - rather, it is a utility with its own manual page.
As every other utility referenced in the file has it, append the
relevant manual section that ps(1) can be found in.

While here, also wordsmith a sentence to avoid awkward phrasing, and fix
a typo.

Pointy hat to: me
Reported by: danfe, brueffer, maxim

3 years agopowerpc/pseries: Add new hypercall definition, H_REGISTER_PROC_TBL
Justin Hibbits [Sun, 16 Aug 2020 16:01:49 +0000 (11:01 -0500)]
powerpc/pseries: Add new hypercall definition, H_REGISTER_PROC_TBL

This will be used by the Radix MMU on pseries.

MFC after: 1 week

3 years ago[PowerPC] Fix ISA_206 subword atomics
Justin Hibbits [Tue, 8 Dec 2020 16:18:44 +0000 (10:18 -0600)]
[PowerPC] Fix ISA_206 subword atomics

The POWER7 subword atomics were not using the correct instructions for
byte and halfword stores in the atomic_fcmpset code.

This only affects builds with custom CFLAGS that have explicitly enabled
ISA_206_ATOMICS.

3 years agoClean up a couple of MD warts in vm_fault_populate():
Jason A. Harmening [Sat, 27 Mar 2021 03:10:46 +0000 (20:10 -0700)]
Clean up a couple of MD warts in vm_fault_populate():

--Eliminate a big ifdef that encompassed all currently-supported
architectures except mips and powerpc32.  This applied to the case
in which we've allocated a superpage but the pager-populated range
is insufficient for a superpage mapping.  For platforms that don't
support superpages the check should be inexpensive as we shouldn't
get a superpage in the first place.  Make the normal-page fallback
logic identical for all platforms and provide a simple implementation
of pmap_ps_enabled() for MIPS and Book-E/AIM32 powerpc.

--Apply the logic for handling pmap_enter() failure if a superpage
mapping can't be supported due to additional protection policy.
Use KERN_PROTECTION_FAILURE instead of KERN_FAILURE for this case,
and note Intel PKU on amd64 as the first example of such protection
policy.

Reviewed by: kib, markj, bdragon
Differential Revision: https://reviews.freebsd.org/D29439

3 years ago[PowerPC] Remove unused IPI type count tracking.
Justin Hibbits [Thu, 24 Sep 2020 15:00:31 +0000 (10:00 -0500)]
[PowerPC] Remove unused IPI type count tracking.

ipi_msg_count is inaccessible outside this file and is never read.

It was introduced in the original SMP support code in r178628 and was never
actually used anywhere.

Remove it to slightly improve IPI performance.

Submitted by: jhibbits
MFC after: 1 week

3 years agox86: clear %db registers in new process
Konstantin Belousov [Tue, 30 Mar 2021 15:40:02 +0000 (18:40 +0300)]
x86: clear %db registers in new process

Reported by:  Michał Górny <mgorny@gentoo.org>
PR: 254661
Reviewed by: emaste, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D29496

3 years agoUPDATING: Add an entry for commit 01ae8969a9ee.
Rick Macklem [Tue, 30 Mar 2021 21:43:53 +0000 (14:43 -0700)]
UPDATING: Add an entry for commit 01ae8969a9ee.

3 years agonfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts
Rick Macklem [Tue, 30 Mar 2021 21:31:05 +0000 (14:31 -0700)]
nfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts

The NFSv4.1 (and 4.2 on 13) server incorrectly binds
a new TCP connection to the back channel when first
used by an RPC with a Sequence op in it (almost all of them).
RFC5661 specifies that only the fore channel should be bound.

This was done because early clients (including FreeBSD)
did not do the required BindConnectionToSession RPC.

Unfortunately, this breaks the Linux client when the
"nconnects" mount option is used, since the server
may do a callback on the incorrect TCP connection.

This patch converts the server behaviour to that
required by the RFC.  It also makes the server test/indicate
failure of the back channel more aggressively.

Until this patch is applied to the server, the
"nconnects" mount option is not recommended for a Linux
NFSv4.1/4.2 client mount to the FreeBSD server.

Reported by: bcodding@redhat.com
Tested by: bcodding@redhat.com
PR: 254560
MFC after: 1 week

3 years agousr.sbin/services_mkdb: plug memory leak when line was blank.
Xin LI [Tue, 30 Mar 2021 22:21:37 +0000 (15:21 -0700)]
usr.sbin/services_mkdb: plug memory leak when line was blank.

Reviewed by: bapt
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29370

3 years agosh: improve emacs mode
Baptiste Daroussin [Tue, 30 Mar 2021 09:37:29 +0000 (11:37 +0200)]
sh: improve emacs mode

In emacs mode, force ^R to backware search the history
This behaviour is the default in emacs mode for most of the other shells

Note: Note that this can still be overridden via $EDITRC, ~/.editrc or a
bind command after set -o emacs.

MFC after: 1 week
Approved by: jilles
Reviewed by: jilles, arichardson, pstef
Differential Revision: https://reviews.freebsd.org/D29494

3 years agoAdd IPv4 fib lookup performance tests with uniform keys.
Alexander V. Chernikov [Tue, 30 Mar 2021 12:43:55 +0000 (13:43 +0100)]
Add IPv4 fib lookup performance tests with uniform keys.

Submitted by: zec
MFC after: 1 week

3 years agopowerpc64: support superpages on pmap_mincore
Leandro Lupori [Tue, 30 Mar 2021 18:54:01 +0000 (15:54 -0300)]
powerpc64: support superpages on pmap_mincore

Now that superpages for HPT MMU has landed, finish implementation of
pmap_mincore by adding support for superpages.

Submitted by:           Fernando Eckhardt Valle <fernando.valle@eldorado.org.br>
Reviewed by:            bdragon, luporl
MFC after:              1 week
Sponsored by:           Eldorado Research Institute (eldorado.org.br)
Differential Revision:  https://reviews.freebsd.org/D29230

3 years agocam: make sure to clear CCBs allocated on the stack
Edward Tomasz Napierala [Tue, 30 Mar 2021 18:15:11 +0000 (19:15 +0100)]
cam: make sure to clear CCBs allocated on the stack

This is required for small CCBs support, where we need to track
whether the CCB was allocated from an UMA zone or not.  There are
no (intended) functional changes with the current source.

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D29484

3 years agofortune/freebsd-tips: Add a few fortunes
Daniel Ebdrup Jensen [Tue, 30 Mar 2021 17:35:50 +0000 (19:35 +0200)]
fortune/freebsd-tips: Add a few fortunes

These are fortunes I've used locally, probably for decades, so there's
no reason why they shouldn't be available to everyone.

3 years agofortune/freebsd-tips: Remove errant spaces
Daniel Ebdrup Jensen [Tue, 30 Mar 2021 17:05:05 +0000 (19:05 +0200)]
fortune/freebsd-tips: Remove errant spaces

I noticed these errant spaces while removing a bogus fortune, and
decided I might as well fix them.

While here, reflow a line to it within 80 columns

3 years agofortune/freebsd-tips: Remove bogus fortune
Daniel Ebdrup Jensen [Tue, 30 Mar 2021 16:59:55 +0000 (18:59 +0200)]
fortune/freebsd-tips: Remove bogus fortune

The RCS IDs have been retired as of the move to git, so on 14-CURRENT
and 13.0-STABLE this fortune returns the following.

This fortune brought to you by:
$FreeBSD$

While faintly amusing the first time, this might just cause confusion
for folks, and in addition it's not the most useful of tips, so doesn't
add much.

Therefore it seems prudent to get rid of it.

MFC: Not to 11-STABLE or 12-STABLE.

3 years agoefifb,vbefb: implement vd_fini
Greg V [Tue, 30 Mar 2021 15:46:17 +0000 (17:46 +0200)]
efifb,vbefb: implement vd_fini

This removes the pmap entry when switching away to e.g. drm fb.

Differential Revision: https://reviews.freebsd.org/D29020
MFC After: 1 month

3 years agoarm: add options GDB to std.armv6 and std.armv7
Mitchell Horne [Thu, 4 Mar 2021 20:53:12 +0000 (16:53 -0400)]
arm: add options GDB to std.armv6 and std.armv7

There are now options for specifying the debug port via tunable
(hw.fdt.dbgport) and device tree (/chosen/freebsd-dbgpath), so this can
be usefully included in GENERIC.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29152

3 years agoLinuxKPI/OFED: (re)move inetdevice.h implementation
Bjoern A. Zeeb [Fri, 26 Mar 2021 17:52:24 +0000 (17:52 +0000)]
LinuxKPI/OFED: (re)move inetdevice.h implementation

The two functions in linux/inetdevice.h are highly FreeBSD/ifnet
specific.  This is a result of struct net_device being mapped to
struct ifnet.

The only known consumer of these functions are two files in the
ofed/infiniband code.

As a first step of cleaning up copy linux/inetdevice.h to
rdma/ib_addr_freebsd.h. (It stayed a separate file to preserve
copyright and license of the original file; otherwise it could be
merged into ib_addr.h where more EPOCH/vnet/.. are already used).

Slightly rename the function to not conflict with LinuxKPI
in the future.

Remove the three last, now unneeded includes of inetdevice.h and
zap linux/inetdevice.h to an empty header file with only the forward
include to netdevice.h remaining.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky, kib
X-D-R: D29366 (extracted as further cleanup)
Differential Revision: https://reviews.freebsd.org/D29434

3 years agogdb: report specific stop reason for watchpoints
Mitchell Horne [Mon, 8 Mar 2021 19:04:51 +0000 (15:04 -0400)]
gdb: report specific stop reason for watchpoints

The remote protocol allows for implementations to report more specific
reasons for the break in execution back to the client [1]. This is
entirely optional, so it is only implemented for amd64, arm64, and i386
at the moment.

[1] https://sourceware.org/gdb/current/onlinedocs/gdb/Stop-Reply-Packets.html

Reviewed by: jhb
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
NetApp PR: 51
Differential Revision: https://reviews.freebsd.org/D29174

3 years agogdb: allow setting/removing hardware watchpoints
Mitchell Horne [Mon, 8 Mar 2021 19:03:45 +0000 (15:03 -0400)]
gdb: allow setting/removing hardware watchpoints

Handle the 'z' and 'Z' remote packets for manipulating hardware
watchpoints.

This could be expanded quite easily to support hardware or software
breakpoints as well.

https://sourceware.org/gdb/onlinedocs/gdb/Packets.html

Reviewed by: cem, markj
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
NetApp PR: 51
Differential Revision: https://reviews.freebsd.org/D29173

3 years agoresolv_test: Fix racy exit check, remove mutexes, and reduce output
Alex Richardson [Tue, 30 Mar 2021 14:00:16 +0000 (15:00 +0100)]
resolv_test: Fix racy exit check, remove mutexes, and reduce output

Instead of polling nleft[i] (without appropriate memory barriers!) and
using sleep() to detect the exit just call pthread_join() on all threads.

Also replace the use of a mutex that guarding the increments with atomic
fetch_add. This should reduce the runtime of this test on SMP systems.

Finally, remove all the debug printfs unless DEBUG_OUTPUT is set in
the environment.

Test Plan: still fails sometimes on qemu (but maybe less often?)
Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D29390

3 years agosys/dev/md: Drop unncessary __GLOBL(mfs_root)
Alex Richardson [Tue, 30 Mar 2021 13:53:41 +0000 (14:53 +0100)]
sys/dev/md: Drop unncessary __GLOBL(mfs_root)

LLVM12 complains if you change the symbol binding:
error: mfs_root_end changed binding to STB_WEAK [-Werror,-Winline-asm]
error: mfs_root changed binding to STB_WEAK [-Werror,-Winline-asm]

3 years agolibsa: Remove conflicting .global/.weak directive
Alex Richardson [Tue, 30 Mar 2021 13:52:31 +0000 (14:52 +0100)]
libsa: Remove conflicting .global/.weak directive

LLVM12 complains if you change the symbol binding:
`error: _longjmp changed binding to STB_GLOBAL`
In this case LLVM actually ignored the weak directive and used the
later .global, but GNU as would mark the symbol as weak.
None of the other architectures mark the libsa _setjmp as weak so
just drop this directive.

3 years agolibnetmap: restore changes in 26c29e743bbdbb82762540f72d4bc449bae2e092
Vincenzo Maffione [Tue, 30 Mar 2021 09:42:50 +0000 (09:42 +0000)]
libnetmap: restore changes in 26c29e743bbdbb82762540f72d4bc449bae2e092

Commit f8113f0a65ada9367bcbfa6e0d5d8a8451dd8ac2 accidentally
reverted some fixes introduced by 26c29e743bbdbb82762540f72d4bc449bae2e092.
This change restores them.

3 years agoipdivert: check that PCB is still valid after taking INPCB_RLOCK.
Andrey V. Elsukov [Tue, 30 Mar 2021 09:31:09 +0000 (12:31 +0300)]
ipdivert: check that PCB is still valid after taking INPCB_RLOCK.

We are inspecting PCBs of divert sockets under NET_EPOCH section,
but PCB could be already detached and we should check INP_FREED flag
when we took INP_RLOCK.

PR: 254478
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29420

3 years agobhyve: change vq_getchain to return iovecs in both directions
Ka Ho Ng [Tue, 30 Mar 2021 08:43:24 +0000 (16:43 +0800)]
bhyve: change vq_getchain to return iovecs in both directions

The old prototype requires callers to inspect flags of each descriptors
to get the starting position of host-writable iovecs.

vq_getchain() is changed to return a virtio request with the number of
host-readable iovecs and host-writable iovecs instead. Callers can avoid
boilerplate code of getting the start offset of host-writable iovecs.

Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Reviewed by: afedorov
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29433

3 years agonetmap: bridge: fix transmission in busy-wait mode
Vincenzo Maffione [Tue, 30 Mar 2021 06:24:56 +0000 (06:24 +0000)]
netmap: bridge: fix transmission in busy-wait mode

In busy-wait mode (BUSYWAIT defined), NIOCTXSYNC should be
performed after packets have been moved to the TX ring
(rather than before).
Before the change, moved packets may stall for an indefinite
time in the TX ring.

MFC after: 1 week

3 years agonetmap: pkt-gen: allow -Z and -z to be used together
Vincenzo Maffione [Tue, 30 Mar 2021 06:13:07 +0000 (06:13 +0000)]
netmap: pkt-gen: allow -Z and -z to be used together

These options are used for generating random source/destination
IP/ports within transmitted packets.

MFC after: 1 week

3 years agoFix typo in the 9fa8d1582b44b4850d40699c9adb104732328b7d.
Alexander V. Chernikov [Mon, 29 Mar 2021 23:42:27 +0000 (23:42 +0000)]
Fix typo in the 9fa8d1582b44b4850d40699c9adb104732328b7d.

Reported by: cy

3 years ago[PowerPC] Fix 32-bit Book-E panic due to pve leak
Brandon Bergren [Mon, 29 Mar 2021 22:59:19 +0000 (17:59 -0500)]
[PowerPC] Fix 32-bit Book-E panic due to pve leak

On an INVARIANTS kernel on 32-bit Book-E, we were panicing when running
the libproc tests. This was caused by extra pv entries being generated
accidentally by the pmap icache invalidation code.

Use the same VA (i.e. 0) when freeing the temporary mapping, instead of
some arbitrary address within the zero page.

Failure to do this was causing kernel-side icache syncing to leak
PVE entries when invalidating icache for a non page-aligned address, which
would later result in pages erroneously showing up as mapped to vm_page.

This bug was introduced in r347354 in 2019.

Reviewed by: jhibbits (in irc)
Sponsored by: Tag1 Consulting, Inc.