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

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

Reported by: ota@j.email.ne.jp
PR: 254001
MFC after: 3 days

3 years agocxgbe(4): Fix an assertion that is not valid during attach.
Navdeep Parhar [Fri, 5 Mar 2021 19:28:18 +0000 (11:28 -0800)]
cxgbe(4): Fix an assertion that is not valid during attach.

Firmware access from t4_attach takes place without any synchronization.
The driver should not panic (debug kernels) if something goes wrong in
early communication with the firmware.  It should still load so that
it's possible to poke around with cxgbetool.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoOnly set delayed inval for procs using PTI
Eric van Gyzen [Fri, 5 Mar 2021 16:31:43 +0000 (10:31 -0600)]
Only set delayed inval for procs using PTI

invltlb_invpcid_pti_handler() was requesting delayed TLB invalidation
even for processes that aren't using PTI.  With an out-of-tree
change to avoid PTI for non-jailed root processes, this caused an
assertion failure in pmap_activate_sw_pcid_pti() when context-switching
between PTI and non-PTI processes.

Reviewed by: bdrewery kib tychon
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29094

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

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

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

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

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

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

3 years agopoly1305: Don't export generic Poly1305_* symbols from xform_poly1305.c.
John Baldwin [Fri, 5 Mar 2021 17:47:58 +0000 (09:47 -0800)]
poly1305: Don't export generic Poly1305_* symbols from xform_poly1305.c.

There currently isn't a need to provide a public interface to a
software Poly1305 implementation beyond what is already available via
libsodium's APIs and these symbols conflict with symbols shared within
the ossl.ko module between ossl_poly1305.c and ossl_chacha20.c.

Reported by: se, kp
Fixes: 78991a93eb9d
Sponsored by: Netflix

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

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

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

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agotcp: remove a superfluous local var in tcp_sack_partialack()
Richard Scheffenegger [Fri, 5 Mar 2021 17:19:16 +0000 (18:19 +0100)]
tcp: remove a superfluous local var in tcp_sack_partialack()

No functional change.

Reviewed By: #transport, tuexen
MFC after:   3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29088

3 years agotcp: remove incorrect reset of SACK variable in PRR
Richard Scheffenegger [Fri, 5 Mar 2021 16:45:23 +0000 (17:45 +0100)]
tcp: remove incorrect reset of SACK variable in PRR

Reviewed By:   #transport, rrs, tuexen
PR:            253848
MFC after:     3 days
Sponsored By:  NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29083

3 years agorack: unbreak TCP fast open for the client side
Michael Tuexen [Fri, 5 Mar 2021 14:57:26 +0000 (15:57 +0100)]
rack: unbreak TCP fast open for the client side

Allow sending user data on the SYN segment.

Reviewed by: rrs
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29082
Sponsored by: Netflix, Inc.

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

It was missed in the latest merge.

X-MFC-with: caed7b1c399de04279822028e15b36367e84232f

3 years agobc: Vendor import new version 3.3.3
Stefan Eßer [Fri, 5 Mar 2021 10:30:11 +0000 (11:30 +0100)]
bc: Vendor import new version 3.3.3

3 years agosbin/ifconfig: Minor housekeeping
Ryan Moeller [Sun, 28 Feb 2021 02:08:43 +0000 (02:08 +0000)]
sbin/ifconfig: Minor housekeeping

Coalesce adjacent lint ifdefs.
Fix spelling of nitems.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29022

3 years agosbin/ifconfig: Get media status with libifconfig
Ryan Moeller [Sun, 28 Feb 2021 20:27:28 +0000 (20:27 +0000)]
sbin/ifconfig: Get media status with libifconfig

Code deduplication.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29030

3 years agolibifconfig: Overhaul ifconfig_media_* interfaces
Ryan Moeller [Tue, 2 Mar 2021 10:29:17 +0000 (10:29 +0000)]
libifconfig: Overhaul ifconfig_media_* interfaces

Define an ifmedia_t type to use for ifmedia words.

Add ifconfig_media_lookup_* functions to lookup ifmedia words by name.

Get media options as an array of option names rather than formatting it
as a comma-delimited list into a buffer.

Sprinkle const on static the static description tables for peace of
mind.

Don't need to zero memory allocated by calloc.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29029

3 years agopchtherm: fix a wrong bit and a wrong register use
Michal Vanco [Fri, 5 Mar 2021 08:55:30 +0000 (10:55 +0200)]
pchtherm: fix a wrong bit and a wrong register use

Probably just copy-paste errors that slipped in.

PR: 253915
Reported by: Michal Vanco <michal.vanco@gmail.com>
MFC after: 1 week

3 years agopf: Mark struct pf_pdesc as kernel only
Kristof Provost [Wed, 3 Mar 2021 09:28:14 +0000 (10:28 +0100)]
pf: Mark struct pf_pdesc as kernel only

This structure is only used by the kernel module internally. It's not
shared with user space, so hide it behind #ifdef _KERNEL.

Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoHyper-V: hn: Store host hash value in flowid
Wei Hu [Wed, 24 Feb 2021 05:07:46 +0000 (05:07 +0000)]
Hyper-V: hn: Store host hash value in flowid

