]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoSimplify using nvlist_append_string_array().
Hajimu UMEMOTO [Mon, 8 Mar 2021 03:03:32 +0000 (12:03 +0900)]
Simplify using nvlist_append_string_array().

Reported by: hrs
MFC after: 1 week

3 years agoMake kern.timecounter.hardware tunable
Konstantin Belousov [Sun, 7 Mar 2021 23:50:12 +0000 (01:50 +0200)]
Make kern.timecounter.hardware tunable

Noted and reviewed by: kevans
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D29122

3 years agobhyve/snapshot: use SOCK_DGRAM instead of SOCK_STREAM
Robert Wing [Mon, 8 Mar 2021 00:23:29 +0000 (15:23 -0900)]
bhyve/snapshot: use SOCK_DGRAM instead of SOCK_STREAM

The save/restore feature uses a unix domain socket to send messages
from bhyvectl(8) to a bhyve(8) process. A datagram socket will suffice
for this.

An added benefit of using a datagram socket is simplified code. For
bhyve, the listen/accept calls are dropped; and for bhyvectl, the
connect() call is dropped.

EPRINTLN handles raw mode for bhyve(8), use it to print error messages.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D28983

3 years agodecryptcore: do not include sys/sysctl.h
Eric van Gyzen [Fri, 5 Mar 2021 16:38:37 +0000 (10:38 -0600)]
decryptcore: do not include sys/sysctl.h

It's not needed.  Removing it is a small improvement in portability.

Sponsored by: Dell EMC Isilon

3 years agodumpon: do not print errno for resolver failure
Eric van Gyzen [Fri, 5 Mar 2021 16:39:53 +0000 (10:39 -0600)]
dumpon: do not print errno for resolver failure

When the netdump host name fails to resolve, don't print errno, since
it's irrelevant.  We might as well use a different exit status, too.

Sponsored by: Dell EMC Isilon

3 years agoFix dpdk/ldradix fib lookup algorithm preference calculation.
Alexander V. Chernikov [Sun, 7 Mar 2021 22:05:34 +0000 (22:05 +0000)]
Fix dpdk/ldradix fib lookup algorithm preference calculation.

The current preference number were copied from IPv4 code,
 assuming 500k routes to be the full-view. Adjust with the current
 reality (100k full-view).

Reported by: Marek Zarychta <zarychtam at plan-b.pwste.edu.pl>
MFC after: 3 days

3 years agoarmv8crypto: fix AES-XTS regression introduced by ed9b7f44
Oleksandr Tymoshenko [Sun, 7 Mar 2021 20:03:47 +0000 (12:03 -0800)]
armv8crypto: fix AES-XTS regression introduced by ed9b7f44

Initialization of the XTS key schedule was accidentally dropped
when adding AES-GCM support so all-zero schedule was used instead.
This rendered previously created GELI partitions unusable.
This change restores proper XTS key schedule initialization.

Reported by: Peter Jeremy <peter@rulingia.com>
MFC after: immediately

3 years agowg(4): Fix an example in the manual page
Gordon Bergling [Sun, 7 Mar 2021 19:27:59 +0000 (20:27 +0100)]
wg(4): Fix an example in the manual page

The example in the manual page of wg(4) for connecting to a
peer was missing the 'public-key' ifconfig(8) keyword and for the
addressed peer the port must be specified.

PR: 253866
Reported by: Sergey Akhmatov <sergey at akhmatov dot ru>
Reviewed by: debdrup
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29115

3 years agonet80211: ratectl header guard against multiple inclusions
Bjoern A. Zeeb [Sun, 7 Mar 2021 17:35:58 +0000 (17:35 +0000)]
net80211: ratectl header guard against multiple inclusions

Add missing #ifndef/#define/#endif guards against multiple inclusions
to ieee80211_ratectl.h as they are missing.

MFC after: 3 days
Sponsored-by: Rubicon Communications, LLC ("Netgate")

3 years agoRevert "TEST gitrepo-dev"
Li-Wen Hsu [Sun, 7 Mar 2021 17:34:21 +0000 (17:34 +0000)]
Revert "TEST gitrepo-dev"

This reverts commit 4287fa844f5e8f0021ada77c81ce96f9b547fccf.

3 years agoTEST gitrepo-dev
Li-Wen Hsu [Fri, 5 Mar 2021 06:22:09 +0000 (06:22 +0000)]
TEST gitrepo-dev

3 years agomvebu_gpio: Fix settings of gpio pin direction.
Michal Meloun [Sun, 7 Mar 2021 08:50:57 +0000 (09:50 +0100)]
mvebu_gpio: Fix settings of gpio pin direction.

Data Output Enable Control register is inverted – 0 means output direction.
Reflect this fact in code.

MFC after: 3 weeks

