]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoopenssh: tag generated file with @generated
Ed Maste [Thu, 2 Sep 2021 01:49:44 +0000 (21:49 -0400)]
openssh: tag generated file with @generated

Tools like Phabricator use the @generated tag to identify files that
may be excluded from review by default.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b3e858f7622e7fb058c05f81abd657fc47c6f717)

2 years agopfctl: print counters in decimal
Kristof Provost [Sat, 4 Sep 2021 14:07:59 +0000 (16:07 +0200)]
pfctl: print counters in decimal

795d78a46713 pfctl: Don't use PRIu64 mistakenly changed these to be
printed as hexadecimal numbers.

Reported by: Florian Smeets
MFC after: 4 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 846a6e8f9ab25df4e06d28c05fb66060d803c9ba)

2 years agopfctl: Don't use PRIu64
Kristof Provost [Wed, 1 Sep 2021 16:18:26 +0000 (18:18 +0200)]
pfctl: Don't use PRIu64

Rather than PRIu64 we can just treat the data as uintmax_t, and use %jx
instead.

MFC after: 1 week
Suggested by: kib
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 795d78a46713fc16153966e77f20da2f40aac2a3)

2 years agopf: import pf_set_protostate() from OpenBSD
Kristof Provost [Tue, 20 Jul 2021 16:38:16 +0000 (18:38 +0200)]
pf: import pf_set_protostate() from OpenBSD

to change a state's state (that term is overloaded in pf, protocol state
like ESTABLISHED for tcp here), don't do it directly, but go through a newly
introduced pf_set_protostate()

Reviewed by: kbowling
Obtainted from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31729

(cherry picked from commit ce3ea45047c7321bcfcf0cd31272f0e4359640f2)

2 years agopf: Add counters for syncookies
Kristof Provost [Sun, 29 Aug 2021 13:54:50 +0000 (15:54 +0200)]
pf: Add counters for syncookies

Count when we send a syncookie, receive a valid syncookie or detect a
synflood.

Reviewed by: kbowling
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31713

(cherry picked from commit 4cab80a8dfecdf16333a1113513e046b9f4dd7f6)

2 years agocrypto(4): Fix a few typos in camellia.c
Gordon Bergling [Sat, 4 Sep 2021 11:02:11 +0000 (13:02 +0200)]
crypto(4): Fix a few typos in camellia.c

 - s/valiables/variables/

Obtained from: NetBSD

(cherry picked from commit 88a3af4da1aad5cf319c4c465baebc24b4e98fd8)

2 years agoFix a common typo in source code comments
Gordon Bergling [Sat, 4 Sep 2021 10:56:57 +0000 (12:56 +0200)]
Fix a common typo in source code comments

- s/existant/existent/

(cherry picked from commit 631504fb346800f95fc581c15eb88b01c1b66fcf)

2 years agonvme(4): Add MSI and single MSI-X support.
Alexander Motin [Tue, 31 Aug 2021 17:34:48 +0000 (13:34 -0400)]
nvme(4): Add MSI and single MSI-X support.

If we can't allocate more MSI-X vectors, accept using single shared.
If we can't allocate any MSI-X, try to allocate 2 MSI vectors, but
accept single shared.  If still no luck, fall back to shared INTx.

This provides maximal flexibility in some limited scenarios.  For
example, vmd(4) does not support INTx and can handle only limited
number of MSI/MSI-X vectors without sharing.

MFC after: 1 week

(cherry picked from commit e3bdf3da769a55f0944d9c337bb4d91b6435f02c)

2 years agonvme(4): Do not panic on admin queue construct error.
Alexander Motin [Tue, 31 Aug 2021 00:36:22 +0000 (20:36 -0400)]
nvme(4): Do not panic on admin queue construct error.

MFC after: 1 week

(cherry picked from commit 31111372e6bad7212dbee36dd312e3b53fdfd3f6)

2 years agoopenssh: update default version addendum in man pages
Ed Maste [Sat, 4 Sep 2021 15:33:13 +0000 (11:33 -0400)]
openssh: update default version addendum in man pages

Fixes: 2f513db72b03 ("Upgrade to OpenSSH 7.9p1.")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b0025f9b7ff04ed623e9e5d8f9eaf172d5ff23f0)

2 years agoaesni: Avoid a potential out-of-bounds load in aes_encrypt_icm()
Mark Johnston [Mon, 30 Aug 2021 18:22:20 +0000 (14:22 -0400)]
aesni: Avoid a potential out-of-bounds load in aes_encrypt_icm()

Given a partial block at the end of a payload, aes_encrypt_icm() would
perform a 16-byte load of the residual into a temporary variable.  This
is unsafe in principle since the full block may cross a page boundary.
Fix the problem by copying the residual into a stack buffer first.

Reported by: syzbot+b7e44cde9e2e89f0f6c9@syzkaller.appspotmail.com
Reported by: syzbot+4b5eaf123a99456b5160@syzkaller.appspotmail.com
Reported by: syzbot+70c74c1aa232633355ca@syzkaller.appspotmail.com
Reported by: syzbot+2c663776a52828373d41@syzkaller.appspotmail.com
Reviewed by: cem, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 564b6aa7fccd98654207447f870b82659b895e7b)

2 years agoFix -Wformat errors in pfctl on 32-bit architectures
Dimitry Andric [Sun, 29 Aug 2021 15:31:28 +0000 (17:31 +0200)]
Fix -Wformat errors in pfctl on 32-bit architectures

Use PRIu64 to printf(3) uint64_t quantities, otherwise this will result
in "error: format specifies type 'unsigned long' but the argument has
type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]" on 32-bit
architectures.

Fixes: 80078d9d38fd
MFC after: 1 week

(cherry picked from commit 5b8f07b12f8477f1679013d6b3abdab8d33c7243)

2 years agopfctl: use libpfctl to retrieve pf status
Kristof Provost [Thu, 26 Aug 2021 15:09:48 +0000 (17:09 +0200)]
pfctl: use libpfctl to retrieve pf status

Rather than call DIOCGETSTATUS ourselves use the new libpfctl functions.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31697

(cherry picked from commit 80078d9d38fde6f146de28809640b2c7bff45a6c)

2 years agolibpfctl: Implement DIOCGETSTATUS wrappers
Kristof Provost [Thu, 26 Aug 2021 15:06:15 +0000 (17:06 +0200)]
libpfctl: Implement DIOCGETSTATUS wrappers

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31696

(cherry picked from commit 46fb68b1de49c8d235024374b71c1249af9e62ef)

2 years agolibpfctl: fix double free
Kristof Provost [Sun, 22 Aug 2021 14:20:15 +0000 (16:20 +0200)]
libpfctl: fix double free

Reviewed by: donner
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31695

(cherry picked from commit b0ccc2e277acddd33c65b444e7841b780b3094d7)

2 years agopf: Introduce nvlist variant of DIOCGETSTATUS
Kristof Provost [Mon, 16 Aug 2021 19:55:27 +0000 (21:55 +0200)]
pf: Introduce nvlist variant of DIOCGETSTATUS

