]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoFlush remaining routes from the routing table during VNET shutdown.
Alexander V. Chernikov [Mon, 8 Mar 2021 21:35:41 +0000 (21:35 +0000)]
Flush remaining routes from the routing table during VNET shutdown.

Summary:
This fixes rtentry leak for the cloned interfaces created inside the
 VNET.

Loopback teardown order is `SI_SUB_INIT_IF`, which happens after `SI_SUB_PROTO_DOMAIN` (route table teardown).
Thus, any route table operations are too late to schedule.
As the intent of the vnet teardown procedures to minimise the amount of effort by doing global cleanups instead of per-interface ones, address this by adding a relatively light-weight routing table cleanup function, `rib_flush_routes()`.
It removes all remaining routes from the routing table and schedules the deletion, which will happen later, when `rtables_destroy()` waits for the current epoch to finish.

Test Plan:
```
set_skip:set_skip_group_lo  ->  passed  [0.053s]
tail -n 200 /var/log/messages | grep rtentry
```

PR: 253998
Reported by: rashey at superbox.pl
Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D29116

(cherry picked from commit b1d63265ac399112b3bca36c3d75df1a3c2c8102)

3 years agoFix various NOINET* builds broken by 145bf6c0af48.
Alexander V. Chernikov [Fri, 12 Feb 2021 20:36:20 +0000 (20:36 +0000)]
Fix various NOINET* builds broken by 145bf6c0af48.

Reported by: mjg, bdragon

(cherry picked from commit 8ca99aecf749dd088310f81f3c5364a462f1e332)

3 years agoFix blackhole/reject routes.
Alexander V. Chernikov [Mon, 8 Feb 2021 23:29:05 +0000 (23:29 +0000)]
Fix blackhole/reject routes.

Traditionally *BSD routing stack required to supply some
 interface data for blackhole/reject routes. This lead to
 varieties of hacks in routing daemons when inserting such routes.
With the recent routeing stack changes, gateway sockaddr without
 RTF_GATEWAY started to be treated differently, purely as link
 identifier.

This change broke net/bird, which installs blackhole routes with
 127.0.0.1 gateway without RTF_GATEWAY flags.

Fix this by automatically constructing necessary gateway data at
 rtsock level if RTF_REJECT/RTF_BLACKHOLE is set.

Reported by: Marek Zarychta <zarychtam at plan-b.pwste.edu.pl>
Reviewed by: donner

(cherry picked from commit 145bf6c0af48b89f13465e145f4516de37c31d85)

3 years agoPartially revert libcxxrt changes to avoid _Unwind_Exception change
Dimitry Andric [Sat, 13 Mar 2021 13:54:05 +0000 (14:54 +0100)]
Partially revert libcxxrt changes to avoid _Unwind_Exception change

(Note I am also applying this to main and stable/13, to restore the old
libcxxrt ABI and to avoid having to maintain a compat library.)

After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d26 and
d2b3fadf2db5, users reported that editors/libreoffice packages from the
official package builders did not start anymore. It turns out that the
combination of these commits subtly changes the ABI, requiring all
applications that depend on internal details of struct _Unwind_Exception
(available via unwind-arm.h and unwind-itanium.h) to be recompiled.

However, the FreeBSD package builders always use -RELEASE jails, so
these still use the old declaration of struct _Unwind_Exception, which
is not entirely compatible. In particular, LibreOffice uses this struct
in its internal "uno bridge" component, where it attempts to setup its
own exception handling mechanism.

To fix this incompatibility, go back to the old declarations of struct
_Unwind_Exception, and restore the __LP64__ specific workaround we had
in place before (which was to cope with yet another, older ABI bug).

Effectively, this reverts upstream libcxxrt commits 88bdf6b290da
("Specify double-word alignment for ARM unwind") and b96169641f79
("Updated Itanium unwind"), and reapplies our commit 3c4fd2463bb2
("libcxxrt: add padding in __cxa_allocate_* to fix alignment").

PR: 253840

3 years agoRestore AT_RESOLVE_BENEATH support for funlinkat(2)/unlinkat(2).
Konstantin Belousov [Fri, 5 Mar 2021 02:07:57 +0000 (04:07 +0200)]
Restore AT_RESOLVE_BENEATH support for funlinkat(2)/unlinkat(2).

(cherry picked from commit ead7697f04c036853535a4281cec9aa09ef21270)

3 years agoMFC jail: Don't allow jails under dying parents
Jamie Gritton [Tue, 23 Feb 2021 01:04:06 +0000 (17:04 -0800)]
MFC jail: Don't allow jails under dying parents

If a jail is created with jail_set(...JAIL_DYING), and it has a parent
currently in a dying state, that will bring the parent jail back to
life.  Restrict that to require that the parent itself be explicitly
brought back first, and not implicitly created along with the new
child jail.

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

(cherry picked from commit 0a2a96f35a4c2dab3486438680fa289e12971e4b)