When rx packet contains hash value sent from host, store it in
the mbuf's flowid field so when the same mbuf is on the tx path,
the hash value can be used by the host to determine the outgoing
network queue.

MFC after: 2 weeks
Sponsored by: Microsoft

3 years agoktls: Fix CBC encryption when input and output iov sizes are different
Mark Johnston [Fri, 5 Mar 2021 03:45:40 +0000 (22:45 -0500)]
ktls: Fix CBC encryption when input and output iov sizes are different

Reported by: gallatin
Tested by: gallatin
Fixes: 49f6925ca
Differential Revision: https://reviews.freebsd.org/D29073

3 years agoriscv: fix errors in some atomic type aliases
Mitchell Horne [Thu, 4 Mar 2021 17:52:45 +0000 (13:52 -0400)]
riscv: fix errors in some atomic type aliases

This appears to be a copy-and-paste error that has simply been
overlooked. The tree contains only two calls to any of the affected
variants, but recent additions to the test suite started exercising the
call to atomic_clear_rel_int() in ng_leave_write(), reliably causing
panics.

Apparently, the issue was inherited from the arm64 atomic header. That
instance was addressed in c90baf6817a0, but the fix did not make its way
to RISC-V.

Note that the particular test case ng_macfilter_test:main still appears
to fail on this platform, but this change reduces the panic to a
timeout.

PR: 253237
Reported by: Jenkins, arichardson
Reviewed by: kp, arichardson
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29064

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

Clang commit ccb4124a4172bf2cb2e1cd7c253f0f1654fce294:

Fix -gz=zlib options for linker

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

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

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

This patch fixes that.

Clang commit 462cf39a5c180621b56f7602270ce33eb7b68d23:

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

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

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

3 years agoaltq: Increase maximum number of CBQ and HFSC classes
Kristof Provost [Wed, 3 Mar 2021 10:06:49 +0000 (11:06 +0100)]
altq: Increase maximum number of CBQ and HFSC classes

In some configurations we need more classes than ALTQ supports by
default.  Increase the maximum number of classes we allow.
This will only cost us a comparatively trivial amount of memory, so
there's little reason not to do so.

If ever we find we want even more we may want to consider turning these
defines into a tunable, but for now do the easy thing.

Reviewed by: donner@
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29034

3 years agonet: Introduce IPV6_DSCP(), IPV6_ECN() and IPV6_TRAFFIC_CLASS() macros
Kristof Provost [Thu, 4 Mar 2021 10:26:40 +0000 (11:26 +0100)]
net: Introduce IPV6_DSCP(), IPV6_ECN() and IPV6_TRAFFIC_CLASS() macros

Introduce convenience macros to retrieve the DSCP, ECN or traffic class
bits from an IPv6 header.

Use them where appropriate.

Reviewed by: ae (previous version), rscheff, tuexen, rgrimes
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29056

3 years agopf: Retrieve DSCP value from the IPv6 header
Kristof Provost [Wed, 3 Mar 2021 20:33:42 +0000 (21:33 +0100)]
pf: Retrieve DSCP value from the IPv6 header

Teach pf to read the DSCP value from the IPv6 header so that we can
match on them.

Reviewed by: donner
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29048

3 years agojail(8): reset to root cpuset before attaching to run commands
Kyle Evans [Thu, 4 Mar 2021 19:28:53 +0000 (13:28 -0600)]
jail(8): reset to root cpuset before attaching to run commands

Recent changes have made it such that attaching to a jail will augment
the attaching process' cpu mask with the jail's cpuset. While this is
convenient for allowing the administrator to cpuset arbitrary programs
that will attach to a jail, this is decidedly not convenient for
executing long-running daemons during jail creation.

This change inserts a reset of the process cpuset to the root cpuset
between the fork and attach to execute a command. This allows commands
executed to have the widest mask possible, and the administrator can
cpuset(1) it back down inside the jail as needed.

With this applied, one should be able to change a jail's cpuset at
exec.poststart in addition to exec.created.  The former was made
difficult if jail(8) itself was running with a constrained set, as then
some processes may have been spawned inside the jail with a non-root
set.  The latter is the preferred option so that processes starting in
the jail are constrained appropriately up front.

Note that all system commands are still run with the process' initial
cpuset applied.

PR: 253724
MFC after: 3 days
Reviewed by: jamie
Differential Revision: https://reviews.freebsd.org/D29008

3 years agotruss: split counting of syscalls and syscall calling convention
Alex Richardson [Thu, 4 Mar 2021 18:28:25 +0000 (18:28 +0000)]
truss: split counting of syscalls and syscall calling convention

This change is a refactoring cleanup to improve support for compat32
syscalls (and compat64 on CHERI systems). Each process ABI now has it's
own struct sycall instead of using one global list. The list of all
syscalls is replaced with a list of seen syscalls. Looking up the syscall
argument passing convention now interates over the fixed-size array instead
of using a link-list that's populated on startup so we no longer need the
init_syscall() function.
The actual functional changes are in D27625.

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D27636