Make it possible to extend the GETSTATUS call (e.g. when we want to add
new counters, such as for syncookie support) by introducing an
nvlist-based alternative.

MFC after: 1 week
Sponsored by:   Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31694

(cherry picked from commit 2b10cf85f8684f822511d7b9377e256ab623abbc)

2 years agotcp: document TCP Fast Open (RFC 7413) in tcp(4)
Philip Paeps [Fri, 3 Sep 2021 02:33:12 +0000 (10:33 +0800)]
tcp: document TCP Fast Open (RFC 7413) in tcp(4)

Adds documentation for the TCP_FASTOPEN socket option
and related MIB variables to the tcp(4) manual page.

PR: 257907
Reviewed by: gbe
Differential Revision: https://reviews.freebsd.org/D31764

(cherry picked from commit 71611b0c688568d513c665e1af3d95fcd50605fa)

2 years agopf tests: altq:codel_bridge requires if_bridge
Kristof Provost [Wed, 1 Sep 2021 14:09:14 +0000 (16:09 +0200)]
pf tests: altq:codel_bridge requires if_bridge

Check that the bridge module is loaded before running this test.
It likely will be (as a result of running the bridge tests), but if it's
not we'll get spurious failures.

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

(cherry picked from commit d491b42535db50693eac5946557f7527f9903b4b)

2 years agopxeboot: improve and simplify rx handling
Kyle Evans [Thu, 12 Aug 2021 02:49:17 +0000 (21:49 -0500)]
pxeboot: improve and simplify rx handling

This pushes the bulk of the rx servicing into a single loop that's only
slightly convoluted, and it addresses a problem with rx handling in the
process.  If we hit a tx interrupt while we're processing, we'd
previously drop the frame on the floor completely and ultimately
timeout, increasing boot time on particularly busy hosts as we keep
having to backoff and resend.

After this patch, we don't seem to hit timeouts at all on zoo anymore
though loading a 27M kernel is still relatively slow (~1m20s).

Sponsored By: National Bureau of Economic Research
Sponsored by: Klara, Inc.

(cherry picked from commit 3daa8e165c661c1b45e759f4997f447384c15446)

2 years agocaroot: cumulative cert update
Kyle Evans [Tue, 30 Mar 2021 02:56:40 +0000 (21:56 -0500)]
caroot: cumulative cert update

This adds a note in all existing certs that they are explicitly trusted
for server auth, and also:

- Seven (7) added
- Nineteen (19) removed

(cherry picked from commit 446169e0b6f04b96960540784539c218f5a14c86)
(cherry picked from commit 3016c5c2bf68d8c6ebf303939f20092478e7a4ca)
(cherry picked from commit fac832b27105d926d9f8728d7147adb547b937d8)
(cherry picked from commit 76461921dac18b300489e326ba3df61d2809f364)

2 years agocaroot: update CA bundle processor
Kyle Evans [Tue, 30 Mar 2021 03:05:38 +0000 (22:05 -0500)]
caroot: update CA bundle processor

Our current processor was identified as trusting cert not explicitly
marked for SERVER_AUTH, as well as certs that were tagged with
DISTRUST_AFTER.

Update the script to handle both scenarios. This patch was originally
authored by mandree@ for ports, and it was subsequently ported to base
caroot.

(cherry picked from commit c3510c941c0dddd09389915a9395e6f059088bab)

2 years agocam(4): Fix quick unplug/replug for SCSI.
Alexander Motin [Sat, 21 Aug 2021 13:31:41 +0000 (09:31 -0400)]
cam(4): Fix quick unplug/replug for SCSI.

If some device is plugged back in after unplug before the probe periph
destroyed, it will just restart the probe process. But I've found that
PROBE_INQUIRY_CKSUM flag not cleared between the iterations may cause
AC_FOUND_DEVICE not reported on the second iteration, and because of
AC_LOST_DEVICE reported during the first iteration, the device end up
configured, but without any periphs attached.

We've found that enabled serial console and 102-disk JBOD cause enough
probe delays to easily trigger the issue for half of the disks.  This
change fixes it reliably on my tests.

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

(cherry picked from commit 84d5b6bd68ce6496592adb8fdcd8cf0c246ed935)

2 years agovmm: Fix wrong assert in ivhd_dev_add_entry
Ka Ho Ng [Thu, 12 Aug 2021 07:54:40 +0000 (15:54 +0800)]
vmm: Fix wrong assert in ivhd_dev_add_entry

The correct condition is to check the number of ivhd entries fit into
the array.

Reported by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31514

(cherry picked from commit 179bc5729dd72e0f4252c0dce72454c76782f935)

2 years agovmm: Fix AMD-vi using wrong rid range
Ka Ho Ng [Tue, 13 Jul 2021 17:53:10 +0000 (01:53 +0800)]
vmm: Fix AMD-vi using wrong rid range

The ACPI parsing code around rid range was wrong on assuming there is
only one pair of start/end device id range. Besides, ivhd_dev_parse()
never work as supposed. The start/end rid info was always zero.

Restructure the code to build dynamic-sized tables for each IOMMU softc
holding device entries. The device entries are enumerated to find a
suitable IOMMU unit. Operations on devices not governed (e.g. the IOMMU
unit itself) are no-op from now on. There are also a minor fix on wrong
%b formatting string usage.

Tested on my EPYC 7282.

Sponsored by: The FreeBSD Foundation
Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D30827

(cherry picked from commit b5c74dfd6434b7f4dcc59dbd61b508acc5ec3ecf)

2 years agovmm: Fix ivrs_drv device_printf usage
Ka Ho Ng [Sat, 19 Jun 2021 06:05:13 +0000 (14:05 +0800)]
vmm: Fix ivrs_drv device_printf usage

The original %b description string is wrong.

Sponsored by: The FreeBSD Foundation
Reviewed by: imp, jhb
Differential Revision: https://reviews.freebsd.org/D30805

(cherry picked from commit 210e6aec4f83ee0efef348ed9dd86be7592596a1)

2 years agoAMD-vi: Fortify IVHD device_identify process
Ka Ho Ng [Mon, 19 Apr 2021 08:07:03 +0000 (16:07 +0800)]
AMD-vi: Fortify IVHD device_identify process

- Use malloc(9) to allocate ivhd_hdrs list. The previous assumption
  that there are at most 10 IVHDs in a system is not true. A counter
  example would be a system with 4 IOMMUs, and each IOMMU is related
  to IVHDs type 10h, 11h and 40h in the ACPI IVRS table.
- Always scan through the whole ivhd_hdrs list to find IVHDs that has
  the same DeviceId but less prioritized IVHD type.

Sponsored by: The FreeBSD Foundation
MFC with: 74ada297e897
Reviewed by: grehan
Approved by: lwhsu (mentor)
Differential Revision: https://reviews.freebsd.org/D29525

(cherry picked from commit 6fe60f1d5c39c94fc87534e9dd4e9630594e0bec)

2 years agoAMD-vi: Mixed format IVHD block should replace fixed format IVHD block
Ka Ho Ng [Thu, 1 Apr 2021 01:15:19 +0000 (09:15 +0800)]
AMD-vi: Mixed format IVHD block should replace fixed format IVHD block

