]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoarcmsr(4): Fixed no action of hot plugging device on type_F adapter.
Xin LI [Wed, 3 Mar 2021 06:57:20 +0000 (22:57 -0800)]
arcmsr(4): Fixed no action of hot plugging device on type_F adapter.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by: 黃清隆 <ching2048 areca com tw>
MFC after: 3 days

(cherry picked from commit 5842073a9b7471831e0da48d29dd984d575f4e9e)

3 years agogrowfs: allow operation on RW-mounted filesystems
Ed Maste [Tue, 2 Mar 2021 22:35:48 +0000 (17:35 -0500)]
growfs: allow operation on RW-mounted filesystems

growfs supports growing mounted filesystems (writes are temporarily
suspended while the grow happens).  Drop the check for fs_clean == 0
to restore this case.  Leave fs_flags check for FS_UNCLEAN or
FS_NEEDSFSCK which represent the state of the filesystem when it was
mounted, and fsck should be run first if they are set.

PR: 253754
Reviewed by: mckusick
Fixes: 6eb925f8450f ("Filesystem utilities that modify the...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29021

(cherry picked from commit 0dcde5cc12744e5188300711a8829e5e6a9cd0de)

3 years agonfs-over-tls: add rc scripts for rpc.tlsclntd and rpc.tlsservd
Rick Macklem [Thu, 18 Feb 2021 22:38:01 +0000 (14:38 -0800)]
nfs-over-tls: add rc scripts for rpc.tlsclntd and rpc.tlsservd

Add rc.d scripts that control the recently committed rpc.tlsclntd(8)
and rpc.tlsservd(8) daemons.

(cherry picked from commit 2f48313ab26ef257ca8d46052a33fb6ad6abdb4f)

3 years agonfs-over-tls: add user space daemons rpc.tlsclntd and rpc.tlsservd
Rick Macklem [Thu, 18 Feb 2021 22:08:19 +0000 (14:08 -0800)]
nfs-over-tls: add user space daemons rpc.tlsclntd and rpc.tlsservd

The kernel changes needed for nfs-over-tls have been committed to main.
However, nfs-over-tls requires user space daemons to handle the
TLS handshake and other non-application data TLS records.
There is one daemon (rpc.tlsclntd) for the client side and one daemon
(rpc.tlsservd) for the server side, although they share a fair amount
of code found in rpc.tlscommon.c and rpc.tlscommon.h.
They use a KTLS enabled OpenSSL to perform the actual work and, as such,
are only built when MK_OPENSSL_KTLS is set.
Communication with the kernel is done via upcall RPCs done on AF_LOCAL
sockets and the custom system call rpctls_syscall.

Relnotes: yes

(cherry picked from commit b9cbc85d727214cf3e13196ab7e7564e53037f77)

3 years agobsdinstall: add knob to set ASLR sysctls
Ed Maste [Fri, 29 Jan 2021 19:15:28 +0000 (14:15 -0500)]
bsdinstall: add knob to set ASLR sysctls

Reviewed by: mw
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28418

(cherry picked from commit 020f4112559ebf7e94665c9a69f89d21929ce82a)

3 years agobsdinstall: replace multiple ifs with case
Ed Maste [Fri, 29 Jan 2021 19:00:29 +0000 (14:00 -0500)]
bsdinstall: replace multiple ifs with case

Reduce copy-paste and use a more typical construct.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28417

(cherry picked from commit fbc57e2df95b582f7d3287ed3919337bfec5711a)

3 years agoCirrus-CI: temporarily avoid qemu smoke test boot
Ed Maste [Fri, 5 Mar 2021 17:49:23 +0000 (12:49 -0500)]
Cirrus-CI: temporarily avoid qemu smoke test boot

Cirrus-CI has been red for some time because we're running out of disk
space on the ephemeral GCP VMs.  For now remove the package + qemu boot,
and just check for build regressions.

This change to be reverted once we have identified and addressed the
underlying issue.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit a7d593dd1da27833b5384349700bc3c7bcae6aad)

3 years agoCirrus-CI: add df/du to track down disk full issues
Ed Maste [Mon, 1 Mar 2021 03:07:05 +0000 (22:07 -0500)]
Cirrus-CI: add df/du to track down disk full issues

Cirrus-CI: show mounted filesystems and free space at start

CI runs have been encountering disk full errors.  Add a `df` invocation
so that we can see what we're working with.

(cherry picked from commit af11c2029006b64da41a78f2e2dcc910e13ce07a)

Cirrus-CI: Add more information to help track down disk full issues

Execute df(1) before and after the build (reporting in MiB for
consistency), and du(1) of /usr/obj.  Also include the uname.

(cherry picked from commit f2f24008a2b1b3c7a1c4b75e9b9c2d0f08abc27b)

3 years agoCirrus-CI: remove svn2git remnant
Ed Maste [Fri, 29 Jan 2021 14:34:27 +0000 (09:34 -0500)]
Cirrus-CI: remove svn2git remnant

Previously Cirrus was skipped on svn_head to avoid running CI on two
different branches with identical content.  With the transition to git
this serves no purpose.

Reported by: kevans
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f17fc5439f517d06ac8976f53354789cde5a7427)

3 years agonewvers.sh: add newline at EOF in generated vers.c
Ed Maste [Mon, 25 Jan 2021 19:53:47 +0000 (14:53 -0500)]
newvers.sh: add newline at EOF in generated vers.c

Previously we omitted the newline, which did not cause a functional
issue for the build but resulted in suboptimal output from e.g.
`cat vers.c`.

(cherry picked from commit 8564660237aec4c679e8b607dbbf861c90fafc4c)

3 years agotests/sys/audit: force PIE off
Ed Maste [Fri, 19 Feb 2021 01:41:33 +0000 (20:41 -0500)]
tests/sys/audit: force PIE off

df093aa9463b linked against libprivateauditd.a, but that is currently
(and incorrectly) built as position-dependent.  For now just force PIE
off for this test to fix the WITH_PIE build.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4621c4f2fd179eff0923140da9af122c42dbe78b)

3 years agocxgbetool: correct utilties typo
Ed Maste [Sun, 24 Jan 2021 15:21:53 +0000 (10:21 -0500)]
cxgbetool: correct utilties typo

(cherry picked from commit 25611bc0abf8a21f90cf3a702d6163b23bb7bed5)

3 years agoImport wireguard fixes from pfSense 2.5
Peter Grehan [Sat, 27 Feb 2021 04:15:04 +0000 (14:15 +1000)]
Import wireguard fixes from pfSense 2.5