3 years agoSilence annoying and incorrect non-default linker warning with GCC
Alex Richardson [Thu, 4 Mar 2021 18:27:37 +0000 (18:27 +0000)]
Silence annoying and incorrect non-default linker warning with GCC

The CROSS_TOOLCHAIN GCC .mk files include -B${CROSS_BINUTILS_PREFIX}, so
GCC will select the right linker and we don't need to warn.
While here also apply 17b8b8fb5fc4acc832dabfe7ef11e3e1d399ad0f to kern.mk.

Test Plan: no more warning printed with CROSS_TOOLCHAIN=mips-gcc6
Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D29015

3 years agoRemove unnecessary semicolon from CRITICAL_ASSERT()
Alex Richardson [Thu, 4 Mar 2021 15:06:32 +0000 (15:06 +0000)]
Remove unnecessary semicolon from CRITICAL_ASSERT()

This fixes off-by-default "empty statement" compiler warnings.

3 years agosys/arm64/arm64/vfp.c: Fix -Wunused and -Wpointer-sign warnings
Alex Richardson [Thu, 4 Mar 2021 14:55:29 +0000 (14:55 +0000)]
sys/arm64/arm64/vfp.c: Fix -Wunused and -Wpointer-sign warnings

These are off by default but were flagged by my IDE while adding some
debugging printfs for D29060.

3 years agomvebu_gpio: Multiple fixes.
Michal Meloun [Wed, 3 Mar 2021 17:28:45 +0000 (18:28 +0100)]
mvebu_gpio: Multiple fixes.

- gpio register access primitives
- locking in interrupt path
- cleanup

In cooperation with: mw
Reviewed by: mw (initial version)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D29044
Differential Revision: https://reviews.freebsd.org/D28911

3 years agosimple_mfd: switch to controllable locking for syscon provider.
Michal Meloun [Thu, 4 Mar 2021 14:09:32 +0000 (15:09 +0100)]
simple_mfd: switch to controllable locking for syscon provider.

MFC after 3 weeks

3 years agolink_elf_obj: Handle init_array sections in KLDs
Mark Johnston [Thu, 4 Mar 2021 15:02:47 +0000 (10:02 -0500)]
link_elf_obj: Handle init_array sections in KLDs

Reuse existing handling for .ctors, print a warning if multiple
constructor sections are present.   Destructors are not handled as of
yet.

This is required for KASAN.

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

3 years agoFix creating the early arm64 level 2 blocks
Andrew Turner [Thu, 4 Mar 2021 14:00:19 +0000 (14:00 +0000)]
Fix creating the early arm64 level 2 blocks

In 48ba9b2669e6 we switched from creating level 1 blocks to smaller
level 2 blocks when creating the early arm64 page tables. On issue
was that they had a different meaning for register x7. The former used
it to hold page table attributes, while the latter held just the memory
type. This caused these attributes to be incorrectly shifted.

Fix this by changing the meaning of x7 to hold the block attributes
and fix the only caller that used the old meaning.

Most hardware seems to have handled the bits being off however qemu
failed to boot as reserved bits that should be zero were being set and
qemu fails to clear these when translating from a virtual address to a
physical address.

Sponsored by: Innovate UK

3 years agoModernize geom_stats_snapshot_get
Alan Somers [Wed, 3 Mar 2021 20:06:38 +0000 (13:06 -0700)]
Modernize geom_stats_snapshot_get

* A logically useless memset() is used to fault in some memory pages.
  Change it to explicit_bzero so the compiler won't eliminate it.

* Eliminate the second memset.  It made sense in the days of the Big
  Kernel Lock, but not in the days of fine-grained SMP and especially
  not in the days of VDSO.

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

3 years agorelease: sprinkle UNAME_r hacks following c883b6fd8ccd
Glen Barber [Thu, 4 Mar 2021 14:22:45 +0000 (09:22 -0500)]
release: sprinkle UNAME_r hacks following c883b6fd8ccd

Pass UNAME_r override to make(1) for ports builds when building
ports for another branch.

MFC after: 3 days
MFC with: 0be274d3737980ab50e1de19c883b6fd8ccd
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agocompress(1): warn about link handling
Fernando Apesteguía [Tue, 9 Feb 2021 09:11:22 +0000 (10:11 +0100)]
compress(1): warn about link handling

compress(1) handles links badly and does not provide link-handling options.
Document this behavior.

PR:     84271
Submitted by: garys@opusnet.com
Approved by: gbe@ (mentor)
Differential Revision: https://reviews.freebsd.org/D28552

3 years agorelease: fix VMSIZE following 1ca8842f3ad9
Glen Barber [Thu, 4 Mar 2021 13:39:43 +0000 (08:39 -0500)]
release: fix VMSIZE following 1ca8842f3ad9

