]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoInclude TMPFS in all the GENERIC kernel configs
arichardson [Fri, 24 Jul 2020 08:40:04 +0000 (08:40 +0000)]
Include TMPFS in all the GENERIC kernel configs

Being able to use tmpfs without kernel modules is very useful when building
small MFS_ROOT kernels without a real file system.
Including TMPFS also matches arm/GENERIC and the MIPS std.MALTA configs.

Compiling TMPFS only adds 4 .c files so this should not make much of a
difference to NO_MODULES build times (as we do for our minimal RISC-V
images).

Reviewed By: br (earlier version for riscv), brooks, emaste
Differential Revision: https://reviews.freebsd.org/D25317

3 years agofix up docs for m_getjcl as well..
jmg [Fri, 24 Jul 2020 00:47:14 +0000 (00:47 +0000)]
fix up docs for m_getjcl as well..

3 years agodocument that m_get2 only accepts up to MJUMPAGESIZE..
jmg [Fri, 24 Jul 2020 00:35:21 +0000 (00:35 +0000)]
document that m_get2 only accepts up to MJUMPAGESIZE..

3 years agoAdd support for KTLS RX via software decryption.
jhb [Thu, 23 Jul 2020 23:48:18 +0000 (23:48 +0000)]
Add support for KTLS RX via software decryption.

Allow TLS records to be decrypted in the kernel after being received
by a NIC.  At a high level this is somewhat similar to software KTLS
for the transmit path except in reverse.  Protocols enqueue mbufs
containing encrypted TLS records (or portions of records) into the
tail of a socket buffer and the KTLS layer decrypts those records
before returning them to userland applications.  However, there is an
important difference:

- In the transmit case, the socket buffer is always a single "record"
  holding a chain of mbufs.  Not-yet-encrypted mbufs are marked not
  ready (M_NOTREADY) and released to protocols for transmit by marking
  mbufs ready once their data is encrypted.

- In the receive case, incoming (encrypted) data appended to the
  socket buffer is still a single stream of data from the protocol,
  but decrypted TLS records are stored as separate records in the
  socket buffer and read individually via recvmsg().

Initially I tried to make this work by marking incoming mbufs as
M_NOTREADY, but there didn't seemed to be a non-gross way to deal with
picking a portion of the mbuf chain and turning it into a new record
in the socket buffer after decrypting the TLS record it contained
(along with prepending a control message).  Also, such mbufs would
also need to be "pinned" in some way while they are being decrypted
such that a concurrent sbcut() wouldn't free them out from under the
thread performing decryption.

As such, I settled on the following solution:

- Socket buffers now contain an additional chain of mbufs (sb_mtls,
  sb_mtlstail, and sb_tlscc) containing encrypted mbufs appended by
  the protocol layer.  These mbufs are still marked M_NOTREADY, but
  soreceive*() generally don't know about them (except that they will
  block waiting for data to be decrypted for a blocking read).

- Each time a new mbuf is appended to this TLS mbuf chain, the socket
  buffer peeks at the TLS record header at the head of the chain to
  determine the encrypted record's length.  If enough data is queued
  for the TLS record, the socket is placed on a per-CPU TLS workqueue
  (reusing the existing KTLS workqueues and worker threads).

- The worker thread loops over the TLS mbuf chain decrypting records
  until it runs out of data.  Each record is detached from the TLS
  mbuf chain while it is being decrypted to keep the mbufs "pinned".
  However, a new sb_dtlscc field tracks the character count of the
  detached record and sbcut()/sbdrop() is updated to account for the
  detached record.  After the record is decrypted, the worker thread
  first checks to see if sbcut() dropped the record.  If so, it is
  freed (can happen when a socket is closed with pending data).
  Otherwise, the header and trailer are stripped from the original
  mbufs, a control message is created holding the decrypted TLS
  header, and the decrypted TLS record is appended to the "normal"
  socket buffer chain.

(Side note: the SBCHECK() infrastucture was very useful as I was
 able to add assertions there about the TLS chain that caught several
 bugs during development.)

Tested by: rmacklem (various versions)
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24628

3 years agoLimit gmirror failpoint tests to the test worker
bdrewery [Thu, 23 Jul 2020 23:29:50 +0000 (23:29 +0000)]
Limit gmirror failpoint tests to the test worker

This avoids injecting errors into the test system's mirrors.

gnop seems like a good solution here but it injects errors at the wrong
place vs where these tests expect and does not support a 'max global count'
like the failpoints do with 'n*' syntax.

Reviewed by: cem, vangyzen
Sponsored by: Dell EMC Isilon

3 years agoupdate example to make it active when creating a new boot method...
jmg [Thu, 23 Jul 2020 22:28:35 +0000 (22:28 +0000)]
update example to make it active when creating a new boot method...

Clean up some of the sentences and grammar...

make igor happy..

3 years agoConsolidate duplicated code into a ktls_ocf_dispatch function.
jhb [Thu, 23 Jul 2020 21:43:06 +0000 (21:43 +0000)]
Consolidate duplicated code into a ktls_ocf_dispatch function.

This function manages the loop around crypto_dispatch and coordination
with ktls_ocf_callback.

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

3 years agoSet si_trapno to the exception code from esr.
jhb [Thu, 23 Jul 2020 21:40:03 +0000 (21:40 +0000)]
Set si_trapno to the exception code from esr.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25771