Merge the following fixes from https://github.com/pfsense/FreeBSD-src
 1940e7d3  Save address of ingress packets to allow wg to work on HA
 8f5531f1  Fix connection to IPv6 endpoint
 825ed9ee  Fix tcpdump for wg IPv6 rx tunnel traffic
 2ec232d3  Fix issue with replying to INITIATION messages in server mode
 ec77593a  Return immediately in wg_init if in DETACH'd state
 0f0dde6f  Remove unnecessary wg debug printf on transmit
 2766dc94  Detect and fix case in wg_init() where sockets weren't cleaned up
 b62cc7ac  Close the UDP tunnel sockets when the interface has been stopped

Obtained from: pfSense 2.5
Relnotes: yes
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 95331c228a39b44cb96c4d0142ed8afec8a4d063)

3 years agoixl(4): Add ability to control link state on ifconfig down
Krzysztof Galazka [Wed, 3 Mar 2021 01:38:51 +0000 (17:38 -0800)]
ixl(4): Add ability to control link state on ifconfig down

Add sysctl link_active_on_if_down, which allows user to control
if interface is kept in active state when it is brought
down with ifconfig. Set it to enabled by default to preserve
backwards compatibility.

Reviewed by: erj
Tested by: gowtham.kumar.ks@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D28028

(cherry picked from commit 21802a127d83e8a8c721d69b697e7ddb223d7797)

3 years agoixl(4): Report RX errors as sum of all RX error counters
Krzysztof Galazka [Wed, 3 Mar 2021 01:33:11 +0000 (17:33 -0800)]
ixl(4): Report RX errors as sum of all RX error counters

HW keeps track of RX errors using several counters, each for
specific type of errors. Report RX errors to OS as sum
of all those counters: CRC errors, illegal bytes, checksum,
length, undersize, fragment, oversize and jabber errors.

There is no HW counter for frames with invalid L3/L4 checksums
so add a SW one.

Also add a "rx_errors" sysctl with a copy of netstat IERRORS
counter value to make it easier accessible from scripts.

Reviewed By: erj
Tested By: gowtham.kumar.ks@intel.com
Sponsored By: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D27639

(cherry picked from commit 9f99061ef9c95b171fc92d34026222bb5e052337)

3 years agoix(4): Report RX errors as sum of all RX error counters
Piotr Pietruszewski [Wed, 3 Mar 2021 01:21:58 +0000 (17:21 -0800)]
ix(4): Report RX errors as sum of all RX error counters

HW keeps track of RX errors using several counters, each for
specific type of errors. Report RX errors to OS as sum
of all those counters: CRC errors, illegal bytes, checksum,
length, undersize, fragment, oversize and jabber errors.

Also, add new "rx_errs" sysctl in the dev.ix.N.mac_stats tree. This is
to provide an another way to display the sum of RX errors.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed By: erj
Tested By: gowtham.kumar.ks@intel.com
Sponsored By: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D27191

(cherry picked from commit afb1aa4e6df245d38fd2ba683fa521d5dabe8392)

3 years agoixl(4): Fix VLAN HW filtering
Krzysztof Galazka [Wed, 3 Feb 2021 23:22:55 +0000 (15:22 -0800)]
ixl(4): Fix VLAN HW filtering

X700 family of controllers has limited number of available VLAN
HW filters. Driver did not handle properly a case when user
assigned more VLANs to the interface which had all filters
already in use. Fix that by disabling HW filtering when
it is impossible to create filters for all requested VLANs.
Keep track of registered VLANs using bitstring to be able
to re-enable HW filtering when number of requested VLANs
drops below the limit.

Also switch all allocations to use M_IXL malloc type
to ease detecting memory leaks in the driver.

Reviewed by: erj
Tested by: gowtham.kumar.ks@intel.com
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28137

(cherry picked from commit 7d4dceec103039e2b2fa90793ceeb71a8d6684aa)

3 years agoRemove pointless lun->be_lun checks.
Alexander Motin [Fri, 26 Feb 2021 00:45:59 +0000 (19:45 -0500)]
Remove pointless lun->be_lun checks.

There is no such thing as LUN without backend, at least for years.

MFC after: 1 week

(cherry picked from commit a9bd22814f680ce87259d56155204f9294e684ce)

3 years agoloader: use display pixel density for font autoselection
Toomas Soome [Sat, 20 Feb 2021 08:51:28 +0000 (10:51 +0200)]
loader: use display pixel density for font autoselection

Calculate font size from 16 density independent pixels (dp) by using:
size = 16 * ppi/160 * display_factor

We are specifying font size 16dp, and assuming 1dp = 160ppi.
Also apply scaling factor 2 (display_factor).

(cherry picked from commit becaac3972f1fde4e3c44516399468ba5ca65c9b)

3 years agoO_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path
Konstantin Belousov [Sun, 28 Feb 2021 23:59:12 +0000 (01:59 +0200)]
O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path

(cherry picked from commit 28cd3a673e0e32b009fd573764956b280d1affe1)

3 years agonameicap_check_dotdot: trim tracker on check
Konstantin Belousov [Sun, 28 Feb 2021 00:15:21 +0000 (02:15 +0200)]
nameicap_check_dotdot: trim tracker on check

(cherry picked from commit 49c98a4bf3a87ace0df99056fa683805c1645e61)

3 years agoAdd nameicap_cleanup_from(), to clean tracker list starting from some element
Konstantin Belousov [Sun, 28 Feb 2021 00:14:43 +0000 (02:14 +0200)]
Add nameicap_cleanup_from(), to clean tracker list starting from some element

(cherry picked from commit e8a2862aa0384c75603f801625e309a3dae0ed05)

3 years agonameicap_tracker_add: avoid duplicates in the tracker list
Konstantin Belousov [Sun, 28 Feb 2021 00:13:19 +0000 (02:13 +0200)]
nameicap_tracker_add: avoid duplicates in the tracker list

(cherry picked from commit 2388ad7c293fbc89ee239a1adcb87fd158c4e8e9)

3 years agoDo not call nameicap_tracker_add() for dotdot case.
Konstantin Belousov [Sun, 28 Feb 2021 00:12:43 +0000 (02:12 +0200)]
Do not call nameicap_tracker_add() for dotdot case.

(cherry picked from commit 59e749428111c029116a4302a544c7cc18b33772)

3 years agoopen(2): Remove O_BENEATH and AT_BENEATH
Konstantin Belousov [Tue, 16 Feb 2021 03:31:40 +0000 (05:31 +0200)]
open(2): Remove O_BENEATH and AT_BENEATH

(cherry picked from commit 20e91ca36a56b8db1e6677f577ad011b66dd6eb3)

3 years agofhlink(2): the syscalls do not take flag
Konstantin Belousov [Sun, 28 Feb 2021 00:38:11 +0000 (02:38 +0200)]
fhlink(2): the syscalls do not take flag

(cherry picked from commit 600756afb532a86a39fb488f5c4fc7e248921655)

3 years agoFFS extattr: fix handling of the tail
Konstantin Belousov [Mon, 1 Mar 2021 15:24:11 +0000 (17:24 +0200)]
FFS extattr: fix handling of the tail