This fixes double IVHD_SETUP_INTR calls on the same IOMMU device.

Sponsored by: The FreeBSD Foundation
MFC with: 74ada297e897
Reported by: Oleg Ginzburg <olevole@olevole.ru>
Reviewed by: grehan
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29521

(cherry picked from commit 03efa462b2ab3ae8166598363e9e83d4e5cf0398)

2 years agoAMD-vi: Fix mismatched NULL checking in amdiommu teardown path
Ka Ho Ng [Wed, 31 Mar 2021 19:30:21 +0000 (03:30 +0800)]
AMD-vi: Fix mismatched NULL checking in amdiommu teardown path

Sponsored by: The FreeBSD Foundation
Approved by: lwhsu (mentor)
MFC with: 74ada297e897

(cherry picked from commit cf76495e0a30043503ef126f0a485e314730a221)

2 years agobhyve amd: Small cleanups in amdvi_dump_cmds
Ka Ho Ng [Tue, 23 Mar 2021 08:11:56 +0000 (16:11 +0800)]
bhyve amd: Small cleanups in amdvi_dump_cmds

Bump offset with MOD_INC instead in amdvi_dump_cmds.

Reviewed by: jhb
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D28862

(cherry picked from commit be97fc8dced052f824387a1ae6a0063f9dcfdc89)

2 years agoCorrect "Fondation" typo (missing "u")
Ed Maste [Mon, 22 Mar 2021 17:06:03 +0000 (13:06 -0400)]
Correct "Fondation" typo (missing "u")

(cherry picked from commit 54399caa2f8470d9f7c404ce419362bc62d5a094)

2 years agoAMD-vi: Fix IOMMU device interrupts being overridden
Ka Ho Ng [Mon, 22 Mar 2021 09:33:43 +0000 (17:33 +0800)]
AMD-vi: Fix IOMMU device interrupts being overridden

Currently, AMD-vi PCI-e passthrough will lead to the following lines in
dmesg:
"kernel: CPU0: local APIC error 0x40
ivhd0: Error: completion failed tail:0x720, head:0x0."

After some tracing, the problem is due to the interaction with
amdvi_alloc_intr_resources() and pci_driver_added(). In ivrs_drv, the
identification of AMD-vi IVHD is done by walking over the ACPI IVRS
table and ivhdX device_ts are added under the acpi bus, while there are
no driver handling the corresponding IOMMU PCI function. In
amdvi_alloc_intr_resources(), the MSI intr are allocated with the ivhdX
device_t instead of the IOMMU PCI function device_t. bus_setup_intr() is
called on ivhdX. the IOMMU pci function device_t is only used for
pci_enable_msi(). Since bus_setup_intr() is not called on IOMMU pci
function, the IOMMU PCI function device_t's dinfo->cfg.msi is never
updated to reflect the supposed msi_data and msi_addr. So the msi_data
and msi_addr stay in the value 0. When pci_driver_added() tried to loop
over the children of a pci bus, and do pci_cfg_restore() on each of
them, msi_addr and msi_data with value 0 will be written to the MSI
capability of the IOMMU pci function, thus explaining the errors in
dmesg.

This change includes an amdiommu driver which currently does attaching,
detaching and providing DEVMETHODs for setting up and tearing down
interrupt. The purpose of the driver is to prevent pci_driver_added()
from calling pci_cfg_restore() on the IOMMU PCI function device_t.
The introduction of the amdiommu driver handles allocation of an IRQ
resource within the IOMMU PCI function, so that the dinfo->cfg.msi is
populated.

This has been tested on EPYC Rome 7282 with Radeon 5700XT GPU.