3 years agoPass the right size to memcpy() when copying the array of FP registers.
jhb [Thu, 23 Jul 2020 21:33:10 +0000 (21:33 +0000)]
Pass the right size to memcpy() when copying the array of FP registers.

The size of the containing structure was passed instead of the size of
the array.  This happened to be harmless as the extra word copied is
one we copy in the next line anyway.

Reported by: CHERI (bounds check violation)
Reviewed by: brooks, imp
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25791

3 years agoSet si_addr to badvaddr for TLB faults.
jhb [Thu, 23 Jul 2020 20:08:42 +0000 (20:08 +0000)]
Set si_addr to badvaddr for TLB faults.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25775

3 years agomd5: return non-zero if built-in tests (-x) fail
emaste [Thu, 23 Jul 2020 20:06:24 +0000 (20:06 +0000)]
md5: return non-zero if built-in tests (-x) fail

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoClear the pointer to the socket when closing it also in case of
tuexen [Thu, 23 Jul 2020 19:43:49 +0000 (19:43 +0000)]
Clear the pointer to the socket when closing it also in case of
an ungraceful operation.
This fixes a use-after-free bug found and reported by Taylor
Brandstetter of Google by testing the userland stack.

MFC after: 1 week

3 years agomodules/crypto: disable optimized assembly skein1024 implementation
emaste [Thu, 23 Jul 2020 19:19:33 +0000 (19:19 +0000)]
modules/crypto: disable optimized assembly skein1024 implementation

It is presumably broken in the same way as userland skein1024 (see r363454)

PR: 248221

3 years agolibmd: temporarily disable optimized assembly skein1024 implementation
emaste [Thu, 23 Jul 2020 18:55:47 +0000 (18:55 +0000)]
libmd: temporarily disable optimized assembly skein1024 implementation

It is apparently broken when assembled by contemporary GNU as as well as
Clang IAS (which is used in the default configuration).

PR: 248221
Reported by: pizzamig
Sponsored by: The FreeBSD Foundation

3 years agoDocument the IPFILTER_PREDEFINED environment variable.
cy [Thu, 23 Jul 2020 17:39:49 +0000 (17:39 +0000)]
Document the IPFILTER_PREDEFINED environment variable.

PR: 248088
Reported by: joeb1@a1poweruser.com
MFC after: 1 week

3 years agoLoad ipfilter, ipnat, and ippool rules, and start ipmon in a vnet jail.
cy [Thu, 23 Jul 2020 17:39:45 +0000 (17:39 +0000)]
Load ipfilter, ipnat, and ippool rules, and start ipmon in a vnet jail.

PR: 248109
Reported by: joeb1@a1poweruser.com
MFC after: 2 weeks

3 years agolocks: fix a long standing bug for primitives with kdtrace but without spinning
mjg [Thu, 23 Jul 2020 17:26:53 +0000 (17:26 +0000)]
locks: fix a long standing bug for primitives with kdtrace but without spinning

In such a case the second argument to lock_delay_arg_init was NULL which was
immediately causing a null pointer deref.

Since the sructure is only used for spin count, provide a dedicate routine
initializing it.

Reported by: andrew

3 years agoRank balanced (RB) trees are a class of balanced trees that includes
dougm [Thu, 23 Jul 2020 17:16:20 +0000 (17:16 +0000)]
Rank balanced (RB) trees are a class of balanced trees that includes
AVL trees, red-black trees, and others. Weak AVL (wavl) trees are a
recently discovered member of that class. This change replaces
red-black rebalancing with weak AVL rebalancing in the RB tree macros.

Wavl trees sit between AVL and red-black trees in terms of how
strictly balance is enforced. They have the stricter balance of AVL
trees as the tree is built - a wavl tree is an AVL tree until the
first deletion. Once removals start, wavl trees are lazier about
rebalancing than AVL trees, so that removals can be fast, but the
balance of the tree can decay to that of a red-black tree. Subsequent
insertions can push balance back toward the stricter AVL conditions.

Removing a node from a wavl tree never requires more than two
rotations, which is better than either red-black or AVL
trees. Inserting a node into a wavl tree never requires more than two
rotations, which matches red-black and AVL trees. The only
disadvantage of wavl trees to red-black trees is that more insertions
are likely to adjust the tree a bit. That's the cost of keeping the
tree more balanced.

Testing has shown that for the cases where red-black trees do worst,
wavl trees better balance leads to faster lookups, so that if lookups
outnumber insertions by a nontrivial amount, lookup time saved exceeds
the extra cost of balancing.

Reviewed by: alc, gbe, markj
Tested by: pho
Discussed with: emaste
Differential Revision: https://reviews.freebsd.org/D25480

3 years agorc.firewall: Merge two identical conditions into one.
markj [Thu, 23 Jul 2020 15:03:28 +0000 (15:03 +0000)]
rc.firewall: Merge two identical conditions into one.

No functional change intended.

PR: 247949
Submitted by: Jose Luis Duran <jlduran@gmail.com>
MFC after: 1 week

3 years agoAdd missing newlines.
mav [Thu, 23 Jul 2020 14:33:25 +0000 (14:33 +0000)]
Add missing newlines.

MFC after: 3 days

3 years agoMFOpenZFS: Fix zpool history unbounded memory usage
markj [Thu, 23 Jul 2020 14:21:45 +0000 (14:21 +0000)]
MFOpenZFS: Fix zpool history unbounded memory usage

In original implementation, zpool history will read the whole history
before printing anything, causing memory usage goes unbounded. We fix
this by breaking it into read-print iterations.

Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #9516