(cherry picked from commit 8742817ba62ec604156c139727155d36f5fbad06)

3 years agoqeueue.h: Add {SLIST,STAILQ,LIST,TAILQ}_END()
Alex Richardson [Mon, 25 Jan 2021 14:11:45 +0000 (14:11 +0000)]
qeueue.h: Add {SLIST,STAILQ,LIST,TAILQ}_END()

We provide these for compat with other queue.h headers since some software
assumes it exists (e.g. the libevent contrib code), but we are not
encouraging their use (NULL should be used instead).

This fixes the following warning (which should arguable be an error since
it results in a function call to an undefined function):

.../contrib/libevent/buffer.c:495:16: warning: implicit declaration of function 'LIST_END' is invalid in C99 [-Wimplicit-function-declaration]
             cbent != LIST_END(&buffer->callbacks);
                      ^
.../contrib/libevent/buffer.c:495:13: warning: comparison between pointer and integer ('struct evbuffer_cb_entry *' and 'int') [-Wpointer-integer-compare]
             cbent != LIST_END(&buffer->callbacks);
             ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D27151

(cherry picked from commit 8d55837dc1331a5cdacad539b1788ab1070159b4)

3 years agoMake DataSN counter of solicited Data-Out local.
Alexander Motin [Tue, 2 Feb 2021 18:37:13 +0000 (13:37 -0500)]
Make DataSN counter of solicited Data-Out local.

DataSN for solicited Data-Out is per-R2T.  Since we handle whole R2T
in one go, we don't need to store it anywhere, especially in global
per-command structure.  This may allow us to handle multiple R2T per
command at once, if we decide, or may be relax locking.

Rename the second use of that field to io_referenced_task_tag.

MFC after: 1 month

(cherry picked from commit 3dd2a7a5ea2f1641c7525f692eed416fa02c28e6)

3 years agobuf: Fix the dirtybufthresh check
Mark Johnston [Thu, 25 Feb 2021 15:04:44 +0000 (10:04 -0500)]
buf: Fix the dirtybufthresh check

dirtybufthresh is a watermark, slightly below the high watermark for
dirty buffers.  When a delayed write is issued, the dirtying thread will
start flushing buffers if the dirtybufthresh watermark is reached.  This
helps ensure that the high watermark is not reached, otherwise
performance will degrade as clustering and other optimizations are
disabled (see buf_dirty_count_severe()).

When the buffer cache was partitioned into "domains", the dirtybufthresh
threshold checks were not updated.  Fix this.

Reported by: Shrikanth R Kamath <kshrikanth@juniper.net>
Reviewed by: rlibby, mckusick, kib, bdrewery
Sponsored by: Juniper Networks, Inc., Klara, Inc.
Fixes: 3cec5c77d6
Differential Revision: https://reviews.freebsd.org/D28901

(cherry picked from commit 369706a6f887f8ffe1037d78bc31565ec701d72b)

3 years agosendfile: Use the pager size to determine the file extent when possible
Mark Johnston [Thu, 25 Feb 2021 15:04:44 +0000 (10:04 -0500)]
sendfile: Use the pager size to determine the file extent when possible

Previously sendfile would issue a VOP_GETATTR and use the returned size,
i.e., the file size.  When paging in file data, sendfile_swapin() will
use the pager to determine whether it needs to zero-fill, most often
because of a hole in a sparse file.  An attempt to page in beyond the
end of a file is treated this way, and occurs when the requested page is
past the end of the pager.  In other words, both the file size and pager
size were used interchangeably.

With ZFS, updates to the pager and file sizes are not synchronized by
the exclusive vnode lock, at least partially due to its use of
MNTK_SHARED_WRITES.  In particular, the pager size is updated after the
file size, so in the presence of a writer concurrently extending the
file, sendfile could incorrectly instantiate "holes" in the page cache
pages backing the file, which manifests as data corruption when reading
the file back from the page cache.  The on-disk copy is unaffected.

Fix this by consistently using the pager size when available.

Reported by: dumbbell
Reviewed by: chs, kib
Tested by: dumbbell, pho
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28811

(cherry picked from commit faa998f6ff69573fe82765c77c7268ee89ac945e)

3 years agoRACK: fix an issue triggered by using the CDG CC module
Michael Tuexen [Tue, 2 Mar 2021 11:32:16 +0000 (12:32 +0100)]
RACK: fix an issue triggered by using the CDG CC module

Obtained from: rrs@
PR: 238741
Sponsored by: Netlix, Inc.

(cherry picked from commit 99adf230061268175a36061130e6adb0882270e8)

3 years agobridge tests: Test that we also forward on some interfaces
Kristof Provost [Wed, 24 Feb 2021 15:40:37 +0000 (16:40 +0100)]
bridge tests: Test that we also forward on some interfaces

Ensure that we not only block on some interfaces, but also forward on
some. Without the previous commit we wound up discarding on all ports,
rather than only on the ports needed to break the loop.

MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28917

(cherry picked from commit 7a4dbffa4205fc274b4884a6332d4831c5791320)

3 years agobridgestp: Ensure we send STP on VLAN interfaces
Kristof Provost [Wed, 24 Feb 2021 15:38:53 +0000 (16:38 +0100)]
bridgestp: Ensure we send STP on VLAN interfaces

Reviewed by: donner@
MFC after: 1 week
X-MFC-with: 711ed156b94562c3dcb2ee9c1b3f240f960a75d2
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28916

(cherry picked from commit f5537cd0693c85efdb2180a0a107c51eae15ba39)

3 years agoipfw: make algo name argument optional for some table types
Andrey V. Elsukov [Thu, 25 Feb 2021 13:57:47 +0000 (16:57 +0300)]
ipfw: make algo name argument optional for some table types

Most of table types currently supported by ipfw have only one
algorithm implementation. When user creates such tables, allow
to omit algo name in arguments. E.g. now it is possible:
ipfw table T1 create type number
ipfw table T2 create type iface
ipfw table T3 create type flow

PR: 233072
Sponsored by: Yandex LLC

(cherry picked from commit 13ad237a19b7368124483d9d1dc3258c27880fef)

3 years agocalculate prr_out correctly when pipe < ssthresh
Richard Scheffenegger [Mon, 1 Mar 2021 15:25:46 +0000 (16:25 +0100)]
calculate prr_out correctly when pipe < ssthresh

Reviewed By: #transport, tuexen
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28998

(cherry picked from commit 0b0f8b359d0b94b09cfec35e5d5de01b23c7fbf1)

3 years agojail: allow root to implicitly widen its cpuset to attach
Kyle Evans [Fri, 26 Feb 2021 21:46:47 +0000 (15:46 -0600)]
jail: allow root to implicitly widen its cpuset to attach