MFC jail: Fix locking on an early jail_set error.

I had locked allprison_lock without immediately setting PD_LIST_LOCKED.

(cherry picked from commit 108a9384e9e945cccba73c959f7e9cdb023cbcad)

3 years agoMFC jail: Add PD_KILL to remove a prison in prison_deref().
Jamie Gritton [Mon, 22 Feb 2021 20:27:44 +0000 (12:27 -0800)]
MFC jail: Add PD_KILL to remove a prison in prison_deref().

Add the PD_KILL flag that instructs prison_deref() to take steps
to actively kill a prison and its descendents, namely marking it
PRISON_STATE_DYING, clearing its PR_PERSIST flag, and killing any
attached processes.

This replaces a similar loop in sys_jail_remove(), bringing the
operation under the same single hold on allprison_lock that it already
has. It is also used to clean up failed jail (re-)creations in
kern_jail_set(), which didn't generally take all the proper steps.

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

(cherry picked from commit 811e27fa3c445664e36071a7d08228fc7fb85676)

MFC jail: back out 811e27fa3c44 until it doesn't break Jenkins

Reported by: arichardson

(cherry picked from commit ddfffb41a22d4798a036fe2d30e59694ba7cdad3)

MFC jail: re-commit 811e27fa3c44 with fixes

Make sure PD_KILL isn't passed to do_jail_attach, where it might end
up trying to kill the caller's prison (even prison0).

Fix the child jail loop in prison_deref_kill, which was doing the
post-order part during the pre-order part.  That's not a system-
killer, but make jails not always die correctly.

(cherry picked from commit c861373bdff90d8167a0d998899ca718ccdb541b)

MFC jail: Add safety around prison_deref() flags.

do_jail_attach() now only uses the PD_XXX flags that refer to lock
status, so make sure that something else like PD_KILL doesn't slip
through.

Add a KASSERT() in prison_deref() to catch any further PD_KILL misuse.

(cherry picked from commit 589e4c1df4a6e4b1368f26fc7fef704a2e5cb42c)

3 years agoMFC jail: Add pr_state to struct prison
Jamie Gritton [Sun, 21 Feb 2021 21:24:47 +0000 (13:24 -0800)]
MFC jail: Add pr_state to struct prison

Rather that using references (pr_ref and pr_uref) to deduce the state
of a prison, keep track of its state explicitly.  A prison is either
"invalid" (pr_ref == 0), "alive" (pr_uref > 0) or "dying"
(pr_uref == 0).

State transitions are generally tied to the reference counts, but with
some flexibility: a new prison is "invalid" even though it now starts
with a reference, and jail_remove(2) sets the state to "dying" before
the user reference count drops to zero (which was prviously
accomplished via the PR_REMOVE flag).

pr_state is protected by both the prison mutex and allprison_lock, so
it has the same availablity guarantees as the reference counts do.

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

(cherry picked from commit 1158508a8086a1a93492c1a2e22b61cd7fee4ec7)

MFC jail: Fix a LOR introduced in 1158508a8086

(cherry picked from commit 701d6b50ae7b0b2b50fbd191c2dbd646ef3b4a67)

3 years agox86: tsc: deprioritize TSC on VirtualBox
Kyle Evans [Mon, 8 Mar 2021 20:20:10 +0000 (14:20 -0600)]
x86: tsc: deprioritize TSC on VirtualBox

Misbehavior has been observed with TSC under VirtualBox, where threads
doing small sleeps (~1 second) may miss their wake up and hang around
in a sleep state indefinitely.  Switching back to ACPI-fast decidedly
fixes it, so stop using TSC on VirtualBox at least for the time being.

This partially reverts 84eaf2ccc6aa, applying it only to VirtualBox and
increasing the quality to 0. Negative qualities can never be chosen and
cannot be chosen with the tunable recently added. If we do not have a
timecounter with a higher quality than 0, then TSC does at least leave
the system mostly usable.

PR: 253087

(cherry picked from commit 8cc15b0dfc2f3299662e78f18bd6127f83c14ab4)

3 years agoMFC jail: Change the locking around pr_ref and pr_uref
Jamie Gritton [Sun, 21 Feb 2021 18:55:44 +0000 (10:55 -0800)]
MFC jail: Change the locking around pr_ref and pr_uref

Require both the prison mutex and allprison_lock when pr_ref or
pr_uref go to/from zero.  Adding a non-first or removing a non-last
reference remain lock-free.  This means that a shared hold on
allprison_lock is sufficient for prison_isalive() to be useful, which
removes a number of cases of lock/check/unlock on the prison mutex.

Expand the locking in kern_jail_set() to keep allprison_lock held
exclusive until the new prison is valid, thus making invalid prisons
invisible to any thread holding allprison_lock (except of course the
one creating or destroying the prison).  This renders prison_isvalid()
nearly redundant, now used only in asserts.