Note, this change changes the libzfs.so ABI by modifying the prototype
of zpool_get_history().  Since libzfs is effectively private to the base
system it is anticipated that this will not be a problem.

PR: 247557
Obtained from: OpenZFS
Reported and tested by: Sam Vaughan <samjvaughan@gmail.com>
Discussed with: freqlabs
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25745
openzfs/zfs@7125a109dcc55628336ff3f58e59e503f4d7694d

3 years agocuse: Stop checking for failures from malloc(M_WAITOK).
markj [Thu, 23 Jul 2020 14:03:37 +0000 (14:03 +0000)]
cuse: Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25765

3 years agontb: Stop checking for failures from malloc(M_WAITOK).
markj [Thu, 23 Jul 2020 14:03:24 +0000 (14:03 +0000)]
ntb: Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: cem, mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25768

3 years agovm: annotate swap_reserved with __exclusive_cache_line
mjg [Thu, 23 Jul 2020 08:42:16 +0000 (08:42 +0000)]
vm: annotate swap_reserved with __exclusive_cache_line

The counter keeps being updated all the time and variables read afterwards
share the cacheline. Note this still fundamentally does not scale and needs
to be replaced, in the meantime gets a bandaid.

brk1_processes -t 52 ops/s:
before: 8598298
after:  9098080

3 years agoDetect and handle an invalid reassembly constellation, which results in
tuexen [Thu, 23 Jul 2020 01:35:24 +0000 (01:35 +0000)]
Detect and handle an invalid reassembly constellation, which results in
a memory leak.

Thanks to Felix Weinrank for finding this issue using fuzz testing the
userland stack.

MFC after: 1 week

3 years agoCorrect a type-mismatch between xdr_long and the variable "bad".
brooks [Wed, 22 Jul 2020 23:39:58 +0000 (23:39 +0000)]
Correct a type-mismatch between xdr_long and the variable "bad".

Way back in r28911 (August 1997, CVS rev 1.22) we imported a NetBSD
information leak fix via OpenBSD.  Unfortunatly we failed to track the
followup commit that fixed the type of the error code.  Apply the change
from int to long now.

Reviewed by: emaste
Found by: CHERI
Obtained from: CheriBSD
MFC after: 3 days
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25779

3 years agoUse SI_ORDER_(FOURTH|FIFTH) rather than bespoke versions.
brooks [Wed, 22 Jul 2020 23:35:41 +0000 (23:35 +0000)]
Use SI_ORDER_(FOURTH|FIFTH) rather than bespoke versions.

No functional change.

When these SYSINITs were added these macros didn't exist.

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

3 years agoModify writing to mirrored pNFS DSs to prepare for use of ext_pgs mbufs.
rmacklem [Wed, 22 Jul 2020 23:33:37 +0000 (23:33 +0000)]
Modify writing to mirrored pNFS DSs to prepare for use of ext_pgs mbufs.

This patch modifies writing to mirrored pNFS DSs slightly so that there is
only one m_copym() call for a mirrored pair instead of two of them.
This call replaces the custom nfsm_copym() call, which is no longer needed
and deleted by this patch. The patch does introduce a new nfsm_split()
function that only calls m_split() for the non-ext_pgs case.
The semantics of nfsm_uiombuflist() is changed to include code that nul
pads the generated mbuf list. This was done by nfsm_copym() prior to this patch.

The main reason for this change is that it allows the data to be a list
of ext_pgs mbufs, since the m_copym() is for the entire mbuf list.
This support will be added in a future commit.

This patch only affects writing to mirrored flexible file layout pNFS servers.

3 years agoAdd missing space after switch.
jhb [Wed, 22 Jul 2020 22:51:14 +0000 (22:51 +0000)]
Add missing space after switch.

Reviewed by: br, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25778

3 years agoAvoid reading one byte before the path buffer.
brooks [Wed, 22 Jul 2020 21:44:51 +0000 (21:44 +0000)]
Avoid reading one byte before the path buffer.

This happens when there's only one component (e.g. "/foo"). This
(mostly-harmless) bug has been present since June 1990 when it was
commited to mountd.c SCCS version 5.9.

Note: the bug is on the second changed line, the first line is changed
for visual consistency.

Reviewed by: cem, emaste, mckusick, rmacklem
Found with: CHERI
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25759

3 years agoUntie nmi_handle_intr() from DEV_ISA.
mav [Wed, 22 Jul 2020 20:15:21 +0000 (20:15 +0000)]
Untie nmi_handle_intr() from DEV_ISA.

The only part of nmi_handle_intr() depending on ISA is isa_nmi(), which is
already wrapped.  Entering debugger on NMI does not really depend on ISA.

MFC after: 2 weeks

3 years agommccam: Add support for 1.2V and 1.8V eMMC
manu [Wed, 22 Jul 2020 19:08:05 +0000 (19:08 +0000)]
mmccam: Add support for 1.2V and 1.8V eMMC

If the card reports that it support 1.2V or 1.8V signaling switch to this voltage.

Submitted by: kibab

3 years agommccam: Add support for 1.8V sdcard
manu [Wed, 22 Jul 2020 19:04:45 +0000 (19:04 +0000)]
mmccam: Add support for 1.8V sdcard

If the card reports that it support 1.8V signaling switch to this voltage.
While here update the list of mode for mmccam.

Submitted by: kibab

