]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoipfw: add IPv6 support for sockarg opcode.
Andrey V. Elsukov [Tue, 2 Mar 2021 09:45:59 +0000 (12:45 +0300)]
ipfw: add IPv6 support for sockarg opcode.

Sponsored by: Yandex LLC

(cherry picked from commit a9f7eba9597189c0e438f6986067d31dca1c53b0)

3 years agoloader: cursor off should restore display content
Toomas Soome [Sat, 6 Mar 2021 10:19:43 +0000 (12:19 +0200)]
loader: cursor off should restore display content

When drawing cursor, we should store original display
content because there may be image data we would like to restore
when the cursor is removed.

PR: 254054
Reported by: Jose Luis Duran

(cherry picked from commit d708f23ebb06cfc9cf8f96f17a43eb63653b818a)

3 years agoatomic(9): note that atomic_interrupt_fence first appeared in 13.0
Konstantin Belousov [Sat, 6 Mar 2021 05:21:40 +0000 (07:21 +0200)]
atomic(9): note that atomic_interrupt_fence first appeared in 13.0

(cherry picked from commit f5e930b369c6ea7a3f81d8e5b52cc395bb7b4187)

3 years agoDo not exit ctl_be_block_worker() prematurely.
Alexander Motin [Sat, 6 Mar 2021 03:39:52 +0000 (22:39 -0500)]
Do not exit ctl_be_block_worker() prematurely.

Return while there are any I/Os in a queue may result in them stuck
indefinitely, since there is only one taskqueue task for all of them.
I think I've reproduced this by switching ha_role to secondary under
heavy load.

MFC after: 3 days

(cherry picked from commit 6ed39db2573bb808ac2c206cd6c831f0be86219c)

3 years agoMove back the isa non-PNP driver deadline to FreeBSD 14.
Warner Losh [Mon, 8 Mar 2021 22:59:48 +0000 (15:59 -0700)]
Move back the isa non-PNP driver deadline to FreeBSD 14.

(cherry picked from commit 6ffdaa5f2d4f0881557f64dabf61fb57541e0fba)

3 years agoif_vtbe: Add missing includes to fix build
Jessica Clarke [Mon, 8 Mar 2021 20:47:29 +0000 (20:47 +0000)]
if_vtbe: Add missing includes to fix build

PR: 254137
Reported by: Mina Galić <me@igalic.co>
Fixes: f8bc74e2f4a5 ("tap: add support for virtio-net offloads")

(cherry picked from commit f2f8405cf6b50a9d91acc02073abf1062d9d34f4)

3 years agobc: Vendor import new version 3.3.3
Stefan Eßer [Fri, 5 Mar 2021 10:30:11 +0000 (11:30 +0100)]
bc: Vendor import new version 3.3.3

(cherry picked from commit 028616d0dd69a3da7a30cb94d35f040bf2ced6b9)

Make length(0) and length(0.0) return 1 for compatibility with GNU bc
and the traditional FreeBSD bc.

Fix a potential division by zero error in a non-standard (extended)
math library function.

3 years ago[PowerPC64] Fix multiple issues in fpsetmask().
Brandon Bergren [Mon, 1 Mar 2021 02:35:53 +0000 (20:35 -0600)]
[PowerPC64] Fix multiple issues in fpsetmask().

Building R exposed a problem in fpsetmask() whereby we were not properly
clamping the provided mask to the valid range.

R initilizes the mask by calling fpsetmask(~0) on FreeBSD. Since we
recently enabled precise exceptions, this was causing an immediate
SIGFPE because we were attempting to set invalid bits in the fpscr.

Properly limit the range of bits that can be set via fpsetmask().

While here, use the correct fp_except_t type instead of fp_rnd_t.

Reported by: pkubaj (in IRC)
Sponsored by: Tag1 Consulting, Inc.

(cherry picked from commit dd95b39235dd81c890aa3cce02a5bb7f91f23803)

3 years ago[PowerPC] [PowerPCSPE] Fix multiple issues in fpsetmask().
Brandon Bergren [Mon, 1 Mar 2021 03:06:59 +0000 (21:06 -0600)]
[PowerPC] [PowerPCSPE] Fix multiple issues in fpsetmask().

Building R on powerpc64 exposed a problem in fpsetmask() whereby we
were not properly clamping the provided mask to the valid range.