Differential Revision: https://reviews.freebsd.org/D28419
Differential Revision: https://reviews.freebsd.org/D28458

(cherry picked from commit f7496dcab0360a74bfb00cd6118f66323fffda61)

MFC jail: fix build after the previous commit
Noted by: Michael Butler <imb protected-networks.net>

(cherry picked from commit ee9b37ae5c115c41835119bb5c9d2e14c83abd65)

3 years agoMFC jail: Improve locking when removing prisons
Jamie Gritton [Sat, 20 Feb 2021 22:38:58 +0000 (14:38 -0800)]
MFC jail: Improve locking when removing prisons

Change the flow of prison_deref() so it doesn't let go of allprison_lock
until it's completely done using it (except for a possible drop as part
of an upgrade on its first try).

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

(cherry picked from commit 6e1d1bfcac77603541706807803a198c6d954d7c)

3 years agoopencrypto: Make cryptosoft attach silently
Mark Johnston [Fri, 5 Mar 2021 18:11:25 +0000 (13:11 -0500)]
opencrypto: Make cryptosoft attach silently

cryptosoft is always present and doesn't print any useful information
when it attaches.

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

(cherry picked from commit 4fc60fa9294f82c7f4e1a0e71f9a17794124217f)

3 years agonetmap: Stop printing a line to the dmesg in netmap_init()
Mark Johnston [Fri, 5 Mar 2021 23:07:47 +0000 (18:07 -0500)]
netmap: Stop printing a line to the dmesg in netmap_init()

netmap is compiled into the kernel by default so initialization was
always reported, and netmap uses a formatting convention not used in the
rest of the kernel.

Reviewed by: vmaffione
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29099

(cherry picked from commit fef845097190f0ecb783d6c75a9398c4e4a4c0e1)

3 years agoktls: Hide initialization message behind bootverbose
Mark Johnston [Fri, 5 Mar 2021 18:11:02 +0000 (13:11 -0500)]
ktls: Hide initialization message behind bootverbose

We don't typically print anything when a subsystem initializes itself,
and KTLS is currently disabled by default anyway.

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

(cherry picked from commit 89b650872bba2e4bfbc94a200946b461ef69ae22)

3 years agoacpi: Make nexus_acpi quiet on amd64 and i386
Mark Johnston [Fri, 5 Mar 2021 17:53:30 +0000 (12:53 -0500)]
acpi: Make nexus_acpi quiet on amd64 and i386

Otherwise during attach newbus prints "nexus0", which is not very
useful.

The generic nexus device is already quiet, as is nexus_acpi on arm64.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 732b69c9f9c84408e7e680a93ab91ce76ffef2ce)

3 years agoAdd ObsoleteFiles.inc entries for various OCF headers removed in 13.
John Baldwin [Mon, 8 Mar 2021 19:17:21 +0000 (11:17 -0800)]
Add ObsoleteFiles.inc entries for various OCF headers removed in 13.

(cherry picked from commit ef74bfc6fed298d5ca0e3cb92bf008b715ea0c2f)

3 years agoCorrect the name of the structure used for TCP socket options.
John Baldwin [Mon, 8 Mar 2021 18:46:40 +0000 (10:46 -0800)]
Correct the name of the structure used for TCP socket options.

The structure was renamed while refactoring Netflix's KTLS changes for
upstreaming, but the original name remained in tcp.4 and was
subsequently copied to ktls.4.

PR: 254141
Reported by: asomers

(cherry picked from commit c5a365623f88999b524d94003187ef09fda55f67)

3 years agoRemove the usr/tests/usr.bin/yacc/yacc directory when removing yacc.
John Baldwin [Wed, 3 Mar 2021 22:46:45 +0000 (14:46 -0800)]
Remove the usr/tests/usr.bin/yacc/yacc directory when removing yacc.

(cherry picked from commit e6cfd2939a4261c1f4bf802368cea8faf824c128)

3 years agowg(4): Fix an example in the manual page
Gordon Bergling [Sun, 7 Mar 2021 19:27:59 +0000 (20:27 +0100)]
wg(4): Fix an example in the manual page

The example in the manual page of wg(4) for connecting to a
peer was missing the 'public-key' ifconfig(8) keyword and for the
addressed peer the port must be specified.

PR: 253866
Reported by: Sergey Akhmatov <sergey at akhmatov dot ru>
Reviewed by: debdrup
Differential Revision: https://reviews.freebsd.org/D29115

(cherry picked from commit f7bfe310191c8292da51c8da166a521ff16e0e46)

3 years agosecurity(7): mention new W^X sysctls in the manual page
Evgeniy Khramtsov [Tue, 2 Mar 2021 18:52:22 +0000 (19:52 +0100)]
security(7): mention new W^X sysctls in the manual page

Reviewed by: emaste, gbe
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28986

(cherry picked from commit 907023b454f06a6af87f21f8a9d6de6c11b2d275)