Sponsored by: The FreeBSD Foundation
Reviewed by: jhb
Approved by: philip (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D28984

(cherry picked from commit 74ada297e8978b8efda3dffdd1bb24aee7c5faa4)

2 years agoivrs_drv: Fix IVHDs with duplicated BaseAddress
Ka Ho Ng [Mon, 22 Mar 2021 09:33:43 +0000 (17:33 +0800)]
ivrs_drv: Fix IVHDs with duplicated BaseAddress

Reviewed by: jhb
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D28945

(cherry picked from commit ede14736fd6d74db0374f4a233491ad5dc0e9b1d)

2 years ago__FreeBSD_version: update the references to the doc tree
Ka Ho Ng [Thu, 22 Apr 2021 09:36:22 +0000 (17:36 +0800)]
__FreeBSD_version: update the references to the doc tree

Update the reference of which file to update in the doc tree when
bumping __FreeBSD_version.

This change is to catch up with commit f8fed61b80 in the doc repository.

Approved by: lwhsu (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29920

(cherry picked from commit 7c707c7c25ad361f911716c31d22f5722f4dffc9)

2 years agovnode_pager_setsize.9: Some clarifications on the manpage
Ka Ho Ng [Sun, 11 Apr 2021 06:45:37 +0000 (14:45 +0800)]
vnode_pager_setsize.9: Some clarifications on the manpage

A number of changes:
- Clarifies the locking rules when calling the routine.
- Correct the description regarding the content range to be purged.
- Document the effects on page fault handler.

MFC with: 86a52e262a6f
Sponsored by: The FreeBSD Foundation
Reviewed by: bcr, kib
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29637

(cherry picked from commit b77f5f5553e8ac7868b4b234a36bda3cf2db0907)

2 years agoDocument vnode_pager_setsize(9)
Ka Ho Ng [Wed, 7 Apr 2021 11:00:31 +0000 (19:00 +0800)]
Document vnode_pager_setsize(9)

Sponsored by: The FreeBSD Foundation
Reviewed by: bcr
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29408

(cherry picked from commit 86a52e262a6faf75ee34eaa801f6d8ddaad20733)

2 years agopmap_extract.9: Fix pmap_extract_and_hold()'s function type
Ka Ho Ng [Fri, 27 Aug 2021 13:42:49 +0000 (21:42 +0800)]
pmap_extract.9: Fix pmap_extract_and_hold()'s function type

pmap_extract_and_hold() returns a vm_page_t instead of a physical page
address.

Sponsored by: The FreeBSD Foundation
Reviewed by: alc
Differential Revision: https://reviews.freebsd.org/D31691

(cherry picked from commit 6e1df1d14c6dfcc209c1416ec0832e4d08191c72)

2 years agoOpenSSL: Reduce diff with the upstream
Jung-uk Kim [Wed, 1 Sep 2021 04:10:59 +0000 (00:10 -0400)]
OpenSSL: Reduce diff with the upstream

(cherry picked from commit 649ccdd753790069623e192185d133fd26a03bf9)

2 years agoOpenSSL: Regen manual pages for 1.1.1l
Jung-uk Kim [Fri, 3 Sep 2021 18:12:06 +0000 (14:12 -0400)]
OpenSSL: Regen manual pages for 1.1.1l

2 years agoImport OpenSSL 1.1.1l
Jung-uk Kim [Wed, 1 Sep 2021 04:26:38 +0000 (00:26 -0400)]
Import OpenSSL 1.1.1l

(cherry picked from commit 9a3ae0cdef9ac9a4b8c5cc66305d9a516ce8d4a0)

2 years agoRevert the changes that removed support for old gcc, as stable/12 still
Dimitry Andric [Fri, 3 Sep 2021 10:41:44 +0000 (12:41 +0200)]
Revert the changes that removed support for old gcc, as stable/12 still
uses gcc 4.2.1 for mips, powerpc and sparc64.

Revert "Revert part of r360964"

This reverts commit 2ebf10e7a1ced5d3dc4059d0595743277464d915.

Revert "Remove tests for obsolete compilers in the build system"

This reverts commit a606cb388f975561c37dbabc2fee82c27ef09929.

2 years agoxen: Fix warning by adding KERNBASE to modlist_paddr before casting
Dimitry Andric [Sun, 29 Aug 2021 14:02:31 +0000 (16:02 +0200)]
xen: Fix warning by adding KERNBASE to modlist_paddr before casting

Clang 13 produces the following warning for hammer_time_xen():

sys/x86/xen/pv.c:183:19: error: the pointer incremented by -2147483648 refers past the last possible element for an array in 64-bit address space containing 256-bit (32-byte) elements (max possible 576460752303423488 elements) [-Werror,-Warray-bounds]
                    (vm_paddr_t)start_info->modlist_paddr + KERNBASE;
                                ^                               ~~~~~~~~
sys/xen/interface/arch-x86/hvm/start_info.h:131:5: note: array 'modlist_paddr' declared here
    uint64_t modlist_paddr;         /* Physical address of an array of           */
    ^

This is because the expression first casts start_info->modlist_paddr to
struct hvm_modlist_entry * (via vmpaddr_t), and *then* adds KERNBASE,
which is then interpreted as KERNBASE * sizeof(struct
hvm_modlist_entry).

Instead, parenthesize the addition to get the intended result, and cast
it to struct hvm_modlist_entry * afterwards. Also remove the cast to
vmpaddr_t since it is not necessary.

Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D31711

(cherry picked from commit 8e3c56d6b676a175e974bad4c20797fb35017db8)

2 years agoDon't error out on unused but set variables with clang 13
Dimitry Andric [Sun, 29 Aug 2021 13:53:40 +0000 (15:53 +0200)]
Don't error out on unused but set variables with clang 13

Clang 13.0.0 now has a -Wunused-but-set-variable warning similar to the
one gcc has had for quite a while. Since this triggers *very* often for
our kernel builds, don't make it a hard error, but leave the warning
visible so is some incentive to fix the instances.

(cherry picked from commit 395d46caaed73228b84dfaeb37c702304a46ba8f)

2 years agoRemove -simplifycfg-dup-ret from CLANG_OPT_SMALL flags for clang 13
Dimitry Andric [Sun, 29 Aug 2021 13:39:16 +0000 (15:39 +0200)]
Remove -simplifycfg-dup-ret from CLANG_OPT_SMALL flags for clang 13

After llvm/clang 13.0.0, the -simplifycfg-dup-ret backend flag is no
longer supported. This was part of CLANG_OPT_SMALL, which is only still
used for stand/i386/boot2 and stand/i386/isoboot, to achieve the very
small binary size required. Luckily clang 13.0.0 does not need any
additional flags for this (I get 240 bytes available when building
boot2).

(cherry picked from commit 22b8ab15c41a9efac201691b40e961b83698aa9c)

2 years agoFix acpica macros that subtract null pointers
Dimitry Andric [Sun, 29 Aug 2021 11:15:23 +0000 (13:15 +0200)]
Fix acpica macros that subtract null pointers

Clang 13.0.0 produces a new -Werror warning about the ACPI_TO_INTEGER(p)
and ACPI_OFFSET(d, f) macros in acpica's actypes.h:

    sys/contrib/dev/acpica/components/dispatcher/dsopcode.c:708:31: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
        ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/acpica/include/actypes.h:664:41: note: expanded from macro 'ACPI_PTR_TO_PHYSADDR'
    #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
                                            ^~~~~~~~~~~~~~~~~~
    sys/contrib/dev/acpica/include/actypes.h:661:41: note: expanded from macro 'ACPI_TO_INTEGER'
    #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) 0)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/acpica/include/actypes.h:656:82: note: expanded from macro 'ACPI_PTR_DIFF'
    #define ACPI_PTR_DIFF(a, b)             ((ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))))
                                                                                     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

This problem of undefined behavior was also reported to acpica by @cem
in 2018: https://github.com/acpica/acpica/issues/407, but it seems there
was never any fix committed for it upstream.

Instead fix these locally, for ACPI_TO_INTEGER by simply casting the
incoming pointer to ACPI_SIZE (which corresponds roughly to uintptr_t
and size_t), and for ACPI_OFFSET by reusing our __offsetof definition
from sys/cdefs.h.

Reviewed by: emaste, kib, imp
Differential Revision: https://reviews.freebsd.org/D31710

(cherry picked from commit 130a690ae16e1b845629e586203b508eff699f38)

2 years agoSuppress -Wempty-body warnings in GCC 6.x and later.
John Baldwin [Mon, 31 Aug 2020 21:57:01 +0000 (21:57 +0000)]
Suppress -Wempty-body warnings in GCC 6.x and later.

libc++ in LLVM 11 uses an empty else clause in
include/c++/v1/__thread_support which triggers this warning.

Reviewed by: dim, emaste
Differential Revision: https://reviews.freebsd.org/D26257

(cherry picked from commit 73fd212c813d74ad593c93904c5d8edf763e6c54)

2 years agoDisable errors for -Wredundant-decls for GCC 6+.
John Baldwin [Tue, 4 Aug 2020 18:20:39 +0000 (18:20 +0000)]
Disable errors for -Wredundant-decls for GCC 6+.

GCC triggers warnings for this that clang does not for duplicate
declarations of yylex().

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

(cherry picked from commit 0ea6e5109d681b55886f61822ec23a4404d3eac5)

2 years agoTurn off errors for -Wmaybe-uninitialized in GCC 6+.
John Baldwin [Tue, 4 Aug 2020 18:19:29 +0000 (18:19 +0000)]
Turn off errors for -Wmaybe-uninitialized in GCC 6+.

Recent changes to <sys/tree.h> trigger this warning and seem like a
false positive.

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

(cherry picked from commit a02fb76280fd663aa46843423002d605a7bd0796)

2 years agoRevert part of r360964
Eric van Gyzen [Thu, 28 May 2020 21:56:31 +0000 (21:56 +0000)]
Revert part of r360964

ports/devel/linux_libusb builds FreeBSD libusb with GCC 4.8.5
from devel/linux-c7-devtools.  Restore the tests for older GCC
in bsd.sys.mk to accomodate such ports.

Reported by: tijl
Sponsored by: Dell EMC Isilon

(cherry picked from commit 824214da6434b1f0a361f6e8b94e7668db306beb)

2 years agoRemove tests for obsolete compilers in the build system
Eric van Gyzen [Tue, 12 May 2020 15:22:40 +0000 (15:22 +0000)]
Remove tests for obsolete compilers in the build system

Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree.
Assume clang is at least 6, which was in 11.2-RELEASE.  Drop conditions
for older compilers.

Reviewed by: imp (earlier version), emaste, jhb
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D24802

(cherry picked from commit fac6dee9eb58b2b558fec2aea749460ca623f6d6)

2 years agogcc9: quiet Waddress-of-packed-member for user build
Ryan Libby [Sat, 21 Dec 2019 02:43:49 +0000 (02:43 +0000)]
gcc9: quiet Waddress-of-packed-member for user build

Disable the warning for WARNS <= 3.  This is lame, but it's what we
already do for the clang build.

Reviewed by: dim
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22889

(cherry picked from commit fc41af14c8298c88d5a2bee85ecf1864a3d37a51)

2 years agoRemove obsolete, non-use of CLANG_NO_IAS.
Brooks Davis [Fri, 18 Oct 2019 00:00:17 +0000 (00:00 +0000)]
Remove obsolete, non-use of CLANG_NO_IAS.

CLANG_NO_IAS was removed in r351661.

(cherry picked from commit a1d5358777feafeb3b0bf977e018c9545f5315f7)

2 years agoRemove CLANG_NO_IAS definition
Ed Maste [Sun, 1 Sep 2019 16:47:48 +0000 (16:47 +0000)]
Remove CLANG_NO_IAS definition

CLANG_NO_IAS is not used anywhere in the tree.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6c30aa54c3f580b72a5171b69bc541fba31831b8)

2 years agogptzfsboot: remove CLANG_NO_IAS
Ed Maste [Thu, 15 Aug 2019 18:43:01 +0000 (18:43 +0000)]
gptzfsboot: remove CLANG_NO_IAS

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler did not handle .codeNN directives.  Clang gained
support quite some time ago, so we can build stand/ with IAS.

In some cases there were small differences in generated object output.
In the case of gptzfsboot however using GNU as or Clang IAS to assemble
gptldr.S resulted in identical final gptzfsboot binary output.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11115

(cherry picked from commit 0a062e5ff6522fa7bac1c2e9c9f686eb55ca998c)

2 years agostand: remove CLANG_NO_IAS from pxeldr
Ed Maste [Thu, 15 Aug 2019 17:59:22 +0000 (17:59 +0000)]
stand: remove CLANG_NO_IAS from pxeldr

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler (IAS) did not handle .codeNN directives.  Clang
gained support quite some time ago, and we can now build stand/ with
IAS.  In most cases IAS- and GNU as-assembled boot components were
identical, and CLANG_NO_IAS was already removed from other components.

Clang IAS produces different output for some components, including
pxeldr, so CLANG_NO_IAS was not previously removed for those.

In the case of pxeldr the difference is that IAS adds a size override
prefix (67h) to three instructions to specify a 32-bit address, even
though the two high bytes are zero and the address fits in 16 bits.
this wastes three bytes per instruction and causes some additional nop
npadding to be required elsewhere in the object, but pxeboot is not
size-constrained so it doesn't matter.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit aa2dd958b489d590be9573f1bd05ec5b8a12f016)

2 years agostand: remove CLANG_NO_IAS from cdboot
Ed Maste [Thu, 15 Aug 2019 17:32:39 +0000 (17:32 +0000)]
stand: remove CLANG_NO_IAS from cdboot

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler (IAS) did not handle .codeNN directives.  Clang
gained support quite some time ago, and we can now build stand/ with
IAS.  In most cases IAS- and GNU as-assembled boot components were
identical, and CLANG_NO_IAS was already removed from other components.

Clang IAS produces different output for some components, including
cdboot, so CLANG_NO_IAS was not previously removed for those.

In the case of cdboot the difference is that IAS adds a size override
prefix (67h) to many instructions to specify a 32-bit address, even
though the two high bytes are zero.  This wastes three bytes per
instance, but as cdboot is not size-constrained it doesn't matter.
Padding is also different in one case; Clang used two one-byte nops
while GNU as used a single two-byte xchg %eax, %eax.  In any case, there
is no functional change.

Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 1596e9a43cbfef904232a3321136e2ae480565f9)