3 years agoaw_mmc: Start a mmccam discovery when the CD handler is called.
manu [Wed, 22 Jul 2020 18:33:36 +0000 (18:33 +0000)]
aw_mmc: Start a mmccam discovery when the CD handler is called.

Submitted by: kibab

3 years agommccam: Add a generic mmccam_start_discovery function
manu [Wed, 22 Jul 2020 18:30:17 +0000 (18:30 +0000)]
mmccam: Add a generic mmccam_start_discovery function

This is a generic function start a scan request for the given
cam_sim.
Other driver can now just use this function to request a new rescan.

Submitted by: kibab

3 years agommccam: Use a sbuf for the mmc ident function
manu [Wed, 22 Jul 2020 18:21:37 +0000 (18:21 +0000)]
mmccam: Use a sbuf for the mmc ident function

While here fix a typo.

3 years agoFix sys.geom.class.eli.onetime_test.onetime after r363402
lwhsu [Wed, 22 Jul 2020 17:37:11 +0000 (17:37 +0000)]
Fix sys.geom.class.eli.onetime_test.onetime after r363402

PR: 247954
X-MFC with: r363402
Sponsored by: The FreeBSD Foundation

3 years agommc_xpt: Fix debug messages
manu [Wed, 22 Jul 2020 17:36:28 +0000 (17:36 +0000)]
mmc_xpt: Fix debug messages

PROBE_RESET was printed for PROBE_IDENTIFY, fix this.
While here add one for the PROBE_RESET.

Submitted by: kibab

3 years agopkg-bootstrap: complain on improper `pkg bootstrap` usage
kevans [Wed, 22 Jul 2020 17:33:35 +0000 (17:33 +0000)]
pkg-bootstrap: complain on improper `pkg bootstrap` usage

Right now, the bootstrap will gloss over things like pkg bootstrap -x or
pkg bootstrap -f pkg. Make it more clear that this is incorrect, and hint
at the correct formatting.

Reported by: jhb (IIRC via IRC)
Approved by: bapt, jhb, manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24750

3 years agousb(4): Stop checking for failures from malloc(M_WAITOK).
markj [Wed, 22 Jul 2020 14:32:47 +0000 (14:32 +0000)]
usb(4): Stop checking for failures from malloc(M_WAITOK).

Handle the fact that parts of usb(4) can be compiled into the boot
loader, where M_WAITOK does not guarantee a successful allocation.

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org> (original version)
Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25706

3 years agoAdd tests for "add", "change" and "delete" functionality of /sbin/route.
thj [Wed, 22 Jul 2020 13:49:54 +0000 (13:49 +0000)]
Add tests for "add", "change" and "delete" functionality of /sbin/route.

Add tests to cover "add", "change" and "delete" functionality of /sbin/route
for ipv4 and ipv6. These tests for the existing route tool are the first step
towards creating libroute.