truncate(1) is not case-sensitive with regard to setting the size
of a file.  makefs(8), however, does not honor upper-case values.
Update release-specific files and the release(7) manual page to
reflect this.

MFC with: 1ca8842f3ad9
Submitted by: ehem_freebsd_m5p.com (original)
Differential Review: https://reviews.freebsd.org/D28979
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoRemove obsolete bc library and dc test files
Stefan Eßer [Thu, 4 Mar 2021 13:21:58 +0000 (14:21 +0100)]
Remove obsolete bc library and dc test files

The new bc implementation has the library embedded into the binary
and tests in tests/usr.bin/bc instead of tests/ustr.bin/dc.

MFC after: 3 days

3 years agomq_open(2): Fix xref to mq_unlink(2)
Fernando Apesteguía [Wed, 24 Feb 2021 15:20:57 +0000 (16:20 +0100)]
mq_open(2): Fix xref to mq_unlink(2)

mq_unlink(2) was added in acab1d58befaa8f42930bd62c26558e6005e1c13

PR: 215611
Reported by: rwatson@FreeBSD.org
Approved by: gbe@ (mentor)
Differential Revision: https://reviews.freebsd.org/D28913

3 years agoelftoolchain: stop leaving tempfiles on error
Chris Rees [Mon, 15 Feb 2021 11:37:06 +0000 (11:37 +0000)]
elftoolchain: stop leaving tempfiles on error

Temporary files were not cleaned up, resulting in $TMPDIR or even
the current directory becoming littered with ecp.* files.

This happened with error and even sometimes on success!

Approved by: dim
MFC after: 4 weeks
Accepted upstream: https://sourceforge.net/p/elftoolchain/code/3918/
Differential Revision: https://reviews.freebsd.org/D28651

3 years agocron: consume blanks in system crontabs before options
Oleksandr Tymoshenko [Thu, 4 Mar 2021 07:23:31 +0000 (23:23 -0800)]
cron: consume blanks in system crontabs before options

On system crontabs, multiple blanks are not being consumed after reading the
username. This change adds blank consumption before parsing any -[qn] options.
Without this change, an entry like:

  * * * * * username  -n true  # Two spaces between username and option.

will fail, as the shell will try to execute (' -n true'), while an entry like:

  * * * * * username -n true   # One space between username and option.

works as expected (executes 'true').

For user crontabs, this is not an issue as the preceding (day of week
or @shortcut) processing consumes any leading whitespace.

PR: 253699
Submitted by: Eric A. Borisch <eborisch@gmail.com>
MFC after: 1 week

3 years agolibkvm: Refine the previous commit (645eaa2ccaed)
Jung-uk Kim [Wed, 3 Mar 2021 23:50:45 +0000 (18:50 -0500)]
libkvm: Refine the previous commit (645eaa2ccaed)

Resort free()'ing memory in kvm_close() to make it easier to MFC.

MFC after: 3 days

3 years agogrowfs: allow operation on RW-mounted filesystems
Ed Maste [Tue, 2 Mar 2021 22:35:48 +0000 (17:35 -0500)]
growfs: allow operation on RW-mounted filesystems

growfs supports growing mounted filesystems (writes are temporarily
suspended while the grow happens).  Drop the check for fs_clean == 0
to restore this case.  Leave fs_flags check for FS_UNCLEAN or
FS_NEEDSFSCK which represent the state of the filesystem when it was
mounted, and fsck should be run first if they are set.