2 years agostand: remove CLANG_NO_IAS from boot2
Ed Maste [Thu, 15 Aug 2019 14:54:18 +0000 (14:54 +0000)]
stand: remove CLANG_NO_IAS from boot2

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler (IAS) did not handle .codeNN directives.  Clang
gained support quite some time ago, and we can now build stand/ with
IAS.  In most cases IAS- and GNU as-assembled boot components were
identical, and CLANG_NO_IAS was already removed from other components.

Clang IAS produces different output for some components, including
boot2, so CLANG_NO_IAS was not previously removed for those.

In the case of boot2 the difference is that IAS produces a larger
encoding for one instruction (the testb at the beginning of read).

GNU as produces:

    2e    f6 06 b0 08       80

while IAS includes an address size override prefix (67) and produces:

    2e 67 f6 05 b3 08 00 00 80

This results in three fewer NOPs elsewhere in boot2 but no functional
change, so switch to IAS for boot2.

(We can separately pursue improved 16-bit IAS support with the LLVM
developers.)

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3a6c85abcbc3fbe2e0388a8708b36b9aac4b7bb1)

2 years agostand: remove CLANG_NO_IAS from zfsldr
Ed Maste [Tue, 26 Mar 2019 20:32:05 +0000 (20:32 +0000)]
stand: remove CLANG_NO_IAS from zfsldr

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler (IAS) did not handle .codeNN directives.  Clang
gained support quite some time ago, and we can now build stand/ with
IAS.

Note that in some cases there are small differences in the generated
output, so CLANG_NO_IAS should be removed only after testing (or after
finding no differences in the output).  For zfsldr I compared objdump
output between GNU as- and Clang IAS-built zfsldr and .text was
identical (changes were limited to the object's ELF headers and debug
info).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 698194ab249ffd23422048dc2157042fd5442288)

2 years agostand: remove CLANG_NO_IAS from btx and gptboot
Ed Maste [Tue, 20 Nov 2018 16:54:42 +0000 (16:54 +0000)]
stand: remove CLANG_NO_IAS from btx and gptboot

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler (IAS) did not handle .codeNN directives.  Clang
gained support quite some time ago, and we can now build stand/ with
IAS.

Note that in some cases there are small differences in the generated
output, so CLANG_NO_IAS should be removed only after testing (or after
finding no differences in the output).

PR: 205250, 233094
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 02c4bf4391ec7296f5a002c139576ae8797853d1)

2 years agoRetire CLANG_NO_IAS34
Ed Maste [Thu, 1 Nov 2018 23:11:47 +0000 (23:11 +0000)]
Retire CLANG_NO_IAS34

CLANG_NO_IAS34 was introduced in r276696 to allow then-HEAD kernels to
be built with clang 3.4 in FreeBSD 10.  As FreeBSD 11 and later includes
a version of Clang with a sufficiently capable integrated assembler we
do not need the workaround any longer.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ea96b3de2b3e4492e6bba3ab35961e3531a006bd)

