]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years ago[traceroute6] Don't do the casper bits when we're not doing casper
adrian [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.
mav [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 [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.
jhb [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.
rpokala [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
mjg [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 [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):
dim [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.
ae [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.
ae [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 [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 [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
tychon [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.
jhb [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.
rew [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.
jhb [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.
jhb [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>.
jhb [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 [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 [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.
hselasky [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
scottl [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
kp [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 [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

3 years agoFix write only mappings on arm64
andrew [Tue, 13 Oct 2020 10:26:15 +0000 (10:26 +0000)]
Fix write only mappings on arm64

When trapping on a wrote access to a buffer the kernel has mapped as write
only we should only pass the VM_PROT_WRITE flag. Previously the call to
vm_fault_trap as the VM_PROT_READ flag was unexpected.

Reported by: manu
Sponsored by: Innovate UK

3 years agoStop using -O instead of -O2 for MIPS
arichardson [Tue, 13 Oct 2020 08:14:33 +0000 (08:14 +0000)]
Stop using -O instead of -O2 for MIPS

Until clang 11 that was equivalent to -O2, but clang changed it to -O1 so
generated MIPS code will now be unnecessarily slow. It also removes a weird
special case from sys.mk.
This is similar to the D26471 change for debug kernels and should not change
anything since everything was previously building MIPS code at -O2 until the
clang 11 update.

Reviewed By: trasz
Differential Revision: https://reviews.freebsd.org/D26749

3 years agoDocument /boot/config as well as /boot.config
imp [Tue, 13 Oct 2020 05:39:43 +0000 (05:39 +0000)]
Document /boot/config as well as /boot.config

Add a note about /boot/config being an alternative location for this
information. Correct description of -P.

3 years agodevmatch: First appeared in 12.0
imp [Tue, 13 Oct 2020 05:32:00 +0000 (05:32 +0000)]
devmatch: First appeared in 12.0

Document that devmatch first appeared in FreeBSD 12.0. Also can't -> can not. But
it doesn't help the sentence much.

MFC After: 3 days

3 years agoDocument the rather suprising behavior with ' inside action rules.
imp [Tue, 13 Oct 2020 05:19:00 +0000 (05:19 +0000)]
Document the rather suprising behavior with ' inside action rules.

To prevent issues with odd shell characters appearing in, a surprising
shell feature is used. Document it and a workaround for it.

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

3 years agoForce __BMI__ experimental instructions off.
imp [Tue, 13 Oct 2020 04:37:57 +0000 (04:37 +0000)]
Force __BMI__ experimental instructions off.

The OpenZFS code that uses the BMI instructions is broken. Forcibly
disable them to prevent their use. When enabled, the build breaks.
This fixes the build when compiled for a core with BMI instructions.
This is the same fix committed in r364777, for the same issue.

Submitted by: Jung-uk Kim

3 years agoAdd back org.freebsd:zstd_compress to features_for_read
imp [Tue, 13 Oct 2020 03:49:12 +0000 (03:49 +0000)]
Add back org.freebsd:zstd_compress to features_for_read

This list is the of features that are allowed on the whole pool,
not the list of features that are implemented.

3 years agoTurn off zstd on aarch64
imp [Tue, 13 Oct 2020 02:36:16 +0000 (02:36 +0000)]
Turn off zstd on aarch64

loader support for zstd and zfs doesn't work for aarch64. Disable it
to unbreak the build.

3 years agoAdd zstd support to the boot loader.
imp [Mon, 12 Oct 2020 22:19:07 +0000 (22:19 +0000)]
Add zstd support to the boot loader.

Add support to the _STANDALONE environment enough bits of the kernel
that we can compile it. We still have a small zstd_shim.c since there
were 3 items that were a bit hard to nail down and may be cleaned up
in the future. These go hand in hand with a number of commits to
sys/sys in the past weeks, should this need be MFCd.

Discussed with: mmacy (in review and on IRC/Slack)
Reviewed by: freqlabs (on openzfs repo)
Differential Revision: https://reviews.freebsd.org/D26218

3 years agonewbus: use ssize_t to match sb's len and size, fix ordering of space check
imp [Mon, 12 Oct 2020 22:07:44 +0000 (22:07 +0000)]
newbus: use ssize_t to match sb's len and size, fix ordering of space check

Both s_len and s_size are ssize_t, so their differece is also more
properly a ssize_t not a size_t. Also, assert that len is <= size when
we enter. This should always be the case. Ensure that we have that one
byte that we write to the end of the buffer before we do so, though
the error should already be set on the buffer if not, and the only
times we supply 'partial' buffers they should be plenty large.

Reviewed by: cem, jhb (prior version, I did cem's suggestion)
Differential Revsion: https://reviews.freebsd.org/D26752

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Mon, 12 Oct 2020 21:35:29 +0000 (21:35 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-0-g176249bd673 (aka 11.0.0 release).

MFC after: 4 weeks
X-MFC-With: r364284

3 years agoBug fixes for the ads111x driver... make configurable gain and sample rate
ian [Mon, 12 Oct 2020 18:02:51 +0000 (18:02 +0000)]
Bug fixes for the ads111x driver... make configurable gain and sample rate
hints work on per-channel basis as documented, rather than chip-wide.  Also,
when configured via hints, return BUS_PROBE_NOWILDCARD on successful hints
match, so that the hints don't bogusly match other types of i2c chips.

3 years agopf tests: Test that 'set skip on <group>' works on new group members
kp [Mon, 12 Oct 2020 12:41:10 +0000 (12:41 +0000)]
pf tests: Test that 'set skip on <group>' works on new group members

There's a know issue where new group members don't get the 'set skip on'
applied until the rules are re-loaded.

Do this by setting rules that block all traffic, but skip members of the
'epair' group. If we can communicate over the epair interface we know the set
skip rule took effect, even if the rule was set before the interface was
created.

MFC after: 2 weeks

3 years agopf: create a kif for flags
kp [Mon, 12 Oct 2020 12:39:37 +0000 (12:39 +0000)]
pf: create a kif for flags

If userspace tries to set flags (e.g. 'set skip on <ifspec>') and <ifspec>
doesn't exist we should create a kif so that we apply the flags when the
<ifspec> does turn up.

Otherwise we'd end up in surprising situations where the rules say the
interface should be skipped, but it's not until the rules get re-applied.

Reviewed by: Lutz Donnerhacke <lutz_donnerhacke.de>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26742

3 years agoLink efi programs with -pie rather than -shared
arichardson [Mon, 12 Oct 2020 11:27:08 +0000 (11:27 +0000)]
Link efi programs with -pie rather than -shared

This was causing build failures in CheriBSD where we were passing -pie
already by default.

Reviewed By: andrew
Differential Revision: https://reviews.freebsd.org/D24787

3 years agoEnable SUBDIR_PARELLEL in lib/libclang_rt
arichardson [Mon, 12 Oct 2020 10:42:33 +0000 (10:42 +0000)]
Enable SUBDIR_PARELLEL in lib/libclang_rt

I noticed that this part of the build was taking much longer than
expected. Turns out it's due to not running the subdirs in parallel.
Reduces `make all` inside lib/libclang_rt time from 63s to 20s with -j32.

Reviewed By: dim
Differential Revision: https://reviews.freebsd.org/D26623

3 years agoFix build with -DBOOTSTRAP_ALL_TOOLS
arichardson [Mon, 12 Oct 2020 10:42:28 +0000 (10:42 +0000)]
Fix build with -DBOOTSTRAP_ALL_TOOLS

sbin/sysctl can no longer be bootstrapped on FreeBSD 12 after r366465,
so create a symlink to the host tool instead of trying to build it.

3 years agoFix buildworld on Linux/macOS after nvi update
arichardson [Mon, 12 Oct 2020 10:42:24 +0000 (10:42 +0000)]
Fix buildworld on Linux/macOS after nvi update

This re-applies r365941 which was lost in the nvi update.

3 years agoDon't use install(1) for the library symlinks in the build directory
arichardson [Mon, 12 Oct 2020 10:42:19 +0000 (10:42 +0000)]
Don't use install(1) for the library symlinks in the build directory

It appears this was changed from ln to use install in rS245752. I noticed
this because my buildenv was setting INSTALL=install -U -M //METALOG
and then these links fail to be created with the following error:
install: open //METALOG: Permission denied

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D26618

3 years agoFix building on Linux/macOS after r366622
arichardson [Mon, 12 Oct 2020 10:42:14 +0000 (10:42 +0000)]
Fix building on Linux/macOS after r366622

We have to bootstrap arc4random.c, so guard the FenestrasX code to avoid
using it on Linux/macOS.

Reviewed By: cem
Differential Revision: https://reviews.freebsd.org/D26738

3 years agoloader: edd_device_path_v3 is too small
tsoome [Mon, 12 Oct 2020 09:34:50 +0000 (09:34 +0000)]
loader: edd_device_path_v3 is too small

The EDD v3[1], see table 13, page 33, does define device path as double
qword, that is, 16 bytes, we have only qword.

Also remove edd_device_path_v4 and edd_params_v4 because those are not used,
and there is no size difference in v3 versus v4.

[1] http://www.t13.org/documents/UploadedDocuments/docs2004/d1572r3-EDD3.pdf

MFC after: 2 weeks

3 years agosystm.h: forward declare ucred for _STANDALONE too
imp [Mon, 12 Oct 2020 05:56:29 +0000 (05:56 +0000)]
systm.h: forward declare ucred for _STANDALONE too

There's a number of types we forward declare for the kernel. We need
struct ucred for the ZSTD ZFS integration, so go ahead and forward
declare it here too.

3 years ago10Gigabit Ethernet driver for AMD SoC
manu [Sun, 11 Oct 2020 16:01:16 +0000 (16:01 +0000)]
10Gigabit Ethernet driver for AMD SoC

This patch has the driver for 10Gigabit Ethernet controller in AMD
SoC. This driver is written compatible to the Iflib framework. The
existing driver is for the old version of hardware. The submitted
driver here is for the recent versions of the hardware where the Ethernet
controller is PCI-E based.

Submitted by: Rajesh Kumar <rajesh1.kumar@amd.com>
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D25793

3 years agoThe nextboot(8) manual page currently says that the loader(8) would delete
danfe [Sun, 11 Oct 2020 10:40:11 +0000 (10:40 +0000)]
The nextboot(8) manual page currently says that the loader(8) would delete
the /boot/nextboot.conf file or its contents which is 1) not the most user-
friendly way of working with custom configurations, and 2) simply not true
for both Forth and Lua implementations: they would not delete it, but just
change the setting to "NO", that is, disable it.

While at it, add one missing serial (Oxford) comma and fix some bogus line
wraps along the way.

Approved by: bcr (manpages)
Differential Revision: https://reviews.freebsd.org/D25971

3 years agoip_mroute: fix the viftable export sysctl
bz [Sun, 11 Oct 2020 00:01:00 +0000 (00:01 +0000)]
ip_mroute: fix the viftable export sysctl

It seems that in r354857 I got more than one thing wrong.
Convert the SYSCTL_OPAQUE to a SYSCTL_PROC to properly export the these
days allocated and not longer static per-vnet viftable array.
This fixes a problem with netstat -g which would show bogus information
for the IPv4 Virtual Interface Table.

PR: 246626
Reported by: Ozkan KIRIK (ozkan.kirik gmail.com)
MFC after: 3 days

3 years agorandom(4) FenestrasX: Push root seed version to arc4random(3)
cem [Sat, 10 Oct 2020 21:52:00 +0000 (21:52 +0000)]
random(4) FenestrasX: Push root seed version to arc4random(3)

Push the root seed version to userspace through the VDSO page, if
the RANDOM_FENESTRASX algorithm is enabled.  Otherwise, there is no
functional change.  The mechanism can be disabled with
debug.fxrng_vdso_enable=0.

arc4random(3) obtains a pointer to the root seed version published by
the kernel in the shared page at allocation time.  Like arc4random(9),
it maintains its own per-process copy of the seed version corresponding
to the root seed version at the time it last rekeyed.  On read requests,
the process seed version is compared with the version published in the
shared page; if they do not match, arc4random(3) reseeds from the
kernel before providing generated output.

This change does not implement the FenestrasX concept of PCPU userspace
generators seeded from a per-process base generator.  That change is
left for future discussion/work.

Reviewed by: kib (previous version)
Approved by: csprng (me -- only touching FXRNG here)
Differential Revision: https://reviews.freebsd.org/D22839

3 years agoarc4random(9): Integrate with RANDOM_FENESTRASX push-reseed
cem [Sat, 10 Oct 2020 21:48:06 +0000 (21:48 +0000)]
arc4random(9): Integrate with RANDOM_FENESTRASX push-reseed

There is no functional change for the existing Fortuna random(4)
implementation, which remains the default in GENERIC.

In the FenestrasX model, when the root CSPRNG is reseeded from pools due to
an (infrequent) timer, child CSPRNGs can cheaply detect this condition and
reseed.  To do so, they just need to track an additional 64-bit value in the
associated state, and compare it against the root seed version (generation)
on random reads.

This revision integrates arc4random(9) into that model without substantially
changing the design or implementation of arc4random(9).  The motivation is
that arc4random(9) is immediately reseeded when the backing random(4)
implementation has additional entropy.  This is arguably most important
during boot, when fenestrasX is reseeding at 1, 3, 9, 27, etc., second
intervals.  Today, arc4random(9) has a hardcoded 300 second reseed window.
Without this mechanism, if arc4random(9) gets weak entropy during initial
seed (and arc4random(9) is used early in boot, so this is quite possible),
it may continue to emit poorly seeded output for 5 minutes.  The FenestrasX
push-reseed scheme corrects consumers, like arc4random(9), as soon as
possible.

Reviewed by: markm
Approved by: csprng (markm)
Differential Revision: https://reviews.freebsd.org/D22838

3 years agoAdd "Fenestras X" alternative /dev/random implementation
cem [Sat, 10 Oct 2020 21:45:59 +0000 (21:45 +0000)]
Add "Fenestras X" alternative /dev/random implementation

Fortuna remains the default; no functional change to GENERIC.

Big picture:
- Scalable entropy generation with per-CPU, buffered local generators.
- "Push" system for reseeding child generators when root PRNG is
  reseeded.  (Design can be extended to arc4random(9) and userspace
  generators.)
- Similar entropy pooling system to Fortuna, but starts with a single
  pool to quickly bootstrap as much entropy as possible early on.
- Reseeding from pooled entropy based on time schedule.  The time
  interval starts small and grows exponentially until reaching a cap.
  Again, the goal is to have the RNG state depend on as much entropy as
  possible quickly, but still periodically incorporate new entropy for
  the same reasons as Fortuna.

Notable design choices in this implementation that differ from those
specified in the whitepaper:
- Blake2B instead of SHA-2 512 for entropy pooling
- Chacha20 instead of AES-CTR DRBG
- Initial seeding.  We support more platforms and not all of them use
  loader(8).  So we have to grab the initial entropy sources in kernel
  mode instead, as much as possible.  Fortuna didn't have any mechanism
  for this aside from the special case of loader-provided previous-boot
  entropy, so most of these sources remain TODO after this commit.

Reviewed by: markm
Approved by: csprng (markm)
Differential Revision: https://reviews.freebsd.org/D22837

3 years agopnfsdsfile(8): Remove dublicate word 'the'
gbe [Sat, 10 Oct 2020 14:38:01 +0000 (14:38 +0000)]
pnfsdsfile(8): Remove dublicate word 'the'

MFC after: 1 week

3 years agocxgbetool(8): Remove dublicate word 'whether'
gbe [Sat, 10 Oct 2020 14:36:16 +0000 (14:36 +0000)]
cxgbetool(8): Remove dublicate word 'whether'

MFC after: 1 week

3 years agoman5: Fix a few typos spotted by igor
gbe [Sat, 10 Oct 2020 14:20:07 +0000 (14:20 +0000)]
man5: Fix a few typos spotted by igor

- fstab(5): conjuction -> conjunction
- mount.conf(5): repeated 'the'
- periodic.conf(5): Partion ->  Partition

MFC after: 1 week

3 years agols(1): Use \& as an escape character for the ',' option
gbe [Sat, 10 Oct 2020 13:39:13 +0000 (13:39 +0000)]
ls(1): Use \& as an escape character for the ',' option

Reported by: karels@, xtouqh at hotmail dot com
MFC after: 1 day

3 years agocpuset(1): Fix a typo
gbe [Sat, 10 Oct 2020 13:01:04 +0000 (13:01 +0000)]
cpuset(1): Fix a typo

- 'at at' -> 'at a'

MFC after: 1 week

3 years agosigevent(3): Fix a typo
gbe [Sat, 10 Oct 2020 12:06:39 +0000 (12:06 +0000)]
sigevent(3): Fix a typo

- asychronous -> asynchronous

MFC after: 1 week

3 years agodtrace_audit(4): Fix a typo
gbe [Sat, 10 Oct 2020 12:05:54 +0000 (12:05 +0000)]
dtrace_audit(4): Fix a typo

- asynchonously -> asynchronously

MFC after: 1 week

3 years agoarm: Check dtb version against the one we're expecting to find
manu [Sat, 10 Oct 2020 07:20:59 +0000 (07:20 +0000)]
arm: Check dtb version against the one we're expecting to find

Reviewed by: imp, emaste, mmel
Differential Revision: https://reviews.freebsd.org/D26725

3 years agoBrand our DTS with the Linux version it was imported from
manu [Sat, 10 Oct 2020 07:18:51 +0000 (07:18 +0000)]
Brand our DTS with the Linux version it was imported from

DTS must be synced with the kernel, add a freebsd,dts-version string in
the root node of each DTS that we compile so we can later in the kernel
check that it contain a correct value.

Reviewed by: imp, mmel
Differential Revision: https://reviews.freebsd.org/D26724

3 years agozfs: use cache_rename
mjg [Sat, 10 Oct 2020 04:18:49 +0000 (04:18 +0000)]
zfs: use cache_rename

3 years agovfs: support lockless dirfd lookups
mjg [Sat, 10 Oct 2020 03:48:17 +0000 (03:48 +0000)]
vfs: support lockless dirfd lookups

3 years agomodules/crypto: reenable assembly optimized skein implementation
emaste [Sat, 10 Oct 2020 01:13:14 +0000 (01:13 +0000)]
modules/crypto: reenable assembly optimized skein implementation

r366344 corrected the optimized amd64 skein assembly implementation, so
we can now enable it again.

Also add a dependency on this Makefile for the skein_block object, so
that it will be rebuit (similar to r366362).

PR: 248221
Sponsored by: The FreeBSD Foundation

3 years agoModify mountd.c so that it does not always malloc 4K for the map credentials.
rmacklem [Sat, 10 Oct 2020 00:01:40 +0000 (00:01 +0000)]
Modify mountd.c so that it does not always malloc 4K for the map credentials.

r362163 upgraded mountd so that it could handle MAX_NGROUPS
groups for the anonymous user credentials (the ones provided by
-maproot and -mapall exports options).
The problem is that this resulted in every export structure growing by
about 4Kbytes, because the cr_groups field went from 16->MAX_NGROUPS.

This patch fixes this by only including a small 32 element cr_groups in the
structure and then malloc()'ng cr_groups when a larger one is needed.
The value of SMALLNGROUPS is arbitrarily set to 32, assuming most users
used by -maproot or -mapall will be in <= 32 groups.

Reviewed by: kib, freqlabs
Differential Revision: https://reviews.freebsd.org/D26521

3 years agoUse unlocked page lookup for inmem() to avoid object lock contention
bdrewery [Fri, 9 Oct 2020 23:49:42 +0000 (23:49 +0000)]
Use unlocked page lookup for inmem() to avoid object lock contention

Reviewed By: kib, markj
Submitted by: mlaier
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D26653

3 years agocxgbe(4): More fixes for the T6 FCS error counter.
np [Fri, 9 Oct 2020 22:23:39 +0000 (22:23 +0000)]
cxgbe(4): More fixes for the T6 FCS error counter.

r365732 was the first attempt to get an accurate count but it was
writing to some read-only registers to clear them and that obviously
didn't work.  Instead, note the counter's value when it is supposed to
be cleared and subtract it from future readings.

dev.<port>.stats.rx_fcs_error should not be serviced from the MPS
register for T6.

The stats.* sysctls should all use T5_PORT_REG for T5 and above.  This
must have been missed in the initial T5 support years ago.  Fix it while
here.

MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agovfs: fix a panic when truncating comming from copy_file_range
mjg [Fri, 9 Oct 2020 20:31:42 +0000 (20:31 +0000)]
vfs: fix a panic when truncating comming from copy_file_range

Truncating requires an exclusive lock, but it was not taken if the
filesystem indicates support for shared writes. This only concerns
ZFS.

In particular fixes cp of files which have trailing holes.

Reported by: bdrewery

3 years agoDon't invoke semunload() if seminit() fails during MOD_LOAD.
jhb [Fri, 9 Oct 2020 20:20:42 +0000 (20:20 +0000)]
Don't invoke semunload() if seminit() fails during MOD_LOAD.

The module handler code invokes a MOD_UNLOAD event immediately if
MOD_LOAD fails.  The result was that if seminit() failed, semunload()
was invoked twice.  semunload() is not idempotent however and would
try to remove it's process_exit eventhandler twice resulting in a
panic.

Reviewed by: kib, markj
Obtained from: CheriBSD
MFC after: 1 month
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26696

3 years agoFix a few mandoc issues
gbe [Fri, 9 Oct 2020 19:12:44 +0000 (19:12 +0000)]
Fix a few mandoc issues

- skipping paragraph macro: Pp after Sh
- sections out of conventional order: Sh EXAMPLES
- whitespace at end of input line
- normalizing date format

3 years agocache: fix vexec panic when racing against vgone
mjg [Fri, 9 Oct 2020 19:10:00 +0000 (19:10 +0000)]
cache: fix vexec panic when racing against vgone

Use of dead_vnodeops would result in a panic instead of returning the intended
EOPNOTSUPP error.

While here make sure to abort, not just try to return a partial result.
The former allows the regular lookup to restart from scratch, while the latter
makes it stuck with an unusable vnode.

Reported by: kevans

3 years agobpf(4): Update the man page to reflect reality
gbe [Fri, 9 Oct 2020 15:50:50 +0000 (15:50 +0000)]
bpf(4): Update the man page to reflect reality

PR: 131918
Submitted by: guy at alum dot mit dot edu
Reviewed by: gnn, gbe
Approved by: gnn
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25993

3 years agoRemove gratuitous use of '' around arguments
imp [Fri, 9 Oct 2020 15:45:34 +0000 (15:45 +0000)]
Remove gratuitous use of '' around arguments

There's no need to use ' here, so remove it. This use causes no
problems, but is a bad example.

3 years agoAvoid using single quotes in arguments to logger.
imp [Fri, 9 Oct 2020 15:29:05 +0000 (15:29 +0000)]
Avoid using single quotes in arguments to logger.

Single quotes interfere with the workaround put in with r335753 and
aren't necessary in this case. I believe that all the underling issues
with r335753 have been corrected, but need to do more extensive
followup before reverting it as a bad idea.

PR: 240411
MFC After: 2 days (to give it time to get into 12.2)

3 years agocol(1): Fix a couple of bugs
markj [Fri, 9 Oct 2020 15:27:37 +0000 (15:27 +0000)]
col(1): Fix a couple of bugs

- When flushing extra lines after all input has been processed, make
  sure that local state is reinitialized correctly.
- When -f is specified, make sure to end output with a full newline.
- Fix some style issues and update comments.
- Add some regression tests.

PR: 249308
Submitted by: Yang Zhong <yzhong@freebsdfoundation.org>
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D26536

3 years agosyslogd: Avoid trimming host names in RFC 5424 mode
markj [Fri, 9 Oct 2020 15:19:29 +0000 (15:19 +0000)]
syslogd: Avoid trimming host names in RFC 5424 mode

RFC 5424 says that implementations should log hostnames in FQDN
format.  Only trim host names in RFC 3164 mode.

PR: 250014
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D26644

3 years agoFix a few mandoc issues
gbe [Fri, 9 Oct 2020 15:14:19 +0000 (15:14 +0000)]
Fix a few mandoc issues

- whitespace at end of input line
- skipping paragraph macro: Pp at the end of Sh
- new sentence, new line
- consider using OS macro: Fx
- AUTHORS section without An macro
- skipping paragraph macro: Pp before Ss

3 years agoRISC-V LINT kernel config
mhorne [Fri, 9 Oct 2020 14:45:41 +0000 (14:45 +0000)]
RISC-V LINT kernel config

Create the RISC-V NOTES and LINT files. As of r366559, LINT configs are
no longer generated but checked in to the tree.

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

3 years agoAdd DSCP support for network QoS to iscsi initiator.
rscheff [Fri, 9 Oct 2020 14:33:09 +0000 (14:33 +0000)]
Add DSCP support for network QoS to iscsi initiator.

Allow the DSCP codepoint also to be configurable
for the traffic in the direction from the initiator
to the target, such that writes and any requests
are also treated in the appropriate QoS class.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26714

3 years agoFix a few mandoc issues
gbe [Fri, 9 Oct 2020 14:03:45 +0000 (14:03 +0000)]
Fix a few mandoc issues

- no blank before trailing delimiter
- whitespace at end of input line
- sections out of conventional order
- normalizing date format
- AUTHORS section without An macro

3 years agoAdd iommu_get_dev_ctx() helper that allows to instantiate an iommu context
br [Fri, 9 Oct 2020 13:11:14 +0000 (13:11 +0000)]
Add iommu_get_dev_ctx() helper that allows to instantiate an iommu context
for a given device_t.

Submitted by: andrew
Reviewed by: kib
Sponsored by: DARPA, AFRL

3 years agoStop sending tiny new data segments during SACK recovery
rscheff [Fri, 9 Oct 2020 12:44:56 +0000 (12:44 +0000)]
Stop sending tiny new data segments during SACK recovery

Consider the currently in-use TCP options when
calculating the amount of new data to be injected during
SACK loss recovery. That addresses the effect that very small
(new) segments could be injected on partial ACKs while
still performing a SACK loss recovery.

Reported by: Liang Tian
Reviewed by: tuexen, chengc_netapp.com
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26446

3 years agoAdd IP(V6)_VLAN_PCP to set 802.1 priority per-flow.
rscheff [Fri, 9 Oct 2020 12:06:43 +0000 (12:06 +0000)]
Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow.

This adds a new IP_PROTO / IPV6_PROTO setsockopt (getsockopt)
option IP(V6)_VLAN_PCP, which can be set to -1 (interface
default), or explicitly to any priority between 0 and 7.

Note that for untagged traffic, explicitly adding a
priority will insert a special 801.1Q vlan header with
vlan ID = 0 to carry the priority setting

Reviewed by: gallatin, rrs
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26409

3 years agoFix EINVAL message when CPU binding information is requested for IRQ.
ae [Fri, 9 Oct 2020 11:24:19 +0000 (11:24 +0000)]
Fix EINVAL message when CPU binding information is requested for IRQ.

`cpuset -g -x N` along with requested information always prints
message `cpuset: getdomain: Invalid argument'. The EINVAL is returned
from kern_cpuset_getdomain(), since it doesn't expect CPU_LEVEL_WHICH
and CPU_WHICH_IRQ parameters.

To fix the error, do not call cpuset_getdomain() when `-x' is specified.

MFC after: 1 week

3 years agoExtend netstat to display TCP stack and detailed congestion state (2)
rscheff [Fri, 9 Oct 2020 10:55:19 +0000 (10:55 +0000)]
Extend netstat to display TCP stack and detailed congestion state (2)

Extend netstat to display TCP stack and detailed congestion state

Adding the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, which adds the relevant variables into
xtcpcb. As previous "spare" space is used, these changes are ABI
compatible.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26518

3 years agoExtend netstat to display TCP stack and detailed congestion state
rscheff [Fri, 9 Oct 2020 10:07:41 +0000 (10:07 +0000)]
Extend netstat to display TCP stack and detailed congestion state

Adding the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, which adds the relevant variables into
xtcpcb. As previous "spare" space is used, these changes are ABI
compatible.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26518

3 years agoMFV: r366539
jkim [Fri, 9 Oct 2020 05:27:02 +0000 (05:27 +0000)]
MFV: r366539

Merge ACPICA 20200925.

3 years agoCorrect the primary to find(1)
lwhsu [Fri, 9 Oct 2020 04:03:57 +0000 (04:03 +0000)]
Correct the primary to find(1)

Sponsored by: The FreeBSD Foundation

3 years agoRemove now-unused files
imp [Fri, 9 Oct 2020 01:48:21 +0000 (01:48 +0000)]
Remove now-unused files

makeLINT.mk isn't needed or used anymore, remove it and all the files
it uses.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540

3 years agoCreate in-tree LINT files
imp [Fri, 9 Oct 2020 01:48:14 +0000 (01:48 +0000)]
Create in-tree LINT files

Now that config(8) has supported include for 19 years, transition to
including the NOTES files. include support didn't exist at the time,
nor did the envvar stuff recently added. Now that it does, eliminate
the building of LINT files by just including everything you need.

Note: This may cause conflicts with updating in some cases.
find sys -name LINT\* -rm
is suggested across this commit to remove the generated LINT
files.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540

3 years agoMake vn_generic_copy_file_range() interruptible via a signal.
rmacklem [Fri, 9 Oct 2020 01:04:28 +0000 (01:04 +0000)]
Make vn_generic_copy_file_range() interruptible via a signal.

Without this patch, when vn_generic_copy_file_range() is
doing a large copy, it will remain in the function for a
considerable amount of time, delaying handling of any
outstanding signals until the copy completes.

This patch adds checks for signals that need to be
processed after each successful data copy cycle.
When sig_intr() returns non-zero, vn_generic_copy_file_range()
will return.
The check "if (len < savlen)" ensures that some data
has been copied, so that progress will be made.

Note that, since copy_file_range(2) is allowed to
return fewer bytes copied than requested, it
will never return EINTR/ERESTART when sig_intr()
returns non-zero.

Reviewed by: kib, asomers
Differential Revision: https://reviews.freebsd.org/D26620

3 years agoStop ignoring makeLINT generated files
imp [Fri, 9 Oct 2020 00:27:45 +0000 (00:27 +0000)]
Stop ignoring makeLINT generated files

We're going to check these files in shortly since we don't need to
generate them anymore. Generated files cause issues for different work
flows anyway.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540

3 years agoEliminate building LINT makefiles
imp [Fri, 9 Oct 2020 00:27:40 +0000 (00:27 +0000)]
Eliminate building LINT makefiles

LINT config files are about to be checked in directly. Eliminate
building them by hand here from NOTES files.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540

3 years agoInitial support for implementing the bootXXX.efi workaround
imp [Fri, 9 Oct 2020 00:16:26 +0000 (00:16 +0000)]
Initial support for implementing the bootXXX.efi workaround

Too many version of UEFI firmware (so far only confirmed on amd64)
don't really support efibootmgr selection of boot. That's the most
reliable, when it works, since there's no guesswork. However, many do
not save, unmolested, the variables that efibootmgr sets, so as a
fallback we also install loader.efi as bootXXX.efi (where XXX is
either aa64 or x64) if it doesn't already exist in /efi/boot on the
ESP. The standard only defines this for removable devices, but it's
almost ubiquitously used as a fallback. Many BIOSes implement a drive
selection feature that takes over the efibootmgr protocol, rendinering
it useless (either generally, or for those vendors not on the short
list). bootxxx.efi works around this. However, we don't install it
unconditionally there, as that breaks some popular multi-boot setups.

MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D26428

3 years agovm_page_dump_index_to_pa(): Add braces to the expression involving + and &.
kib [Thu, 8 Oct 2020 22:46:15 +0000 (22:46 +0000)]
vm_page_dump_index_to_pa(): Add braces to the expression involving + and &.

The precedence of the '&' operator is less than of '+'.  Added braces
do change the order of evaluation into the natural one, in my opinion.
On the other hand, the value of the expression should not change since
all elements should have page-aligned values.

This fixes a gcc warning reported.

Reported by: adrian
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoDo not leak B_BARRIER.
kib [Thu, 8 Oct 2020 22:41:02 +0000 (22:41 +0000)]
Do not leak B_BARRIER.

Normally when a buffer with B_BARRIER is written, the flag is cleared
by g_vfs_strategy() when creating bio.  But in some cases FFS buffer
might not reach g_vfs_strategy(), for instance when copy-on-write
reports an error like ENOSPC.  In this case buffer is returned to
dirty queue and might be written later by other means.  Among then
bdwrite() reasonably asserts that B_BARRIER is not set.

In fact, the only current use of B_BARRIER is for lazy inode block
initialization, where write of the new inode block is fenced against
cylinder group write to mark inode as used.  The situation could be
seen that we break dependency by updating cg without written out
inode.  Practically since CoW was not able to find space for a copy of
inode block, for the same reason cg group block write should fail.

Reported by: pho
Discussed with: chs, imp, mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26511

3 years agosig_intr(9): return early if AST is not scheduled.
kib [Thu, 8 Oct 2020 22:34:34 +0000 (22:34 +0000)]
sig_intr(9): return early if AST is not scheduled.

Check td_flags for relevant AST requests lock-less.  This opens the
race slightly wider where sig_intr() returns false negative, but might
be it is worth it.

Requested by: mjg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoDo not allow to use O_BENEATH as an oracle.
kib [Thu, 8 Oct 2020 22:31:11 +0000 (22:31 +0000)]
Do not allow to use O_BENEATH as an oracle.

Specifically, if lookup() returned any error and the topping directory
was not latched, which means that (non-existent) path did not returned
to the topping location, give ENOTCAPABLE a priority over the lookup()
error.

PR: 249960
Reviewed by: emaste, ngie
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26695

3 years ago[PowerPC] add machdep.uprintf_signal sysctl
alfredo [Thu, 8 Oct 2020 22:00:31 +0000 (22:00 +0000)]
[PowerPC] add machdep.uprintf_signal sysctl

Add support for sysctl 'machdep.uprintf_signal' that prints debugging
information on trap signal.

Reviewed by: jhibbits, luporl, bdragon
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D26004

3 years agotimer_restore is now unused, remove it
imp [Thu, 8 Oct 2020 20:56:11 +0000 (20:56 +0000)]
timer_restore is now unused, remove it

apm was the only consumer of timer_restore. Now that it's gone, this
can be removed.