3 years agowg: Avoid leaking mbufs when the input handshake queue is full
Mark Johnston [Mon, 8 Mar 2021 17:39:05 +0000 (12:39 -0500)]
wg: Avoid leaking mbufs when the input handshake queue is full

Reviewed by: grehan
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29011

(cherry picked from commit a11009dccb6a2e75de2b8f1b45a0896eda2e6d85)

3 years agoqat.4: Fix some firmware module names
Mark Johnston [Wed, 3 Mar 2021 14:07:53 +0000 (09:07 -0500)]
qat.4: Fix some firmware module names

PR: 252984

(cherry picked from commit 3adf72a36b9b151eef57e3d83f71a3a9fbacb78d)

3 years agoFix 'in6_purgeaddr: err=65, destination address delete failed' message.
Alexander V. Chernikov [Mon, 8 Mar 2021 20:27:29 +0000 (20:27 +0000)]
Fix 'in6_purgeaddr: err=65, destination address delete failed' message.

P2P ifa may require 2 routes: one is the loopback route, another is
 the "prefix" route towards its destination.

Current code marks loopback routes existence with IFA_RTSELF and
 "prefix" p2p routes with IFA_ROUTE.

For historic reasons, we fill in ifa_dstaddr for loopback interfaces.
To avoid installing the same route twice, we preemptively set
 IFA_RTSELF when adding "prefix" route for loopback.
However, the teardown part doesn't have this hack, so we try to
 remove the same route twice.

Fix this by checking if ifa_dstaddr is different from the ifa_addr
 and moving this logic into a separate function.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D29121

(cherry picked from commit 7634919e15f1147b6f26d55354be375bc9b198db)

3 years agoEnforce net epoch in in6_selectsrc().
Alexander V. Chernikov [Sat, 13 Feb 2021 14:32:10 +0000 (14:32 +0000)]
Enforce net epoch in in6_selectsrc().

in6_selectsrc() may call fib6_lookup() in some cases, which requires
 epoch. Wrap in6_selectsrc* calls into epoch inside its users.
Mark it as requiring epoch by adding NET_EPOCH_ASSERT().

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

(cherry picked from commit 605284b894748d23136b30a202689493d8f8af52)

3 years agoFix dpdk/ldradix fib lookup algorithm preference calculation.
Alexander V. Chernikov [Sun, 7 Mar 2021 22:05:34 +0000 (22:05 +0000)]
Fix dpdk/ldradix fib lookup algorithm preference calculation.

The current preference number were copied from IPv4 code,
 assuming 500k routes to be the full-view. Adjust with the current
 reality (100k full-view).

Reported by: Marek Zarychta <zarychtam at plan-b.pwste.edu.pl>

(cherry picked from commit d5be41beb7c44119730791d92782d8e77174d312)

3 years agoFix setting static entries for arp/ndp.
Alexander V. Chernikov [Sat, 20 Feb 2021 18:21:52 +0000 (18:21 +0000)]
Fix setting static entries for arp/ndp.

rtsock message validation changes committed in 2fe5a79425c7
 did not take llinfo messages into account.

Add a special validation case for RTA_GATEWAY llinfo messages.

(cherry picked from commit e5b394f2d0d94f190c9da2346fd22d7c6fb14730)

3 years agoFix arp/ndp deletion broken by 2fe5a79425c7.
Alexander V. Chernikov [Fri, 19 Feb 2021 21:09:17 +0000 (21:09 +0000)]
Fix arp/ndp deletion broken by 2fe5a79425c7.

Changes in the 2fe5a79425c7 moved dst sockaddr masking from the
 routing control plane to the rtsock code.

It broke arp/ndp deletion.
It turns out, arp/ndp perform RTM_GET request first to get an
 interface index necessary for the deletion.
Then they simply stamp the reply with RTF_LLDATA and set the
 command to RTM_DELETE.
As a result, kernel receives request with non-empty RTA_NETMASK
 and clears RTA_DST host bits before passing the message to the
 lla code.

De facto, the only needed bits are RTA_DST, RTA_GATEWAY and the
 subset of rtm_flags.

With that in mind, fix the interace by clearing RTA_NETMASK
 for every messages with RTF_LLDATA.

While here, cleanup arp/ndp code a bit.

Reviewed by: gnn
Differential Revision: https://reviews.freebsd.org/D28804

(cherry picked from commit f9e1cd6c99200846b324a8b65f7f31ded74013bd)

3 years agoFix NOINET6 build broken by 2fe5a79425c7.
Alexander V. Chernikov [Tue, 16 Feb 2021 21:49:48 +0000 (21:49 +0000)]
Fix NOINET6 build broken by 2fe5a79425c7.

Reported by: mjg

(cherry picked from commit a4513bace0e0c38d38b0c49c1daea60f2741d781)

3 years agoFix dst/netmask handling in routing socket code.
Alexander V. Chernikov [Tue, 16 Feb 2021 20:30:04 +0000 (20:30 +0000)]
Fix dst/netmask handling in routing socket code.