3 years agobhyvectl: print a better error message when vm_open() fails
Robert Wing [Sun, 7 Mar 2021 06:19:30 +0000 (21:19 -0900)]
bhyvectl: print a better error message when vm_open() fails

Use errno to print a more descriptive error message when vm_open() fails

libvmm: preserve errno when vm_device_open() fails

vm_destroy() squashes errno by making a dive into sysctlbyname() - we
can safely skip vm_destroy() here since it's not doing any critical
clean up at this point. Replace vm_destroy() with a free() call.

PR:             250671
MFC after:      3 days
Submitted by:   marko@apache.org
Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D29109

3 years agopoly1305: Chase xform_poly1305.h removal
Jung-uk Kim [Sun, 7 Mar 2021 02:47:03 +0000 (21:47 -0500)]
poly1305: Chase xform_poly1305.h removal

It was missed in bb6e84c988d3 and afbee98232f4.

3 years agoRemove references to the now-removed bktr(4) driver.
Mark Murray [Sat, 6 Mar 2021 23:15:09 +0000 (23:15 +0000)]
Remove references to the now-removed bktr(4) driver.

3 years agoRemove the never-installed setchannel(1) utility. It only work(s|ed)
Mark Murray [Sat, 6 Mar 2021 23:07:04 +0000 (23:07 +0000)]
Remove the never-installed setchannel(1) utility. It only work(s|ed)
with the never-committed cxm(4) driver and the now-removed bktr(4)
driver.

3 years ago[PowerPC] Fix AP bringup on 32-bit AIM SMP
Brandon Bergren [Sat, 6 Mar 2021 21:26:16 +0000 (15:26 -0600)]
[PowerPC] Fix AP bringup on 32-bit AIM SMP

In r361544, the pmap drivers were converted to ifuncs. When doing so,
this changed the call type of pmap functions to be called via the
secure-plt stubs.

These stubs depend on the TOC base being loaded to r30 to run properly.

On SMP AIM (i.e. a dual processor G4 or running 32-bit on G5), since the
APs were being started up from the reset vector instead of going
through __start, they had never had r30 initialized properly, so when the
cpu_reset code in trap_subr32.S attempted to branch to
pmap_cpu_bootstrap(), it was loading the target from the wrong location.

Ensure r30 is set up directly in the cpu_reset trap code, so we can make
PLT calls as normal.

Fixes boot on my SMP G4.

Reviewed by: jhibbits
MFC after: 3 days
Sponsored by: Tag1 Consulting, Inc.

3 years agolinux: add support for SO_PEERGROUPS
Edward Tomasz Napierala [Sun, 7 Feb 2021 21:29:32 +0000 (21:29 +0000)]
linux: add support for SO_PEERGROUPS

The su(8) and sudo(8) from Ubuntu Bionic use it.

Sponsored By: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28165

3 years agoFix 'make bmake' top-level bootstrapping.
Bryan Drewery [Sat, 6 Mar 2021 17:45:08 +0000 (09:45 -0800)]
Fix 'make bmake' top-level bootstrapping.

Fixes: ee10666327b62

3 years agonet: fixing a memory leak in if_deregister_com_alloc()
Tai-hwa Liang [Sat, 6 Mar 2021 14:36:35 +0000 (14:36 +0000)]
net: fixing a memory leak in if_deregister_com_alloc()

Drain the callbacks upon if_deregister_com_alloc() such that the
if_com_free[type] won't be nullified before if_destroy().

Taking fwip(4) as an example, before this fix, kldunload if_fwip will
go through the following:

  1. fwip_detach()
  2. if_free() -> schedule if_destroy() through NET_EPOCH_CALL
  3. fwip_detach() returns
  4. firewire_modevent(MOD_UNLOAD) -> if_deregister_com_alloc()
  5. kernel complains about:
Warning: memory type fw_com leaked memory on destroy (1 allocations, 64 bytes leaked).
  6. EPOCH runs if_destroy() -> if_free_internal()i

By this time, if_com_free[if_alloctype] is NULL since it's already
nullified by if_deregister_com_alloc(); hence, firewire_free() won't
have a chance to release the allocated fw_com.

Reviewed by: hselasky, glebius
MFC after: 2 weeks

3 years agoarm64: Add support for bcm2838 RNG
Gordon Bergling [Sat, 6 Mar 2021 11:28:35 +0000 (12:28 +0100)]
arm64: Add support for bcm2838 RNG

The hardware random number generator of the RPi4 differs slightly
from the version found on the RPi3.

This commit extends the existing bcm2835_rng driver to function on the RPi4.

Submitted by: James Mintram <me at jamesrm dot com>
Reviewed by: markm, cem, delphij
Approved by: csprng(cem, markm)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22493