The default behavior for attaching processes to jails is that the jail's
cpuset augments the attaching processes, so that it cannot be used to
escalate a user's ability to take advantage of more CPUs than the
administrator wanted them to.

This is problematic when root needs to manage jails that have disjoint
sets with whatever process is attaching, as this would otherwise result
in a deadlock. Therefore, if we did not have an appropriate common
subset of cpus/domains for our new policy, we now allow the process to
simply take on the jail set *if* it has the privilege to widen its mask
anyways.

With the new logic, root can still usefully cpuset a process that
attaches to a jail with the desire of maintaining the set it was given
pre-attachment while still retaining the ability to manage child jails
without jumping through hoops.

A test has been added to demonstrate the issue; cpuset of a process
down to just the first CPU and attempting to attach to a jail without
access to any of the same CPUs previously resulted in EDEADLK and now
results in taking on the jail's mask for privileged users.

PR: 253724

(cherry picked from commit 60c4ec806dfd0f79edf8ca3abc04bbb69c0418f7)

3 years agoUpdate manpage for AMD 10GbE driver
Rajesh Kumar M A [Wed, 24 Feb 2021 05:01:10 +0000 (05:01 +0000)]
Update manpage for AMD 10GbE driver

Approved by: vmaffione, gallatin

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

(cherry picked from commit ec786886661ac8d6c41420c4460eba8461308e0b)

3 years agoarmv8crypto: add missing newline
Elliott Mitchell [Sun, 28 Feb 2021 20:03:44 +0000 (16:03 -0400)]
armv8crypto: add missing newline

The missing newline mildly garbles boot-time messages and this can be
troublesome if you need those.

Reported by: Mike Karels (mike@karels.net)
Reviewed By: gonzo

(cherry picked from commit 530d38441d55b7ac62ebae6ac8ea76903a4a3b0c)

3 years agonfsclient: fix panic in cache_enter_time()
Rick Macklem [Sun, 28 Feb 2021 01:54:05 +0000 (17:54 -0800)]
nfsclient: fix panic in cache_enter_time()

Juraj Lutter (otis@) reported a panic "dvp != vp not true" in
cache_enter_time() called from the NFS client's nfsrpc_readdirplus()
function.
This is specific to an NFSv3 mount with the "rdirplus" mount
option. Unlike NFSv4, NFSv3 replies to ReaddirPlus
includes entries for the current directory.

This trivial patch avoids doing a cache_enter_time()
call for the current directory to avoid the panic.

(cherry picked from commit 3fe2c68ba20fb3365ef91e0b85f88237b5369f38)

3 years agocopy_file_range(2): Fix for small values of input file offset and len
Rick Macklem [Mon, 1 Mar 2021 14:28:30 +0000 (06:28 -0800)]
copy_file_range(2): Fix for small values of input file offset and len

r366302 broke copy_file_range(2) for small values of
input file offset and len.

It was possible for rem to be greater than len and then
"len - rem" was a large value, since both variables are
unsigned.

(cherry picked from commit a5f9fe2bab789f49e8b53da3a62dbd34725e23ea)

3 years agoMFC 9febbc454190:
Hans Petter Selasky [Mon, 22 Feb 2021 10:58:46 +0000 (11:58 +0100)]
MFC 9febbc454190:
Fix for natd(8) sending wrong sequence number after TCP retransmission,
terminating a TCP connection.

If a TCP packet must be retransmitted and the data length has changed in the
retransmitted packet, due to the internal workings of TCP, typically when ACK
packets are lost, then there is a 30% chance that the logic in GetDeltaSeqOut()
will find the correct length, which is the last length received.

This can be explained as follows:

If a "227 Entering Passive Mode" packet must be retransmittet and the length
changes from 51 to 50 bytes, for example, then we have three cases for the
list scan in GetDeltaSeqOut(), depending on how many prior packets were
received modulus N_LINK_TCP_DATA=3:

  case 1:  index 0:   original packet        51
           index 1:   retransmitted packet   50
           index 2:   not relevant

  case 2:  index 0:   not relevant
           index 1:   original packet        51
           index 2:   retransmitted packet   50

  case 3:  index 0:   retransmitted packet   50
           index 1:   not relevant
           index 2:   original packet        51

This patch simply changes the searching order for TCP packets, always starting
at the last received packet instead of any received packet, in
GetDeltaAckIn() and GetDeltaSeqOut().

Else no functional changes.

Discussed with: rscheff@
Submitted by: Andreas Longwitz <longwitz@incore.de>
PR: 230755
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 9febbc4541903bb8e6b0f1c84988c98b2f7c96ef)

3 years agoImprove PRR initial transmission timing
Richard Scheffenegger [Sun, 28 Feb 2021 14:46:38 +0000 (15:46 +0100)]
Improve PRR initial transmission timing

Reviewed By: tuexen, #transport
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28953

(cherry picked from commit e9071000c9a04e3f685579500e24da9848944bb1)

3 years agoatomic: add atomic_interrupt_fence()
Konstantin Belousov [Tue, 23 Feb 2021 22:12:29 +0000 (00:12 +0200)]
atomic: add atomic_interrupt_fence()

(cherry picked from commit e2494f7561c852951d8ac567314f5e12f19ee7af)

3 years agoAdd VOP_READ_PGCACHE(9)
Konstantin Belousov [Sun, 28 Feb 2021 01:08:37 +0000 (03:08 +0200)]
Add VOP_READ_PGCACHE(9)

PR: 253894

(cherry picked from commit 55eb51ab6649c3c10bf201f82a4ec410fe4da4a2)

3 years agozfs: cancel TRIM or initialize on FAULTED non-writeable vdevs
Martin Matuska [Wed, 3 Mar 2021 01:38:09 +0000 (02:38 +0100)]
zfs: cancel TRIM or initialize on FAULTED non-writeable vdevs

From the openzfs commit message:
  When a device which is actively trimming or initializing becomes
  FAULTED, and therefore no longer writable, cancel the active
  TRIM or initialization.  When the device is merely taken offline
  with `zpool offline` then stop the operation but do not cancel it.
  When the device is brought back online the operation will be
  resumed if possible.

Obtained from: openzfs/zfs@bedbc13daa6dfe9e0221bfadb8d8db2378deaacc
MFS after: 3 days

(direct commit)

3 years agozfs: fix assert in FreeBSD-specific dmu_read_pages
Martin Matuska [Wed, 3 Mar 2021 01:32:59 +0000 (02:32 +0100)]
zfs: fix assert in FreeBSD-specific dmu_read_pages

From the openzfs 2e160dee9 commit message:
  The function has three similar pieces of code: for read-behind pages,
  requested pages and read-ahead pages.  All three pieces had an
  assert to ensure that the page is not mapped.  Later the assert was
  relaxed to require that the page is not mapped for writing.  But that
  was done in two places out of three.  This change fixes the third piece,
  read-ahead.