Submitted by:   Ahsan Barkati
Sponsored by:   Google, Inc. (GSoC 2020)
Reviewed by:    kp, thj
Approved by:    bz (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D25220

3 years agogeli(8): Add missing commands in the EXAMPLES section
gbe [Wed, 22 Jul 2020 13:00:56 +0000 (13:00 +0000)]
geli(8): Add missing commands in the EXAMPLES section

- Add a missing 'geli attach' command
- Fix the passphrase prompt for a 'geli attach' command

Reported by: Fabian Keil <freebsd-listen at fabiankeil dot de>
Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D25761

3 years agolockmgr: add adaptive spinning
mjg [Wed, 22 Jul 2020 12:30:31 +0000 (12:30 +0000)]
lockmgr: add adaptive spinning

It is very conservative. Only spinning when LK_ADAPTIVE is passed, only on
exclusive lock and never when any waiters are present. buffer cache is remains
not spinning.

This reduces total sleep times during buildworld etc., but it does not shorten
total real time (culprits are contention in the vm subsystem along with slock +
upgrade which is not covered).

For microbenchmarks: open3_processes -t 52 (open/close of the same file for
writing) ops/s:
before: 258845
after: 801638

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D25753

3 years agoConsistently use gctl_get_provider instead of home-grown variants.
delphij [Wed, 22 Jul 2020 02:15:21 +0000 (02:15 +0000)]
Consistently use gctl_get_provider instead of home-grown variants.

Reviewed by: cem, imp
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D25739

3 years agogctl_get_class, gctl_get_geom and gctl_get_provider: provide feedback
delphij [Wed, 22 Jul 2020 02:14:27 +0000 (02:14 +0000)]
gctl_get_class, gctl_get_geom and gctl_get_provider: provide feedback
when the requested argument is missing.

Reviewed by: cem
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D25738

3 years agolibbe: annotate lbh as __unused in be_is_auto_snapshot_name
kevans [Wed, 22 Jul 2020 02:09:10 +0000 (02:09 +0000)]
libbe: annotate lbh as __unused in be_is_auto_snapshot_name

lbh is included for consistency with other functions and in case
future work needs to use it, but it is currently unused. Mark it,
and a post-OpenZFS-import world will be able to raise WARNS of
libbe to the default (pending some minor changes to openzfs libzfs).

MFC after: 3 days

3 years agogetty appears to date from 3rd edition research unix. That's the oldest man page
imp [Wed, 22 Jul 2020 00:44:47 +0000 (00:44 +0000)]
getty appears to date from 3rd edition research unix. That's the oldest man page
on TUHS and its 'unix 1972' restoration effort has assembler sources that look
like simpler version of what's in the 5th edition.

3 years agoINTRNG: only shuffle for !EARLY_AP_STARTUP
mhorne [Tue, 21 Jul 2020 22:47:02 +0000 (22:47 +0000)]
INTRNG: only shuffle for !EARLY_AP_STARTUP

During device attachment, all interrupt sources will bind to the BSP,
as it is the only processor online. This means interrupts must be
redistributed ("shuffled") later, during SI_SUB_SMP.

For the EARLY_AP_STARTUP case, this is no longer true. SI_SUB_SMP will
execute much earlier, meaning APs will be online and available before
devices begin attachment, and there will therefore be nothing to
shuffle.

All PIC-conforming interrupt controllers will handle this early
distribution properly, except for RISC-V's PLIC. Make the necessary
tweak to the PLIC driver.

While here, convert irq_assign_cpu from a boolean_t to a bool.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D25693

3 years agoTransition from rtrequest1_fib() to rib_action().
melifaro [Tue, 21 Jul 2020 19:56:13 +0000 (19:56 +0000)]
Transition from rtrequest1_fib() to rib_action().

Remove all variations of rtrequest <rtrequest1_fib, rtrequest_fib,
 in6_rtrequest, rtrequest_fib> and their uses and switch to
 to rib_action(). This is part of the new routing KPI.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision: https://reviews.freebsd.org/D25546

3 years agoFix geli's null cipher, and add a test case
asomers [Tue, 21 Jul 2020 19:18:29 +0000 (19:18 +0000)]
Fix geli's null cipher, and add a test case

PR: 247954
Submitted by: jhb (sys), asomers (tests)
Reviewed by: jhb (tests), asomers (sys)
MFC after: 2 weeks
Sponsored by: Axcient

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Tue, 21 Jul 2020 17:34:05 +0000 (17:34 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
10.0.1 final (aka llvmorg-10.0.1-0-gef32c611aa2).

There were no changes since rc2, except in the upstream regression
tests, which we do not ship.

Relnotes: yes
MFC after: immediately (no material changes except tag)

3 years agoAvoid code duplicaiton by using ipi_selected().
mav [Tue, 21 Jul 2020 17:18:38 +0000 (17:18 +0000)]
Avoid code duplicaiton by using ipi_selected().

MFC after: 2 weeks

3 years ago[skip ci] document close_range(2) as async-signal-safe
asomers [Tue, 21 Jul 2020 16:46:40 +0000 (16:46 +0000)]
[skip ci] document close_range(2) as async-signal-safe

Reviewed by: bcr (manpages)
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25513

3 years agoFix style and comment around concave/convex regions in TCP cubic.
rscheff [Tue, 21 Jul 2020 16:21:52 +0000 (16:21 +0000)]
Fix style and comment around concave/convex regions in TCP cubic.

In cubic, the concave region is when snd_cwnd starts growing slower
towards max_cwnd (cwnd at the time of the congestion event), and
the convex region is when snd_cwnd starts to grow faster and
eventually appearing like slow-start like growth.

PR: 238478
Reviewed by: tuexen (mentor), rgrimes (mentor)
Approved by: tuexen (mentor), rgrimes (mentor)
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D24657

3 years agonetstat(1): Add EXAMPLES section
fernape [Tue, 21 Jul 2020 16:17:23 +0000 (16:17 +0000)]
netstat(1): Add EXAMPLES section

* Add small EXAMPLES section
* Fix warning reported by mandoc (./netstat.1:747:2: WARNING: skipping paragraph
  macro: Pp before Ss)

Approved by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D25212

3 years agotraceroute6: Fix most warnings at the default WARNS level.
markj [Tue, 21 Jul 2020 15:03:36 +0000 (15:03 +0000)]
traceroute6: Fix most warnings at the default WARNS level.

Fix some style issues as well.  Leave -Wno-cast-aligned set for now, as
most of the warnings come casts of CMSG_DATA(), which does provide
sufficient alignment in practice.

Submitted by: Shubh Gupta <shubh@freebsd.org>
Sponsored by: Google (GSOC 2020)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25603

3 years agolockmgr: denote recursion with a bit in lock value
mjg [Tue, 21 Jul 2020 14:42:22 +0000 (14:42 +0000)]
lockmgr: denote recursion with a bit in lock value

This reduces excessive reads from the lock.

Tested by: pho

3 years agolockmgr: rewrite upgrade to stop always dropping the lock
mjg [Tue, 21 Jul 2020 14:41:25 +0000 (14:41 +0000)]
lockmgr: rewrite upgrade to stop always dropping the lock

This matches rw and sx locks.

3 years agolockmgr: add a helper for reading the lock value
mjg [Tue, 21 Jul 2020 14:39:20 +0000 (14:39 +0000)]
lockmgr: add a helper for reading the lock value

3 years agoOnly write to VIRTIO_MMIO_GUEST_PAGE_SIZE with virtio mmio version 1
andrew [Tue, 21 Jul 2020 14:25:36 +0000 (14:25 +0000)]
Only write to VIRTIO_MMIO_GUEST_PAGE_SIZE with virtio mmio version 1

This register is only defined for the legacy v1 interface so only write
to it when interacting with a legacy device.

Sponsored by: Innovate UK

3 years agoMove sys/iommu.h to dev/iommu/ as a part of generic IOMMU busdma backend.
br [Tue, 21 Jul 2020 13:50:10 +0000 (13:50 +0000)]
Move sys/iommu.h to dev/iommu/ as a part of generic IOMMU busdma backend.

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25750

3 years agoMove the Intel DMAR busdma backend to a generic place so
br [Tue, 21 Jul 2020 10:38:51 +0000 (10:38 +0000)]
Move the Intel DMAR busdma backend to a generic place so
it can be used on other IOMMU systems.

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25720

3 years agodtrace/fbt: fix return probe arguments on arm
avg [Tue, 21 Jul 2020 07:41:36 +0000 (07:41 +0000)]
dtrace/fbt: fix return probe arguments on arm

arg0 should be an offset of the return point within the function, arg1
should be the return value.  Previously the return probe had arguments as
if for the entry probe.

Tested on armv7.

andrew noted that the same problem seems to be present on arm64, mips,
and riscv.
I am not sure if I will get around to fixing those.  So, platform users
or anyone looking to make a contribution please be aware of this
opportunity.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25685

3 years agogpioiic: never drive lines active high
avg [Tue, 21 Jul 2020 07:35:03 +0000 (07:35 +0000)]
gpioiic: never drive lines active high

I2C communication is done by a combination of driving a line low or
letting it float, so that it is either pulled up or driven low by
another party.

r355276 besides the stated goal of the change -- using the new GPIO API
-- also changed the logic, so that active state is signaled by actively
driving a line.

That worked with iicbb prior to r362042, but stopped working after that
commit on at least some hardware.  My guess that the breakage was
related to getting an ACK bit.  A device expected to be able to drive
SDA actively low, but controller was actively driving it high for some
time.

Anyway, this change seems to fix the problem.
Tested using gpioiic on Orange Pi PC Plus with HTU21 sensor.

Reported by: Nick Kostirya <nikolay.kostirya@i11.co>
Reviewed by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25684

3 years agoFix some regressions with the zgrep(1) wrapper.
leres [Mon, 20 Jul 2020 23:57:53 +0000 (23:57 +0000)]
Fix some regressions with the zgrep(1) wrapper.

 - Handle whitespace with long flags that take arguments:

echo 'foo bar' > test
zgrep --regexp='foo bar' test

 - Do not hang reading from stdin with patterns in a file:

echo foobar > test
echo foo > pattern
zgrep -f pattern test
zgrep --file=pattern test

 - Handle any flags after -e:

echo foobar > test
zgrep -e foo --ignore-case < test

These two are still outstanding problems:

 - Does not handle flags that take an argument if there is no
   whitespace:

zgrep -enfs /etc/rpc

 - When more than one -e pattern used matching should occur for all
   patterns (similar to multiple patterns supplied with -f file).
   Instead only the last pattern is used for matching:

zgrep -e rex -e nfs /etc/rpc

   (This problem is masked in the unpatched version by the "any
   flags after -e" problem.)

Add tests for the above problems.

Update the mange and add references to gzip(1) and zstd(1) and also
document the remaining known problems.

PR: 247126
Approved by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25613

3 years agoAdd MODULE_VERSION to TCP loadable congestion control modules.
rscheff [Mon, 20 Jul 2020 23:47:27 +0000 (23:47 +0000)]
Add MODULE_VERSION to TCP loadable congestion control modules.

Without versioning information, using preexisting loader /
linker code is not easily possible when another module may
have dependencies on pre-loaded modules, and also doesn't
allow the automatic loading of dependent modules.

No functional change of the actual modules.

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

3 years agoDon't dynamically allocate data structures for KTLS crypto requests.
jhb [Mon, 20 Jul 2020 22:32:39 +0000 (22:32 +0000)]
Don't dynamically allocate data structures for KTLS crypto requests.

Allocate iovec arrays and struct cryptop and struct ocf_operation
objects on the stack to reduce avoid the overhead of malloc().

These structures are all small enough to fit on the stack of the KTLS
worker threads.

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

3 years agoiflib: initialize netmap with the correct number of descriptors
vmaffione [Mon, 20 Jul 2020 21:08:56 +0000 (21:08 +0000)]
iflib: initialize netmap with the correct number of descriptors

In case the network device has a RX or TX control queue, the correct
number of TX/RX descriptors is contained in the second entry of the
isc_ntxd (or isc_nrxd) array, rather than in the first entry.
This case is correctly handled by iflib_device_register() and
iflib_pseudo_register(), but not by iflib_netmap_attach().
If the first entry is larger than the second, this can result in a
panic. This change fixes the bug by introducing two helper functions
that also lead to some code simplification.

PR: 247647
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D25541

3 years agoadd a few tests for sendfile.
chs [Mon, 20 Jul 2020 20:36:32 +0000 (20:36 +0000)]
add a few tests for sendfile.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25431

3 years agolibdwarf: Hide SHT_NOBITS sections.
markj [Mon, 20 Jul 2020 18:22:38 +0000 (18:22 +0000)]
libdwarf: Hide SHT_NOBITS sections.

gnu_debuglink external debug files will contain an .eh_frame section of
type SHT_NOBITS.  libdwarf does not handle such sections (or rather, it
expects all debug sections to not have type SHT_NOBITS).  Avoid loading
SHT_NOBITS sections, to be consistent with SGI libdwarf's handling of
this case.

PR: 239516
Diagnosed by: Paco Pascal <me@pacopascal.com>
Reviewed by: emaste (previous version)
Event: July 2020 Bugathon
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25626

3 years agocrypto(9): Stop checking for failures from malloc(M_WAITOK).
markj [Mon, 20 Jul 2020 17:44:13 +0000 (17:44 +0000)]
crypto(9): Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: cem, delphij, jhb
MFC after: 1 week
Event: July 2020 Bugathon

3 years agoFix a memory leak in dsl_scan_visitbp().
markj [Mon, 20 Jul 2020 17:05:44 +0000 (17:05 +0000)]
Fix a memory leak in dsl_scan_visitbp().

This should be triggered only if arc_read() fails, i.e., quite rarely.
The same logic is already present in OpenZFS.

PR: 247445
Submitted by: jdolecek@NetBSD.org
MFC after: 1 week

3 years agopadlock: fix Via Padlock with 192-bit keys
asomers [Mon, 20 Jul 2020 16:12:14 +0000 (16:12 +0000)]
padlock: fix Via Padlock with 192-bit keys

It's been broken since a typo in r359374

Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25710

3 years agoext2fs: Stop checking for failures from malloc(M_WAITOK).
markj [Mon, 20 Jul 2020 14:28:26 +0000 (14:28 +0000)]
ext2fs: Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: fsu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25707

3 years agogeli(8): Add an example on how to use geli(8) with a file as encrypted storage
gbe [Mon, 20 Jul 2020 13:24:50 +0000 (13:24 +0000)]
geli(8): Add an example on how to use geli(8) with a file as encrypted storage

Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25741

3 years agozpool(8): Fix a few typos regarding 'inverval' -> 'interval'
gbe [Mon, 20 Jul 2020 13:01:19 +0000 (13:01 +0000)]
zpool(8): Fix a few typos regarding 'inverval' -> 'interval'

PR: 248068
Submitted by: PauAmma <pauamma at gundo dot com>
Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D25719

3 years agotests/sys/opencrypto: use python3
asomers [Mon, 20 Jul 2020 12:47:15 +0000 (12:47 +0000)]
tests/sys/opencrypto: use python3

python2 will be EOL soon

Reviewed by: lwhsu, jmg
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25682

3 years agoFix indent for if clause.
delphij [Mon, 20 Jul 2020 01:55:19 +0000 (01:55 +0000)]
Fix indent for if clause.

MFC after: 2 weeks

3 years agoRevert that!
sjg [Sun, 19 Jul 2020 23:56:19 +0000 (23:56 +0000)]
Revert that!

3 years agoOops missed Makefile.config
sjg [Sun, 19 Jul 2020 23:54:00 +0000 (23:54 +0000)]
Oops missed Makefile.config

3 years agoriscv: look for bootargs in FDT
mhorne [Sun, 19 Jul 2020 23:34:52 +0000 (23:34 +0000)]
riscv: look for bootargs in FDT

The FDT may contain a short /chosen/bootargs string which we should pass
to boot_parse_cmdline. Notably, this allows the use of qemu's -append
option to pass things like -s to boot to single user mode.

Submitted by: Nathaniel Filardo <nwf20@cl.cam.ac.uk>
Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25544

3 years agoMake efirt module dependent on MK_EFI
mhorne [Sun, 19 Jul 2020 23:19:09 +0000 (23:19 +0000)]
Make efirt module dependent on MK_EFI

MK_EFI was added to kern.opts.mk in r331099, but is currently unused.
Take advantage of that fact and gate the build of efirt behind it.

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

3 years agoThe ds3231 RTC chip bitmask values for 12- versus 24-hour mode were reversed,
ian [Sun, 19 Jul 2020 18:53:19 +0000 (18:53 +0000)]
The ds3231 RTC chip bitmask values for 12- versus 24-hour mode were reversed,
flip them so that times in the 20:00:00 to 23:59:59 range read correctly.

Reported by: Dr. Rolf Jansen <freebsd-rj@obsigna.com>
Pointy hat: ian@

3 years agoSimplify non-pti syscall entry on amd64.
kib [Sun, 19 Jul 2020 17:47:55 +0000 (17:47 +0000)]
Simplify non-pti syscall entry on amd64.

Limit manipulations to use %rax as scratch to the pti portion of the
syscall entry code.

Submitted by: alc
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25722

3 years ago[if_an] unbreak!
adrian [Sun, 19 Jul 2020 17:27:48 +0000 (17:27 +0000)]
[if_an] unbreak!

.. I missed this when checking drivers.

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

3 years ago[net80211] missing from last commit, le whoops
adrian [Sun, 19 Jul 2020 16:07:51 +0000 (16:07 +0000)]
[net80211] missing from last commit, le whoops

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

3 years ago[net80211] Add new privileges; restrict what can be done in a jail.
adrian [Sun, 19 Jul 2020 15:16:27 +0000 (15:16 +0000)]
[net80211] Add new privileges; restrict what can be done in a jail.

Split the MANAGE privilege into MANAGE, SETMAC and CREATE_VAP.

+ VAP_MANAGE is everything but setting the MAC and creating a VAP.
+ VAP_SETMAC is setting the MAC address of the VAP.
  Typically you wouldn't want the jail to be able to modify this.
+ CREATE_VAP is to create a new VAP. Again, you don't want to be doing
  this in a jail, but this DOES stop being able to run some corner
  cases like Dynamic WDS (DWDS) AP in a jail/vnet. We can figure this
  bit out later.

This allows me to run wpa_supplicant in a jail after transferring
a STA VAP into it. I unfortunately can't currently set the wlan
debugging inside the jail; that would be super useful!

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D25630

3 years agoat(1): Markup environment variables with proper macros
allanjude [Sun, 19 Jul 2020 14:42:13 +0000 (14:42 +0000)]
at(1): Markup environment variables with proper macros

Submitted by: debdrup
Reported by: 0mp
Reviewed by: imp
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25721

3 years agoAdd reference counts for inp/stcb/net when timers are running.
tuexen [Sun, 19 Jul 2020 12:34:19 +0000 (12:34 +0000)]
Add reference counts for inp/stcb/net when timers are running.
This avoids a use-after-free reported for the userland stack.
Thanks to Taylor Brandstetter for suggesting a patch for
the userland stack.

MFC after: 1 week

3 years agoMake linux(4) support the BLKPBSZGET ioctl. Oracle uses it.
trasz [Sun, 19 Jul 2020 12:25:03 +0000 (12:25 +0000)]
Make linux(4) support the BLKPBSZGET ioctl.  Oracle uses it.

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

3 years agoAdd missing bitset(9) MLINKS.
trasz [Sun, 19 Jul 2020 12:22:32 +0000 (12:22 +0000)]
Add missing bitset(9) MLINKS.

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

3 years agoTemporarly revert r363319 to unbreak the build.
melifaro [Sun, 19 Jul 2020 10:53:15 +0000 (10:53 +0000)]
Temporarly revert r363319 to unbreak the build.

Reported by: CI
Pointy hat to: melifaro

3 years agoTransition from rtrequest1_fib() to rib_action().
melifaro [Sun, 19 Jul 2020 09:29:27 +0000 (09:29 +0000)]
Transition from rtrequest1_fib() to rib_action().

Remove all variations of rtrequest <rtrequest1_fib, rtrequest_fib,
 in6_rtrequest, rtrequest_fib> and their uses and switch to
to rib_action(). This is part of the new routing KPI.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision: https://reviews.freebsd.org/D25546

3 years agoloader: cstyle cleanup
tsoome [Sun, 19 Jul 2020 06:59:09 +0000 (06:59 +0000)]
loader: cstyle cleanup

No functional changes intended.

Sponsored by: Netflix, Klara Inc.

3 years agoamd64 pmap: microoptimize local shootdowns for PCID PTI configurations
kib [Sat, 18 Jul 2020 18:19:57 +0000 (18:19 +0000)]
amd64 pmap: microoptimize local shootdowns for PCID PTI configurations

When pmap operates in PTI mode, we must reload %cr3 on return to
userspace.  In non-PCID mode the reload always flushes all non-global
TLB entries and we take advantage of it by only invalidating the KPT
TLB entries (there is no cached UPT entries at all).

In PCID mode, we flush both KPT and UPT TLB explicitly, but we can
take advantage of the fact that PCID mode command to reload %cr3
includes a flag to flush/not flush target TLB.  In particular, we can
avoid the flush for UPT, instead record that load of pc_ucr3 into %cr3
on return to usermode should be flushing.  This is done by providing
either all-1s or ~CR3_PCID_MASK in pc_ucr3_load_mask.  The mask is
automatically reset to all-1s on return to usermode.

Similarly, we can avoid flushing UPT TLB on context switch, replacing
it by setting pc_ucr3_load_mask.  This unifies INVPCID and non-INVPCID
PTI ifunc, leaving only 4 cases instead of 6.  This trick is also
applicable both to the TLB shootdown IPI handlers, since handlers
interrupt the target thread.

But then we need to check pc_curpmap in handlers, and this would
reopen the same race for INVPCID machines as was fixed in r306350 for
non-INVPCID.  To not introduce the same bug, unconditionally do
spinlock_enter() in pmap_activate().

Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D25483

3 years agoo Move iommu_test_boundary() to sys/iommu.h
br [Sat, 18 Jul 2020 13:10:31 +0000 (13:10 +0000)]
o Move iommu_test_boundary() to sys/iommu.h
o Rename DMAR -> IOMMU in comments
o Add IOMMU_PAGE_SIZE / IOMMU_PAGE_MASK macroses
o x86 only: dmar_quirks_pre_use() / dmar_instantiate_rmrr_ctxs()

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25665

3 years agoRemove code which is not needed.
tuexen [Sat, 18 Jul 2020 13:10:02 +0000 (13:10 +0000)]
Remove code which is not needed.

MFC after: 1 week

3 years agobridge: Don't sleep during epoch
kp [Sat, 18 Jul 2020 12:43:11 +0000 (12:43 +0000)]
bridge: Don't sleep during epoch

While it doesn't trigger INVARIANTS or WITNESS on head it does in stable/12.
There's also no reason for it, as we can easily report the out of memory error
to the caller (i.e. userspace). All of these can already fail.

PR: 248046
MFC after: 3 days

3 years agoMake linux fallocate(2) return EOPNOTSUPP, not ENOSYS, on unsupported mode,
trasz [Sat, 18 Jul 2020 12:21:08 +0000 (12:21 +0000)]
Make linux fallocate(2) return EOPNOTSUPP, not ENOSYS, on unsupported mode,
as documented in the man page.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoBump the default linux version from 3.2.0 to 3.10.0, which corresponds
trasz [Sat, 18 Jul 2020 11:37:30 +0000 (11:37 +0000)]
Bump the default linux version from 3.2.0 to 3.10.0, which corresponds
to RHEL 7.  Required for DB2.

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