PR: 253754
Reviewed by: mckusick
MFC after: 3 days
Fixes: 6eb925f8450f ("Filesystem utilities that modify the...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29021

3 years agoossl: Add support for the ChaCha20 + Poly1305 AEAD cipher from RFC 8439
John Baldwin [Wed, 3 Mar 2021 23:17:51 +0000 (15:17 -0800)]
ossl: Add support for the ChaCha20 + Poly1305 AEAD cipher from RFC 8439

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

3 years agoossl: Add ChaCha20 cipher support.
John Baldwin [Wed, 3 Mar 2021 23:17:43 +0000 (15:17 -0800)]
ossl: Add ChaCha20 cipher support.

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

3 years agoThe ChaCha20 counter is little endian, not big endian.
John Baldwin [Wed, 3 Mar 2021 23:17:37 +0000 (15:17 -0800)]
The ChaCha20 counter is little endian, not big endian.

Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D28755

3 years agoossl: Add Poly1305 digest support.
John Baldwin [Wed, 3 Mar 2021 23:17:29 +0000 (15:17 -0800)]
ossl: Add Poly1305 digest support.

Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D28754

3 years agocryptocheck: Free generated IV after each GMAC test.
John Baldwin [Wed, 3 Mar 2021 23:17:19 +0000 (15:17 -0800)]
cryptocheck: Free generated IV after each GMAC test.

Reviewed by: cem
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D28753

3 years agocryptocheck: Add support for the Poly1305 digest.
John Baldwin [Wed, 3 Mar 2021 23:17:00 +0000 (15:17 -0800)]
cryptocheck: Add support for the Poly1305 digest.

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

3 years agolibkvm: Plug couple of memory leaks and check possible calloc(3) failure
Jung-uk Kim [Wed, 3 Mar 2021 23:10:00 +0000 (18:10 -0500)]
libkvm: Plug couple of memory leaks and check possible calloc(3) failure

First, r204494 introduced dpcpu_off in struct __kvm and it was allocated
from _kvm_dpcpu_init() but it was not free(3)'ed from kvm_close(3).
Second, r291406 introduced kvm_nlist2(3) and converted kvm_nlist(3) to
use the new function but it did not free the temporary buffer.
Also, check possible calloc(3) failure while I am in the neighborhood.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29019

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

MFC after: 1 week

3 years agohid: add opt_hid.h to modules that use HID_DEBUG
Vladimir Kondratyev [Wed, 3 Mar 2021 22:21:15 +0000 (01:21 +0300)]
hid: add opt_hid.h to modules that use HID_DEBUG

Submitted by: Greg V <greg_AT_unrelenting_DOT_technology>
Reviewed by: imp, wulf
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D28995

3 years agoktls: Cache output buffers for software encryption
Mark Johnston [Wed, 3 Mar 2021 22:30:08 +0000 (17:30 -0500)]
ktls: Cache output buffers for software encryption

Maintain a cache of physically contiguous runs of pages for use as
output buffers when software encryption is configured and in-place
encryption is not possible.  This makes allocation and free cheaper
since in the common case we avoid touching the vm_page structures for
the buffer, and fewer calls into UMA are needed.  gallatin@ reports a
~10% absolute decrease in CPU usage with sendfile/KTLS on a Xeon after
this change.

It is possible that we will not be able to allocate these buffers if
physical memory is fragmented.  To avoid frequently calling into the
physical memory allocator in this scenario, rate-limit allocation
attempts after a failure.  In the failure case we fall back to the old
behaviour of allocating a page at a time.

N.B.: this scheme could be simplified, either by simply using malloc()
and looking up the PAs of the pages backing the buffer, or by falling
back to page by page allocation and creating a mapping in the cache
zone.  This requires some way to save a mapping of an M_EXTPG page array
in the mbuf, though.  m_data is not really appropriate.  The second
approach may be possible by saving the mapping in the plinks union of
the first vm_page structure of the array, but this would force a vm_page
access when freeing an mbuf.

Reviewed by: gallatin, jhb
Tested by: gallatin
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D28556

3 years agogit-arc.1: Fix synopsis for the "update" verb
Mark Johnston [Wed, 3 Mar 2021 22:01:04 +0000 (17:01 -0500)]
git-arc.1: Fix synopsis for the "update" verb

3 years agogit-arc: Handle commit ranges in the "update" verb
Mark Johnston [Wed, 3 Mar 2021 22:00:58 +0000 (17:00 -0500)]
git-arc: Handle commit ranges in the "update" verb

Reported by: imp

3 years agoMove ic_check_send_space clear to the actual check.
Alexander Motin [Wed, 3 Mar 2021 20:21:26 +0000 (15:21 -0500)]
Move ic_check_send_space clear to the actual check.

It closes tiny race when the flag could be set between being cleared
and the space is checked, that would create us some more work.  The
flag setting is protected by both locks, so we can clear it in either
place, but in between both locks are dropped.

MFC after: 1 week

3 years agoenv: style(9) fix, add a space
Kyle Evans [Wed, 3 Mar 2021 20:20:17 +0000 (14:20 -0600)]
env: style(9) fix, add a space

Reported by: pstef
Fixes: 55deb0a5f089 ("service(8): use an environment more [...]")

3 years agoservice(8): use an environment more consistent with init(8)
Andrew Gierth [Wed, 3 Mar 2021 18:25:11 +0000 (12:25 -0600)]
service(8): use an environment more consistent with init(8)

init(8) sets the "daemon" login class without specifying a pw
entry (so no substitutions are done on the variables). service(8)'s
use of env -L had the effect of specifying root's pw entry, with two
effects: getpwnam and getpwuid are being called, which may not be
entirely safe depending on what nsswitch is up to and what stage of
boot we are at, and substitutions would have been done.

Fix by teaching env(8) to allow -L -/classname to set the class
environment with no pw entry at all specified, and use it in
service(8).

PR: 253959

3 years agoRestore condition removed in df3747c6607b.
Alexander Motin [Wed, 3 Mar 2021 16:58:04 +0000 (11:58 -0500)]
Restore condition removed in df3747c6607b.

I think it allowed to avoid some TX thread wakeups while the socket
buffer is full.  But add there another options if ic_check_send_space
is set, which means socket just reported that new space appeared, so
it may have sense to pull more data from ic_to_send for better TX
coalescing.

MFC after: 1 week

3 years agoCirrus-CI: Add more information to help track down disk full issues
Ed Maste [Mon, 1 Mar 2021 21:19:01 +0000 (16:19 -0500)]
Cirrus-CI: Add more information to help track down disk full issues

Execute df(1) before and after the build (reporting in MiB for
consistency), and du(1) of /usr/obj.  Also include the uname.

3 years agocrontab.5: Correct claims on ranges and names
Chris Rees [Wed, 3 Mar 2021 16:35:45 +0000 (16:35 +0000)]
crontab.5: Correct claims on ranges and names

Ranges use the function get_number, which means that ranges of names
are supported and indeed always have been, righ back to the initial
import.

PR: docs/253969
Reported by: Ben Bullock <benkasminbullock@gmail.com>

3 years agoMinor grammar nit
Andreas Bjornestad [Wed, 3 Mar 2021 16:17:26 +0000 (16:17 +0000)]
Minor grammar nit

PR: docs/253975

3 years agoRevert "Split out the loader efifb setup to a new function"
Andrew Turner [Wed, 3 Mar 2021 16:09:00 +0000 (16:09 +0000)]
Revert "Split out the loader efifb setup to a new function"

It was broken by a rebase. Revert until it can be fixed.

This reverts commit c8db60c0673d4bb7a3a3e2c043804e1ed1108c2f.

3 years agoarm64: mv_ap806_gicp: Fix spi_ranges_cnt
Zyta Szpak [Fri, 19 Feb 2021 14:31:45 +0000 (15:31 +0100)]
arm64: mv_ap806_gicp: Fix spi_ranges_cnt

Previously the spi_ranges_cnt stored the table size in bytes
instead of the number of elements. Fix that.

Reviewed by: mmel
Submitted by: Zyta Szpak <zr@semihalf.com>
Obtained from: Semihalf
Sponsored by: Marvell

3 years agoHandle functions that use a nop in the arm64 fbt
Andrew Turner [Wed, 13 Jan 2021 11:08:19 +0000 (11:08 +0000)]
Handle functions that use a nop in the arm64 fbt

To trace leaf asm functions we can insert a single nop instruction as
the first instruction in a function and trigger off this.

Reviewed by: gnn
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D28132

3 years agoUse L2 blocks when in the identity map
Andrew Turner [Thu, 24 Dec 2020 11:02:34 +0000 (11:02 +0000)]
Use L2 blocks when in the identity map

This reduces the memory mapped to be closer to the minimal memory
needed to enable the MMU.

Reviewed by: mmel
Sponsored by: Innovate UK
Differential Revision:://reviews.freebsd.org/D27765

3 years agoSplit out the loader efifb setup to a new function
Andrew Turner [Fri, 26 Feb 2021 11:47:34 +0000 (11:47 +0000)]
Split out the loader efifb setup to a new function

This makes bi_load_efi_data cleaner to add common acpi setup code.

Reviewed by: imp, tsoome
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D28936

3 years agostress2: Initial import
Peter Holm [Wed, 3 Mar 2021 12:56:56 +0000 (13:56 +0100)]
stress2:  Initial import

Discussed with:  kib

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

PR: 252984
MFC after: 1 week

3 years agoFix capsicum-test build with GCC
Alex Richardson [Wed, 3 Mar 2021 13:53:30 +0000 (13:53 +0000)]
Fix capsicum-test build with GCC

Apparently GCC defines NULL to 0 in C++11 mode (instead of nullptr), so
this causes the following error:
```
In file included from capsicum-test.h:15,
                 from capsicum-test.cc:1:
gtest-1.10.0/include/gtest/gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperNE(const char*, const char*, const T1&, const T2&) [with T1 = long int; T2 = procstat*]':
capsicum-test.cc:75:3:   required from here
gtest-1.10.0/include/gtest/gtest.h:1621:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
 1609 |   if (val1 op val2) {\
      |       ~~~~~~~~~~~~
......
 1621 | GTEST_IMPL_CMP_HELPER_(NE, !=);
gtest-1.10.0/include/gtest/gtest.h:1609:12: note: in definition of macro 'GTEST_IMPL_CMP_HELPER_'
 1609 |   if (val1 op val2) {\
      |            ^~
```

Fix this by using nullptr directly.

Submitted upstream as https://github.com/google/capsicum-test/pull/56

Reported by: Jenkins CI

3 years agoFix GCC build of ptrace_test after 96a9e50e63bfc
Alex Richardson [Wed, 3 Mar 2021 11:21:04 +0000 (11:21 +0000)]
Fix GCC build of ptrace_test after 96a9e50e63bfc

It seems like GCC's -Wsign-compare is stricter and also warns for
constants. Appease GCC by adding the required casts.

Fixes: 96a9e50e63bfc ("ptrace_test: Add more debug output on test failures")
Reported by: Jenkins CI

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

MFC after:    3 days
PR:        253737

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

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

MFC After:    3 days
PR:        253736

3 years agoarcmsr(4): Fixed no action of hot plugging device on type_F adapter.
Xin LI [Wed, 3 Mar 2021 06:57:20 +0000 (22:57 -0800)]
arcmsr(4): Fixed no action of hot plugging device on type_F adapter.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by: 黃清隆 <ching2048 areca com tw>
MFC after: 3 days

3 years agoinit: use explicit_bzero() for clearing passwords
Kyle Evans [Wed, 3 Mar 2021 03:38:37 +0000 (21:38 -0600)]
init: use explicit_bzero() for clearing passwords

This is a nop in practice, because it cannot be proven that this
particular bzero() is not significant.  Make it explicit anyways, rather
than relying on an implementation detail of how the password is
collected.

Discussed with: Andrew Gierth <andrew tao146 riddles org uk>

3 years agorelease.7: describe the NOGIT option
Alan Somers [Wed, 3 Mar 2021 01:05:25 +0000 (18:05 -0700)]
release.7: describe the NOGIT option

It was added in 91ce469984500aa994c85640e0af129e3e0c938f (svn r365638)

MFC after: 7 days
Sponsored by: Axcient
Reviewed by: gjb
Differential Revision: https://reviews.freebsd.org/D29027

3 years agolibifconfig: Fix typo in symbol map
Ryan Moeller [Wed, 3 Mar 2021 01:55:18 +0000 (01:55 +0000)]
libifconfig: Fix typo in symbol map

MFC after: 1 week

3 years agosbin/ifconfig: Use a global libifconfig handle
Ryan Moeller [Sun, 28 Feb 2021 10:30:09 +0000 (10:30 +0000)]
sbin/ifconfig: Use a global libifconfig handle

This should eventually replace the socket passed to the various
handlers. In the meantime, making it global avoids repeatedly opening
and closing handles.

Reported by: kp
Reviewed by: kp (earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28990

3 years agoixl(4): Add ability to control link state on ifconfig down
Krzysztof Galazka [Wed, 3 Mar 2021 01:38:51 +0000 (17:38 -0800)]
ixl(4): Add ability to control link state on ifconfig down

Add sysctl link_active_on_if_down, which allows user to control
if interface is kept in active state when it is brought
down with ifconfig. Set it to enabled by default to preserve
backwards compatibility.

Reviewed by: erj
Tested by: gowtham.kumar.ks@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D28028

3 years agoixl(4): Report RX errors as sum of all RX error counters
Krzysztof Galazka [Wed, 3 Mar 2021 01:33:11 +0000 (17:33 -0800)]
ixl(4): Report RX errors as sum of all RX error counters

HW keeps track of RX errors using several counters, each for
specific type of errors. Report RX errors to OS as sum
of all those counters: CRC errors, illegal bytes, checksum,
length, undersize, fragment, oversize and jabber errors.

There is no HW counter for frames with invalid L3/L4 checksums
so add a SW one.

Also add a "rx_errors" sysctl with a copy of netstat IERRORS
counter value to make it easier accessible from scripts.

Reviewed By: erj
Tested By: gowtham.kumar.ks@intel.com
Sponsored By: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D27639

3 years agocam: remove redundant scsi_vpd_block_characteristics definition
Warner Losh [Wed, 3 Mar 2021 01:31:43 +0000 (18:31 -0700)]
cam: remove redundant scsi_vpd_block_characteristics definition

There were two definitions for the SCSI VPD Block Device Characteristics (page
0xb1): struct scsi_vpd_block_characteristics and struct
scsi_vpd_block_device_characteristics. The latter is more complete and more
widely used. Convert uses of the former to the latter by tweaking the da driver
and removing sturct scsi_vpd_block_characteristics.

3 years ago[skip ci] fix a typo in a comment in mdconfig.c
Alan Somers [Sat, 27 Feb 2021 16:04:10 +0000 (09:04 -0700)]
[skip ci] fix a typo in a comment in mdconfig.c

Sponsored by: Axcient
Reviewed by:    mav, imp
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D28968

3 years agoSpeed up geom_stats_resync in the presence of many devices
Alan Somers [Sat, 27 Feb 2021 15:59:40 +0000 (08:59 -0700)]
Speed up geom_stats_resync in the presence of many devices

The old code had a O(n) loop, where n is the size of /dev/devstat.
Multiply that by another O(n) loop in devstat_mmap for a total of
O(n^2).

This change adds DIOCGMEDIASIZE support to /dev/devstat so userland can
quickly determine the right amount of memory to map, eliminating the
O(n) loop in userland.

This change decreases the time to run "gstat -bI0.001" with 16,384 md
devices from 29.7s to 4.2s.

Also, fix a memory leak first reported as PR 203097.

Sponsored by: Axcient
Reviewed by: mav, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28968

3 years agoix(4): Report RX errors as sum of all RX error counters
Piotr Pietruszewski [Wed, 3 Mar 2021 01:21:58 +0000 (17:21 -0800)]
ix(4): Report RX errors as sum of all RX error counters

HW keeps track of RX errors using several counters, each for
specific type of errors. Report RX errors to OS as sum
of all those counters: CRC errors, illegal bytes, checksum,
length, undersize, fragment, oversize and jabber errors.

Also, add new "rx_errs" sysctl in the dev.ix.N.mac_stats tree. This is
to provide an another way to display the sum of RX errors.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed By: erj
Tested By: gowtham.kumar.ks@intel.com
Sponsored By: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D27191

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

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

MFC after: 1 week
Obtained from: OpenZFS

3 years agoUpdate vendor/openzfs to master-bedbc13da
Martin Matuska [Wed, 3 Mar 2021 00:40:13 +0000 (01:40 +0100)]
Update vendor/openzfs to master-bedbc13da

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

3 years agoReplace STAILQ_SWAP() with simpler STAILQ_CONCAT().
Alexander Motin [Tue, 2 Mar 2021 23:39:44 +0000 (18:39 -0500)]
Replace STAILQ_SWAP() with simpler STAILQ_CONCAT().

Also remove stray STAILQ_REMOVE_AFTER(), not causing problems only
because STAILQ_SWAP() fixed corrupted stqh_last.

MFC after: 1 week

3 years agoiflib: add support for admin completion queues
Marcin Wojtas [Tue, 2 Mar 2021 23:24:29 +0000 (00:24 +0100)]
iflib: add support for admin completion queues

For interfaces with admin completion queues, introduce a new devmethod
IFDI_ADMIN_COMPLETION_HANDLE and a corresponding flag IFLIB_HAS_ADMINCQ.

This provides an option for handling any admin cq logic, which cannot be
run from an interrupt context.

Said method is called from within iflib's admin task, making it safe to
sleep.

Reviewed by: mmacy
Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.
Differential Revision: https://reviews.freebsd.org/D28708

3 years agolib/flua/libjail: Allow empty params table
Ryan Moeller [Thu, 25 Feb 2021 05:16:52 +0000 (05:16 +0000)]
lib/flua/libjail: Allow empty params table

The name or jid always gets added to the params, and that's enough to
avoid allocating a 0 length params array.

Reported by: kevans
Reviewed by: kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28778

3 years agomvebu_gpio: fix interrupt cause register configuration
Marcin Wojtas [Wed, 24 Feb 2021 17:02:40 +0000 (18:02 +0100)]
mvebu_gpio: fix interrupt cause register configuration

According to Armada 8k documentation, the interrupt cause register
(at offset 0x14) is RW0C. Update the configuration in attach and
the mvebu_gpio_isrc_eoi() to follow the description.

Reviewed by: mmel
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D29013

3 years agofilt_fsevent: only record interested events
Robert Wing [Tue, 2 Mar 2021 23:19:22 +0000 (14:19 -0900)]
filt_fsevent: only record interested events

Respect filter-specific flags for the EVFILT_FS filter.

When a kevent is registered with the EVFILT_FS filter, it is always
triggered when an EVFILT_FS event occurs, regardless of the
filter-specific flags used. Fix that.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D28974

3 years agoautounmountd: set filter-specific flags for the EVFILT_FS filter
Robert Wing [Tue, 2 Mar 2021 23:18:40 +0000 (14:18 -0900)]
autounmountd: set filter-specific flags for the EVFILT_FS filter

Set the filter-specific flags VQ_MOUNT and VQ_UNMOUNT for the
EVFILT_FS filter.

The filter-specific flags for the EVFILT_FS filter are undocumented, but
their usage can be found by looking up vfs_event_signal().

Reviewed by: trasz
Differential Revision: https://reviews.freebsd.org/D28975

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

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

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

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

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

3 years agonfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS
Rick Macklem [Tue, 2 Mar 2021 22:18:23 +0000 (14:18 -0800)]
nfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS

During a recent virtual NFSv4 testing event, a bug in the FreeBSD client
was detected when doing I/O DS operations on a Flexible File Layout pNFS
server.  For an NFSv3 DS, the Read/Write/Commit nfsstats were incremented
instead of the ReadDS/WriteDS/CommitDS counts.
This patch fixes this.

Only the RPC counts reported by nfsstat(1) were affected by this bug,
the I/O operations were performed correctly.

MFC after: 2 weeks

3 years agoRegenerate src.conf(5) after FMTREE removal
Kyle Evans [Tue, 2 Mar 2021 21:21:46 +0000 (15:21 -0600)]
Regenerate src.conf(5) after FMTREE removal

3 years agoRemove fmtree(8)
Kyle Evans [Tue, 2 Mar 2021 21:15:17 +0000 (15:15 -0600)]
Remove fmtree(8)

fmtree(8) deprecation was announced on February 12, 2021, and no longer
built by default as of that date.  The deprecation notice was merged
back to stable/12 and stable/13 + releng/13.0.

Continue with the plan by finishing the removal.

Relnotes: yes

3 years agoRegenerate src.conf(5) after PIE default change
Kyle Evans [Tue, 2 Mar 2021 21:21:27 +0000 (15:21 -0600)]
Regenerate src.conf(5) after PIE default change

3 years agoFix initiator panic after 6895f89fe54e.
Alexander Motin [Tue, 2 Mar 2021 21:07:22 +0000 (16:07 -0500)]
Fix initiator panic after 6895f89fe54e.

There are sessions without socket that are not disconnecting yet.

MFC after: 3 weeks

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

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