]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoInitial support for bhyve save and restore.
John Baldwin [Tue, 5 May 2020 00:02:04 +0000 (00:02 +0000)]
Initial support for bhyve save and restore.

Save and restore (also known as suspend and resume) permits a snapshot
to be taken of a guest's state that can later be resumed.  In the
current implementation, bhyve(8) creates a UNIX domain socket that is
used by bhyvectl(8) to send a request to save a snapshot (and
optionally exit after the snapshot has been taken).  A snapshot
currently consists of two files: the first holds a copy of guest RAM,
and the second file holds other guest state such as vCPU register
values and device model state.

To resume a guest, bhyve(8) must be started with a matching pair of
command line arguments to instantiate the same set of device models as
well as a pointer to the saved snapshot.

While the current implementation is useful for several uses cases, it
has a few limitations.  The file format for saving the guest state is
tied to the ABI of internal bhyve structures and is not
self-describing (in that it does not communicate the set of device
models present in the system).  In addition, the state saved for some
device models closely matches the internal data structures which might
prove a challenge for compatibility of snapshot files across a range
of bhyve versions.  The file format also does not currently support
versioning of individual chunks of state.  As a result, the current
file format is not a fixed binary format and future revisions to save
and restore will break binary compatiblity of snapshot files.  The
goal is to move to a more flexible format that adds versioning,
etc. and at that point to commit to providing a reasonable level of
compatibility.  As a result, the current implementation is not enabled
by default.  It can be enabled via the WITH_BHYVE_SNAPSHOT=yes option
for userland builds, and the kernel option BHYVE_SHAPSHOT.

Submitted by: Mihai Tiganus, Flavius Anton, Darius Mihai
Submitted by: Elena Mihailescu, Mihai Carabas, Sergiu Weisz
Relnotes: yes
Sponsored by: University Politehnica of Bucharest
Sponsored by: Matthew Grooms (student scholarships)
Sponsored by: iXsystems
Differential Revision: https://reviews.freebsd.org/D19495

4 years agoAdd net epoch support back, which was taken out by accident in
Michael Tuexen [Mon, 4 May 2020 23:05:11 +0000 (23:05 +0000)]
Add net epoch support back, which was taken out by accident in
https://svnweb.freebsd.org/changeset/base/360639

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

4 years agoThis fixes two issues found by ankitraheja09@gmail.com
Randall Stewart [Mon, 4 May 2020 23:02:58 +0000 (23:02 +0000)]
This fixes two issues found by ankitraheja09@gmail.com
1) When BBR retransmits the syn it was messing up the snd_max
2) When we need to send a RST we might not send it when we should

Reported by: ankitraheja09@gmail.com
Sponsored by:  Netflix.com
Differential Revision: https://reviews.freebsd.org/D24693

4 years agoUse a lookup table of algorithm types for alg_is_* helpers.
John Baldwin [Mon, 4 May 2020 22:31:38 +0000 (22:31 +0000)]
Use a lookup table of algorithm types for alg_is_* helpers.

This makes it easier to maintain these functions as algorithms are
added or removed.

Reviewed by: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24668

4 years agoEnter the net epoch before calling the output routine in TCP BBR.
Michael Tuexen [Mon, 4 May 2020 22:02:49 +0000 (22:02 +0000)]
Enter the net epoch before calling the output routine in TCP BBR.
This was only triggered when setting the IPPROTO_TCP level socket
option TCP_DELACK.
This issue was found by runnning an instance of SYZKALLER.
Reviewed by: rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D24690

4 years agoThis commit brings things into sync with the advancements that
Randall Stewart [Mon, 4 May 2020 20:28:53 +0000 (20:28 +0000)]
This commit brings things into sync with the advancements that
have been made in rack and adds a few fixes in BBR. This also
removes any possibility of incorrectly doing OOB data the stacks
do not support it. Should fix the skyzaller crashes seen in the
past. Still to fix is the BBR issue just reported this weekend
with the SYN and on sending a RST. Note that this version of
rack can now do pacing as well.

Sponsored by:Netflix Inc
Differential Revision:https://reviews.freebsd.org/D24576

4 years agoAdjust the fb to have a way to ask the underlying stack
Randall Stewart [Mon, 4 May 2020 20:19:57 +0000 (20:19 +0000)]
Adjust the fb to have a way to ask the underlying stack
if it can support the PRUS option (OOB). And then have
the new function call that to validate and give the
correct error response if needed to the user (rack
and bbr do not support obsoleted OOB data).

Sponsoered by: Netflix Inc.
Differential Revision:  https://reviews.freebsd.org/D24574

4 years agoSet LG_VADDR to 48 on RISC-V.
Brooks Davis [Mon, 4 May 2020 17:16:30 +0000 (17:16 +0000)]
Set LG_VADDR to 48 on RISC-V.

The Sv48 PTE format is the largest currently defined address space for
RISC-V. It makes no sense to define a larger size and doing so (at
least for 64-bits) forces rtrees down a slow path.

Reviewed by: vangyzen, jhb, mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24658

4 years agoAdd RFC reference for AES-CTR with IPsec.
John Baldwin [Mon, 4 May 2020 16:50:01 +0000 (16:50 +0000)]
Add RFC reference for AES-CTR with IPsec.

MFC after: 1 week
Sponsored by: Chelsio Communications