This same issue affects powerpc and powerpcspe.

Properly limit the range of bits that can be set via fpsetmask().

While here, use the correct fp_except_t type instead of fp_rnd_t.

Reported by: pkubaj, jhibbits (in IRC)
Sponsored by: Tag1 Consulting, Inc.

(cherry picked from commit 384ee7cc6e9e4ddc91a6e9e623fcbbe5826bce38)

3 years ago[PowerPC64LE] pseries: Fix input buffering logic.
Brandon Bergren [Thu, 25 Feb 2021 18:55:58 +0000 (12:55 -0600)]
[PowerPC64LE] pseries: Fix input buffering logic.

In uart_phyp_get(), when the internal buffer is empty, we make a
hypercall to retrieve up to 16 bytes of input data from the
hypervisor. As this is specified to be returned in BE format, we need
to do a 64-bit byte swap on the first and second half of the data.

If the buffer being passed in was insufficient to return the fetched
data, we store the remainder in the internal buffer and use it to
satisfy the following calls to uart_phyp_get() until it is drained.

However, in this case, we were accidentally byteswapping the internal
buffer again.

Move the byteswapping code to just after the hypercall so it only gets
swapped when we're filling the buffer.

Fixes arrow keys in qemu on pseries, among other console oddities.

Sponsored by: Tag1 Consulting, Inc.

(cherry picked from commit 5001c579baff78719919d79ec054207aa2938dbd)

3 years agoriscv: fix errors in some atomic type aliases
Mitchell Horne [Thu, 4 Mar 2021 17:52:45 +0000 (13:52 -0400)]
riscv: fix errors in some atomic type aliases

This appears to be a copy-and-paste error that has simply been
overlooked. The tree contains only two calls to any of the affected
variants, but recent additions to the test suite started exercising the
call to atomic_clear_rel_int() in ng_leave_write(), reliably causing
panics.

Apparently, the issue was inherited from the arm64 atomic header. That
instance was addressed in c90baf6817a0, but the fix did not make its way
to RISC-V.

Note that the particular test case ng_macfilter_test:main still appears
to fail on this platform, but this change reduces the panic to a
timeout.

PR: 253237
Reported by: Jenkins, arichardson
Reviewed by: kp, arichardson

(cherry picked from commit 0d3b3beeb253e09b2b6b3805065594aecc7e2c2f)

3 years agoarm64: add definition for IS_SSTEP_TRAP()
Mitchell Horne [Mon, 1 Mar 2021 14:01:25 +0000 (10:01 -0400)]
arm64: add definition for IS_SSTEP_TRAP()

arm64 has a distinct exception code for single-step, so we can use this
to detect when an unexpected SS trap is encountered, or when an expected
one is not. See db_stop_at_pc().

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

(cherry picked from commit e152c882738ffe26a2f52e420e2a92c014943207)

3 years agoarm64: update kdb_thrctx->pcb_lr with BKPT_SKIP
Mitchell Horne [Mon, 1 Mar 2021 14:00:17 +0000 (10:00 -0400)]
arm64: update kdb_thrctx->pcb_lr with BKPT_SKIP

This value should be kept in sync with updates to kdb_frame->tf_elr,
since it is queried by PC_REGS() in several places.

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

(cherry picked from commit bd0b7cbf5ac1baff4211e09584e0b86d4d96228b)

3 years agoarm64: fix hardware single-stepping from EL1
Mitchell Horne [Mon, 1 Mar 2021 13:59:25 +0000 (09:59 -0400)]
arm64: fix hardware single-stepping from EL1

The main issue is that debug exceptions must to be disabled for the
entire duration that SS bit in MDSCR_EL1 is set. Otherwise, a
single-step exception will be generated immediately. This can occur
before returning from the debugger (when MDSCR is written to) or before
re-entering it after the single-step (when debug exceptions are unmasked
in the exception handler).

Solve this by delaying the unmask to C code for EL1, and avoid unmasking
at all while handling debug exceptions, thus avoiding any recursive
debug traps.

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

(cherry picked from commit 874635e381731e1fbd5e2d0459ca87814f1e455c)

3 years agorack: unbreak TCP fast open for the client side
Michael Tuexen [Fri, 5 Mar 2021 14:57:26 +0000 (15:57 +0100)]
rack: unbreak TCP fast open for the client side