Traditionally routing socket code did almost zero checks on
 the input message except for the most basic size checks.

This resulted in the unclear KPI boundary for the routing system code
 (`rtrequest*` and now `rib_action()`) w.r.t message validness.

Multiple potential problems and nuances exists:
* Host bits in RTAX_DST sockaddr. Existing applications do send prefixes
 with hostbits uncleared. Even `route(8)` does this, as they hope the kernel
 would do the job of fixing it. Code inside `rib_action()` needs to handle
 it on its own (see `rt_maskedcopy()` ugly hack).
* There are multiple way of adding the host route: it can be DST without
 netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be set correspondingly.
 Currently, these 2 options create 2 DIFFERENT routes in the kernel.
* no sockaddr length/content checking for the "secondary" fields exists: nothing
 stops rtsock application to send sockaddr_in with length of 25 (instead of 16).
 Kernel will accept it, install to RIB as is and propagate to all rtsock consumers,
 potentially triggering bugs in their code. Same goes for sin_port, sin_zero, etc.

The goal of this change is to make rtsock verify all sockaddr and prefix consistency.
Said differently, `rib_action()` or internals should NOT require to change any of the
 sockaddrs supplied by `rt_addrinfo` structure due to incorrectness.

To be more specific, this change implements the following:
* sockaddr cleanup/validation check is added immediately after getting sockaddrs from rtm.
* Per-family dst/netmask checks clears host bits in dst and zeros all dst/netmask "secondary" fields.
* The same netmask checking code converts /32(/128) netmasks to "host" route case
 (NULL netmask, RTF_HOST), removing the dualism.
* Instead of allowing ANY "known" sockaddr families (0<..<AF_MAX), allow only actually
 supported ones (inet, inet6, link).
* Automatically convert `sockaddr_sdl` (AF_LINK) gateways to
  `sockaddr_sdl_short`.

Reported by: Guy Yur <guyyur at gmail.com>
Reviewed By: donner
Differential Revision: https://reviews.freebsd.org/D28668

(cherry picked from commit 2fe5a79425c79f7b828acd91da66d97230925fc8)

3 years agoAdd ifa_try_ref() to simplify ifa handling inside epoch.
Alexander V. Chernikov [Tue, 16 Feb 2021 20:12:58 +0000 (20:12 +0000)]
Add ifa_try_ref() to simplify ifa handling inside epoch.

More and more code migrates from lock-based protection to the NET_EPOCH
 umbrella. It requires some logic changes, including, notably, refcount
 handling.

When we have an `ifa` pointer and we're running inside epoch we're
 guaranteed that this pointer will not be freed.
However, the following case can still happen:
 * in thread 1 we drop to 0 refcount for ifa and schedule its deletion.
 * in thread 2 we use this ifa and reference it
 * destroy callout kicks in
 * unhappy user reports bug

To address it, new `ifa_try_ref()` function is added, allowing to return
 failure when we try to reference `ifa` with 0 refcount.
Additionally, existing `ifa_ref()` is enforced with `KASSERT` to provide
 cleaner error in such scenarious.

Reviewed By: rstone, donner
Differential Revision: https://reviews.freebsd.org/D28639

(cherry picked from commit 600eade2fb4faacfcd408a01140ef15f85f0c817)

3 years agoMake in_localip_more() fib-aware.
Alexander V. Chernikov [Tue, 16 Feb 2021 20:00:46 +0000 (20:00 +0000)]
Make in_localip_more() fib-aware.

It fixes loopback route installation for the interfaces
 in the different fibs using the same prefix.

Reviewed By: donner
PR: 189088
Differential Revision: https://reviews.freebsd.org/D28673

(cherry picked from commit 9fdbf7eef5c006002769add15b1ebb8fa8d9e220)

3 years agoRemove per-packet ifa refcounting from IPv6 fast path.
Alexander V. Chernikov [Mon, 15 Feb 2021 21:59:21 +0000 (21:59 +0000)]
Remove per-packet ifa refcounting from IPv6 fast path.

Currently ip6_input() calls in6ifa_ifwithaddr() for
 every local packet, in order to check if the target ip
 belongs to the local ifa in proper state and increase
 its counters.

in6ifa_ifwithaddr() references found ifa.
With epoch changes, both `ip6_input()` and all other current callers
 of `in6ifa_ifwithaddr()` do not need this reference
 anymore, as epoch provides stability guarantee.

Given that, update `in6ifa_ifwithaddr()` to allow
 it to return ifa without referencing it, while preserving
 option for getting referenced ifa if so desired.

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

(cherry picked from commit 8268d82cff1bcd7969e5b3c676f28684784a7a43)

3 years agoRemove now-unused RTF_RNH_LOCKED route flag.
Alexander V. Chernikov [Sun, 14 Feb 2021 13:45:14 +0000 (13:45 +0000)]
Remove now-unused RTF_RNH_LOCKED route flag.