4 years agoSwitch DDB show route to direct rnh_matchaddr() call instead of rtalloc1().
Alexander V. Chernikov [Mon, 4 May 2020 15:07:57 +0000 (15:07 +0000)]
Switch DDB show route to direct rnh_matchaddr() call instead of rtalloc1().

Eliminate the last rtalloc1() call to finish transition to the new routing
KPI defined in r359823.

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

4 years agoSimplify address parsing in DDB show route command.
Alexander V. Chernikov [Mon, 4 May 2020 15:00:19 +0000 (15:00 +0000)]
Simplify address parsing in DDB show route command.

Use db_get_line() to overcome parser limitation.

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

4 years agoRemove now-unused rt_ifp,rt_ifa,rt_gateway,rt_mtu rte fields.
Alexander V. Chernikov [Mon, 4 May 2020 14:31:45 +0000 (14:31 +0000)]
Remove now-unused rt_ifp,rt_ifa,rt_gateway,rt_mtu rte fields.

After converting routing subsystem customers to use nexthop objects
 defined in r359823, some fields in struct rtentry became unused.

This commit removes rt_ifp, rt_ifa, rt_gateway and rt_mtu from struct rtentry
 along with the code initializing and updating these fields.

Cleanup of the remaining fields will be addressed by D24669.

This commit also changes the implementation of the RTM_CHANGE handling.
Old implementation tried to perform the whole operation under radix WLOCK,
 resulting in slow performance and hacks like using RTF_RNH_LOCKED flag.
New implementation looks up the route nexthop under radix RLOCK, creates new
 nexthop and tries to update rte nhop pointer. Only last part is done under
 WLOCK.
In the hypothetical scenarious where multiple rtsock clients
 repeatedly issue RTM_CHANGE requests for the same route, route may get
 updated between read and update operation. This is addressed by retrying
 the operation multiple (3) times before returning failure back to the
 caller.

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

4 years agoRevert r360204, sys.netipsec.tunnel.empty.v{4,6} are fixed by r360560
Li-Wen Hsu [Mon, 4 May 2020 11:23:55 +0000 (11:23 +0000)]
Revert r360204, sys.netipsec.tunnel.empty.v{4,6} are fixed by r360560

PR: 245832
Sponsored by: The FreeBSD Foundation

4 years ago[evdev] Sync event codes with Linux kernel 5.6
Vladimir Kondratyev [Mon, 4 May 2020 11:00:24 +0000 (11:00 +0000)]
[evdev] Sync event codes with Linux kernel 5.6

MFC after: 2 weeks

4 years ago[evdev] Add AT translated set1 scancodes for F-unlocked F1-12 keys.
Vladimir Kondratyev [Mon, 4 May 2020 10:59:17 +0000 (10:59 +0000)]
[evdev] Add AT translated set1 scancodes for F-unlocked F1-12 keys.

"F lock" is a switch between two sets of scancodes for function keys F1-F12
found on some Logitech and Microsoft PS/2 keyboards [1]. When "F lock" is
pressed, then F1-F12 act as function keys and produce usual keyscans for
these keys. When "F lock" is depressed, F1-F12 produced the same keyscans
but prefixed with E0.
Some laptops use [2] E0-prefixed F1-F12 scancodes for non-standard keys.

[1] https://www.win.tue.nl/~aeb/linux/kbd/scancodes-6.html
[2] https://reviews.freebsd.org/D21565

MFC after: 2 weeks

4 years agoOptimise use of sg_page_count() in __sg_page_iter_next() in the LinuxKPI.
Hans Petter Selasky [Mon, 4 May 2020 10:10:07 +0000 (10:10 +0000)]
Optimise use of sg_page_count() in __sg_page_iter_next() in the LinuxKPI.
No need to compute value twice.

No functional change intended.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement more scatter and gather functions in the LinuxKPI.
Hans Petter Selasky [Mon, 4 May 2020 09:58:45 +0000 (09:58 +0000)]
Implement more scatter and gather functions in the LinuxKPI.

Differential Revision: https://reviews.freebsd.org/D24611
Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix warning about sleeping with non-sleepable lock when allocating
Hans Petter Selasky [Mon, 4 May 2020 08:05:01 +0000 (08:05 +0000)]
Fix warning about sleeping with non-sleepable lock when allocating
"current" from linux_cdev_pager_populate() in the LinuxKPI:

Backtrace:
witness_debugger()
witness_warn()
uma_zalloc_arg()
malloc()
linux_alloc_current()
linux_cdev_pager_populate()
vm_fault()
vm_fault_trap()
trap_pfault()
trap()
calltrap()

Suggested by: avg@
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years ago - Fix logic error in swapoff case: follow same handling of p and
Xin LI [Mon, 4 May 2020 05:49:11 +0000 (05:49 +0000)]
 - Fix logic error in swapoff case: follow same handling of p and
   linelen in the swapon case.
 - Use strlcpy instead of strncpy.

MFC after: 1 week

4 years agoFix intermittent cleanup failures in the ggated test
Alan Somers [Sun, 3 May 2020 18:10:54 +0000 (18:10 +0000)]
Fix intermittent cleanup failures in the ggated test

MFC after: 2 weeks

4 years agoAdd session locking in cfiscsi_ioctl_handoff().
Alexander Motin [Sun, 3 May 2020 16:14:55 +0000 (16:14 +0000)]
Add session locking in cfiscsi_ioctl_handoff().

While there, remove ifdef around cs_target check in cfiscsi_ioctl_list().
I am not sure why this ifdef was added, but without this check code will
crash below on NULL dereference.