Obtained from: openzfs/zfs@2e160dee97a4badbc318561f76ea56451c916d2f
MFS after: 3 days

(direct commit)

3 years agozfs: fix vdev_rebuild_thread deadlock
Martin Matuska [Wed, 3 Mar 2021 01:28:56 +0000 (02:28 +0100)]
zfs: fix vdev_rebuild_thread deadlock

From the openzfs 8e43fa12c commit message:
  The metaslab_disable() call may block waiting for a txg sync.
  Therefore it's important that vdev_rebuild_thread release the
  SCL_CONFIG read lock it is holding before this call.  Failure
  to do so can result in the txg_sync thread getting blocked
  waiting for this lock which results in a deadlock.

Obtained from: openzfs/zfs@8e43fa12c571878f32119122771888ab9092a75a
MFS after: 3 days

(direct commit)

3 years agozfs: fix overly broad locking in spa_vdev_config_exit()
Martin Matuska [Wed, 3 Mar 2021 01:25:03 +0000 (02:25 +0100)]
zfs: fix overly broad locking in spa_vdev_config_exit()

Resolves a deadlock which can occur when the ZED or zpool
command attaches a new device.

From the openzfs 75a089ed3 commit message:
  Calling vdev_free() only requires the we acquire the spa config
  SCL_STATE_ALL locks, not the SCL_ALL locks.  In particular, we need
  need to avoid taking the SCL_CONFIG lock (included in SCL_ALL) as a
  writer since this can lead to a deadlock.  The txg_sync_thread() may
  block in spa_txg_history_init_io() when taking the SCL_CONFIG lock
  as a reading when it detects there's a pending writer.

Obtained from: openzfs/zfs@75a089ed34befb8d11df9be92a4438cc49554bf6
MFS after: 3 days

(direct commit)

3 years agormlock: Add a required compiler membar to the rlock slow path
Mark Johnston [Wed, 24 Feb 2021 02:15:50 +0000 (21:15 -0500)]
rmlock: Add a required compiler membar to the rlock slow path

The tracker flags need to be loaded only after the tracker is removed
from its per-CPU queue.  Otherwise, readers may fail to synchronize with
pending writers attempting to propagate priority to active readers, and
readers and writers deadlock on each other.  This was observed in a
stable/12-based armv7 kernel where the compiler had reordered the load
of rmp_flags to before the stores updating the queue.

Reviewed by: rlibby, scottl
Discussed with: kib
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D28821

(cherry picked from commit 1d44514fcd68809cfd493a7352ace29ddad443d6)

3 years agolinux: add support for SO_PEERSEC getsockopt
Edward Tomasz Napierala [Sun, 7 Feb 2021 20:28:35 +0000 (20:28 +0000)]
linux: add support for SO_PEERSEC getsockopt

It returns "unconfined", like Linux without SELinux would.

Sponsored By: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28164

(cherry picked from commit e44a78ce6f249f1eb7df94cb6953698953ebd88b)

3 years agolinux: fix handling of flags for 32 bit send(2) syscall
Edward Tomasz Napierala [Fri, 5 Feb 2021 17:24:23 +0000 (17:24 +0000)]
linux: fix handling of flags for 32 bit send(2) syscall

Previously the flags were passed as-is, which could resulted
in spurious EAGAIN returned for non-blocking sockets, which
broke some Steam games.

PR: 248065
Reported By: Alex S <iwtcex@gmail.com>
Tested By: Alex S <iwtcex@gmail.com>
Reviewed By: emaste
MFC After: 3 days
Sponsored By: The FreeBSD Foundation

(cherry picked from commit f6e8256a965d5b7a7d43034ea31b2430a3b51066)

3 years agoDon't check compat.linux.emul_path before loading linux(4)
Edward Tomasz Napierala [Mon, 8 Feb 2021 21:52:31 +0000 (21:52 +0000)]
Don't check compat.linux.emul_path before loading linux(4)

Fix e40787f900f to make libexec/rc/rc.d/linux retrieve the sysctl
after loading the kernel module which provides it, not before.

Reported By: jkim
Sponsored By: The FreeBSD Foundation

(cherry picked from commit 07cac176fba947381c8111b8e02e8067e7fa542a)

3 years agoUse compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux
Edward Tomasz Napierala [Tue, 2 Feb 2021 14:40:38 +0000 (14:40 +0000)]
Use compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux

In /etc/rc.d/linux the mounting paths of procfs, sysfs and devfs
are hardcoded to "/compat/linux".  Switching to the content of
compat.linux.emul_path sysctl would allow to switch linuxulator
to different place.

Submitted by: freebsdnewbie_freenet.de
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27807

(cherry picked from commit e40787f900f3c262d5134d342e5a16757dd2193c)

3 years agolibc: fix buffer overrun in getrpcport(3)
Edward Tomasz Napierala [Sun, 31 Jan 2021 21:41:55 +0000 (21:41 +0000)]
libc: fix buffer overrun in getrpcport(3)

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

(cherry picked from commit 5299d64b2b9f7a25e423ef1785d9402a0ef198d3)

3 years agomsdosfs: fix vnode leak with msdosfs_rename()
Edward Tomasz Napierala [Sun, 31 Jan 2021 21:37:41 +0000 (21:37 +0000)]
msdosfs: fix vnode leak with msdosfs_rename()

This could happen when failing due to disappearing source file.

Reviewed By: kib
Tested by: pho
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27338

(cherry picked from commit b8073b3c74342113398f36a1c68f442ae9e092e6)

3 years agomsdosfs: fix double unlock if the source file disappears
Edward Tomasz Napierala [Sun, 31 Jan 2021 21:07:02 +0000 (21:07 +0000)]
msdosfs: fix double unlock if the source file disappears

We would unlock fvp here, only to unlock it again below,
just before "bad".

Reviewed By: kib
Tested by: pho
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27339

(cherry picked from commit cb696212495995c8374d9fe12fbae340614af45c)

3 years agoCreate dhclient pid directory if it doesn't exist
Chris Rees [Sun, 21 Feb 2021 18:56:56 +0000 (18:56 +0000)]
Create dhclient pid directory if it doesn't exist

 - Upgrading from older FreeBSD versions can result in errors

 - /var/run can be a tmpfs, and this should be handled correctly

Approved by: markj
Differential: https://reviews.freebsd.org/D28843
MFC after: 2 weeks

3 years agoupdate the SACK loss recovery to RFC6675, with the following new features:
Richard Scheffenegger [Tue, 16 Feb 2021 11:18:43 +0000 (12:18 +0100)]
update the SACK loss recovery to RFC6675, with the following new features:
- improved pipe calculation which does not degrade under heavy loss
- engaging in Loss Recovery earlier under adverse conditions
- Rescue Retransmission in case some of the trailing packets of a request got lost

