]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoUpdate OpenZFS to 2.0.0-rc3-gfc5966
Matt Macy [Sat, 17 Oct 2020 01:06:04 +0000 (01:06 +0000)]
Update OpenZFS to 2.0.0-rc3-gfc5966

- fix panic due to tqid overflow
- Improve libzfs_error_init messages
- Expose zfetch_max_idistance tunable
- Make dbufstat work on FreeBSD
- Fix EIO after resuming receive of new dataset over an existing one

3 years agoImport tzdata 2020c
Philip Paeps [Sat, 17 Oct 2020 00:44:04 +0000 (00:44 +0000)]
Import tzdata 2020c

Changes: https://github.com/eggert/tz/blob/2020c/NEWS

MFC after: 1 day

3 years agoImport tzdata 2020c
Philip Paeps [Sat, 17 Oct 2020 00:41:14 +0000 (00:41 +0000)]
Import tzdata 2020c

3 years agocache: add a probe reporting addition of duplicate entries
Mateusz Guzik [Sat, 17 Oct 2020 00:27:26 +0000 (00:27 +0000)]
cache: add a probe reporting addition of duplicate entries

3 years agoUpdate OpenZFS to 2.0.0-rc3-gbd565f
Matt Macy [Sat, 17 Oct 2020 00:05:34 +0000 (00:05 +0000)]
Update OpenZFS to 2.0.0-rc3-gbd565f

3 years agoTry to enable multipath routing in flowid tests.
Alexander V. Chernikov [Fri, 16 Oct 2020 21:51:17 +0000 (21:51 +0000)]
Try to enable multipath routing in flowid tests.

3 years agobhyve: Update TX descriptor base address and host mapping on change
Ryan Moeller [Fri, 16 Oct 2020 20:27:20 +0000 (20:27 +0000)]
bhyve: Update TX descriptor base address and host mapping on change

bhyve sometimes segfaults when using an e1000 NIC with a Windows guest.

We are only updating our tdba and cached host mapping when the low address
register is written and when tx is set enabled, but not when the high address
or length registers are written. It is observed that Windows 10 is occasionally
enabling tx first then writing the registers in the order low, high, len. This
leaves us with a bogus base address and mapping, which causes a segfault later
when we try to copy from a descriptor that has unpredictable garbage in a
pointer.

Updating the address and mapping when any of those registers change seems to fix
that particular issue.

Reviewed by: mav, grehan (bhyve)
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D26798

3 years agolibc: typo fix (s/involes/involves)
Kyle Evans [Fri, 16 Oct 2020 17:51:09 +0000 (17:51 +0000)]
libc: typo fix (s/involes/involves)

Reported by: Masahiko Sawada via twitter
MFC after: 3 days

3 years agoMFC r366760: lua: update to 5.3.6
Kyle Evans [Fri, 16 Oct 2020 17:03:27 +0000 (17:03 +0000)]
MFC r366760: lua: update to 5.3.6

This release contains some minor bugfixes; notably:
- 2x minor Makefile fixes (not used in base)
- Long brackets with a huge number of '=' overflow some internal buffer
  arithmetic.
- Joining an upvalue with itself can cause a use-after-free crash.

See here for examples: http://www.lua.org/bugs.html#5.3.5

MFC after: 2 weeks

3 years agoamd64 pmap.h: explicitly provide constants values instead of relying
Konstantin Belousov [Fri, 16 Oct 2020 16:22:32 +0000 (16:22 +0000)]
amd64 pmap.h: explicitly provide constants values instead of relying
on some more advanced C features.

This fixes gcc-toolchain build of exception.S.

Reported and tested by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoUpdate arcmsr(4) to 1.50.00.00:
Xin LI [Fri, 16 Oct 2020 15:55:06 +0000 (15:55 +0000)]
Update arcmsr(4) to 1.50.00.00:

Add support for ARC-1886, NVMe/SAS/SATA controller.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by:   黃清隆 <ching2048 areca com tw>
MFC after:      2 weeks

3 years agoMakefile: add a small blurb about building with gcc xtoolchain
Kyle Evans [Fri, 16 Oct 2020 15:16:23 +0000 (15:16 +0000)]
Makefile: add a small blurb about building with gcc xtoolchain

The key details are to install the appropriate flavor of devel/freebsd-gcc9
and pass CROSS_TOOLCHAIN while building.

Suggested by: kib

3 years ago This fixes some fun type size truncation that shows up giving errors like
Adrian Chadd [Fri, 16 Oct 2020 14:28:13 +0000 (14:28 +0000)]
 This fixes some fun type size truncation that shows up giving errors like
" changes value from '287948901175001088' to '0' "

.. which turns out is a known issue with later gcc's.

eg - https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00154.html