Allow sending user data on the SYN segment.

Reviewed by: rrs
Differential Revision: https://reviews.freebsd.org/D29082
Sponsored by: Netflix, Inc.

(cherry picked from commit 705d06b289e9821439b7b694d766cad75bc064e5)

3 years agotcp: Add prr_out in preparation for PRR/nonSACK and LRD
Richard Scheffenegger [Fri, 5 Mar 2021 23:36:48 +0000 (00:36 +0100)]
tcp: Add prr_out in preparation for PRR/nonSACK and LRD

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

(cherry picked from commit e53138694aa41c24c17847afe959225ce0eeff91)

3 years agotcp: remove a superfluous local var in tcp_sack_partialack()
Richard Scheffenegger [Fri, 5 Mar 2021 17:19:16 +0000 (18:19 +0100)]
tcp: remove a superfluous local var in tcp_sack_partialack()

No functional change.

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

(cherry picked from commit 9a13d9dceee27fc1bf6fb7e58e83c88707665859)

3 years agotcp: remove incorrect reset of SACK variable in PRR
Richard Scheffenegger [Fri, 5 Mar 2021 16:45:23 +0000 (17:45 +0100)]
tcp: remove incorrect reset of SACK variable in PRR

Reviewed By:   #transport, rrs, tuexen
PR:            253848
MFC after:     3 days
Sponsored By:  NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29083

(cherry picked from commit 4a8f3aad37dd35c905e34b64b022d60844ba8d01)

3 years agocam: remove redundant scsi_vpd_block_characteristics definition
Warner Losh [Wed, 3 Mar 2021 01:31:43 +0000 (18:31 -0700)]
cam: remove redundant scsi_vpd_block_characteristics definition

There were two definitions for the SCSI VPD Block Device Characteristics (page
0xb1): struct scsi_vpd_block_characteristics and struct
scsi_vpd_block_device_characteristics. The latter is more complete and more
widely used. Convert uses of the former to the latter by tweaking the da driver
and removing sturct scsi_vpd_block_characteristics.

(cherry picked from commit b3fce46a3eac600935f3aac2b224a83defcf1cb3)

3 years agocam: add new ASC and ASCQ values related to drive depopulation
Warner Losh [Fri, 26 Feb 2021 18:43:35 +0000 (11:43 -0700)]
cam: add new ASC and ASCQ values related to drive depopulation

Add 04/25 Depopulation restoration in progress, 31/04 Depopulation failed, and
31/05 Depopulation restoration failed.

These are defined in SPC-6r2 (though 31/4 was added in an earlier draft). They
relate to different aspects of in-progress or failed depopulation removal and
restoration commands.

(cherry picked from commit 34d6961108bd47243236d086551459c52adabf49)

3 years agocamcontrol: change hueristic for I/O-less devtype
Warner Losh [Tue, 23 Feb 2021 19:33:26 +0000 (12:33 -0700)]
camcontrol: change hueristic for I/O-less devtype

Some SATA drives have 'config' set to 0 in the identify block. Rather than rely
on it, use the strings windows uses to display the drive since they are supposed
to be space padded and will always be non-zero.

(cherry picked from commit 6b7580f7b1b66134286813b971ab575862b95426)

3 years agoservice(8): use an environment more consistent with init(8)
Andrew Gierth [Wed, 3 Mar 2021 18:25:11 +0000 (12:25 -0600)]
service(8): use an environment more consistent with init(8)

init(8) sets the "daemon" login class without specifying a pw
entry (so no substitutions are done on the variables). service(8)'s
use of env -L had the effect of specifying root's pw entry, with two
effects: getpwnam and getpwuid are being called, which may not be
entirely safe depending on what nsswitch is up to and what stage of
boot we are at, and substitutions would have been done.

Fix by teaching env(8) to allow -L -/classname to set the class
environment with no pw entry at all specified, and use it in
service(8).

PR: 253959

(cherry picked from commit 55deb0a5f089c8a27cfc1666655b93881c2b47ae)
(cherry picked from commit 0c1a5eaae83267365330437adb60f44e1a622a2b)

3 years agojail(8): reset to root cpuset before attaching to run commands
Kyle Evans [Thu, 4 Mar 2021 19:28:53 +0000 (13:28 -0600)]
jail(8): reset to root cpuset before attaching to run commands