All above changes are toggled with the sysctl "rfc6675_pipe" (disabled by default).

Reviewers: #transport, tuexen, lstewart, slavash, jtl, hselasky, kib, rgrimes, chengc_netapp.com, thj, #manpages, kbowling, #netapp, rscheff
Reviewed By: #transport
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D18985

(cherry picked from commit 3c40e1d52cd86168779cf99dbabe58df465d7e3f)

3 years agobridge tests: Test STP on top of VLAN devices
Kristof Provost [Sat, 20 Feb 2021 09:13:33 +0000 (10:13 +0100)]
bridge tests: Test STP on top of VLAN devices

This is basically the same test as the existing STP test, but now on top
of VLAN interfaces instead of directly using the epair devices.

MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28861

(cherry picked from commit 26492ba2716f8b839f743bb663ce47405990fdf0)

3 years agobridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic
Kristof Provost [Sun, 21 Feb 2021 20:18:46 +0000 (21:18 +0100)]
bridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic

Reviewed by: donner@
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28858

(cherry picked from commit 89fa9c34d76bbf85cd7cda60c1868f5e3dba4ec7)

3 years agoarp/nd: Cope with late calls to iflladdr_event
Kristof Provost [Mon, 22 Feb 2021 07:19:43 +0000 (08:19 +0100)]
arp/nd: Cope with late calls to iflladdr_event

When tearing down vnet jails we can move an if_bridge out (as
part of the normal vnet_if_return()). This can, when it's clearing out
its list of member interfaces, change its link layer address.
That sends an iflladdr_event, but at that point we've already freed the
AF_INET/AF_INET6 if_afdata pointers.

In other words: when the iflladdr_event callbacks fire we can't assume
that ifp->if_afdata[AF_INET] will be set.

Reviewed by: donner@, melifaro@
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28860

(cherry picked from commit c139b3c19b52abe3b5ba23a8175e58e70c7a528d)

3 years agobridge: Remove members when assigned to a new vnet
Kristof Provost [Sun, 21 Feb 2021 20:20:32 +0000 (21:20 +0100)]
bridge: Remove members when assigned to a new vnet

When the bridge is moved to a different vnet we must remove all of its
member interfaces (and span interfaces), because we don't know if those
will be moved along with it. We don't want to hold references to
interfaces not in our vnet.

Reviewed by: donner@
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28859

(cherry picked from commit 38c0951386d82f4c51cf4e245253cdef18d2254a)

3 years agobridge: Support STP on VLAN devices
Kristof Provost [Sat, 20 Feb 2021 09:11:30 +0000 (10:11 +0100)]
bridge: Support STP on VLAN devices

VLAN devices have type IFT_L2VLAN, so the STP code mistakenly believed
they couldn't be used for STP. That's not the case, so add the
ITF_L2VLAN to the check.

Reviewed by: donner@
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28857

(cherry picked from commit 711ed156b94562c3dcb2ee9c1b3f240f960a75d2)

3 years agonvi: fix catalog generation
dankm [Fri, 26 Feb 2021 15:32:01 +0000 (16:32 +0100)]
nvi: fix catalog generation

Upstream broke catalog generation with some over-eagre style cleanups.
This brings in my pull request.

Obtained from: https://github.com/lichray/nvi2/pull/88
Differential Revision: https://reviews.freebsd.org/D28594

(cherry picked from commit 888ae5725257c251319f14f31c2e941717b675f2)

3 years agomkimg: Add support for offset if the source is an image
Emmanuel Vadot [Thu, 25 Feb 2021 17:10:19 +0000 (18:10 +0100)]
mkimg: Add support for offset if the source is an image

This allow us to create image with the following format:
mkimg -v -o sdcard -s gpt -p efi:=esp_aarch64.img:1M -p freebsd-ufs::1G

Which will add a efi partition at a 1M offset on the image with its content
coming from the esp_aarch64.img file.

MFC after: 3 days

(cherry picked from commit 8f3c71c85e5f6a4d2bddbfead225d33b96dbd7d7)

3 years agomkimg: We always want the last block of the last inserted partition
Emmanuel Vadot [Thu, 25 Feb 2021 15:34:28 +0000 (16:34 +0100)]
mkimg: We always want the last block of the last inserted partition

Even with an absolute offset we want to know the last block the partition
otherwise we endup with an image the size of the metadata.
This allow to create image with the ESP placed at a specific position which
is useful on arm/arm64 where u-boot have always a hard time to read the ESP
if it's not aligned on 512k.
mkimg -v -o sdcard -s gpt -p efi::54M:1M -p freebsd-ufs::1G
now works.

MFC after: 3 days

(cherry picked from commit 3b6268bb9e4aea939c4ce7f37353174aa90e6751)

3 years agopwm_backlight: Add MODULE_DEPEND on backlight
Brett Mastbergen [Mon, 22 Feb 2021 10:28:28 +0000 (10:28 +0000)]
pwm_backlight: Add MODULE_DEPEND on backlight

Make the pwm_backlight module depend on backlight, so it
has access to the backlight interface symbols.  Otherwise you'll
get an error like:

link_elf: symbol backlight_get_info_desc undefined

Signed-off-by: Brett Mastbergen <brett.mastbergen@gmail.com>
MFC after: 3 days
PR:  253765
(cherry picked from commit 43d4dfac96f7f8285a27989f315c075d28aadb12)

3 years agosctp: avoid integer overflow when starting the HB timer
Michael Tuexen [Sat, 27 Feb 2021 22:27:30 +0000 (23:27 +0100)]
sctp: avoid integer overflow when starting the HB timer

MFC after: 3 days
Reported by: syzbot+14b9d7c3c64208fae62f@syzkaller.appspotmail.com

(cherry picked from commit 70e95f0b6917a8b8cd4a2a5f883f3e9753fc86d8)

3 years agosctp: improve computation of an alternate net
Michael Tuexen [Sun, 21 Feb 2021 16:13:06 +0000 (17:13 +0100)]
sctp: improve computation of an alternate net

Espeially handle the case where the net passed in is about to
be deleted and therefore not in the list of nets anymore.

Reported by: syzbot+9756917a7c8381adf5e8@syzkaller.appspotmail.com

(cherry picked from commit b963ce4588b33f733aef3f7a7f3fbe5018a89728)

3 years agosctp: clear a pointer to a net which will be removed
Michael Tuexen [Sun, 21 Feb 2021 12:03:57 +0000 (13:03 +0100)]
sctp: clear a pointer to a net which will be removed

(cherry picked from commit 5ac839029d01c0f48e1b1ff1a599cb47cf5e98ee)

3 years agotcp: improve behaviour when using TCP_NOOPT
Michael Tuexen [Sun, 14 Feb 2021 11:10:31 +0000 (12:10 +0100)]
tcp: improve behaviour when using TCP_NOOPT