2 years agoCirrus-CI: reduce VM memory to 8G
Ed Maste [Tue, 31 Aug 2021 00:50:34 +0000 (20:50 -0400)]
Cirrus-CI: reduce VM memory to 8G

Cirrus-CI now provides a task memory use graph, and it is clear we do
not need to provision the VM with 24GB.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit bbf70270551d8defb427316e5d0e0f368b9aac96)

2 years agoRevert "arm: Bump KSTACK_PAGES default to match i386/amd64"
Kevin Bowling [Wed, 1 Sep 2021 20:06:27 +0000 (13:06 -0700)]
Revert "arm: Bump KSTACK_PAGES default to match i386/amd64"

This reverts commit b684d812fcb04b2997fd755405a92c36b9f6e30e.

It causes an issue on a pfsense routing workload where memory
fragmentation prevents the necessary consecutive pages from being
readily available.

Reported by: pfsense (mjg, scottl)
Approved by: ian
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D31244

(cherry picked from commit 5647f85ade3ae1db042560a3354b6a9945d619a4)

2 years agoFix a common typo in man pages and src comments
Gordon Bergling [Sat, 28 Aug 2021 17:24:27 +0000 (19:24 +0200)]
Fix a common typo in man pages and src comments

- s/desciptor/descriptor/

(cherry picked from commit b1603638e38b3d8c23da6599e389db9a9218c240)

2 years agopf tests: Test ALTQ on top of if_bridge
Kristof Provost [Wed, 25 Aug 2021 09:08:38 +0000 (11:08 +0200)]
pf tests: Test ALTQ on top of if_bridge

Reviewed by: donner
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31676

(cherry picked from commit 062463698eeafc7f75ce22541a244238f37ef2e2)

2 years agoif_bridge: add ALTQ support
Luiz Otavio O Souza [Wed, 25 Aug 2021 09:07:44 +0000 (11:07 +0200)]
if_bridge: add ALTQ support

Similar to the recent addition of ALTQ support to if_vlan.

Reviewed by: donner
Obtained from: pfsense
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31675

(cherry picked from commit eb680a63de1dbf5c974f483975dcb2c60ec6fa08)

2 years agopf tests: ALTQ priority test
Kristof Provost [Thu, 26 Aug 2021 08:25:57 +0000 (10:25 +0200)]
pf tests: ALTQ priority test

Test that ALTQ can prioritise one type of traffic over another. Do this
by establishing a slow link and saturating it with ICMP echos.
When prioritised TCP connections reliably go through. When not
prioritised TCP connections reliably fail.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit cd46399b9ccf04f6ec00a532e52c8b1edb007af7)

2 years agopf tests: test ALTQ CBQ on top of if_vlan
Kristof Provost [Mon, 23 Aug 2021 14:58:50 +0000 (16:58 +0200)]
pf tests: test ALTQ CBQ on top of if_vlan

The main purpose of this test is to verify that we can use ALTQ on top
of if_vlan, but while we're here we also exercise the CBQ code. There's
already a basis test for HFSC, so it makes sense to test another
algorithm while we test if_vlan.

Reviewed by: donner
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31649

(cherry picked from commit e62175df4ec2c8fe2aa2e372f683ddb933768e62)

2 years agoif_vlan: add the ALTQ support to if_vlan.
Luiz Otavio O Souza [Sat, 21 Aug 2021 09:41:03 +0000 (11:41 +0200)]
if_vlan: add the ALTQ support to if_vlan.

Inspired by the iflib implementation, allow ALTQ to be used with if_vlan
interfaces.

Reviewed by: donner
Obtained from: pfsense
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31647

(cherry picked from commit 2e5ff01d0a1fabc757252f9c28ad5cddc98a652d)

2 years agoisci(4): Fix a common typo in src comments
Gordon Bergling [Sun, 29 Aug 2021 07:55:10 +0000 (09:55 +0200)]
isci(4): Fix a common typo in src comments

- s/exlusive/exclusive/

(cherry picked from commit 2dfcc3a91dd4d21c16269b7add3141c99dfa48ab)

2 years agolibsa: Fix a typo in source code comments
Gordon Bergling [Sun, 29 Aug 2021 08:09:58 +0000 (10:09 +0200)]
libsa: Fix a typo in source code comments

- s/mininum/minimum/

(cherry picked from commit 005fe24f2a4c873a96f446604e0453cf99e9bcd7)

2 years agofwohci: Cast bitfield to uint32_t before passing it to roundup2().
John Baldwin [Wed, 17 Feb 2021 21:12:06 +0000 (13:12 -0800)]
fwohci: Cast bitfield to uint32_t before passing it to roundup2().

The fallback for __align_up() used by roundup2() uses __typeof__()
which doesn't work for bitfields.  This fixes the build on GCC which
uses the fallback.

Reviewed by: arichardson, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D28599

(cherry picked from commit 50a61f8db532676d7dc37410540fff7209b7c072)
(cherry picked from commit ae0219c10fe3a2ea9caa7bc88ddc7d0a7e988efd)

2 years agoExpose clang's alignment builtins and use them for roundup2/rounddown2
Alex Richardson [Wed, 3 Feb 2021 15:27:17 +0000 (15:27 +0000)]
Expose clang's alignment builtins and use them for roundup2/rounddown2

This makes roundup2/rounddown2 type- and const-preserving and allows
using it on pointer types without casting to uintptr_t first. Not
performing pointer-to-integer conversions also helps the compiler's
optimization passes and can therefore result in better code generation.
When using it with integer values there should be no change other than
the compiler checking that the alignment value is a valid power-of-two.

I originally implemented these builtins for CHERI a few years ago and
they have been very useful for CheriBSD. However, they are also useful
for non-CHERI code so I was able to upstream them for Clang 10.0.

Rationale from the clang documentation:
Clang provides builtins to support checking and adjusting alignment
of pointers and integers. These builtins can be used to avoid relying
on implementation-defined behavior of arithmetic on integers derived
from pointers. Additionally, these builtins retain type information
and, unlike bitwise arithmetic, they can perform semantic checking on
the alignment value.

There is also a feature request for GCC, so GCC may also support it in
the future: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641

Reviewed By: brooks, jhb, imp
Differential Revision: https://reviews.freebsd.org/D28332

(cherry picked from commit 8fa6abb6f4f64f4f23e2920e2aea7996566851a4)

2 years agoiflib: fix potential NULL dereference
Kristof Provost [Tue, 31 Aug 2021 12:11:22 +0000 (14:11 +0200)]
iflib: fix potential NULL dereference

iflib_softirq_alloc_generic() can be called with a NULL irq parameter
(as done by for example the bnxt and ixl drivers). If
iflib_irq_set_affinity() then returns an error we'd try to dereference
the NULL irq pointer.

Check irq, and pass '-1' (which taskqgroup_attach() expects) if we don't
have an irq.

Direct commit to stable/12, because this issue does not exist on main
and stable/13.

Reviewed by:    kbowling
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D31758

2 years agoSilence more gtest warnings, now in fusefs tests
Dimitry Andric [Fri, 27 Aug 2021 21:39:23 +0000 (23:39 +0200)]
Silence more gtest warnings, now in fusefs tests