3 years agoImplement mallocarray_domainset(9) variant of mallocarray(9).
Hans Petter Selasky [Sat, 6 Mar 2021 10:25:12 +0000 (11:25 +0100)]
Implement mallocarray_domainset(9) variant of mallocarray(9).

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

3 years agoloader: cursor off should restore display content
Toomas Soome [Sat, 6 Mar 2021 10:19:43 +0000 (12:19 +0200)]
loader: cursor off should restore display content

When drawing cursor, we should store original display
content because there may be image data we would like to restore
when the cursor is removed.

PR: 254054
Reported by: Jose Luis Duran
MFC after: 3 days

3 years agopf tests: Test tos/dscp matching
Kristof Provost [Wed, 3 Mar 2021 20:15:39 +0000 (21:15 +0100)]
pf tests: Test tos/dscp matching

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

3 years agopfctl: Add missing 'va' code point name
Kristof Provost [Thu, 4 Mar 2021 12:50:28 +0000 (13:50 +0100)]
pfctl: Add missing 'va' code point name

Add the 'va' (voice-admit, RFC5865) symbolic name.

Reviewed by: rgrimes, gbe (man page)
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29069

3 years agoloader_4th: brand image is aligned right
Toomas Soome [Sat, 6 Mar 2021 08:54:08 +0000 (10:54 +0200)]
loader_4th: brand image is aligned right

With screen border removed, I forgot to update forth brand image
coordinates to avoid image alignment.

3 years agoatomic(9): note that atomic_interrupt_fence first appeared in 13.0
Konstantin Belousov [Sat, 6 Mar 2021 05:21:40 +0000 (07:21 +0200)]
atomic(9): note that atomic_interrupt_fence first appeared in 13.0

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoRestore AT_RESOLVE_BENEATH support for funlinkat(2)/unlinkat(2).
Konstantin Belousov [Fri, 5 Mar 2021 02:07:57 +0000 (04:07 +0200)]
Restore AT_RESOLVE_BENEATH support for funlinkat(2)/unlinkat(2).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoDo not exit ctl_be_block_worker() prematurely.
Alexander Motin [Sat, 6 Mar 2021 03:39:52 +0000 (22:39 -0500)]
Do not exit ctl_be_block_worker() prematurely.

Return while there are any I/Os in a queue may result in them stuck
indefinitely, since there is only one taskqueue task for all of them.
I think I've reproduced this by switching ha_role to secondary under
heavy load.

MFC after: 3 days

3 years agoRestore /boot/efi to mtree.
Nathan Whitehorn [Sat, 6 Mar 2021 01:57:50 +0000 (20:57 -0500)]
Restore /boot/efi to mtree.

Instead of whether /boot/efi exists, which it now always does, including
on systems that don't and can't use EFI, use whether /boot/efi is
present in fstab to signal to the installer that it is a valid ESP and
should be configured. This has essentially the same semantics, but allows
/boot/efi to be created unconditionally.

Reviewed by: bdragon, imp
Tested by: bdragon (ppc64)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29068

3 years agoice(4): Update to version 0.28.1-k
Eric Joyner [Tue, 23 Feb 2021 01:45:09 +0000 (17:45 -0800)]
ice(4): Update to version 0.28.1-k

This updates the driver to align with the version included in
the "Intel Ethernet Adapter Complete Driver Pack", version 25.6.

There are no major functional changes; this mostly contains
bug fixes and changes to prepare for new features. This version
of the driver uses the previously committed ice_ddp package
1.3.19.0.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Tested by: jeffrey.e.pieper@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D28640

3 years agotcp: Add prr_out in preparation for PRR/nonSACK and LRD
Richard Scheffenegger [Fri, 5 Mar 2021 23:36:48 +0000 (00:36 +0100)]
tcp: Add prr_out in preparation for PRR/nonSACK and LRD

Reviewed By:           #transport, kbowling
MFC after:             3 days
Sponsored By:          Netapp, Inc.
Differential Revision: https://reviews.freebsd.org/D29058

3 years agonetmap: Stop printing a line to the dmesg in netmap_init()
Mark Johnston [Fri, 5 Mar 2021 23:07:47 +0000 (18:07 -0500)]
netmap: Stop printing a line to the dmesg in netmap_init()

netmap is compiled into the kernel by default so initialization was
always reported, and netmap uses a formatting convention not used in the
rest of the kernel.

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

3 years agoRemove xform_poly1305.h from the build, it is not necessary.
Scott Long [Fri, 5 Mar 2021 21:28:10 +0000 (21:28 +0000)]
Remove xform_poly1305.h from the build, it is not necessary.

3 years agocxgbe(4): Remove extra blank line.
Navdeep Parhar [Fri, 5 Mar 2021 20:48:39 +0000 (12:48 -0800)]
cxgbe(4): Remove extra blank line.

No functional change.

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