Use ISS for SEG.SEQ when sending a SYN-ACK segment in response to
an SYN segment received in the SYN-SENT state on a socket having
the IPPROTO_TCP level socket option TCP_NOOPT enabled.

Reviewed by: rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D28656

(cherry picked from commit ed782b9f5a7a05debe944a33b4ac9e5629a95803)

3 years agolibsysdecode: fix decoding of TCP_NOPUSH and TCP_MD5SIG
Michael Tuexen [Tue, 9 Feb 2021 22:35:55 +0000 (23:35 +0100)]
libsysdecode: fix decoding of TCP_NOPUSH and TCP_MD5SIG

TCP_FASTOPEN_MIN_COOKIE_LEN was incorrectly registered as a name of
a IPPROTO_TCP level socket option, which overwrote TCP_NOPUSH.
TCP_FASTOPEN_PSK_LEN was incorrectly registered as a name of an
IPPROTO_TCP level socket option, which overwrote TCP_MD5SIG.

Sponsored by: Netflix, Inc.

(cherry picked from commit f25266bee7dafb10f03e06537c8127cc17335bed)

3 years agosctp: small cleanup, no functional change intended.
Michael Tuexen [Mon, 1 Feb 2021 13:03:41 +0000 (14:03 +0100)]
sctp: small cleanup, no functional change intended.

(cherry picked from commit bdd4630c9a9cea64830f981fc897ac953c48892c)

3 years agosctp: improve input validation
Michael Tuexen [Sun, 31 Jan 2021 22:43:15 +0000 (23:43 +0100)]
sctp: improve input validation

Improve the handling of INIT chunks in specific szenarios and
report and appropriate error cause.
Thanks to Anatoly Korniltsev for reporting the issue for the
userland stack.

(cherry picked from commit af885c57d65d33c0306e91d3e090e76772a0d012)

3 years agosctp: fix a locking issue for old unordered data
Michael Tuexen [Sun, 31 Jan 2021 09:46:23 +0000 (10:46 +0100)]
sctp: fix a locking issue for old unordered data

Thanks to Anatoly Korniltsev for reporting the issue for the
userland stack.

(cherry picked from commit 8dc6a1edca6de0c64f6c082f69097746d1346592)

3 years agosctp: fix PR-SCTP stats when adding addtional streams
Michael Tuexen [Sat, 23 Jan 2021 23:50:33 +0000 (00:50 +0100)]
sctp: fix PR-SCTP stats when adding addtional streams

(cherry picked from commit 0f7573ffd6141b19419c9a6238246b9ba0e6dce6)

3 years agosctp: improve consistency
Michael Tuexen [Sat, 23 Jan 2021 19:56:45 +0000 (20:56 +0100)]
sctp: improve consistency

No functional change intended.

(cherry picked from commit 7a051c0a7890dc8e490ebe125bfc70a28e89ddaf)

3 years agocardbus: Be sure to acquire Giant when calling into newbus
Warner Losh [Sat, 27 Feb 2021 07:00:52 +0000 (00:00 -0700)]
cardbus: Be sure to acquire Giant when calling into newbus

Acquire Giant in cardbus_detach_card. This used to be done above us, but no
more.

Tested by: kargl@
MFC After: 3 days

(cherry picked from commit c01da939b0998f8de068a23c9016c377e761255e)

3 years agoRemove __NO_TLS.
Konstantin Belousov [Fri, 19 Feb 2021 15:20:29 +0000 (17:20 +0200)]
Remove __NO_TLS.

MFC note: this plus the merge of two preliminary removal of __NO_TLS
definitions for mips and risc-v break ABI.  It was decided that doing
ABI break on tier 2 platforms at this stage of 13.0 release process is
better than drag on __NO_TLS presence for the 13.x branch lifetime.

(cherry picked from commit 3ae8d83d04a7a6ec11b64c89ee60c180b0bde30e)

3 years agomips: Don't set __NO_TLS to disable some uses of TLS.
John Baldwin [Thu, 18 Feb 2021 00:34:23 +0000 (16:34 -0800)]
mips: Don't set __NO_TLS to disable some uses of TLS.

(cherry picked from commit 24fd63e0970f91189dd2acde987bd2e4c8c04a50)

3 years agoriscv: Don't set __NO_TLS to disable some uses of TLS.
John Baldwin [Thu, 18 Feb 2021 00:33:09 +0000 (16:33 -0800)]
riscv: Don't set __NO_TLS to disable some uses of TLS.

(cherry picked from commit dd176fd7e7b5aad231cd6ebf49fd14ae7394dfee)

3 years agoBump CTL block backend threads from 14 to 32 per LUN.
Alexander Motin [Tue, 23 Feb 2021 15:58:56 +0000 (10:58 -0500)]
Bump CTL block backend threads from 14 to 32 per LUN.

This makes random read benchmarks look better on a wide ZFS pools.
I am not sure where the original value goes from, but it is there
for too long now.

MFC after: 1 week

(cherry picked from commit 7d4c444374d53e54ce197138df64bf40c1fb05a3)

3 years agogetdirentries.2: fix for NFS mounts
Rick Macklem [Mon, 15 Feb 2021 02:16:58 +0000 (18:16 -0800)]
getdirentries.2: fix for NFS mounts

It was reported that getdirentries(2) was
returning dirents with d_off set to 0 for an NFS
mount.

This is believed to be correct behaviour at
this time (it may change for some NFS mounts
in the future), but is inconsistent with what the
getdirentries(2) man page says.

This patch fixes the man page.

This is a content change.

PR: 253428

(cherry picked from commit a0698341cd894ba4a640e9a9bb0f72c2133d1228)

3 years agoloader: autoload_font will hung loader when there is no local console
Toomas Soome [Sun, 21 Feb 2021 10:32:18 +0000 (12:32 +0200)]
loader: autoload_font will hung loader when there is no local console

If we start with console set to comconsole, the local
console (vidconsole, efi) is never initialized and attempt to
use the data can render the loader hung.

(cherry picked from commit 61c50cbc096d28e44cb8b627e524ae58158c423a)

Reported by: Kamigishi Rei

3 years agoInclude new data sent in PRR calculation
Richard Scheffenegger [Fri, 26 Feb 2021 21:30:33 +0000 (22:30 +0100)]
Include new data sent in PRR calculation

Reviewed By: #transport, kbowling
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28941

(cherry picked from commit 9e83a6a556ed8d9a2821de5d5f5c7d4b1292c694)

3 years agom_uiotombuf_nomap(): Stop clearing PG_ZERO in newly allocated pages
Mark Johnston [Mon, 22 Feb 2021 15:03:37 +0000 (10:03 -0500)]
m_uiotombuf_nomap(): Stop clearing PG_ZERO in newly allocated pages

The caller should not be passing M_ZERO in the first place, so PG_ZERO
will not be preserved by the page allocator and clearing it accomplishes
nothing.