It was fixed up upstream corelib/gnulib in commit hash
252b52457da7887667c036d18cc5169777615bb0
(eg in https://github.com/coreutils/gnulib/commit/252b52457da7887667c036d18cc5169777615bb0)

TEST PLAN
  - compiled/run for gcc-6.4 on amd64

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D26804

3 years agoarm64: export a few more HWCAPs
Mitchell Horne [Fri, 16 Oct 2020 13:37:58 +0000 (13:37 +0000)]
arm64: export a few more HWCAPs

These were missed in the previous pass. The extensions (partially)
supported by this change are:
 - ARMv8.2-FHM, Floating-point multiplication variant
 - ARMv8.4-LSE, Large System Extensions
 - ARMv8.4-DIT, Data Independent Timing instructions

Reviewed by: andrew, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26707

3 years agoUpdate the ID_AA64MMFR2_EL1 register definitions
Mitchell Horne [Fri, 16 Oct 2020 13:35:29 +0000 (13:35 +0000)]
Update the ID_AA64MMFR2_EL1 register definitions

This brings these definitions in sync with the ARMv8.6 version of the
architecture reference manual.

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

3 years agolua: update to 5.3.6
Kyle Evans [Fri, 16 Oct 2020 13:04:28 +0000 (13:04 +0000)]
lua: update to 5.3.6

This release contains some minor bugfixes; notably:
- 2x minor Makefile fixes (not used in base)
- Long brackets with a huge number of '=' overflow some internal buffer
  arithmetic.
- Joining an upvalue with itself can cause a use-after-free crash.

See here for examples: http://www.lua.org/bugs.html#5.3.5

3 years agoTrigger soft lifetime expiration on sequence number
Marcin Wojtas [Fri, 16 Oct 2020 11:27:01 +0000 (11:27 +0000)]
Trigger soft lifetime expiration on sequence number

This patch adds 80% of UINT32_MAX limit on sequence number.
When sequence number reaches limit kernel sends SADB_EXPIRE message to
IKE daemon which is responsible to perform rekeying.

Submitted by:           Patryk Duda <pdk@semihalf.com>
Reviewed by:            ae
Differential revision:  https://reviews.freebsd.org/D22370
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoAdd support for IPsec ESN and pass relevant information to crypto layer
Marcin Wojtas [Fri, 16 Oct 2020 11:25:45 +0000 (11:25 +0000)]
Add support for IPsec ESN and pass relevant information to crypto layer

Implement support for including IPsec ESN (Extended Sequence Number) to
both encrypt and authenticate mode (eg. AES-CBC and SHA256) and combined
mode (eg. AES-GCM). Both ESP and AH protocols are updated. Additionally
pass relevant information about ESN to crypto layer.

For the ETA mode the ESN is stored in separate crp_esn buffer because
the high-order 32 bits of the sequence number are appended after the
Next Header (RFC 4303).

For the AEAD modes the high-order 32 bits of the sequence number
[e.g.  RFC 4106, Chapter 5 AAD Construction] are included as part of
crp_aad (SPI + ESN (32 high order bits) + Seq nr (32 low order bits)).

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb, gnn
Differential revision:  https://reviews.freebsd.org/D22369
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoImplement anti-replay algorithm with ESN support
Marcin Wojtas [Fri, 16 Oct 2020 11:24:12 +0000 (11:24 +0000)]
Implement anti-replay algorithm with ESN support

As RFC 4304 describes there is anti-replay algorithm responsibility
to provide appropriate value of Extended Sequence Number.

This patch introduces anti-replay algorithm with ESN support based on
RFC 4304, however to avoid performance regressions window implementation
was based on RFC 6479, which was already implemented in FreeBSD.

To keep things clean and improve code readability, implementation of window
is kept in seperate functions.

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb
Differential revision:  https://reviews.freebsd.org/D22367
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoSet default stack size for Linux apps to 8MB. This matches Linux'
Edward Tomasz Napierala [Fri, 16 Oct 2020 11:23:30 +0000 (11:23 +0000)]
Set default stack size for Linux apps to 8MB.  This matches Linux'
defaults, makes core files smaller, and fixes applications which use
pthread_join(3) in a wrong way, namely Steam.

This is based on a patch submitted by Jason Yang, which I've reworked
to set the limit instead of only changing the value reported (which
is enough to fix the bug for Linux pthreads, but could be confusing).

PR: 248225
Submitted by: Jason_YH_Yang at wistron.com (earlier version)
Analyzed by: Alex S <iwtcex@gmail.com>
Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26778

3 years agoAdd SADB_SAFLAGS_ESN flag
Marcin Wojtas [Fri, 16 Oct 2020 11:22:29 +0000 (11:22 +0000)]
Add SADB_SAFLAGS_ESN flag

This flag is going to be used by IKE daemon to signal if
Extended Sequence Number feature is going to be used.

Value for this flag was taken from OpenBSD source code
https://github.com/openbsd/src/commit/6b4cbaf181c6b60701d9fb888fd0e7a4333eecbd

Submitted by:           Patryk Duda <pdk@semihalf.com>
Reviewed by:            ae
Differential revision:  https://reviews.freebsd.org/D22366
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoAdd support for ESN in AES-NI crypto driver
Marcin Wojtas [Fri, 16 Oct 2020 11:21:56 +0000 (11:21 +0000)]
Add support for ESN in AES-NI crypto driver

This patch adds support for IPsec ESN (Extended Sequence Numbers) in
encrypt and authenticate mode (eg. AES-CBC and SHA256) and combined mode
(eg. AES-GCM).

For the encrypt and authenticate mode the ESN is stored in separate
crp_esn buffer because the high-order 32 bits of the sequence number are
appended after the Next Header (RFC 4303).

For the combined modes the high-order 32 bits of the sequence number
[e.g.  RFC 4106, Chapter 5 AAD Construction] are part of crp_aad
(prepared by netipsec layer in case of ESN support enabled), therefore
non visible diff around combined modes.

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb
Differential revision:  https://reviews.freebsd.org/D22365
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoAdd support for ESN in cryptosoft
Marcin Wojtas [Fri, 16 Oct 2020 11:18:13 +0000 (11:18 +0000)]
Add support for ESN in cryptosoft

This patch adds support for IPsec ESN (Extended Sequence Numbers) in
encrypt and authenticate mode (eg. AES-CBC and SHA256) and combined mode
(eg. AES-GCM).

For encrypt and authenticate mode the ESN is stored in separate crp_esn
buffer because the high-order 32 bits of the sequence number are
appended after the Next Header (RFC 4303).

For combined modes the high-order 32 bits of the sequence number [e.g.
RFC 4106, Chapter 5 AAD Construction] are part of crp_aad (prepared by
netipsec layer in case of ESN support enabled), therefore non visible
diff around combined modes.

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb
Differential revision:  https://reviews.freebsd.org/D22364
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoPrepare crypto framework for IPsec ESN support
Marcin Wojtas [Fri, 16 Oct 2020 11:06:33 +0000 (11:06 +0000)]
Prepare crypto framework for IPsec ESN support

This permits requests (netipsec ESP and AH protocol) to provide the
IPsec ESN (Extended Sequence Numbers) in a separate buffer.

As with separate output buffer and separate AAD buffer not all drivers
support this feature. Consumer must request use of this feature via new
session flag.

Submitted by:           Grzegorz Jaszczyk <jaz@semihalf.com>
                        Patryk Duda <pdk@semihalf.com>
Reviewed by:            jhb
Differential revision:  https://reviews.freebsd.org/D24838
Obtained from:          Semihalf
Sponsored by:           Stormshield

3 years agoRemove ifdefs around IS_ALIGNED() definition in the LinuxKPI.
Hans Petter Selasky [Fri, 16 Oct 2020 11:01:21 +0000 (11:01 +0000)]
Remove ifdefs around IS_ALIGNED() definition in the LinuxKPI.

Discussed with: manu@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoImprove the handling of cookie life times.
Michael Tuexen [Fri, 16 Oct 2020 10:44:48 +0000 (10:44 +0000)]
Improve the handling of cookie life times.
The staleness reported in an error cause is in us, not ms.
Enforce limits on the life time via sysct; and socket options
consistently. Update the description of the sysctl variable to
use the right unit. Also do some minor cleanups.
This also fixes an interger overflow issue if the peer can
modify the cookie. This was reported by Felix Weinrank by fuzz testing
the userland stack and in
https://oss-fuzz.com/testcase-detail/4800394024452096

MFC after: 3 days

3 years agoMake linux getrlimit(2) and prlimit(2) return something reasonable
Edward Tomasz Napierala [Fri, 16 Oct 2020 10:10:09 +0000 (10:10 +0000)]
Make linux getrlimit(2) and prlimit(2) return something reasonable
for linux-specific limits.  Fixes prlimit (util-linux-2.31.1-0.4ubuntu3.7).

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26777

3 years agoBump pseudofs size limit from 128kB to 1MB. The old limit could result
Edward Tomasz Napierala [Fri, 16 Oct 2020 09:58:10 +0000 (09:58 +0000)]
Bump pseudofs size limit from 128kB to 1MB.  The old limit could result
in process' memory maps being truncated.

PR: 237883
Submitted by: dchagin
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20575

3 years agocache: flip inverted condition in previous
Mateusz Guzik [Fri, 16 Oct 2020 02:19:33 +0000 (02:19 +0000)]
cache: flip inverted condition in previous

It happened to not affect correctness in that the fallback code would
simply neglect to promote the entry.

3 years agocache: support negative entry promotion in slowpath smr
Mateusz Guzik [Fri, 16 Oct 2020 00:56:13 +0000 (00:56 +0000)]
cache: support negative entry promotion in slowpath smr

3 years agocache: elide vhold/vdrop around promoting negative entry
Mateusz Guzik [Fri, 16 Oct 2020 00:55:57 +0000 (00:55 +0000)]
cache: elide vhold/vdrop around promoting negative entry

3 years agocache: dedup code for negative promotion
Mateusz Guzik [Fri, 16 Oct 2020 00:55:31 +0000 (00:55 +0000)]
cache: dedup code for negative promotion

3 years agocache: neglist -> nl; negstate -> ns
Mateusz Guzik [Fri, 16 Oct 2020 00:55:09 +0000 (00:55 +0000)]
cache: neglist -> nl; negstate -> ns

No functional changes.

3 years agoBump the ISO EFI partition size from 1024 to 2048, following r366732.
Glen Barber [Thu, 15 Oct 2020 23:05:13 +0000 (23:05 +0000)]
Bump the ISO EFI partition size from 1024 to 2048, following r366732.

Suggested by: imp
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoSimplify preload_dump() condition
Mitchell Horne [Thu, 15 Oct 2020 20:21:15 +0000 (20:21 +0000)]
Simplify preload_dump() condition

Hiding this feature behind RB_VERBOSE is gratuitous. The tunable is enough
to limit its use to only those who explicitly request it.

Suggested by: kevans

3 years agokldxref: Avoid buffer overflows in parse_pnp_list
Jessica Clarke [Thu, 15 Oct 2020 18:03:14 +0000 (18:03 +0000)]
kldxref: Avoid buffer overflows in parse_pnp_list

We convert a string like "W32:vendor/device" into "I:vendor;I:device",
where the output is longer than the input, but only allocate space equal
to the length of the input, leading to a buffer overflow.

Instead use open_memstream so we get a safe dynamically-grown buffer.

Found by: CHERI
Reviewed by: imp, jhb (mentor)
Approved by: imp, jhb (mentor)
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D26637

3 years agocache: split hotlist between existing negative lists
Mateusz Guzik [Thu, 15 Oct 2020 17:44:17 +0000 (17:44 +0000)]
cache: split hotlist between existing negative lists

This simplifies the code while allowing for concurrent negative eviction
down the road.

Cache misses increased slightly due to higher rate of evictions allowed by
the change.

The current algorithm remains too aggressive.

3 years agocache: make neglist an array given the static size
Mateusz Guzik [Thu, 15 Oct 2020 17:42:22 +0000 (17:42 +0000)]
cache: make neglist an array given the static size

3 years agoDrop unsolicited responses to the still attaching CODECs.
Alexander Motin [Thu, 15 Oct 2020 17:40:02 +0000 (17:40 +0000)]
Drop unsolicited responses to the still attaching CODECs.

It is reported to fix kernel panics when early unsolicited responses
delivered to the CODEC device not having driver attached yet.

PR: 250248
Reported by: Rajeev Pillai <rajeev_v_pillai@yahoo.com>
Reviewed by: avg
MFC after: 2 weeks

3 years agoIncrease the amd64 ISO ESP file size from 800KB to 1024KB.
Glen Barber [Thu, 15 Oct 2020 17:12:58 +0000 (17:12 +0000)]
Increase the amd64 ISO ESP file size from 800KB to 1024KB.

At some poing over the last week, the bootx64.efi file has grown
past the 800KB threshold, resulting in being unable to copy it to
the EFI/BOOT directory.

 # stat -f %z efiboot.znWo7m
 819200
 # stat -f %z stand-test.PIEugN/EFI/BOOT/bootx64.efi
 842752

The comment in the script that creates the ISOs suggests that 800KB
is the maximum allowed for the boot code, however I was able to
boot an ISO with a 1024KB boot partition.  Additionally, I verified
against an ISO from OtherOS, where the boot EFI partition is 2.4MB.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agophysio: Don't store user addresses in bio_data
Brooks Davis [Thu, 15 Oct 2020 17:05:21 +0000 (17:05 +0000)]
physio: Don't store user addresses in bio_data

Only assign the address from the iovec to bio_data if it is a kernel
address.  This was the single place where bio_data stored (however
briefly) a userspace pointer.

Reviewed by: imp, markj
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26783

3 years agoFix nvmecontrol logpage -i parameter.
Alexander Motin [Thu, 15 Oct 2020 15:36:08 +0000 (15:36 +0000)]
Fix nvmecontrol logpage -i parameter.

MFC after: 3 days

3 years ago[pfctl_tests] Add missing void to empty function declaration
Adrian Chadd [Thu, 15 Oct 2020 14:56:51 +0000 (14:56 +0000)]
[pfctl_tests] Add missing void to empty function declaration

Our gcc-6.4 flags require non-empty function declarations.
Fix this to match the rest of the codebase.

Tested:

* compiled on gcc-6.4 for amd64

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D26795

3 years ago[tests] Fix itimer test warning-errors on gcc-6.4
Adrian Chadd [Thu, 15 Oct 2020 14:55:07 +0000 (14:55 +0000)]
[tests] Fix itimer test warning-errors on gcc-6.4

This fixes a "suggested parens" compile warning-into-error
that shows up on gcc-6.4.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D26789

3 years agomove vmware pv drivers to sys/conf/files
Ed Maste [Thu, 15 Oct 2020 14:37:51 +0000 (14:37 +0000)]
move vmware pv drivers to sys/conf/files

VMware now has arm64 support; move these to MI files in advance of
building them on arm64.

PR: 250308
Reported by: Vincent Milum Jr
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoFix formatting of SYNOPSIS
Mateusz Piotrowski [Thu, 15 Oct 2020 14:17:45 +0000 (14:17 +0000)]
Fix formatting of SYNOPSIS

There was an unnecessary newline being added before Nm.

MFC after: 3 days

3 years agoSplit-out Guest Address Space (GAS) macroses to a separate header.
Ruslan Bukin [Thu, 15 Oct 2020 13:47:52 +0000 (13:47 +0000)]
Split-out Guest Address Space (GAS) macroses to a separate header.

Sponsored by: Innovate DSbD

3 years agoProvide a slightly more-tolerant set of thermal parameters for PowerMac
Nathan Whitehorn [Thu, 15 Oct 2020 13:43:43 +0000 (13:43 +0000)]
Provide a slightly more-tolerant set of thermal parameters for PowerMac
motherboard temperatures. In particular, the U4 northbridge die is very
hard to cool or heat effectively with fans and is not responsive to load.
It generally sits around 64C, where it seems happy, so (like Linux) just
declare that to be its target temperature.

This makes the PowerMac G5 much less loud, with no change in the
temperatures of any system components.

MFC after: 2 weeks

3 years agoWith some popular multiplayer games (such as Counter-Strike: Global
Edward Tomasz Napierala [Thu, 15 Oct 2020 12:48:30 +0000 (12:48 +0000)]
With some popular multiplayer games (such as Counter-Strike: Global
Offensive) the Linux Steam client likes to occasionally scan the game
process memory, presumably as part anti-cheat measures. Turns out
the client also expects each inode entry to be followed by a space
character, otherwise the parsing code crashes.

PR: 248216
Submitted by: Alex S <iwtcex@gmail.com>
MFC after: 2 weeks

3 years agoHyper-V: hn: Relinquish cpu in HN_LOCK to avoid deadlock
Wei Hu [Thu, 15 Oct 2020 11:44:28 +0000 (11:44 +0000)]
Hyper-V: hn: Relinquish cpu in HN_LOCK to avoid deadlock

The try lock loop in HN_LOCK put the thread spinning on cpu if the lock
is not available. It is possible to cause deadlock if the thread holding
the lock is sleeping. Relinquish the cpu to work around this problem even
it doesn't completely solve the issue. The priority inversion could cause
the livelock no matter how less likely it could happen. A more complete
solution may be needed in the future.

Reported by: Microsoft, Netapp
MFC after: 2 weeks
Sponsored by: Microsoft

3 years agoHyper-V: pcib: Check revoke status during device attach
Wei Hu [Thu, 15 Oct 2020 05:57:20 +0000 (05:57 +0000)]
Hyper-V: pcib: Check revoke status during device attach

It is possible that the vmbus pcib channel is revoked during attach path.
The attach path could be waiting for response from host and this response will never
arrive since the channel has already been revoked from host point of view. Check
this situation during wait complete and return failed if this happens.

Reported by: Netapp
MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D26486

3 years agoBump __FreeBSD_version after addition of VOP_EAGAIN
Mateusz Guzik [Thu, 15 Oct 2020 05:11:16 +0000 (05:11 +0000)]
Bump __FreeBSD_version after addition of VOP_EAGAIN

3 years agozfs: g/c unused vop_vector zfsctl_ops_shares_dir
Mateusz Guzik [Thu, 15 Oct 2020 05:04:57 +0000 (05:04 +0000)]
zfs: g/c unused vop_vector zfsctl_ops_shares_dir

3 years agozfs: add missing fplookup vops
Mateusz Guzik [Thu, 15 Oct 2020 04:49:34 +0000 (04:49 +0000)]
zfs: add missing fplookup vops

Some vnodes come with a hack which inherits the fplookup flag despite having vops
which don't provide the routine.

Reported by: YAMAMOTO Shigeru <shigeru@os-hackers.jp>

3 years agovfs: add VOP_EAGAIN
Mateusz Guzik [Thu, 15 Oct 2020 04:48:14 +0000 (04:48 +0000)]
vfs: add VOP_EAGAIN

Can be used to stub fplookup for example.

3 years agoarm64: Increase NIRQ to 16k
D Scott Phillips [Thu, 15 Oct 2020 03:12:00 +0000 (03:12 +0000)]
arm64: Increase NIRQ to 16k

Ampere Altra in a dual socket configuration has 12 ITSes for the
12 PCIe root complexes. The NIRQ interrupts are statically split
between each child of the gic bus, so here we increase that
value. 16k is enough for

  (#cpus * #its * max_pcie_bifurcation) LPIs + (#SPIs and #PPIs)

Reviewed by: jhb
Approved by: scottl (implicit)
MFC after: 1 week
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D26766

3 years agoFix for mis-interpretation of PCB_KERNFPU.
Konstantin Belousov [Wed, 14 Oct 2020 23:01:41 +0000 (23:01 +0000)]
Fix for mis-interpretation of PCB_KERNFPU.

RIght now PCB_KERNFPU is used both as indication that kernel prepared
hardware FPU context to use and that the thread is fpu-kern
thread.  This also breaks fpu_kern_enter(FPU_KERN_NOCTX), since
fpu_kern_leave() then clears PCB_KERNFPU.

Introduce new flag PCB_KERNFPU_THR which indicates that the thread is
fpu-kern.  Do not clear PCB_KERNFPU if fpu-kern thread leaves noctx
fpu region.

Reported and tested by: jhb (amd64)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25511

3 years agoLimit workaround for errata E400 to appropriate AMD cpus.
Konstantin Belousov [Wed, 14 Oct 2020 22:57:50 +0000 (22:57 +0000)]
Limit workaround for errata E400 to appropriate AMD cpus.

From Linux sources and several datasheets I looked at, it seems that
the workaround is only needed on families 0xf and 0x10.  For instance,
Ryzens do not implement the accessed MSR at all, it is documented as
reserved.  Also, hypervisors should not allow guest to put CPU into
idle state, so activate workaround only when on bare hardware.

While there, style the code:
    move MSR defines to specialreg.h
    move identification to initcpu.c

Reported by: whu
Reviewed by: avg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26470

3 years agoAvoid dump_avail[] redefinition.
Konstantin Belousov [Wed, 14 Oct 2020 22:51:40 +0000 (22:51 +0000)]
Avoid dump_avail[] redefinition.

Move dump_avail[] extern declaration and inlines into a new header
vm/vm_dumpset.h.  This fixes default gcc build for mips.

Reviewed by: alc, scottph
Tested by: kevans (previous version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26741

3 years agoSplit-out iommu type definitions to a separate header.
Ruslan Bukin [Wed, 14 Oct 2020 21:22:23 +0000 (21:22 +0000)]
Split-out iommu type definitions to a separate header.

Reviewed by: kib
Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D26780

3 years ago[skein] Fix compile issue with unknown symbol SKEIN_ASM_UNROLL1024
Adrian Chadd [Wed, 14 Oct 2020 20:55:31 +0000 (20:55 +0000)]
[skein] Fix compile issue with unknown symbol SKEIN_ASM_UNROLL1024

Weirdly, I needed to sprinkle more parens here to get gcc-as in 6.4
to correctly generate things.

Without them, I'd get an unknown variable reference to SKEIN_ASM_UNROLL1024.

This at least links now, but I haven't run any test cases against it.
It may be worthwhile doing it in case gcc-as demands we liberally sprinkle
more brackets around variables in .if statements.

Thanks to ed for the suggestion of just sprinkling more brackets to
see if that helped.

Reviewed by: emaste

3 years agoRewrite pfctl_test in C to reduce testsuite run time
Alex Richardson [Wed, 14 Oct 2020 17:39:50 +0000 (17:39 +0000)]
Rewrite pfctl_test in C to reduce testsuite run time

The new C test takes 25 seconds on QEMU-RISC-V, wheras the shell version
takes 332 seconds.

Even with the latest optimizations to atf-sh this test still takes a few
seconds to startup in QEMU. Re-writing it in C reduces the runtime for a
single test from about 2-3 seconds to less than .5 seconds. Since there
are ~80 tests, this adds up to about 3-4 minutes.
This may not seem like a big speedup, but before the recent optimizations
to avoid atf_get_srcdir, each test took almost 100 seconds on QEMU RISC-V
instead of 3. This also significantly reduces the time it takes to list
the available test cases, which speeds up running the tests via kyua:

```
root@qemu-riscv64-alex:~ # /usr/bin/time kyua test -k /usr/tests/sbin/pfctl/Kyuafile pfctl_test_old
...
158/158 passed (0 failed)
      332.08 real        42.58 user       286.17 sys
root@qemu-riscv64-alex:~ # /usr/bin/time kyua test -k /usr/tests/sbin/pfctl/Kyuafile pfctl_test
158/158 passed (0 failed)
       24.96 real         9.75 user        14.26 sys

root@qemu-riscv64-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test pf1001
pfctl_test: WARNING: Running test cases outside of kyua(1) is unsupported
pfctl_test: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Running pfctl -o none -nvf /usr/tests/sbin/pfctl/./files/pf1001.in
---
binat on em0 inet6 from fc00::/64 to any -> fc00:0:0:1::/64
binat on em0 inet6 from any to fc00:0:0:1::/64 -> fc00::/64
---
passed
        0.17 real         0.06 user         0.08 sys
root@qemu-riscv64-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test_old pf1001
pfctl_test_old: WARNING: Running test cases outside of kyua(1) is unsupported
pfctl_test_old: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Id  Refs Name
141    1 pf
Executing command [ pfctl -o none -nvf - ]
passed
        1.73 real         0.25 user         1.41 sys
root@qemu-riscv64-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test_old -l > /dev/null
       24.36 real         2.26 user        21.86 sys
root@qemu-riscv64-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test -l > /dev/null
        0.04 real         0.02 user         0.01 sys
```

The speedups are even more noticeable on CHERI-RISC-V (since QEMU runs
slower when emulating CHERI instructions):
```
root@qemu-cheri-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test_new -l > /dev/null
        0.51 real         0.49 user         0.00 sys
root@qemu-cheri-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test -l > /dev/null
       34.20 real        32.69 user         0.16 sys
root@qemu-cheri-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test pf1001
pfctl_test: WARNING: Running test cases outside of kyua(1) is unsupported
pfctl_test: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Id  Refs Name
147    1 pf
Executing command [ pfctl -o none -nvf - ]
passed
        5.74 real         5.41 user         0.03 sys
root@qemu-cheri-alex:/usr/tests/sbin/pfctl # /usr/bin/time ./pfctl_test_new pf1001
pfctl_test_new: WARNING: Running test cases outside of kyua(1) is unsupported
pfctl_test_new: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
Running pfctl -o none -nvf /usr/tests/sbin/pfctl/./files/pf1001.in
---
binat on em0 inet6 from fc00::/64 to any -> fc00:0:0:1::/64
binat on em0 inet6 from any to fc00:0:0:1::/64 -> fc00::/64
---
passed
        0.68 real         0.66 user         0.00 sys
root@qemu-cheri-alex:/usr/tests/sbin/pfctl #
```

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

3 years agoUse RTD3 Entry Latency value as shutdown timeout.
Alexander Motin [Wed, 14 Oct 2020 15:50:28 +0000 (15:50 +0000)]
Use RTD3 Entry Latency value as shutdown timeout.

This field was not in specs when the driver was written, but now there
are SSDs with the reported latency of 10s, where hardcoded value of 5s
seems to be not enough sometimes, causing shutdown timeout messages.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

3 years agoRemove direct user access from the arm64 copyinstr
Andrew Turner [Wed, 14 Oct 2020 15:31:42 +0000 (15:31 +0000)]
Remove direct user access from the arm64 copyinstr

These already use the load variant that simulates userspace access.
Remove the macros that enable normal loads and stores from userspace
as they are unneeded.

Sponsored by: Innovate UK

3 years agoAdd a per-each macro IOMMU_DOMAIN_UNLOAD_SLEEP which allows to sleep
Ruslan Bukin [Wed, 14 Oct 2020 14:51:11 +0000 (14:51 +0000)]
Add a per-each macro IOMMU_DOMAIN_UNLOAD_SLEEP which allows to sleep
during iommu guest address space entries unload.

Suggested by: kib
Sponsored by: Innovate DSbD
Differential Revision: https://reviews.freebsd.org/D26722

3 years ago[skein] Fix compilation on gnu assembler with gcc-6 and gcc-9
Adrian Chadd [Wed, 14 Oct 2020 14:29:56 +0000 (14:29 +0000)]
[skein] Fix compilation on gnu assembler with gcc-6 and gcc-9

For some reason I don't want to really understand, the following
happens with gnu as.

/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S: Assembler messages:
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:466: Error: found '(', expected: ')'
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:466: Error: junk at end of line, first unrecognized character is `('
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:795: Error: found '(', expected: ')'
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:795: Error: junk at end of line, first unrecognized character is `('
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement
/home/adrian/git/freebsd/src/sys/crypto/skein/amd64/skein_block_asm.S:885: Error: non-constant expression in ".if" statement

After an exhaustive search and experimentation at 11pm, I discovered that
putting them in parentheses fixes the compilation.

Ed pointed out that I could likely fix this in a bunch of other
locations but I'd rather leave these alone until other options
are enabled.

Tested:

* gcc-6, amd64

Reviewed by: emaste

3 years agoAdd iommu_get_ctx_domain() that allows to get iommu domain for a given
Ruslan Bukin [Wed, 14 Oct 2020 14:12:15 +0000 (14:12 +0000)]
Add iommu_get_ctx_domain() that allows to get iommu domain for a given
iommu context.

Submitted by: andrew
Sponsored by: Innovate DSbD

3 years agoRename a header protection macro.
Ruslan Bukin [Wed, 14 Oct 2020 13:39:50 +0000 (13:39 +0000)]
Rename a header protection macro.

Sponsored by: DARPA, AFRL

3 years agoAdd 'netserver' command to EFI loader.
Michal Meloun [Wed, 14 Oct 2020 13:13:14 +0000 (13:13 +0000)]
Add 'netserver' command to EFI loader.

In some environments is difficult to access bootp/dhcp
configuration as "standard user". Add a command that allows to set
or display the URI of the network server used as "net:" device.
Currently only tftp and nfs protocols are supported.

Typical usage pattern is:
netserver tftp://192.168.168.1/path_to_obj_dir/arm.armv7/sys/GENERIC/
boot net:kernel

Reviewed by: imp, kevans
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D26736

3 years agoFix more -Wundef warnings during bootstrap
Alex Richardson [Wed, 14 Oct 2020 12:28:54 +0000 (12:28 +0000)]
Fix more -Wundef warnings during bootstrap

3 years agoDon't build the malo module with clang 10
Alex Richardson [Wed, 14 Oct 2020 12:28:48 +0000 (12:28 +0000)]
Don't build the malo module with clang 10

Compiling it with LLVM 10 triggers https://bugs.llvm.org/show_bug.cgi?id=44351
While LLVM 11 is the default compiler, I regularly build with
CROSS_TOOLCHAIN=llvm10 or use system packages for clang on Linux/macOS and
those have not been updated to 11 yet.

3 years agoinstall(1): Avoid unncessary fstatfs() calls and use mmap() based on size
Alex Richardson [Wed, 14 Oct 2020 12:28:41 +0000 (12:28 +0000)]
install(1): Avoid unncessary fstatfs() calls and use mmap() based on size

According to git blame the trymmap() function was added in 1996 to skip
mmap() calls for NFS file systems. However, nowadays mmap() should be
perfectly safe even on NFS. Importantly, onl ufs and cd9660 file systems
were whitelisted so we don't use mmap() on ZFS. It also prevents the use
of mmap() when bootstrapping from macOS/Linux since on those systems the
trymmap() function was always returning zero due to the missing MFSNAMELEN
define.

This change keeps the trymmap() function but changes it to check whether
using mmap() can reduce the number of system calls that are required.
Using mmap() only reduces the number of system calls if we need multiple read()
syscalls, i.e. if the file size is > MAXBSIZE. However, mmap() is more expensive
than read() so this sets the threshold at 4 fewer syscalls. Additionally, for
larger file size mmap() can significantly increase the number of page faults,
so avoid it in that case.

It's unclear whether using mmap() is ever faster than a read with an appropriate
buffer size, but this change at least removes two unnecessary system calls
for every file that is installed.

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D26041

3 years agocxgbe(4): Do not request FEC when requesting speeds that don't have FEC.
Navdeep Parhar [Wed, 14 Oct 2020 10:12:39 +0000 (10:12 +0000)]
cxgbe(4): Do not request FEC when requesting speeds that don't have FEC.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoImplement SIOCGIFALIAS.
Andrey V. Elsukov [Wed, 14 Oct 2020 09:22:54 +0000 (09:22 +0000)]
Implement SIOCGIFALIAS.

It is lightweight way to check if an IPv4 address exists.

Submitted by: Roy Marples
Reviewed by: gnn, melifaro
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26636

3 years agocxgbe(4): unimplemented cudbg routines should return the correct
Navdeep Parhar [Wed, 14 Oct 2020 08:04:39 +0000 (08:04 +0000)]
cxgbe(4): unimplemented cudbg routines should return the correct
internal error code and not an errno.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoaxgbe: fix tinderbox build
Mateusz Guzik [Wed, 14 Oct 2020 02:23:49 +0000 (02:23 +0000)]
axgbe: fix tinderbox build

3 years ago[traceroute6] Don't do the casper bits when we're not doing casper
Adrian Chadd [Wed, 14 Oct 2020 00:01:17 +0000 (00:01 +0000)]
[traceroute6] Don't do the casper bits when we're not doing casper

This with the previous patch I committed makes traceroute6/traceroute
compile fine when libcasper isn't enabled.

This complains strongly with unused variables and such when compiled
with gcc-6 on mips32.

Tested:

* compiled/run on mips32 hardware (AR9344)

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D26773

3 years agoFix sbuf_finish() error code check in user-space.
Alexander Motin [Tue, 13 Oct 2020 23:29:06 +0000 (23:29 +0000)]
Fix sbuf_finish() error code check in user-space.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

3 years ago[libcasper] Update cap_dns API to not trigger unused variable warnings when disabled
Adrian Chadd [Tue, 13 Oct 2020 22:49:43 +0000 (22:49 +0000)]
[libcasper] Update cap_dns API to not trigger unused variable warnings when disabled

When compiling without casper these API calls result in unused variable warnings.
Using #defines was lovely in the past but unfortunately it triggers warnings
which can cascade into errors.

Instead, just inline with some fallthrough functions and keep things happy.

Tested:

* gcc-6 targeting mips32, with casper disabled

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D26762

3 years agoFix various warnings with higher WARNS.
John Baldwin [Tue, 13 Oct 2020 22:20:03 +0000 (22:20 +0000)]
Fix various warnings with higher WARNS.

- Rename global 'crid' to 'requested_crid' to avoid shadowing.
- Remove some unused function arguments.
- Use __DECONST().

3 years agoAllow IP over IB to work with multiple FIBs.
Ravi Pokala [Tue, 13 Oct 2020 20:41:51 +0000 (20:41 +0000)]
Allow IP over IB to work with multiple FIBs.

Call M_SETFIB() to make sure the IPoIB packet is directed to the correct
interface-specific FIB.

This was sufficient to allow general-purpose routing using the default FIB,
and a separate FIB for routing between IPoIB on ib0 and IPoEthernet on mce0.

Reviewed by: hselasky
Obtained from: Anmol Kumar <anmolk at panasas dot com>
MFC after: 1 week
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D25239

3 years agoFreeBSD: fix panic due to tqid overflow
Mateusz Guzik [Tue, 13 Oct 2020 20:40:09 +0000 (20:40 +0000)]
FreeBSD: fix panic due to tqid overflow

The 32-bit counter eventually wraps to 0 which is a sentinel for invalid
id.

Make it 64-bit on LP64 platforms and 0-check otherwise.

Note: Linux counterpart uses id stored per queue instead of a global.
I did not check going that way is feasible with the goal being the
minimal fix doing the job.

Reported by: YAMAMOTO Shigeru <shigeru@os-hackers.jp>
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D26759

3 years agoRemove --ld-path=* from _LDFLAGS
Brooks Davis [Tue, 13 Oct 2020 20:04:13 +0000 (20:04 +0000)]
Remove --ld-path=* from _LDFLAGS

It makes no sense to pass --ld-path to direct ${LD} invocations.

This was missed in r366270 due to not doing a clean build.

3 years agoMerge commit 35ecc7fe4 from llvm git (by Hubert Tong):
Dimitry Andric [Tue, 13 Oct 2020 19:42:22 +0000 (19:42 +0000)]
Merge commit 35ecc7fe4 from llvm git (by Hubert Tong):

  [clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast

  Fix premature decision in the presence of type-dependent expression
  operands on whether AltiVec vector initializations from single
  expressions are "splat" operations.

  Verify that the instantiation is able to determine the correct cast
  semantics for both the scalar type and the vector type case.

  Note that, because the change only affects the single-expression case
  (and the target type is an AltiVec-style vector type), the
  replacement of a parenthesized list with a parenthesized expression
  does not change the semantics of the program in a program-observable
  manner.

  Reviewed By: aaron.ballman

  Differential Revision: https://reviews.llvm.org/D88526

This should fix 'Assertion failed: (isScalarType()), function
getScalarTypeKind, file /usr/src/contrib/llvm-project/clang/lib/AST
/Type.cpp, line 2146', when building the graphics/opencv-core port for
powerpc64le.

Requested by: pkubaj
MFC after: 4 weeks
X-MFC-With: r364284

3 years agoJoin to AllHosts multicast group again when adding an existing IPv4 address.
Andrey V. Elsukov [Tue, 13 Oct 2020 19:34:36 +0000 (19:34 +0000)]
Join to AllHosts multicast group again when adding an existing IPv4 address.

When SIOCAIFADDR ioctl configures an IPv4 address that is already exist,
it removes old ifaddr. When this IPv4 address is only one configured on
the interface, this also leads to leaving from AllHosts multicast group.
Then an address is added again, but due to the bug, this doesn't lead
to joining to AllHosts multicast group.

Submitted by: yannis.planus_alstomgroup.com
Reviewed by: gnn
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26757

3 years agoAdd IPv4 fragments reassembling to NAT64LSN.
Andrey V. Elsukov [Tue, 13 Oct 2020 18:57:42 +0000 (18:57 +0000)]
Add IPv4 fragments reassembling to NAT64LSN.

NAT64LSN requires the presence of upper level protocol header
in a IPv4 datagram to find corresponding state to make translation.
Now it will be handled automatically by nat64lsn instance.

Reviewed by: melifaro
Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D26758

3 years ago[ath] Set WARNS to 0 here for now
Adrian Chadd [Tue, 13 Oct 2020 18:36:35 +0000 (18:36 +0000)]
[ath] Set WARNS to 0 here for now

There are still more warnings to fix here, but gcc on mips treats a lot
of these as failures.

So stop it stopping me for now whilst I fix them.

3 years ago[athdebug] Fix warnings generated by gcc on mips
Adrian Chadd [Tue, 13 Oct 2020 18:35:43 +0000 (18:35 +0000)]
[athdebug] Fix warnings generated by gcc on mips

* commented out currently unused/dead code; need to see what it was once
  used for
* remove unused variable
* fix typing

3 years agoeliminate possible race in parallel TLB shootdown IPI
Tycho Nightingale [Tue, 13 Oct 2020 18:28:48 +0000 (18:28 +0000)]
eliminate possible race in parallel TLB shootdown IPI

On the target side TLB shootdown IPI handler, prevent the compiler
from performing a forward store optimization which may mask a
subsequent update to the scoreboard by the initiator.

Reported by: Max Laier, Anton Rang
Discussed with: kib
Sponsored by: Dell EMC Isilon

3 years agoAdd support to the KTLS OCF module for AES-CBC MTE ciphersuites.
John Baldwin [Tue, 13 Oct 2020 18:04:19 +0000 (18:04 +0000)]
Add support to the KTLS OCF module for AES-CBC MTE ciphersuites.

This is a simplistic approach which encrypts each TLS record in two
separate passes: one to generate the MAC and a second to encrypt.
This supports TLS 1.0 connections with implicit IVs as well as TLS
1.1+ with explicit IVs.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26730

3 years agoctl.conf(5): fix LUN size in UCL format example.
Robert Wing [Tue, 13 Oct 2020 18:00:23 +0000 (18:00 +0000)]
ctl.conf(5): fix LUN size in UCL format example.

Remove quotes around size in the LUN section and change the suffix to 'GB'. The
UCL format does recognize 'G' on its own, which uses a base 10 multiplier where
'GB' uses a 2 power multiplier.

Document the difference between valid suffixes when using ctl.conf(5) in the
general syntax form or in UCL format.

Reviewed by:    kevans, mav
Approved by:    kevans (mentor)
Differential Revision: https://reviews.freebsd.org/D26716

3 years agoPermit sending empty fragments for TLS 1.0.
John Baldwin [Tue, 13 Oct 2020 17:30:34 +0000 (17:30 +0000)]
Permit sending empty fragments for TLS 1.0.

Due to a weakness in the TLS 1.0 protocol, OpenSSL will periodically
send empty TLS records ("empty fragments").  These TLS records have no
payload (and thus a page count of zero).  m_uiotombuf_nomap() was
returning NULL instead of an empty mbuf, and a few places needed to be
updated to treat an empty TLS record as having a page count of "1" as
0 means "no work to do" (e.g. nothing to encrypt, or nothing to mark
ready via sbready()).

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26729

3 years agoAdd support for FPU_KERN_NOCTX.
John Baldwin [Tue, 13 Oct 2020 17:27:37 +0000 (17:27 +0000)]
Add support for FPU_KERN_NOCTX.

This mirrors the implementation on amd64.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26754

3 years agoAdd a <machine/fpu.h> for i386 that includes <machine/npx.h>.
John Baldwin [Tue, 13 Oct 2020 17:26:12 +0000 (17:26 +0000)]
Add a <machine/fpu.h> for i386 that includes <machine/npx.h>.

arm64 has a similar wrapper.  This permits defining <machine/fpu.h> as
the standard header for fpu_kern_*.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26753

3 years agolibgssapi: modernize static string array use
Brooks Davis [Tue, 13 Oct 2020 17:14:30 +0000 (17:14 +0000)]
libgssapi: modernize static string array use

Use designated initializers to document positions in the arrays rather
than requiring counting. Use nitems() rather than rolling it by hand to
count elements.

Also, passify a Clang 12 warning about suspcious string concatenation
within an array initializer by adding parentheses.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26592

3 years agoUse adrp in the arm64 efi loader
Andrew Turner [Tue, 13 Oct 2020 16:51:05 +0000 (16:51 +0000)]
Use adrp in the arm64 efi loader

On startup the arm64 efi loaders need to know PC-relative addresses.
Previously we used the adr instruction to find this address, however this
instruction is limited to +/- 1MiB.

Switch to adrp to find the 4k page the address is within and an add to
set the bottom 12 bits. This lets us address +/- 4GiB which should be
large enough for now.

Reported by: imp
MFC after: 2 weeks
Sponsored by: Innovate UK

3 years agoImplement more RCU list functions in the LinuxKPI.
Hans Petter Selasky [Tue, 13 Oct 2020 16:19:21 +0000 (16:19 +0000)]
Implement more RCU list functions in the LinuxKPI.

This also fixes a bug in the existing list_add_rcu() where the
prev->prev pointer was updated to the new element instead of
next->prev. Currently this function is not widely used.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoBring the request_descriptor union into harmony internally. No
Scott Long [Tue, 13 Oct 2020 14:10:49 +0000 (14:10 +0000)]
Bring the request_descriptor union into harmony internally.  No
functional change.

3 years agopf: do not remove kifs that are referenced by rules
Kristof Provost [Tue, 13 Oct 2020 11:04:00 +0000 (11:04 +0000)]
pf: do not remove kifs that are referenced by rules

Even if a kif doesn't have an ifp or if_group pointer we still can't delete it
if it's referenced by a rule. In other words: we must check rulerefs as well.

While we're here also teach pfi_kif_unref() not to remove kifs with flags.

Reported-by: syzbot+b31d1d7e12c5d4d42f28@syzkaller.appspotmail.com
MFC after:   2 weeks

3 years agoBump __FreeBSD_version for the fix to arm64 write-only mappings
Andrew Turner [Tue, 13 Oct 2020 10:31:12 +0000 (10:31 +0000)]
Bump __FreeBSD_version for the fix to arm64 write-only mappings

Sponsored by: Innovate UK