(cherry picked from commit 64d5c2777731c1376dd44b6a5fdb68b168d073dc)

3 years agoDo not reference returned ifa in in6_ifawithifp().
Alexander V. Chernikov [Sun, 14 Feb 2021 10:11:06 +0000 (10:11 +0000)]
Do not reference returned ifa in in6_ifawithifp().

The only place where in6_ifawithifp() is used is ip6_output(),
 which uses the returned ifa to bump traffic counters.
Given ifa stability guarantees is provided by epoch, do not refcount ifa.

This eliminates 2 atomic ops from IPv6 fast path.

Reviewed By: rstone
Differential Revision: https://reviews.freebsd.org/D28649

(cherry picked from commit 1bd44b11e59f1e9ee7245f8de1f823bc5287b9ef)

3 years agobacklight(8): Add note that with option it print the current brightness.
Emmanuel Vadot [Wed, 3 Mar 2021 08:00:42 +0000 (09:00 +0100)]
backlight(8): Add note that with option it print the current brightness.

MFC after:    3 days
PR:        253737

(cherry picked from commit 1df30489a8f7083c98010c94d9ce522f9e8213dc)

3 years agobacklight: Fix incr/decr with percent value of 0
David Schlachter [Wed, 3 Mar 2021 07:57:35 +0000 (08:57 +0100)]
backlight: Fix incr/decr with percent value of 0

This now does nothing instead of incr/decr by 10%

MFC After:    3 days
PR:        253736

(cherry picked from commit 3b005d51bd0fe4d8d19fb2df4d470b6e8baebf16)

3 years agozfs: update openzfs version reference to bedbc13da
Martin Matuska [Fri, 5 Mar 2021 14:52:04 +0000 (15:52 +0100)]
zfs: update openzfs version reference to bedbc13da

It was missed in the latest merge.

(cherry picked from commit 6781b8a32e702c694d3f813959d326e36facc19f)

3 years agozfs: merge OpenZFS master-bedbc13da
Martin Matuska [Wed, 3 Mar 2021 01:15:33 +0000 (02:15 +0100)]
zfs: merge OpenZFS master-bedbc13da

Notable upstream commits:
  8e43fa12c Fix vdev_rebuild_thread deadlock
  03ef8f09e Add missing checks for unsupported features
  2e160dee9 Fix assert in FreeBSD-specific dmu_read_pages
  bedbc13da Cancel TRIM / initialize on FAULTED non-writeable vdevs

Obtained from: OpenZFS

(cherry picked from commit caed7b1c399de04279822028e15b36367e84232f)

3 years agoopenzfs: attach pam_zfs_key to build
Greg V [Tue, 2 Mar 2021 11:01:14 +0000 (06:01 -0500)]
openzfs: attach pam_zfs_key to build

This PAM module allows unlocking encrypted user home datasets when
logging in (and changing passphrase when changing the account password),
see https://github.com/openzfs/zfs/pull/9903

Also supposed to unload the key when the last session for the user is
done, but there are EBUSY issues:
https://github.com/openzfs/zfs/issues/11222#issuecomment-731897858

Submitted by: Greg V <greg_unrelenting.technology>
Reviewed by: mm
Differential Revision: https://reviews.freebsd.org/D28018

(cherry picked from commit ee21ee1572d40a3b74f18638dae38c1a9ad1e9e3)

3 years agozfs: add missing seqc write begin/end around zfs_acl_chown_setattr
Mateusz Guzik [Sat, 27 Feb 2021 22:26:20 +0000 (22:26 +0000)]
zfs: add missing seqc write begin/end around zfs_acl_chown_setattr

It happens to trip over an assert but does not matter for correctness at
this time. However, do it for future proofing.

Reported by: avg

(cherry picked from commit 1d8510c1a64d61a85c74c8b02fb12e6f31ede5a1)

3 years agozfs: add missing checks for unsupported features
Martin Matuska [Fri, 26 Feb 2021 21:52:41 +0000 (22:52 +0100)]
zfs: add missing checks for unsupported features

After the merge of OpenZFS master-9312e0fd1 it has become possible to
import ZFS pools witn an active org.illumos:edonr feature on FreeBSD,
leading to a panic.

In addition, "zpool status" reported all pools without edonr as upgradable
and "zpool upgrade -v" lists edonr in the list of upgradable features.

This is an accepted but not yet included bugfix by upstream.

Obtained from: https://github.com/openzfs/zfs/pull/11653
Differential Revision: https://reviews.freebsd.org/D28935
Reported by: garga (on freebsd-current@)
Reviewed by: freqlabs

(cherry picked from commit c170aa9f37e4ce9338a0f26e3e983f7123ea8c1a)

3 years agoInstall links for zpool feature compat aliases
Ryan Moeller [Thu, 25 Feb 2021 19:16:09 +0000 (14:16 -0500)]
Install links for zpool feature compat aliases