Reviewed by: gallatin, jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28808

(cherry picked from commit 608c44f96e88f28f9607374a6c9327d13d3d3d0e)

3 years agouma: Update the comment above startup_alloc() to reflect reality
Mark Johnston [Mon, 22 Feb 2021 23:21:49 +0000 (18:21 -0500)]
uma: Update the comment above startup_alloc() to reflect reality

The scheme used for early slab allocations changed in commit a81c400e75.

Reported by: alc
Reviewed by: alc

(cherry picked from commit 537f92cd351090c09b178a1749cd1d0326f74dc7)

3 years agopmap: Fix largemap restart checks in the kernel_maps sysctl handler
Mark Johnston [Thu, 25 Feb 2021 23:49:47 +0000 (18:49 -0500)]
pmap: Fix largemap restart checks in the kernel_maps sysctl handler

The purpose of these checks is to ensure that the address of the
next-level page table page is valid, since nothing is synchronizing with
a concurrent update of the large map and large map PTPs are freed to the
system.  However, if PG_PS is set, there is no next level.

Reported by: rpokala
Reviewed by: kib
Tested by: rpokala
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28922

(cherry picked from commit aac25e222525780db8939d07a594d3e090c0a148)

3 years agopf: Fix incorrect fragment handling
Kristof Provost [Thu, 25 Feb 2021 07:07:36 +0000 (08:07 +0100)]
pf: Fix incorrect fragment handling

A sequence of overlapping IPv4 fragments could crash the kernel in
pf due to an assertion.

Reported by: Alexander Bluhm
Obtained from: OpenBSD
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5f1b1f184b7f12330cf4a027e3db7c6700c67640)

3 years agoTCP_NOOPT may prevent the negotiation of TCP features, which a server
Richard Scheffenegger [Thu, 25 Feb 2021 18:10:55 +0000 (19:10 +0100)]
TCP_NOOPT may prevent the negotiation of TCP features, which a server
has to take into consideration.

PR: 253576
Reviewed By: tuexen, #transport
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28652

(cherry picked from commit 2593f858d7d078efa85f78f20b6bfa0931cc1dc5)

3 years agoPRR: Avoid accounting left-edge twice in partial ACK.
Richard Scheffenegger [Thu, 25 Feb 2021 17:36:49 +0000 (18:36 +0100)]
PRR: Avoid accounting left-edge twice in partial ACK.

Reviewed By: #transport, kbowling
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28819

(cherry picked from commit 31d7a27c6e88c3d5bd0907774ec70176a92da5bb)

3 years agoAddress two incorrect calculations and enhance readability of PRR code
Richard Scheffenegger [Thu, 25 Feb 2021 16:59:45 +0000 (17:59 +0100)]
Address two incorrect calculations and enhance readability of PRR code

- address second instance of cwnd potentially becoming zero
- fix sublte bug due to implicit int to uint typecase in max()
- fix bug due to typo in hand-coded CEILING() function by using howmany() macro
- use int instead of long, and add a missing long typecast
- replace if conditionals with easier to read imax/imin (as in pseudocode)

Reviewed By: #transport, kbowling
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28813

(cherry picked from commit 48396dc77922c68377ecac0ead2f8b0b5453c451)

3 years agoPRR: use accurate rfc6675_pipe when enabled
Richard Scheffenegger [Sat, 20 Feb 2021 19:10:00 +0000 (20:10 +0100)]
PRR: use accurate rfc6675_pipe when enabled

Reviewed By: #transport, tuexen
MFC after:   1 week
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28816

(cherry picked from commit a8e431e1537d056a3f9e466eaceec28c399c220b)

3 years agoDelete dead CLUSTERDEBUG config option.
Konstantin Belousov [Thu, 18 Feb 2021 09:12:26 +0000 (11:12 +0200)]
Delete dead CLUSTERDEBUG config option.

(cherry picked from commit 750ea20d3fb143a95ccf3ff84cfbe86cce9b9cac)

3 years agoiflib: Avoid double counting in rxeof
Mark Johnston [Wed, 24 Feb 2021 15:08:53 +0000 (10:08 -0500)]
iflib: Avoid double counting in rxeof

iflib_rxeof() was counting everything twice.  This was introduced when
pfil hooks were added to the iflib receive path.  We want to count rx
packets/bytes before the pfil hooks are executed, so remove the counter
adjustments that are executed after.

PR: 253583
Reviewed by: gallatin, erj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28900

(cherry picked from commit b6999635b195e8c0dd5c08ac9ff268c92107cc66)

3 years agonetgraph/ng_car: Add color marking code
Lutz Donnerhacke [Wed, 27 Jan 2021 20:19:14 +0000 (21:19 +0100)]
netgraph/ng_car: Add color marking code

Chained policing should be able to reuse the classification of
traffic.  A new mbuf_tag type is defined to handle gereral QoS
marking.  A new subtype is defined to track the color marking.

Reviewed by: manpages (bcr), melifaro, kp
Sponsored by: IKS Service GmbH
Differential Revision: https://reviews.freebsd.org/D22110

(cherry picked from commit d0d2e523bafb74180f8bebb90788790f0d2f0290)

3 years agoEnsure cwnd doesn't shrink to zero with PRR
Richard Scheffenegger [Fri, 19 Feb 2021 12:52:06 +0000 (13:52 +0100)]
Ensure cwnd doesn't shrink to zero with PRR

Under some circumstances, PRR may end up with a fully
collapsed cwnd when finalizing the loss recovery.

Reviewed By: #transport, kbowling
Reported by: Liang Tian
MFC after: 5 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28780

(cherry picked from commit 853fd7a2e39802e46bd3d6476529796ac22412d9)

3 years agoOpenSSL: Regen manual page for the previous commit
Jung-uk Kim [Wed, 17 Feb 2021 23:19:13 +0000 (18:19 -0500)]
OpenSSL: Regen manual page for the previous commit

This is regen for 9b2f020c14af71a2606012143432dd717c7cf90e.

MFC after: 1 week

(cherry picked from commit 351d06eeb509a420f3470c96b4a265467c87e2c2)

3 years agoHandle partial data re-sending on ktls/sendfile on FreeBSD
Oleksandr Tymoshenko [Wed, 17 Feb 2021 22:49:30 +0000 (14:49 -0800)]
Handle partial data re-sending on ktls/sendfile on FreeBSD

Add a handler for EBUSY sendfile error in addition to
EAGAIN. With EBUSY returned the data still can be partially
sent and user code has to be notified about it, otherwise it
may try to send data multiple times.

PR: 251969
Obtained from: OpenSSL (dfcfd17f2818cf520ce6381aed9ec3d2fc12170d)
Sponsored by: Netflix (merging to FreeBSD)

(cherry picked from commit 9b2f020c14af71a2606012143432dd717c7cf90e)