Submitted by: Aleksandr Fedorov <aleksandr.fedorov@itglobal.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24587

4 years agopf: Improve DIOCADDRULE validation
Kristof Provost [Sun, 3 May 2020 16:09:35 +0000 (16:09 +0000)]
pf: Improve DIOCADDRULE validation

We expect the addrwrap.p.dyn value to be set to NULL (and assert such),
but do not verify it on input.

Reported-by: syzbot+936a89182e7d8f927de1@syzkaller.appspotmail.com
Reviewed by: melifaro (previous version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24538

4 years agoAdd references for the most important man7
Benedict Reuschling [Sun, 3 May 2020 10:35:36 +0000 (10:35 +0000)]
Add references for the most important man7
pages worth reading to intro(7).

Submitted by: Gordon Bergling gbergling_gmail.com
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24649

4 years agoFix various, mostly minor errors in man pages like:
Benedict Reuschling [Sun, 3 May 2020 10:15:58 +0000 (10:15 +0000)]
Fix various, mostly minor errors in man pages like:
- Abbreviated month name in .Dd
- position of HISTORY section
- alphabetical ordering within SEE ALSO section
- adding .Ed before .Sh DESCRIPTION
- remove trailing whitespaces
- Line break after a sentence stop
- Use BSD OS macros instead of hardcoded strings

No .Dd bumps as there was no actual content change made
in any of these pages.

Submitted by: Gordon Bergling gbergling_gmail.com
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24591

4 years agoAdd HISTORY sections to build(7), crypto(7),
Benedict Reuschling [Sun, 3 May 2020 09:54:19 +0000 (09:54 +0000)]
Add HISTORY sections to build(7), crypto(7),
ffs(7), growfs(7), and diskless(8).

Submitted by: Gordon Bergling gbergling_gmail.com
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24271

4 years agoWe need to hold the periph lock when we release the ccb (and when we
Warner Losh [Sun, 3 May 2020 04:22:27 +0000 (04:22 +0000)]
We need to hold the periph lock when we release the ccb (and when we
run it). Make sure that we do. Simplify the flow a bit, and fix a
comment since we do need to do these things.

Noticed by: cperciva (not sure why my invariants kernel didn't trigger)

4 years agoipfw: whitespace fix in SCTP_ABORT_ASSOCIATION case statement comment
Ed Maste [Sun, 3 May 2020 03:44:16 +0000 (03:44 +0000)]
ipfw: whitespace fix in SCTP_ABORT_ASSOCIATION case statement comment

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Reviewed by: rgrimes, tuexen
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24602

4 years agoStep 4.2: start divorce of M_EXT and M_EXTPG
Gleb Smirnoff [Sun, 3 May 2020 00:37:16 +0000 (00:37 +0000)]
Step 4.2: start divorce of M_EXT and M_EXTPG

They have more differencies than similarities. For now there is lots
of code that would check for M_EXT only and work correctly on M_EXTPG
buffers, so still carry M_EXT bit together with M_EXTPG. However,
prepare some code for explicit check for M_EXTPG.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoMechanically rename MBUF_EXT_PGS_ASSERT() to M_ASSERTEXTPG() to match
Gleb Smirnoff [Sun, 3 May 2020 00:27:41 +0000 (00:27 +0000)]
Mechanically rename MBUF_EXT_PGS_ASSERT() to M_ASSERTEXTPG() to match
classical M_ASSERTPKTHDR.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoStep 4.1: mechanically rename M_NOMAP to M_EXTPG
Gleb Smirnoff [Sun, 3 May 2020 00:21:11 +0000 (00:21 +0000)]
Step 4.1: mechanically rename M_NOMAP to M_EXTPG

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoStep 3: anonymize struct mbuf_ext_pgs and move all its fields into mbuf
Gleb Smirnoff [Sun, 3 May 2020 00:12:56 +0000 (00:12 +0000)]
Step 3: anonymize struct mbuf_ext_pgs and move all its fields into mbuf
        within m_epg namespace.
All edits except the 'struct mbuf' declaration and mb_dupcl() were done
mechanically with sed:

s/->m_ext_pgs.nrdy/->m_epg_nrdy/g
s/->m_ext_pgs.hdr_len/->m_epg_hdrlen/g
s/->m_ext_pgs.trail_len/->m_epg_trllen/g
s/->m_ext_pgs.first_pg_off/->m_epg_1st_off/g
s/->m_ext_pgs.last_pg_len/->m_epg_last_len/g
s/->m_ext_pgs.flags/->m_epg_flags/g
s/->m_ext_pgs.record_type/->m_epg_record_type/g
s/->m_ext_pgs.enc_cnt/->m_epg_enc_cnt/g
s/->m_ext_pgs.tls/->m_epg_tls/g
s/->m_ext_pgs.so/->m_epg_so/g
s/->m_ext_pgs.seqno/->m_epg_seqno/g
s/->m_ext_pgs.stailq/->m_epg_stailq/g

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoStep 2.5: Stop using 'struct mbuf_ext_pgs' in the kernel itself.
Gleb Smirnoff [Sun, 3 May 2020 00:08:05 +0000 (00:08 +0000)]
Step 2.5: Stop using 'struct mbuf_ext_pgs' in the kernel itself.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoMake MBUF_EXT_PGS_ASSERT_SANITY() a macro, so that it prints file:line.
Gleb Smirnoff [Sun, 3 May 2020 00:03:39 +0000 (00:03 +0000)]
Make MBUF_EXT_PGS_ASSERT_SANITY() a macro, so that it prints file:line.
While here, stop using struct mbuf_ext_pgs.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoStep 2.4: Stop using 'struct mbuf_ext_pgs' in drivers.
Gleb Smirnoff [Sat, 2 May 2020 23:58:20 +0000 (23:58 +0000)]
Step 2.4: Stop using 'struct mbuf_ext_pgs' in drivers.

Reviewed by: gallatin, hselasky
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoStep 2.3: Rename mbuf_ext_pg_len() to m_epg_pagelen() that
Gleb Smirnoff [Sat, 2 May 2020 23:52:35 +0000 (23:52 +0000)]
Step 2.3: Rename mbuf_ext_pg_len() to m_epg_pagelen() that
          uses mbuf argument.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoStep 2.2:
Gleb Smirnoff [Sat, 2 May 2020 23:46:29 +0000 (23:46 +0000)]
Step 2.2:
o Shrink sglist(9) functions to work with multipage mbufs down from
  four functions to two.
o Don't use 'struct mbuf_ext_pgs *' as argument, use struct mbuf.
o Rename to something matching _epg.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoStep 2.1: Build TLS workqueue from mbufs, not struct mbuf_ext_pgs.
Gleb Smirnoff [Sat, 2 May 2020 23:38:13 +0000 (23:38 +0000)]
Step 2.1: Build TLS workqueue from mbufs, not struct mbuf_ext_pgs.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoGet rid of the mbuf self-pointing pointer.
Gleb Smirnoff [Sat, 2 May 2020 22:56:22 +0000 (22:56 +0000)]
Get rid of the mbuf self-pointing pointer.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoStart moving into EPG_/epg_ namespace. There is only one flag, but
Gleb Smirnoff [Sat, 2 May 2020 22:49:14 +0000 (22:49 +0000)]
Start moving into EPG_/epg_ namespace.  There is only one flag, but
next commit brings in second flag, so let them already be in the
future namespace.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoIn mb_unmapped_compress() we don't need mbuf structure to keep data,
Gleb Smirnoff [Sat, 2 May 2020 22:44:23 +0000 (22:44 +0000)]
In mb_unmapped_compress() we don't need mbuf structure to keep data,
but we need buffer of MLEN bytes.  This isn't just a simplification,
but important fixup, because previous commit shrinked sizeof(struct
mbuf) down below MSIZE, and instantiating an mbuf on stack no longer
provides enough data.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoContinuation of multi page mbuf redesign from r359919.
Gleb Smirnoff [Sat, 2 May 2020 22:39:26 +0000 (22:39 +0000)]
Continuation of multi page mbuf redesign from r359919.

The following series of patches addresses three things:

Now that array of pages is embedded into mbuf, we no longer need
separate structure to pass around, so struct mbuf_ext_pgs is an
artifact of the first implementation. And struct mbuf_ext_pgs_data
is a crutch to accomodate the main idea r359919 with minimal churn.

Also, M_EXT of type EXT_PGS are just a synonym of M_NOMAP.

The namespace for the newfeature is somewhat inconsistent and
sometimes has a lengthy prefixes. In these patches we will
gradually bring the namespace to "m_epg" prefix for all mbuf
fields and most functions.

Step 1 of 4:

 o Anonymize mbuf_ext_pgs_data, embed in m_ext
 o Embed mbuf_ext_pgs
 o Start documenting all this entanglement

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D24598

4 years agoFix various Coverity-detected errors in nvme driver
David Bright [Sat, 2 May 2020 20:47:58 +0000 (20:47 +0000)]
Fix various Coverity-detected errors in nvme driver

This fixes several Coverity-detected errors in the nvme driver.

CIDs addressed: 100834410093771009380119374013054701403975,
1403980

Reviewed by: imp@, vangyzen@
MFC after: 5 days
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D24532

4 years agoResolve conflict between the fusefs(5) and mac_bsdextended(4) tests
Alan Somers [Sat, 2 May 2020 20:14:59 +0000 (20:14 +0000)]
Resolve conflict between the fusefs(5) and mac_bsdextended(4) tests

mac_bsdextended(4), when enabled, causes ordinary operations to send many
more VOP_GETATTRs to file system. The fusefs tests expectations aren't
written with those in mind. Optionally expecting them would greatly
obfuscate the fusefs tests. Worse, certain fusefs functionality (like
attribute caching) would be impossible to test if the tests couldn't expect
an exact number of GETATTR operations.

This commit resolves that conflict by making two changes:

1. The fusefs tests will now check for mac_bsdextended, and skip if it's
   enabled.
2. The mac_bsdextended tests will now check whether the module is enabled, not
   merely loaded. If it's loaded but disabled, the tests will automatically
   enable it for the duration of the tests.

With these changes, a CI system can achieve best coverage by loading both
fusefs and mac_bsdextended at boot, and setting
security.mac.bsdextended.enabled=0

PR: 244229
Reported by: lwhsu
Reviewed by: cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24577

4 years agokern_exec.c: Produce valid code ifndef SYS_PROTO_H
Conrad Meyer [Sat, 2 May 2020 18:54:25 +0000 (18:54 +0000)]
kern_exec.c: Produce valid code ifndef SYS_PROTO_H

Reported by: Coccinelle

4 years agoActually remove support for Triple DES, not just the warning.
John Baldwin [Sat, 2 May 2020 17:18:32 +0000 (17:18 +0000)]
Actually remove support for Triple DES, not just the warning.

Missed in r360562.

4 years agoCleanup LUN addition/removal.
Alexander Motin [Sat, 2 May 2020 16:54:59 +0000 (16:54 +0000)]
Cleanup LUN addition/removal.

 - Make ctl_add_lun() synchronous.  Asynchronous addition was used by
Copan's proprietary code long ago and never for upstream FreeBSD.
 - Move LUN enable/disable calls from backends to CTL core.
 - Serialize LUN modification and partially removal to avoid double frees.
 - Slightly unify backends code.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoDocument removal of deprecated algorithms from /dev/crypto.
John Baldwin [Sat, 2 May 2020 14:23:55 +0000 (14:23 +0000)]
Document removal of deprecated algorithms from /dev/crypto.

4 years agoRemove support for the algorithms deprecated in r348876.
John Baldwin [Sat, 2 May 2020 14:20:32 +0000 (14:20 +0000)]
Remove support for the algorithms deprecated in r348876.

This removes support for the following algorithms:
- ARC4
- Blowfish
- CAST128
- DES
- 3DES
- MD5-HMAC
- Skipjack

Since /dev/crypto no longer supports 3DES, stop testing the 3DES KAT
vectors in cryptotest.py.

Reviewed by: cem (previous version)
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24346

4 years agoDon't pass bogus keys down for NULL algorithms.
John Baldwin [Sat, 2 May 2020 01:00:29 +0000 (01:00 +0000)]
Don't pass bogus keys down for NULL algorithms.

The changes in r359374 added various sanity checks in sessions and
requests created by crypto consumers in part to permit backend drivers
to make assumptions instead of duplicating checks for various edge
cases.  One of the new checks was to reject sessions which provide a
pointer to a key while claiming the key is zero bits long.

IPsec ESP tripped over this as it passes along whatever key is
provided for NULL, including a pointer to a zero-length key when an
empty string ("") is used with setkey(8).  One option would be to
teach the IPsec key layer to not allocate keys of zero length, but I
went with a simpler fix of just not passing any keys down and always
using a key length of zero for NULL algorithms.

PR: 245832
Reported by: CI

4 years agoPrint the fs last-mounted time too.
Chuck Silvers [Sat, 2 May 2020 00:10:25 +0000 (00:10 +0000)]
Print the fs last-mounted time too.

Reviewed by: mckusick
Approved by: mckusick (mentor)
Sponsored by: Netflix

4 years agoDocument removal of deprecated IPsec algorithms.
John Baldwin [Sat, 2 May 2020 00:08:44 +0000 (00:08 +0000)]
Document removal of deprecated IPsec algorithms.

4 years agoRemove support for IPsec algorithms deprecated in r348205 and r360202.
John Baldwin [Sat, 2 May 2020 00:06:58 +0000 (00:06 +0000)]
Remove support for IPsec algorithms deprecated in r348205 and r360202.

Examples of depecrated algorithms in manual pages and sample configs
are updated where relevant.  I removed the one example of combining
ESP and AH (vs using a cipher and auth in ESP) as RFC 8221 says this
combination is NOT RECOMMENDED.

Specifically, this removes support for the following ciphers:
- des-cbc
- 3des-cbc
- blowfish-cbc
- cast128-cbc
- des-deriv
- des-32iv
- camellia-cbc

This also removes support for the following authentication algorithms:
- hmac-md5
- keyed-md5
- keyed-sha1
- hmac-ripemd160

Reviewed by: cem, gnn (older verisons)
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24342

4 years agoUse the HSM SBI extension to halt CPUs
Mitchell Horne [Fri, 1 May 2020 21:59:47 +0000 (21:59 +0000)]
Use the HSM SBI extension to halt CPUs

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

4 years agoUse the HSM SBI extension to start APs
Mitchell Horne [Fri, 1 May 2020 21:58:19 +0000 (21:58 +0000)]
Use the HSM SBI extension to start APs

The addition of the HSM SBI extension to OpenSBI introduces a new
breaking change: secondary harts will remain parked in the firmware,
until they are brought up explicitly via sbi_hsm_hart_start(). Add
the call to do this, sending the secondary harts to mpentry.

If the HSM extension is not present, secondary harts are assumed to be
released by the firmware, as is the case for OpenSBI =< v0.6 and BBL.

In the case that the HSM call fails we exclude the CPU, notify the
user, and allow the system to proceed with booting.

Reviewed by: markj (older version)
Differential Revision: https://reviews.freebsd.org/D24497

4 years agoAdd support for HSM SBI extension
Mitchell Horne [Fri, 1 May 2020 21:55:51 +0000 (21:55 +0000)]
Add support for HSM SBI extension

The Hardware State Management (HSM) extension provides a set of SBI
calls that allow the supervisor software to start and stop hart
execution.

The HSM extension has been implemented in OpenSBI and is present in
the v0.7 release.

[1] https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc

Reviewed by: br
Differential Revision: https://reviews.freebsd.org/D24496

4 years agoMake mpentry independent of _start
Mitchell Horne [Fri, 1 May 2020 21:52:29 +0000 (21:52 +0000)]
Make mpentry independent of _start

APs enter the kernel at the same point as the BSP, the _start routine.
They then jump to mpentry, but not before storing the kernel's physical
load address in the s9 register. Extract this calculation into its own
routine, so that APs can be instructed to enter directly from mpentry.

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

4 years agoAdd KASSERT to ensure sane nsid.
Warner Losh [Fri, 1 May 2020 21:24:19 +0000 (21:24 +0000)]
Add KASSERT to ensure sane nsid.

All callers are currently filtering bad nsid to this function,
however, we'll have undefined behavior if that's not true. Add the
KASSERT to prevent that.

4 years agoRename ns notification function...
Warner Losh [Fri, 1 May 2020 21:24:15 +0000 (21:24 +0000)]
Rename ns notification function...

This function is called whenever the namespace is added, deleted or
changes. Update the name to reflect that. No functional change.

4 years agoDocument the passthru commands.
Warner Losh [Fri, 1 May 2020 20:29:51 +0000 (20:29 +0000)]
Document the passthru commands.

Reviewed by: bcr@ (earlier version)
Differential Revision: https://reviews.freebsd.org/D24639

4 years agoVarious improvements to this man page:
Warner Losh [Fri, 1 May 2020 20:29:46 +0000 (20:29 +0000)]
Various improvements to this man page:

o Be consistent about device-id and namespace-id
o Use consistent arg markup for these
o document you can use disk names too
o document nsid command better
o document the idenntify command
o add a couple of examples.

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

4 years agoRedo r360540 to retain the ifndef sparc code, not delete it.
Warner Losh [Fri, 1 May 2020 18:36:48 +0000 (18:36 +0000)]
Redo r360540 to retain the ifndef sparc code, not delete it.

Also undo the BROKEN stuff, since it was based on the same misreading.

Noticed by: Jens Schweikhardt

4 years agoSpell LOADER correctly so we test lua build.
Warner Losh [Fri, 1 May 2020 17:50:26 +0000 (17:50 +0000)]
Spell LOADER correctly so we test lua build.

4 years agoRemove more stray sparc64 ifdefs.
Warner Losh [Fri, 1 May 2020 17:50:21 +0000 (17:50 +0000)]
Remove more stray sparc64 ifdefs.

Also, dmabuf appears to only be set for sparc64 case, but there was a
comment at its only use that says it was broken for some apple
adapters. #ifdef it all of that out now that nothing sets it.

4 years agoCatch up to arm/arm and sparc64 removal.
Warner Losh [Fri, 1 May 2020 17:17:01 +0000 (17:17 +0000)]
Catch up to arm/arm and sparc64 removal.

4 years agoWhen we have an invalid build option, don't rm -rf the current
Warner Losh [Fri, 1 May 2020 17:16:57 +0000 (17:16 +0000)]
When we have an invalid build option, don't rm -rf the current
directory.

Add a quick sanity check to objdir before using it.  It must start
with /. If there was a make error getting it, report that and continue
with the next target. If there was anything else, bail out.

4 years ago[PowerPC] Set fixed boot1.elf load address
Brandon Bergren [Fri, 1 May 2020 16:56:36 +0000 (16:56 +0000)]
[PowerPC] Set fixed boot1.elf load address

Due to the way claiming works, we need to ensure on AIM OFW machines that
we don't have overlapping ranges on any step of the load.

Load boot1.elf at 0x38000 so it will not overlap with anything even if the
entire PReP partition gets loaded by OFW.

Tested on an iBook G4, a PowerBook G4, a PowerMac G5, and qemu pseries.
(qemu pseries is broken without this patch due to the high address used
by lld10.)

Reviewed by: adalava
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D24623

4 years agoRemove sparc relocation support from reloc_elf.c.
Brandon Bergren [Fri, 1 May 2020 16:47:54 +0000 (16:47 +0000)]
Remove sparc relocation support from reloc_elf.c.

It got missed in the sparc64 removal.

4 years agocorrect procctl(PROC_PROTMAX_STATUS _NOFORCE return
Ed Maste [Fri, 1 May 2020 14:30:59 +0000 (14:30 +0000)]
correct procctl(PROC_PROTMAX_STATUS _NOFORCE return

Previously procctl(PROC_PROTMAX_STATUS, ... used the PROC_ASLR_NOFORCE
macro for the "system-wide configured policy" status, instead of
PROC_PROTMAX_NOFORCE.

They both have a value of 3, so no functional change.

Sponsored by: The FreeBSD Foundation

4 years agoFix typo in r360492:
Benedict Reuschling [Fri, 1 May 2020 11:36:39 +0000 (11:36 +0000)]
Fix typo in r360492:

appeard -> appeared

Reported by: trasz (via IRC)

4 years agoImplement more PCI-express bandwidth functions in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:32:42 +0000 (10:32 +0000)]
Implement more PCI-express bandwidth functions in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement mutex_lock_killable() in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:28:21 +0000 (10:28 +0000)]
Implement mutex_lock_killable() in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement DIV64_U64_ROUND_UP() in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:25:07 +0000 (10:25 +0000)]
Implement DIV64_U64_ROUND_UP() in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement more lockdep macros in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:18:07 +0000 (10:18 +0000)]
Implement more lockdep macros in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement kstrtou64() in the LinuxKPI.
Hans Petter Selasky [Fri, 1 May 2020 10:14:45 +0000 (10:14 +0000)]
Implement kstrtou64() in the LinuxKPI.

Submitted by: ashafer_badland.io (Austin Shafer)
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix a number of the following issues in man4:
Benedict Reuschling [Fri, 1 May 2020 10:02:38 +0000 (10:02 +0000)]
Fix a number of the following issues in man4:
- Inconsistencies in .Dd like abbreviated month names,
"th" after numbers, or leading zeros
- No line breaks after a sentence stop
- Whitespace at the end of the line
- Use macros for BSD OS names instead of hardcoded names
- CAVEATS instead of CAVEAT in section name

No actual content change in terms of additions were made, so
no bump of the .Dd for these man pages.
All of these issues were found and fixed by Gordon Bergling.

Submitted by:     gbergling_gmail.com
Approved by:     bcr
Differential Revision: https://reviews.freebsd.org/D24648

4 years agoAdd RISC-V interpreter example
Mitchell Horne [Fri, 1 May 2020 01:31:19 +0000 (01:31 +0000)]
Add RISC-V interpreter example

Now that RISC-V support has landed in qemu-user-static, add to the list
of examples in the binmiscctl(8) manpage.

Reviewed by: kevans
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D24646

4 years agoMFV: r360512
Jung-uk Kim [Fri, 1 May 2020 01:26:36 +0000 (01:26 +0000)]
MFV: r360512

Merge ACPICA 20200430.

4 years agoFactor some code out of nfsm_dissct() into separate functions.
Rick Macklem [Fri, 1 May 2020 00:36:14 +0000 (00:36 +0000)]
Factor some code out of nfsm_dissct() into separate functions.

Factoring some of the code in nfsm_dissct() out into separate functions
allows these functions to be used elsewhere in the NFS mbuf handling code.
Other uses of these functions will be done in future commits.
It also makes it easier to add support for ext_pgs mbufs, which is needed
for nfs-over-tls under development in base/projects/nfs-over-tls.

Although the algorithm in nfsm_dissct() is somewhat re-written by this
patch, the semantics of nfsm_dissct() should not have changed.

4 years agoImport ACPICA 20200430.
Jung-uk Kim [Thu, 30 Apr 2020 23:40:36 +0000 (23:40 +0000)]
Import ACPICA 20200430.

4 years agoRemove the SYMVER build option.
John Baldwin [Thu, 30 Apr 2020 22:08:40 +0000 (22:08 +0000)]
Remove the SYMVER build option.

This option was added as a transition aide when symbol versioning was
first added.  It was enabled by default in 2007 and is supported even
by the old GPLv2 binutils.  Trying to disable it currently fails to
build in libc and at this point it isn't worth fixing the build.

Reported by: Michael Dexter
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D24637

4 years agogeli tests require OpenSSL - exclude them under WITHOUT_OPENSSL
Ed Maste [Thu, 30 Apr 2020 21:09:01 +0000 (21:09 +0000)]
geli tests require OpenSSL - exclude them under WITHOUT_OPENSSL

PR: 245931
Submitted by: The FreeBSD Foundation

4 years agoFix three bugs highlighted by review:
Warner Losh [Thu, 30 Apr 2020 21:08:59 +0000 (21:08 +0000)]
Fix three bugs highlighted by review:

- maxio should be dp->d_maxsize. This is often MAXPHYS, but not always
  (especially if MAXPHYS is > 1MB).
- Unlock the periph before returning. We don't need to relock it to
  release the ccb.
- Make sure we release the ccb in error paths.

Reviewed by: cperciva

4 years agosrc.conf.5: regen after WITHOUT_OPENSSL dep changes
Ed Maste [Thu, 30 Apr 2020 21:08:22 +0000 (21:08 +0000)]
src.conf.5: regen after WITHOUT_OPENSSL dep changes

4 years agolualoader: config: improve readConfFiles, rename to readConf
Kyle Evans [Thu, 30 Apr 2020 21:04:39 +0000 (21:04 +0000)]
lualoader: config: improve readConfFiles, rename to readConf

The previous interface was pretty bad, and required the caller to get some
implementation details correct that it really shouldn't need to (e.g.
loader_conf_files handling) and pass in an empty table for it to use.

The new and much improved interface, readConf, is much less of a hack;
hiding these implementation details and just doing the right thing.
config.lua will now use it to process /boot/defaults/loader.conf and the
subsequent loader_conf_files from there, and read-conf will also use it.

This improvement submitted by Olivier (cited below), loader_conf_files
handling from the original patch was changed to just clobber it before
processing and not bother restoring it after the fact following r360505
where it's now guaranteed to evade the loader environment.

PR: 244640
Submitted by: Olivier Certner (olivier freebsd free fr>

4 years agolualoader: config: add a table for restricted environment vars
Kyle Evans [Thu, 30 Apr 2020 20:58:58 +0000 (20:58 +0000)]
lualoader: config: add a table for restricted environment vars

This new table should be used for transient values that don't need to end up
in the loader environment. Generally, these will be things that are internal
details that really aren't needed or interesting outside of the config
module (e.g. if we changed how ${module}_* directives work, they might use
this instead).

To start, populate it with loader_conf_files. Any specific value of
loader_conf_files isn't all that interesting; if we're going to export it,
we should really instead export a loader_conf_files that indicates all of
the configuration files we processed. This will be used to reduce
bookkeeping overhead in a future commit that cleans up readConfFiles.

4 years agoStyle(9) nit: put function name at start of line.
Warner Losh [Thu, 30 Apr 2020 20:58:38 +0000 (20:58 +0000)]
Style(9) nit: put function name at start of line.

4 years agoMove / reword a comment.
Warner Losh [Thu, 30 Apr 2020 20:58:33 +0000 (20:58 +0000)]
Move / reword a comment.

Explain what we're doing with mapping CAM's notion of a LUN to NVMe's
notion of a namespace.

4 years agoRemove stray blank line.
Warner Losh [Thu, 30 Apr 2020 19:48:55 +0000 (19:48 +0000)]
Remove stray blank line.

This was accidentally added in r360483.

4 years agosrc.opts.mk: add WITHOUT_OPENSSL dependencies
Ed Maste [Thu, 30 Apr 2020 18:11:56 +0000 (18:11 +0000)]
src.opts.mk: add WITHOUT_OPENSSL dependencies

A number of components require OpenSSL and fail to build if it is not
enabled.  As a first phase force these off under WITHOUT_OPENSSL.  A
second phase should make these more fine-grained, allowing the component
to build but without OpenSSL.

PR: 245931
Sponsored by: The FreeBSD Foundation

4 years agoig4iic_acpi_probe: remove set but unused variable
Andriy Gapon [Thu, 30 Apr 2020 15:45:01 +0000 (15:45 +0000)]
ig4iic_acpi_probe: remove set but unused variable

MFC after: 1 week

4 years agoIncrease the iflib txq callout mutex name length to 32 bytes.
Mark Johnston [Thu, 30 Apr 2020 15:39:04 +0000 (15:39 +0000)]
Increase the iflib txq callout mutex name length to 32 bytes.

With a length of 16, the name ("<if name>:TX(<qid>):callout") typically
gets truncated.

PR: 245712
Reported by: ghuckriede@blackberry.com
MFC after: 1 week

4 years agoAdd a new manual page for unionfs(5), written by
Benedict Reuschling [Thu, 30 Apr 2020 12:02:13 +0000 (12:02 +0000)]
Add a new manual page for unionfs(5), written by
Gordon Bergling. Hook it up to the build by adding
it to the Makefile.

Submitted by:     gbergling_gmail.com
Approved by:     bcr
Differential Revision: https://reviews.freebsd.org/D24589

4 years agoAdd HISTORY sections to disk(9), driver(9), and
Benedict Reuschling [Thu, 30 Apr 2020 11:17:29 +0000 (11:17 +0000)]
Add HISTORY sections to disk(9), driver(9), and
epoch(9).

In one instance, remove a trailing whitespace while here.

Submitted by: gbergling_gmail.com
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24243

4 years agoIntroduce a lower bound of 2 MSS to TCP Cubic.
Richard Scheffenegger [Thu, 30 Apr 2020 11:11:28 +0000 (11:11 +0000)]
Introduce a lower bound of 2 MSS to TCP Cubic.

Running TCP Cubic together with ECN could end up reducing cwnd down to 1 byte, if the
receiver continously sets the ECE flag, resulting in very poor transmission speeds.

In line with RFC6582 App. B, a lower bound of 2 MSS is introduced, as well as a typecast
to prevent any potential integer overflows during intermediate calculation steps of the
adjusted cwnd.

Reported by: Cheng Cui
Reviewed by: tuexen (mentor)
Approved by: tuexen (mentor)
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D23353

4 years agoloader.conf(5): document that loader_conf_files may be clobbered
Kyle Evans [Thu, 30 Apr 2020 02:50:58 +0000 (02:50 +0000)]
loader.conf(5): document that loader_conf_files may be clobbered

A future change in lualoader may take some liberties with the
loader_conf_files in the name of efficiency; namely, it may start omitting
it from the loader environment entirely so that it doesn't need to worry
about maintaining any specific value.

This variable has historically been incredibly volatile anyways, as it may
get set to completely different values in any given configuration file to
trigger a load of more files.

Document now that we may not maintain it in the future, but perhaps we'll
reserve the right to change our minds and eventually formally export all of
the loader configuration files that were read using this variable.

MFC after: 3 days

4 years agoMake sure that we get the sbuf resources we need.
Warner Losh [Thu, 30 Apr 2020 00:43:11 +0000 (00:43 +0000)]
Make sure that we get the sbuf resources we need.

Since we're calling sbuf_new with NOWAIT, make sure it can allocate a
buffer to use. Don't print anything if we can't get it.

Noticed by: rpokala

4 years agoImplement the NVME_GET_NSID and NVME_PASSTHROUGH_CMD ioctls
Warner Losh [Thu, 30 Apr 2020 00:43:07 +0000 (00:43 +0000)]
Implement the NVME_GET_NSID and NVME_PASSTHROUGH_CMD ioctls

With these two ioctls implemented in the nda driver, nvmecontrol now
works with nda just like it does with nvd. It eliminates the need to
jump through odd hoops to get this data.

4 years agoReturn the nvmeX device associated with the ndaX device.
Warner Losh [Thu, 30 Apr 2020 00:43:02 +0000 (00:43 +0000)]
Return the nvmeX device associated with the ndaX device.

Add the nvmeX device to the XPT_PATH_INQ nvme specific
information. while one could figure this out by looking up the
domain:bus:slot:function, it's a lot easier to have the SIM set it
directly since the sim knows this.

4 years agoGenerate a devctl event for interesting events
Warner Losh [Thu, 30 Apr 2020 00:27:19 +0000 (00:27 +0000)]
Generate a devctl event for interesting events

When we reset the controller, and when the controller tells us about a
critical warning, send an event.

4 years agosrc.conf.5: regen after 359736, ZONEINFO_OLD_TIMEZONES_SUPPORT removal
Ed Maste [Thu, 30 Apr 2020 00:14:14 +0000 (00:14 +0000)]
src.conf.5: regen after 359736, ZONEINFO_OLD_TIMEZONES_SUPPORT removal