Recent changes have made it such that attaching to a jail will augment
the attaching process' cpu mask with the jail's cpuset. While this is
convenient for allowing the administrator to cpuset arbitrary programs
that will attach to a jail, this is decidedly not convenient for
executing long-running daemons during jail creation.

This change inserts a reset of the process cpuset to the root cpuset
between the fork and attach to execute a command. This allows commands
executed to have the widest mask possible, and the administrator can
cpuset(1) it back down inside the jail as needed.

With this applied, one should be able to change a jail's cpuset at
exec.poststart in addition to exec.created.  The former was made
difficult if jail(8) itself was running with a constrained set, as then
some processes may have been spawned inside the jail with a non-root
set.  The latter is the preferred option so that processes starting in
the jail are constrained appropriately up front.

Note that all system commands are still run with the process' initial
cpuset applied.

PR: 253724

(cherry picked from commit 466df976babed65f8a8de9e36d7f016a444609af)

3 years agoarmv8crypto: fix AES-XTS regression introduced by ed9b7f44
Oleksandr Tymoshenko [Sun, 7 Mar 2021 20:03:47 +0000 (12:03 -0800)]
armv8crypto: fix AES-XTS regression introduced by ed9b7f44

Initialization of the XTS key schedule was accidentally dropped
when adding AES-GCM support so all-zero schedule was used instead.
This rendered previously created GELI partitions unusable.
This change restores proper XTS key schedule initialization.

Reported by: Peter Jeremy <peter@rulingia.com>
MFC after: immediately

(cherry picked from commit 748be78e60ccc4a26325a636347debb1f7e6749b)

3 years ago[skip ci] Add RELNOTES entries for aio_writev and fusefs
Alan Somers [Sun, 7 Mar 2021 16:17:41 +0000 (16:17 +0000)]
[skip ci] Add RELNOTES entries for aio_writev and fusefs

3 years agoAdd an entry for NFS-over-TLS.
Rick Macklem [Sun, 7 Mar 2021 15:11:50 +0000 (07:11 -0800)]
Add an entry for NFS-over-TLS.

3 years agoFix diroffdiroff, probably copy/paste bug.
Alexander Motin [Sun, 28 Feb 2021 14:07:13 +0000 (09:07 -0500)]
Fix diroffdiroff, probably copy/paste bug.

Too long name looks bad in `vmstat -m`.

MFC after: 1 week

(cherry picked from commit d01032736cf067d63e66d6428ffc08e47652600f)

3 years agolibkvm: Plug couple of memory leaks and check possible calloc(3) failure
Jung-uk Kim [Wed, 3 Mar 2021 23:10:00 +0000 (18:10 -0500)]
libkvm: Plug couple of memory leaks and check possible calloc(3) failure

First, r204494 introduced dpcpu_off in struct __kvm and it was allocated
from _kvm_dpcpu_init() but it was not free(3)'ed from kvm_close(3).
Second, r291406 introduced kvm_nlist2(3) and converted kvm_nlist(3) to
use the new function but it did not free the temporary buffer.
Also, check possible calloc(3) failure while I am in the neighborhood.

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

(cherry picked from commit 645eaa2ccaed6eea801d07d6a092974fc1713896)
(cherry picked from commit 483c6da3a20b2064cd655f7cb19e6b98dee677ff)

3 years agoloader_4th: brand image is aligned right
Toomas Soome [Sat, 6 Mar 2021 08:54:08 +0000 (10:54 +0200)]
loader_4th: brand image is aligned right

With screen border removed, I forgot to update forth brand image
coordinates to avoid image alignment.

(cherry picked from commit 6a3095aa6d0350dda89bac66d26f22a01e2257c4)

3 years agoUse atomic_interrupt_fence() instead of bare __compiler_membar()
Konstantin Belousov [Fri, 26 Feb 2021 23:54:17 +0000 (01:54 +0200)]
Use atomic_interrupt_fence() instead of bare __compiler_membar()

(cherry picked from commit b5449c92b489445635c7962875ce73b2c9211bba)

3 years agokcsan: add atomic_interrupt_fence
Mateusz Guzik [Mon, 1 Mar 2021 07:42:15 +0000 (07:42 +0000)]
kcsan: add atomic_interrupt_fence

(cherry picked from commit 2c1c1255e41ac3fecd79f9f704c934642f34fd60)

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)