The alias links were missed when this feature was introduced to the
FreeBSD build system in 10f57cb98fd61b2669640a84aa73ad118601f281.

Reviewed by: mm
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D28925

(cherry picked from commit 2ae79aa362e7a2ee72657b39be64f1390158aaf6)

3 years agozfs: merge OpenZFS master-9312e0fd1
Martin Matuska [Mon, 22 Feb 2021 11:35:56 +0000 (12:35 +0100)]
zfs: merge OpenZFS master-9312e0fd1

Notable upstream changes:
  778869fa1 Fix reporting of mount progress
  e7adccf7f Disable use of hardware crypto offload drivers on FreeBSD
  03e02e5b5 Fix checksum errors not being counted on repeated repair
  64e0fe14f Restore FreeBSD resource usage accounting
  11f2e9a49 Fix panic if scrubbing after removing a slog device

(cherry picked from commit ba27dd8be821792e15bdabfac69fd6cab0cf9dd3)

3 years agozfs: bump version and install new share files
Martin Matuska [Thu, 18 Feb 2021 11:08:20 +0000 (12:08 +0100)]
zfs: bump version and install new share files

- bump version to 2.0.0-FreeBSD_gbf156c966
- install definition files for the new "-o compatibility" option
  to "zpool create"

MFC after: 2 weeks

(cherry picked from commit 10f57cb98fd61b2669640a84aa73ad118601f281)

3 years agozfs: merge OpenZFS master-bf156c966
Martin Matuska [Thu, 18 Feb 2021 14:17:31 +0000 (15:17 +0100)]
zfs: merge OpenZFS master-bf156c966

Notable upstream changes:
    bf156c966 Remove unused abd_alloc_scatter_offset_chunkcnt
    658fb8020 Add "compatibility" property for zpool feature sets

This update introduces a new pool property called "compatibility"
that can be used to enable a limited set of pool features on pool
creation and "stick" to it, so the "zpool upgrade" does not
accidentally enable features that are not desired. The value of
this property may then be changed later.

See zpool-features(5) for more information about the "compatibility"
pool property.

Obtained from: OpenZFS

(cherry picked from commit ee36e25a86cbe2a9474c1d61f2c4b450da8ef952)

3 years agozfs: change file mode of all merged tests
Martin Matuska [Tue, 16 Feb 2021 11:23:43 +0000 (12:23 +0100)]
zfs: change file mode of all merged tests

If the ksh files are not executable then the tests are not run
and reported as failed.

(cherry picked from commit afcb3c4cb49f1ba9690d066c3dc1af9c7bee1ea3)

3 years agozfs: merge OpenZFS master-436ab35a5
Martin Matuska [Tue, 16 Feb 2021 00:39:34 +0000 (01:39 +0100)]
zfs: merge OpenZFS master-436ab35a5

- speed up writing to ZFS pools without ZIL devices (aa755b3)
- speed up importing ZFS pools (2d8f72da0e0199cf0977a)
...

Reviewed by: mjg (partial)
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D28677

(cherry picked from commit 184c1b943937986c81e1996d999d21626ec7a4ff)

3 years agoice(4): Update to version 0.28.1-k
Eric Joyner [Tue, 23 Feb 2021 01:45:09 +0000 (17:45 -0800)]
ice(4): Update to version 0.28.1-k

This updates the driver to align with the version included in
the "Intel Ethernet Adapter Complete Driver Pack", version 25.6.

There are no major functional changes; this mostly contains
bug fixes and changes to prepare for new features. This version
of the driver uses the previously committed ice_ddp package
1.3.19.0.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Tested by: jeffrey.e.pieper@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D28640

(cherry picked from commit d08b8680e12ad692736c84238dcf45c70c228914)

3 years agoice_ddp: Update package file to 1.3.19.0
Eric Joyner [Tue, 23 Feb 2021 01:43:54 +0000 (17:43 -0800)]
ice_ddp: Update package file to 1.3.19.0

This package is intended to be used with ice(4) version 0.28.1-k.
That update will happen in a forthcoming commit.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Sponsored by: Intel Corporation

(cherry picked from commit a7ac518bff64d48cf262c60c4dc57eef34e74a07)

3 years ago[PowerPC64] add mpr to GENERIC64 and GENERIC64LE
Alfredo Dal'Ava Junior [Tue, 2 Mar 2021 14:05:37 +0000 (11:05 -0300)]
[PowerPC64] add mpr to GENERIC64 and GENERIC64LE

Submitted by: Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by: luporl, alfredo, Sreekanth Reddy <sreekanth.reddy@broadcom.com> (by email)
Sponsored by: Eldorado Research Institute (eldorado.org.br)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25785

(cherry picked from commit 231633a2e9000d67b09f132ee26951a4621c778a)

3 years agompr: big-endian support
Alfredo Dal'Ava Junior [Tue, 2 Mar 2021 14:05:15 +0000 (11:05 -0300)]
mpr: big-endian support