Follow-up d396c67f26b0 by also silencing warnings about deprecated
implicit copy constructors in the fusefs tests, which use googletest.

Fixes: d396c67f26b0

(cherry picked from commit 5a3a8cb01ab8ef4aa16a1950b1ef804070ce1ac6)

2 years agoFix null pointer subtraction in mergesort()
Dimitry Andric [Fri, 27 Aug 2021 17:45:43 +0000 (19:45 +0200)]
Fix null pointer subtraction in mergesort()

Clang 13 produces the following warning for this function:

lib/libc/stdlib/merge.c:137:41: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
        if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
                                               ^ ~~~~~~~~~

This is meant to check whether the size and base parameters are aligned
to the size of an int, so use our __is_aligned() macro instead.

Also remove the comment that indicated this "stupid subtraction" was
done to pacify some ancient and unknown Cray compiler, and which has
been there since the BSD 4.4 Lite Lib Sources were imported.

(cherry picked from commit 4e5d32a445f90d37966cd6de571978551654e3f3)

2 years agopfctl: build fix
Kristof Provost [Tue, 24 Aug 2021 11:21:05 +0000 (13:21 +0200)]
pfctl: build fix

Fix the build issue introduced in e59eff9ad328 (pfctl: fix killing states by ID)

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 9ce320820e6d760df11a88de11fbae024c18d23c)

2 years agopf tests: test killing states by ID
Kristof Provost [Tue, 24 Aug 2021 10:36:57 +0000 (12:36 +0200)]
pf tests: test killing states by ID

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit bbf832f34479d19bff0fa8dc43b48ab5553cc85e)

2 years agopfctl: fix killing states by ID
Kristof Provost [Tue, 24 Aug 2021 10:24:28 +0000 (12:24 +0200)]
pfctl: fix killing states by ID

Since the conversion to the new DIOCKILLSTATESNV the kernel no longer
exists the id and creatorid to be big-endian.
As a result killing states by id (i.e. `pfctl -k id -k 12345`) no longer
worked.

Reported by: Özkan KIRIK
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e59eff9ad3285838730acf48f6d066cec0e53114)

2 years agosound(4): Fix some common typos in comments
Gordon Bergling [Thu, 26 Aug 2021 15:15:55 +0000 (17:15 +0200)]
sound(4): Fix some common typos in comments

- s/doens't/doesn't/
- s/apropriate/appropriate/
- s/intepretation/interpretation/

(cherry picked from commit 58d868c88d21b46d3d6d40a2920e7ba8996723b8)

2 years agoinet(3): Fix a few common typos in source code comments
Gordon Bergling [Sat, 28 Aug 2021 16:53:02 +0000 (18:53 +0200)]
inet(3): Fix a few common typos in source code comments

- s/funtion/function/

(cherry picked from commit 586c9dc37470a2b862b50c041d70229026dd530a)

2 years agoinet6(4): Fix a few common typos in source code comments
Gordon Bergling [Sat, 28 Aug 2021 16:53:59 +0000 (18:53 +0200)]
inet6(4): Fix a few common typos in source code comments

- s/reshedule/reschedule/

(cherry picked from commit 10e0082fff4ec9392db2763ce3b095bc010526df)

2 years agoaltq: Fix panics on rmc_restart()
Kristof Provost [Sat, 21 Aug 2021 11:42:27 +0000 (13:42 +0200)]
altq: Fix panics on rmc_restart()

rmc_restart() is called from a timer, but can trigger traffic. This
means the curvnet context will not be set.
Use the vnet associated with the interface we're currently processing to
set it. We also have to enter net_epoch here, for the same reason.

Reviewed by: mjg
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31642

(cherry picked from commit 159258afb50ad57f7ed27fe86ded83a7b3a26f90)

2 years agonfsstat(1): Fix a typo in an error message
Gordon Bergling [Mon, 23 Aug 2021 07:21:28 +0000 (09:21 +0200)]
nfsstat(1): Fix a typo in an error message

- s/priviledged/privileged/

(cherry picked from commit 72a92f91f466fdb73071ec28982b9f4d4cf9b672)

2 years agokern: mountroot: avoid fd leak in .md parsing
Kyle Evans [Tue, 20 Jul 2021 10:23:11 +0000 (05:23 -0500)]
kern: mountroot: avoid fd leak in .md parsing

parse_dir_md() opens /dev/mdctl but only closes the resulting fd on
success, not upon failure of the ioctl or when we exceed the md unit
max.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #62

(cherry picked from commit 23ecfa9d5bc4f04eb58e26018c2d15f032d5d742)

2 years agofreebsd-update: create a ZFS boot environment on install
Dave Fullard [Fri, 16 Jul 2021 04:02:48 +0000 (23:02 -0500)]
freebsd-update: create a ZFS boot environment on install

Updated freebsd-update to allow it to create boot environments using
bectl should the system support it. The bectl utility was updated in
r352211 (490e13c1403f) to support a 'check' to determine if the system
supports boot environments.  If UFS is used, the bectl check will fail
then no attempt will be made to create the boot environment.

If freebsd-update is run inside a jail, no attempt will be made to
create a boot environment.

The boot environment function will create a new environment using the
format: current FreeBSD kernel version and date/timestamp, example:

12.0-RELEASE-p10_2019-10-03_185233

This functionality can be disabled by setting 'CreateBootEnv' in
freebsd-update.conf to 'no'.

(cherry picked from commit f28f138905416c45ebaa6429f44a0b88a72f54b1)

2 years agoRevert "Do a sweep and remove most WARNS=6 settings"
Dimitry Andric [Sun, 29 Aug 2021 13:28:30 +0000 (15:28 +0200)]
Revert "Do a sweep and remove most WARNS=6 settings"