This fixes mpr driver on big-endian devices.
Tested on powerpc64 and powerpc64le targets using a SAS9300-8i card
(LSISAS3008 pci vendor=0x1000 device=0x0097)

Submitted by: Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by: luporl, alfredo, Sreekanth Reddy <sreekanth.reddy@broadcom.com> (by email)
Sponsored by: Eldorado Research Institute (eldorado.org.br)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25785

(cherry picked from commit 71900a794da046ad5322caae2774aed5b3d361b9)

3 years agoAdd a few missed files to libclang_rt.profile-<arch>.a
Dimitry Andric [Fri, 5 Mar 2021 20:06:05 +0000 (21:06 +0100)]
Add a few missed files to libclang_rt.profile-<arch>.a

Otherwise, programs compiled with -fprofile-instr-generate will
encounter undefined symbol errors during linking, for example
__llvm_profile_counter_bias, lprofSetRuntimeCounterRelocation and a few
others were missing from the profile library.

Reported by: ota@j.email.ne.jp
PR: 254001

(cherry picked from commit 772c631af81abdb6d498d972bab79d04d3db16d0)

3 years agoBuild lib/msun tests with compiler builtins disabled
Dimitry Andric [Tue, 23 Feb 2021 20:03:32 +0000 (21:03 +0100)]
Build lib/msun tests with compiler builtins disabled

This forces the compiler to emit calls to libm functions, instead of
possibly substituting pre-calculated results at compile time, which
should help to actually test those functions.

Reviewed by: emaste, arichardson, ngie
Differential Revision: https://reviews.freebsd.org/D28577

(cherry picked from commit cf97d2a1dab8f2cddc4466fe64d37818339c73be)

riscv: Add a soft-float implementation of fabs()

We could just use a C implementation using __builtin_fabs(), but using
this assembly version guarantees that there is no additional prolog/epilog
code. Additionally, clang generates worse code for masking off the top bit
than GCC: https://bugs.llvm.org/show_bug.cgi?id=49377.

This fixes the RISCV64 softfloat world build after cf97d2a1dab8. That commit
added -fno-builtin to the msun tests which resulted in the first references to
fabs (previously the compiler inlined all calls).

Reviewed By: dim
Reported by: mjg
Differential Revision: https://reviews.freebsd.org/D28994

(cherry picked from commit 524b018d200408bed5eb0d2b892db5b9fb46808b)

riscv: Fix whitespace issues in fabs added in 524b018d2004

(cherry picked from commit 066dab17e7a4a78d43dbcef8119960ddc8090a73)

3 years agoclang: Fix -gz=zlib options for linker
Ed Maste [Wed, 3 Mar 2021 01:35:57 +0000 (20:35 -0500)]
clang: Fix -gz=zlib options for linker

Clang commit ccb4124a4172bf2cb2e1cd7c253f0f1654fce294:

Fix -gz=zlib options for linker

gcc translates -gz=zlib to --compress-debug-options=zlib for both
assembler and linker but clang only does this for assembler.

The linker needs --compress-debug-options=zlib option to compress the
debug sections in the generated executable or shared library.

Due to this bug, -gz=zlib has no effect on the generated executable or
shared library.

This patch fixes that.

Clang commit 462cf39a5c180621b56f7602270ce33eb7b68d23:

[Driver] Fix -gz=zlib options for linker also on FreeBSD

ccb4124a4172 fixed translating -gz=zlib to --compress-debug-sections for
linker invocation for several ToolChains, but omitted FreeBSD.

PR: 253942
Approved by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29028

(cherry picked from commit 19587d742264c5caec33d218e9cea6eb78f6c6bb)

3 years agoMount the EFI system partition (ESP) on newly-installed systems and VM
Nathan Whitehorn [Tue, 23 Feb 2021 21:16:52 +0000 (16:16 -0500)]
Mount the EFI system partition (ESP) on newly-installed systems and VM
images.

Per hier(7), the ESP will be mounted at /boot/efi. On UFS systems,
any existing ESP will be reused and mounted there; otherwise, a new one
will be made. On ZFS systems, space for an ESP is allocated on all disks
in the root pool, but only the partition actually used to boot is set up
and mounted.

This makes future upgrades of the EFI loader easier (upgrade scripts can
just change /boot/efi) and also greatly simplifies the parts of the
installer involved in initialization of the ESP. It also makes the
installer's behavior correspond to the documentation in hier(7).

Reviewed by: imp, tsoome, bdragon
Approved by: re (gjb)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D28897

(cherry picked from commit 0b7472b3d8d2f1e90fade5236b44fd98d8e396c2)
(cherry picked from commit 2c26d77d989abe48c662eeb6f52f7e4c9b81680c)
(cherry picked from commit e77cf2a4ab32a381df3c06d25b8b4f650047c3f2)
(cherry picked from commit e70eb40271512dfbca7cecf823e4b445e3989c2e)

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)