This reverts commit befc47822966, as it caused various CI build errors,
and we never merged the prerequisite commit fe815331bb40 ("build:
provide a default WARNS for all in-tree builds"). The latter is rather
intrusive, so I will avoid it.

Direct commit to stable/12 since the CI bots are broken.

2 years agoCleanup compiler warning flags in lib/libefivar/Makefile
Dimitry Andric [Thu, 26 Aug 2021 18:53:18 +0000 (20:53 +0200)]
Cleanup compiler warning flags in lib/libefivar/Makefile

There is no need to set -Wno-unused-parameter twice, and instead of
appending to CFLAGS, append to CWARNFLAGS instead. While here, add
-Wno-unused-but-set-variable for the sake of clang 13.0.0.

(cherry picked from commit f643997a1761689ef9108d69b86d42881ea0ab1c)

2 years agogoogletest: Silence warnings about deprecated implicit copy constructors
Dimitry Andric [Thu, 26 Aug 2021 20:06:49 +0000 (22:06 +0200)]
googletest: Silence warnings about deprecated implicit copy constructors

Our copy of googletest is rather stale, and causes a number of -Werror
warnings about implicit copy constructor definitions being deprecated,
because several classes have user-declared copy assignment operators.
Silence the warnings until we either upgrade or remove googletest.

(cherry picked from commit d396c67f26b079c2808002c07212d9df9818a11b)

2 years agoDo a sweep and remove most WARNS=6 settings
Kyle Evans [Thu, 1 Oct 2020 01:10:51 +0000 (01:10 +0000)]
Do a sweep and remove most WARNS=6 settings

Repeating the default WARNS here makes it slightly more difficult to
experiment with default WARNS changes, e.g. if we did something absolutely
bananas and introduced a WARNS=7 and wanted to try lifting the default to
that.

Drop most of them; there is one in the blake2 kernel module, but I suspect
it should be dropped -- the default WARNS in the rest of the build doesn't
currently apply to kernel modules, and I haven't put too much thought into
whether it makes sense to make it so.

(cherry picked from commit 7cc42f6d25ef2e19059d088fa7d4853fe9afefb5)

2 years agoEnable rc.d/jail within jails
Dan Langille [Sun, 15 Aug 2021 16:53:16 +0000 (12:53 -0400)]
Enable rc.d/jail within jails

Jails with jails is a supported. This change allows the script to run
upon startup with a jail. Without this, jails are not automatically
started within jails.

(cherry picked from commit 35cf9fecbd80f56e39524f480240acfd953c93e1)

2 years agoext2fs(5): Correct a typo in an error message
Gordon Bergling [Sun, 22 Aug 2021 05:58:22 +0000 (07:58 +0200)]
ext2fs(5): Correct a typo in an error message

- s/talbes/tables/

(cherry picked from commit 47f880ebeb3092b1b7bbc6d75e82532e43bbf010)

2 years agoiflib: Improve mapping of TX/RX queues to CPUs
Patrick Kelsey [Mon, 26 Apr 2021 04:25:59 +0000 (00:25 -0400)]
iflib: Improve mapping of TX/RX queues to CPUs

iflib now supports mapping each (TX,RX) queue pair to the same CPU
(default), to separate CPUs, or to a pair of physical and logical CPUs
that share the same L2 cache.  The mapping mechanism supports unequal
numbers of TX and RX queues, with the excess queues always being
mapped to consecutive physical CPUs.  When the platform cannot
distinguish between physical and logical CPUs, all are treated as
physical CPUs.  See the comment on get_cpuid_for_queue() for the
entire matrix.

The following device-specific tunables influence the mapping process:
dev.<device>.<unit>.iflib.core_offset       (existing)
dev.<device>.<unit>.iflib.separate_txrx     (existing)
dev.<device>.<unit>.iflib.use_logical_cores (new)

The following new, read-only sysctls provide visibility of the mapping
results:
dev.<device>.<unit>.iflib.{t,r}xq<n>.cpu

When an iflib driver allocates TX softirqs without providing reference
RX IRQs, iflib now binds those TX softirqs to CPUs using the above
mapping mechanism (that is, treats them as if they were TX IRQs).
Previously, such bindings were left up to the grouptaskqueue code and
thus fell outside of the iflib CPU mapping strategy.

Reviewed by: kbowling
Tested by: olivier, pkelsey
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D24094

(cherry picked from commit ca7005f1893d199b7c28d5b159e1bdbb55e74543)

2 years agovmm: Bump vmname buffer in struct vm to VM_MAX_NAMELEN + 1
Ka Ho Ng [Mon, 2 Aug 2021 09:54:40 +0000 (17:54 +0800)]
vmm: Bump vmname buffer in struct vm to VM_MAX_NAMELEN + 1

In hw.vmm.create sysctl handler the maximum length of vm name is
VM_MAX_NAMELEN. However in vm_create() the maximum length allowed is
only VM_MAX_NAMELEN - 1 chars. Bump the length of the internal buffer to
allow the length of VM_MAX_NAMELEN for vm name.

Reviewed by: grehan
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31372

(cherry picked from commit df95cc76affbbf114c9ff2e4ee011b6f162aa8bd)

2 years agotmpfs: Fix error being cleared after commit c12118f6cec0
Ka Ho Ng [Tue, 24 Aug 2021 16:35:29 +0000 (00:35 +0800)]
tmpfs: Fix error being cleared after commit c12118f6cec0

In tmpfs_link() error was erroneously cleared in commit c12118f6cec0.

Sponsored by: The FreeBSD Foundation
MFC with: c12118f6cec0

(cherry picked from commit a48416f844e3007b4e9f6df125e25cf3a1daad62)

2 years agotmpfs: Fix styles
Ka Ho Ng [Tue, 24 Aug 2021 13:09:21 +0000 (21:09 +0800)]
tmpfs: Fix styles

A lot of return statements were in the wrong style before this commit.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c12118f6cec0ca5f720be6c06d6c59d551461e5a)

2 years agosound: Add an example of basic sound application
Goran Mekić [Wed, 4 Aug 2021 10:04:54 +0000 (18:04 +0800)]
sound: Add an example of basic sound application

This is an example demonstrating the usage of the OSS-compatible APIs
provided by the sound(4) subsystem. It reads frames from a dsp node and
writes them to the same dsp node.

Reviewed by: hselasky, bcr
Differential revision: https://reviews.freebsd.org/D30149

(cherry picked from commit 21d854658801f6ddb91de3a3c3384e90f5d920f2)

2 years agointel ethernet: Use ether_gen_addr(9)
Kevin Bowling [Fri, 20 Aug 2021 14:45:30 +0000 (07:45 -0700)]
intel ethernet: Use ether_gen_addr(9)

Use ether_gen_addr(9) for VF MAC generation

Reviewed by: Intel Networking (erj), kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31616

(cherry picked from commit 0e5811a2a9a1b4a7e0c79b73e3b9b9d15d481577)

2 years agocrunch: drop WARNS override
Kyle Evans [Thu, 19 Aug 2021 06:33:13 +0000 (01:33 -0500)]
crunch: drop WARNS override

crunchide and crunchgen now build fine with default WARNS

(cherry picked from commit d59c5e023d558161e4f519b88d5209d8bab18bc7)

2 years agocrunchgen: fix remaining issues under WARNS=6
Kyle Evans [Thu, 19 Aug 2021 06:22:16 +0000 (01:22 -0500)]
crunchgen: fix remaining issues under WARNS=6

Entirely variables that should be static, save for one 'no previous
declaration' in mkskel.sh.

(cherry picked from commit bfd70233c3e2bc5c29db6f96fb90b58439908d29)

2 years agocrunchide: static'ify remaining non-exported functions
Kyle Evans [Thu, 19 Aug 2021 06:29:02 +0000 (01:29 -0500)]
crunchide: static'ify remaining non-exported functions

(cherry picked from commit 7ff87026d65c77f90391ead3f2fc752223d16e01)

2 years agocrunchide: address complaints from WARNS=6
Kyle Evans [Thu, 19 Aug 2021 06:17:36 +0000 (01:17 -0500)]
crunchide: address complaints from WARNS=6

- One (1) constify
- One (1) argument is unused
- One (1) local shadows a global
- Various globals that should be static

(cherry picked from commit dd7c7ff192d07912fb7f5874868649c3aa05944a)