]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
23 months agosqlite3: Vendor import of sqlite3 3.39.2
Cy Schubert [Tue, 30 Aug 2022 22:54:32 +0000 (15:54 -0700)]
sqlite3: Vendor import of sqlite3 3.39.2

Changes at https://www.sqlite.org/releaselog/3_39_2.html.

Security:       CVE-2022-35737
Obtained from:  https://www.sqlite.org/2022/sqlite-autoconf-3390200.tar.gz
MFC after:      immediately

Merge commit '1545dd7d6cc54bdfca9bc9f74c42745b514b60c9' into sqlite3/main3

(cherry picked from commit 2a63683b5d5c480d0f652f0ea9cf6b9621d55920)

23 months agobhnd(4): Correct a typo in a source code comment
Gordon Bergling [Sat, 27 Aug 2022 10:10:00 +0000 (12:10 +0200)]
bhnd(4): Correct a typo in a source code comment

- s/in he/in the/

(cherry picked from commit ce99e4fa4442ed7d1a7802612557b23173dd5781)

23 months agobhyve: Address uses of uninitialized variables in pci_nvme.c
Mark Johnston [Sun, 14 Aug 2022 15:57:24 +0000 (11:57 -0400)]
bhyve: Address uses of uninitialized variables in pci_nvme.c

The debug print in nvme_opc_get_log_page() would print an uninitialized
local variable.

In nvme_opc_write_read(), a failed LBA bounds check would cause
pci_nvme_stats_write_read_update() to be called with an uninitialized
variable as a parameter.  Although the parameter is unused when the
check fails (and so status != 0), LLVM 14 emits some bogus machine code
in this path, which happens to result in a segfault when it gets
executed.

PR: 265749
Reviewed by: chuck, emaste
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b6ecef28bfd7c1c267442fae1c8f2fe0f699f617)

23 months agobhyve: Address -Wunused* warnings in pci_nvme.c
Mark Johnston [Sun, 14 Aug 2022 15:56:33 +0000 (11:56 -0400)]
bhyve: Address -Wunused* warnings in pci_nvme.c

Currently these are not reported because bhyve is compiled with WARNS=2.
Let's start taking small steps towards enabling more warnings.

No functional change intended.

Reviewed by: chuck, imp, emaste
Sponsored by: The FreeBSD Foundation

(cherry picked from commit af86d12c80f10dcd4a57ff7834891890b255087d)

23 months agoibcore: Add support for RDMA/RoCE using VLAN(4) devices.
Hans Petter Selasky [Mon, 22 Aug 2022 08:03:24 +0000 (10:03 +0200)]
ibcore: Add support for RDMA/RoCE using VLAN(4) devices.

Classify VLAN devices as ethernet in rdma_copy_addr().
This fixes the following error message:

rdma_bind_addr: No such file or directory

Submitted by: Piotr Kubaj <pkubaj@FreeBSD.org>
Differential Revision: https://reviews.freebsd.org/D36120
Sponsored by: NVIDIA Networking

(cherry picked from commit 57af517ac4e8f88339ad1ff778d3b7ac32827430)

23 months agouftdi(4): Add new USB ID.
Hans Petter Selasky [Mon, 1 Aug 2022 11:25:49 +0000 (13:25 +0200)]
uftdi(4): Add new USB ID.

PR: 265514
Sponsored by: NVIDIA Networking

(cherry picked from commit 9f35dbfdc6c8faafdbb2cfd8a507e0442247a88c)

23 months agogpio: mark INVARIANTS variables as __diagused
Ed Maste [Tue, 9 Aug 2022 23:30:13 +0000 (19:30 -0400)]
gpio: mark INVARIANTS variables as __diagused

Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

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

(cherry picked from commit 7dc4d5118c0268efe48c0e36c49cba1e2a8e39fc)

23 months agoacpi: mark INVARIANTS variables as __diagused
Ed Maste [Wed, 10 Aug 2022 00:39:28 +0000 (20:39 -0400)]
acpi: mark INVARIANTS variables as __diagused

Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

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

(cherry picked from commit 0fd8d3589a68838d62d47f240d7fb22ef0d4dbeb)

23 months agoopencrypto: mark INVARIANTS variables as __diagused
Ed Maste [Tue, 9 Aug 2022 23:23:19 +0000 (19:23 -0400)]
opencrypto: mark INVARIANTS variables as __diagused

Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3471fcf3a42d2a7b221215bfc772a6d1a170a059)

23 months agopf: Reduce diffs against OpenBSD in pf_if.c
Ed Maste [Fri, 19 Aug 2022 21:02:26 +0000 (17:02 -0400)]
pf: Reduce diffs against OpenBSD in pf_if.c

Use memset instead of bzero, memcpy instead of bcopy, and add some
optional {}s.

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

(cherry picked from commit 6b598e263bebaf6664b64f80f029a6ebcfc2848d)

23 months agoamd64: update comment for casueword/casueword32, mentioning return value 1
Konstantin Belousov [Thu, 25 Aug 2022 23:41:48 +0000 (02:41 +0300)]
amd64: update comment for casueword/casueword32, mentioning return value 1

(cherry picked from commit c1a0ab5ec525c4cb2dee4aad72d27f195e21450c)

23 months agoiommu_gas: avoid pointless augmentation
Doug Moore [Sat, 6 Aug 2022 18:26:18 +0000 (13:26 -0500)]
iommu_gas: avoid pointless augmentation

iommu_gas_augment_entry updates a map entry element. Invoked as
RB_AUGMENT in RB tree code, it is applied from the point where the
tree is modified, all the way up to the root, and is also applied when
rotation moves a node down in the tree.

There are several opportunities to invoke it less. The automatic
augmentation with every rotation is a mistake.  Delaying these
augmentations until RB_INSERT_COLOR or RB_REMOVE_COLOR are finishing
allows the augmentation code to be duplicated less, to work when there
is less register pressure, and to be skipped when conditions allow it:

    In the double-rotate case of RB_INSERT_COLOR, augmentation after
    the first rotation is not necessary when the element being moved
    down the tree becomes a leaf. It was in the tree, and was a leaf,
    before the RB_INSERT operation began, and so recomputing
    augmentation for it would do nothing.

    In the final (possibly only) rotation of RB_REMOVE_COLOR, both the
    elements - the one moving up and the one moving down - end up in
    the path from the deletion point to the tree root, so there's no
    need to augment either of them immediately.

    In RB_REMOVE, when the right child of the removed node replaces it
    in tree, it began with a null left child. Replacement creates a
    non-NULL left child, and then rotation may put a NULL node back in
    that place. If that happens, start the augmenting-up-to-root with
    the parent of that node, since augmentation would do nothing.

Adjust to avoid these needless augmentations.

Reviewed by: alc
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35502

(cherry picked from commit 7f2ec173e4613a57732ca162572d25b0a546689f)

23 months agoDecode couple arrays in NFIT table.
Alexander Motin [Fri, 19 Aug 2022 01:30:38 +0000 (21:30 -0400)]
Decode couple arrays in NFIT table.

MFC after: 1 week

(cherry picked from commit 3b7935f33b50aa69637e722c3d3fd275c0efd3cd)

23 months agobhyve: Validate host PAs used to map passthrough BARs.
John Baldwin [Fri, 19 Aug 2022 21:59:44 +0000 (14:59 -0700)]
bhyve: Validate host PAs used to map passthrough BARs.

Reject attempts to map host physical address ranges that are not
subsets of a passthrough device's BAR into a guest.

Reviewed by: markj, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36238

(cherry picked from commit c94f30ea85b745a5137471876013f79689e0af03)

23 months agopci: Add helper routines to iterate over a device's BARs.
John Baldwin [Fri, 19 Aug 2022 21:59:06 +0000 (14:59 -0700)]
pci: Add helper routines to iterate over a device's BARs.

Reviewed by: imp, markj, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36237

(cherry picked from commit 16bedf532c022f2380b0bb2970a3a3ebc7ca0f36)

23 months agobhyve: Support other schemes for naming pass-through devices.
John Baldwin [Fri, 19 Aug 2022 21:55:29 +0000 (14:55 -0700)]
bhyve: Support other schemes for naming pass-through devices.

Permit naming pass through devices using the syntax accepted by
pciconf (pci[<domain>:]<bus>:<slot>:<func>) as well as by device name
(e.g. "ppt0").

While here, fix an error in the manpage that had the bus and slot
arguments for the original /-delimited scheme swapped.

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

(cherry picked from commit baf753cc196e2308828c7fb9b0385d5fe17ecdc2)

23 months agobhyve e1000: Skip packets with a small header.
John Baldwin [Wed, 17 Aug 2022 17:01:16 +0000 (10:01 -0700)]
bhyve e1000: Skip packets with a small header.

Certain operations such as checksum insertion and VLAN insertion
require the device model to rewrite the packet header.  The first step
in rewriting the packet header is to copy the existing packet header
from the source packet.  This copy is done by copying data from an
iovec array that corresponds to the S/G entries described by transmit
descriptors.  However, if the total packet length is smaller than the
headers that need to be copied as the initial template, this copy can
overflow the iovec array and use garbage values as the source pointer
to memcpy.  The PR used a single descriptor with a length of 0 in its
PoC.

To fix, track the total packet length and drop requests to transmit
packets whose payload is smaller than the required header length.

While here, fix another issue where the final descriptor could have an
invalid length (too short) that could underflow 'len' when stripping
the checksum.  Skip those requests instead, too.

PR: 264372
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: grehan, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36182

(cherry picked from commit fa46f3704b7618f9d9493c126df781faf59040a8)

23 months agobhyve: fix -Wunused-but-set-variable warning
Robert Wing [Mon, 6 Dec 2021 19:52:08 +0000 (10:52 -0900)]
bhyve: fix -Wunused-but-set-variable warning

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

(cherry picked from commit 2616ee608cd54e544259ee738cd8b8ff71334ced)

23 months agobhyve xhci: Cache the value of MaxPStreams when initializing an endpoint.
John Baldwin [Wed, 17 Aug 2022 17:00:36 +0000 (10:00 -0700)]
bhyve xhci: Cache the value of MaxPStreams when initializing an endpoint.

This avoids type confusion where a malicious guest could rewrite the
MaxPStreams field in an endpoint context after the endpoint was
initialized causing the device model to interpret a guest provided
address (stored in ep_ringaddr of the "software" endpoint state) as a
bhyve host process address (ep_sctx_trbs).  It also prevents a malicious
guest from triggering overflows of ep_sctx_trbs[] by increasing the
number of streams after the endpoint has been initialized.

Rather than re-reading the MaxPStreams value out of the endpoint context
in guest memory on subsequent operations, cache the value in the software
endpoint state.  Possibly the device model should raise errors if the
value of MaxPStreams changes while an endpoint is running.  This approach
simply ignores any such changes by the guest.

PR: 264294, 264347
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36181

(cherry picked from commit e7439f6aeb235ba3a7e79818c56a63d066c80854)

23 months agobhyve: Style fix for read/write_config.
John Baldwin [Wed, 17 Aug 2022 17:00:09 +0000 (10:00 -0700)]
bhyve: Style fix for read/write_config.

(cherry picked from commit bcab868a650e56d1b452903a1bf23993cf539c2e)

23 months agoktls_test: Add a require_toe option similar to require_ifnet.
John Baldwin [Mon, 8 Aug 2022 18:21:54 +0000 (11:21 -0700)]
ktls_test: Add a require_toe option similar to require_ifnet.

This skips tests that send and receive records that do not use TOE TLS.

Sponsored by: Chelsio Communications

(cherry picked from commit cc13c98302f6d73ab0b0ea81e2b7ef84297057b3)

23 months agocxgbe TOE TLS: Fix handling of unusual record types.
John Baldwin [Mon, 8 Aug 2022 18:21:54 +0000 (11:21 -0700)]
cxgbe TOE TLS: Fix handling of unusual record types.

This doesn't matter for real traffic but fixes failures in the KTLS
unit tests that use unusual record types.

Sponsored by: Chelsio Communications

(cherry picked from commit 782db2881b6b9c8460f7f311e0e4bbbab36eb88a)

23 months agogcore: Trim stale bits from elf32core.c.
John Baldwin [Thu, 14 Jul 2022 20:03:34 +0000 (13:03 -0700)]
gcore: Trim stale bits from elf32core.c.

These should have been removed in
d95657a1a758e8d993a0eb92259f8c860a309207.

Reviewed by: markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35748

(cherry picked from commit a6c3e5fa39a01d63d18b24d9afabfc95c734650e)

23 months agocxgbei: Adjust the calculation for the maximum ISO payload.
John Baldwin [Thu, 26 May 2022 20:38:20 +0000 (13:38 -0700)]
cxgbei: Adjust the calculation for the maximum ISO payload.

Round down the maximim ISO payload by the current MSS.  Otherwise the
round up by MSS when calculating the 16-bit maximum payload len passed
along in the FLOWC work request can overflow.

Discussed with: np
Sponsored by: Chelsio Communications

(cherry picked from commit 8020c05683f266c5513cfe8ad3e58e7e06f85ffa)

23 months agocxgbe: Deactivate upper layer drivers (like TOE) during detach.
John Baldwin [Tue, 17 May 2022 23:33:49 +0000 (16:33 -0700)]
cxgbe: Deactivate upper layer drivers (like TOE) during detach.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D35237

(cherry picked from commit 12b37f8f9c789a48ea0e8cd35f403aee0e020ad9)

23 months agosh: accept fc options grouped behind one '-'
Piotr Pawel Stefaniak [Sat, 20 Aug 2022 10:15:05 +0000 (12:15 +0200)]
sh: accept fc options grouped behind one '-'

As per Utility Syntax Guidelines, accept both forms: -l -n and -ln.

To do that, anticipate the source string for the next option that will
be parsed by nextopt(). It's not always *argptr, sometimes it is
nextopt_optptr.

To simplify the check for not_fcnumber, slightly modify nextopt() to
always nullify nextopt_optptr in cases where it would have been set
to point to a NUL character.

(cherry picked from commit 755a1be6d015287763b0f336d4e9b8179615f511)

23 months agosh: nullify ENV in tests
Piotr Pawel Stefaniak [Sat, 20 Aug 2022 10:16:18 +0000 (12:16 +0200)]
sh: nullify ENV in tests

This is to avoid loading .shrc which may contain commands that would
result in output different than expected.

(cherry picked from commit a1423456415ad4784b31513cfe11438d2446881f)

23 months agoarc4random(3): Reduce diff with OpenBSD.
Xin LI [Wed, 10 Aug 2022 00:27:54 +0000 (17:27 -0700)]
arc4random(3): Reduce diff with OpenBSD.

The main change was v1.57 by djm@:

  Randomise the rekey interval a little. Previously, the chacha20
  instance would be rekeyed every 1.6MB. This makes it happen at a
  random point somewhere in the 1-2MB range.

Reviewed by: csprng (markm, cem)
Differential Revision: https://reviews.freebsd.org/D36088

(cherry picked from commit e9a2e4d1d28bf608a2ec915e25df9200af98e3b8)

23 months agotests: Handle platforms with MAXPAGESIZES < 2
Mark Johnston [Tue, 23 Aug 2022 23:48:06 +0000 (19:48 -0400)]
tests: Handle platforms with MAXPAGESIZES < 2

Reported by: Jenkins
Fixes: 1dfa8b73f6a6 ("tests: Add more shared shadow regression tests")

(cherry picked from commit 4b8feb5d61ace6d94cafb03288a53694e84c2e53)

23 months agoFix shared_shadow_inval_test when superpages are disabled
Eric van Gyzen [Fri, 19 Aug 2022 20:05:19 +0000 (15:05 -0500)]
Fix shared_shadow_inval_test when superpages are disabled

In that case, there is only one page size.

Reviewed by: kib
Sponsored by: Dell EMC Isilon

(cherry picked from commit 3d268c19efb8b47dde1b5ac5bd367f2ff2d75c12)

23 months agotests: Add more shared shadow regression tests
Mark Johnston [Tue, 9 Aug 2022 20:17:56 +0000 (16:17 -0400)]
tests: Add more shared shadow regression tests

The new tests exercise simulated COW that occurs when the protections on
a wired, copy-on-write mapping are changed from read-only to read-write.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1dfa8b73f6a68b5ec202a51021a8ec7ab4b94b8e)

23 months agobhyve: Sprinkle const qualifiers where appropriate
Mark Johnston [Tue, 16 Aug 2022 17:13:12 +0000 (13:13 -0400)]
bhyve: Sprinkle const qualifiers where appropriate

No functional change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit d06bf11c06a0c2a6f52ba23f9b5204912cfd6fc5)

23 months agobhyve: Mark variables and functions as static where appropriate
Mark Johnston [Tue, 16 Aug 2022 17:12:32 +0000 (13:12 -0400)]
bhyve: Mark variables and functions as static where appropriate

Mark them const as well when it makes sense to do so.  No functional
change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 37045dfa891a75455ac19ddfb05cda2040343b4e)

23 months agobhyve: Use "void" instead of empty parameter lists
Mark Johnston [Tue, 16 Aug 2022 17:10:58 +0000 (13:10 -0400)]
bhyve: Use "void" instead of empty parameter lists

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 75ce327a2c433e793cc15861944955396ef3306b)

23 months agodtrace/amd64: Implement emulation of call instructions
Mark Johnston [Tue, 9 Aug 2022 20:08:13 +0000 (16:08 -0400)]
dtrace/amd64: Implement emulation of call instructions

Here, the provider is responsible for updating the trapframe to redirect
control flow and for computing the return address.  Once software-saved
registers are restored, the emulation shifts the remaining context down
on the stack to make space for the return address, then copies the
address provided by the invop handler.  dtrace_invop() is modified to
allocate temporary storage space on the stack for use by the provider to
return the return address.

This is to support a new provider for amd64 which can instrument
arbitrary instructions, not just function entry and exit instructions as
FBT does.

In collaboration with: christos
Sponsored by: Google, Inc. (GSoC 2022)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3ba8e9dc4a0e0e9c35cfadfe25379871ce581697)

23 months agofbt/x86: Extract arg1 for return probes from the trapframe
Mark Johnston [Tue, 9 Aug 2022 20:08:09 +0000 (16:08 -0400)]
fbt/x86: Extract arg1 for return probes from the trapframe

dtrace invop handlers have access to the whole trapframe, just use that
to extract %rax/%eax for return probes instead of relying on an
additional parameter to the handler.  No functional change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit a7aa3d4d758dc60894e7f9c99411a64837fd3c18)

23 months agoreap_kill_proc_locked(): remove outdated part of the comment
Konstantin Belousov [Fri, 12 Aug 2022 22:12:20 +0000 (01:12 +0300)]
reap_kill_proc_locked(): remove outdated part of the comment

(cherry picked from commit 5c78797e42497270d8719590d11243a4473114c4)

23 months agoexit1(): update comment about thread_single()
Konstantin Belousov [Fri, 12 Aug 2022 20:16:29 +0000 (23:16 +0300)]
exit1(): update comment about thread_single()

(cherry picked from commit 30b16a6bcf01c17b52daef76bf2320749e84bd89)

23 months agosleepq_set_timeout_sbt(): correct comment to not talk about ticks
Konstantin Belousov [Fri, 12 Aug 2022 00:35:45 +0000 (03:35 +0300)]
sleepq_set_timeout_sbt(): correct comment to not talk about ticks

(cherry picked from commit f835be58226a058c56d305455ec78c4d6f11b9fc)

23 months agosleepq_check_ast_sc_locked(): update comment
Konstantin Belousov [Fri, 12 Aug 2022 00:19:36 +0000 (03:19 +0300)]
sleepq_check_ast_sc_locked(): update comment

(cherry picked from commit da39a100dbfe60da6512a8b230386b1105c42445)

23 months agofork_norfproc(): style
Konstantin Belousov [Fri, 12 Aug 2022 00:37:55 +0000 (03:37 +0300)]
fork_norfproc(): style

(cherry picked from commit bd76586bb705d62549f6df7ae8cebf7db252db63)

23 months agoiommu_gas: add iommu_gas_remove()
Konstantin Belousov [Sun, 31 Jul 2022 08:43:43 +0000 (11:43 +0300)]
iommu_gas: add iommu_gas_remove()

(cherry picked from commit c9e4d25052065d1e0cbdb3a0eea3f21c9225d1d1)

23 months agorb_tree: resolve name clash
Doug Moore [Tue, 2 Aug 2022 16:47:17 +0000 (11:47 -0500)]
rb_tree: resolve name clash

Rename 'tmp' to 'rb_update_tmp' in a macro to avoid a shadow variable panic.

Reported by: imb@protected-networks.net
Fixes: 35557a0d9169

(cherry picked from commit b3fd5464a903180994313bd903f3c170f5f9e1f3)

23 months agorb_tree: update augmentation after element change
Doug Moore [Tue, 2 Aug 2022 16:19:46 +0000 (11:19 -0500)]
rb_tree: update augmentation after element change

For an augmented rb_tree, allow a faster alternative to removing an
element from the tree, tweaking it slightly, and inserting it back
into the tree, knowing that its relative position in the tree is
unchanged. Instead, just change the element and invoke
RB_UPDATE_AUGMENT to fix the augmentation data for all the nodes in
the tree.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36010

(cherry picked from commit 35557a0d9169172b90df903b0daf389c2839b749)

23 months agoAdjust function definition in subr_devmap.c to avoid clang 15 warning
Andrew Turner [Thu, 11 Aug 2022 12:04:58 +0000 (13:04 +0100)]
Adjust function definition in subr_devmap.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/kern/subr_devmap.c:87:19: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    devmap_print_table()
                      ^
                       void

This is because devmap_print_table() and devmap_lastaddr() are declared
with a (void) argument list, but defined with an empty argument list.
Make the definition match the declaration.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8e9ca1379edad98a957570a2339a9236910e61c1)

23 months agoAdjust function definition in ofw to avoid clang 15 warning
Andrew Turner [Thu, 11 Aug 2022 12:02:50 +0000 (13:02 +0100)]
Adjust function definition in ofw to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/dev/ofw/openfirm.c:826:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    OF_enter()
            ^
             void

This is because OF_enter() and OF_exit are declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ec666d187d0dc44d105a95b5b25b47607236a051)

23 months agoAdjust function definition in hwpmc to avoid clang 15 warning
Andrew Turner [Thu, 11 Aug 2022 12:02:33 +0000 (13:02 +0100)]
Adjust function definition in hwpmc to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/dev/hwpmc/hwpmc_arm64.c:530:21: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pmc_arm64_initialize()
                        ^
                         void

This is because many of the functions are declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 05cef74742154cf3c89be214a464d8fabddf8d7d)

23 months agoRemove "All rights reserved" where I can in libc
Andrew Turner [Fri, 5 Aug 2022 14:11:39 +0000 (15:11 +0100)]
Remove "All rights reserved" where I can in libc

These all have my copyright so can be removed. Some also have FreeBSD
Foundation copyright so drop from there as has been done for previous
files.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 101480e926858c90e6b0db780f48742cf60a0487)

23 months agoOnly add gicv3 fdt children with a compatible property
Andrew Turner [Wed, 6 Jul 2022 17:04:53 +0000 (18:04 +0100)]
Only add gicv3 fdt children with a compatible property

Not all gicv3 fdt children have a compatible property. Those that don't
are configuration data rather than something that should have a driver
attach.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 92f692fd249e64ed4b25199310fafe41e2d9c74d)

23 months agoSupport decoding mem32 memory in the rk pcie driver
Andrew Turner [Thu, 30 Jun 2022 18:08:32 +0000 (19:08 +0100)]
Support decoding mem32 memory in the rk pcie driver

This is needed with some dtb files.

While here use a switch statement as the two options are mutually
exclusive in any iteration of the loop.

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

(cherry picked from commit 1c799a6f29cadc7616362941c279dd0693c24645)

23 months agopfctl tests: test case for the POM_STICKYADDRESS fix
Kristof Provost [Mon, 8 Aug 2022 07:30:42 +0000 (09:30 +0200)]
pfctl tests: test case for the POM_STICKYADDRESS fix

In 1e73fbd8b we fixed an issue with POM_STICKYADDRESS being checked in
the wrong struct.
Add a basic test case for this fix.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 63167eb48c9f275384bae20e9b432ad68f44ff42)

23 months agopf: stop resolving hosts as dns that use ":" modifier
Franco Fichtner [Mon, 8 Aug 2022 16:31:02 +0000 (18:31 +0200)]
pf: stop resolving hosts as dns that use ":" modifier

When the interface does not exist avoid passing host with special pf
modifiers to DNS resolution as they come up empty anyway.

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

(cherry picked from commit 28b64169eace3477abbd50c18163d37c45cf273a)

23 months agoMFC: syslog(3): unbreak log generation using fabricated PID
Eugene Grosbein [Mon, 8 Aug 2022 22:21:02 +0000 (05:21 +0700)]
MFC: syslog(3): unbreak log generation using fabricated PID

Recover application ability to supply fabricated PID
embedded into ident that was lost when libc switched
to generation of RFC 5424 log messages, for example:

logger -t "ident[$$]" -p user.notice "test"

It is essential for long running scripts.
Also, this change unbreaks matching resulted entries
by ident in syslog.conf:

!ident
*.* /var/log/ident.log

Without the fix, the log (and matching) was broken:

Aug  1 07:36:58 hostname ident[123][86483]: test

Now it works as expected and worked before breakage:

Aug  1 07:39:40 hostname ident[123]: test

Differential: https://reviews.freebsd.org/D36005

(cherry picked from commit e9ae9fa93745669b7dd0341d333257ad6cfe8e37)

23 months agodevelopment(7): Update URLs
Li-Wen Hsu [Thu, 18 Aug 2022 01:24:53 +0000 (09:24 +0800)]
development(7): Update URLs

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2541dcaf4430a7d732c73b8f9190791e85c79b1c)

23 months agoAdjust function definition in moea64_native.c to avoid clang 15 warning
Dimitry Andric [Mon, 15 Aug 2022 18:44:30 +0000 (20:44 +0200)]
Adjust function definition in moea64_native.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/powerpc/aim/moea64_native.c:306:22: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    moea64_install_native()
                         ^
                          void

This is because moea64_install_native() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after: 3 days

(cherry picked from commit ff490346fd519501e9263988959ffb583013ccdb)

23 months agoAdjust function definition in riscv's db_trace.c to avoid clang 15 warning
Dimitry Andric [Mon, 15 Aug 2022 18:48:17 +0000 (20:48 +0200)]
Adjust function definition in riscv's db_trace.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/riscv/riscv/db_trace.c:56:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    db_md_list_watchpoints()
                          ^
                           void

This is because db_md_list_watchpoints() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after: 3 days

(cherry picked from commit da36b5d244419fdc137e0cce50bf021e8c46c822)

23 months agoAdjust function definitions in mp_cpudep.c.c to avoid clang 15 warnings
Dimitry Andric [Mon, 15 Aug 2022 18:46:44 +0000 (20:46 +0200)]
Adjust function definitions in mp_cpudep.c.c to avoid clang 15 warnings

With clang 15, the following -Werror warnings are produced:

    sys/powerpc/booke/mp_cpudep.c:54:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    cpudep_ap_bootstrap()
                       ^
                        void
    sys/powerpc/booke/mp_cpudep.c:97:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    cpudep_ap_setup()
                   ^
                    void

This is because cpudep_ap_bootstrap() and cpudep_ap_setup() are declared
with (void) argument lists, but defined with empty argument lists. Make
the definitions match the declarations.

MFC after: 3 days

(cherry picked from commit 02dd51c9bccedc2fc8d98c3892986232f6bacdab)

23 months agoAdjust function definitions in mmu_radix.c to avoid clang 15 warnings
Dimitry Andric [Mon, 15 Aug 2022 18:37:14 +0000 (20:37 +0200)]
Adjust function definitions in mmu_radix.c to avoid clang 15 warnings

With clang 15, the following -Werror warnings are produced:

    sys/powerpc/aim/mmu_radix.c:786:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mmu_radix_tlbie_all()
                       ^
                        void
    sys/powerpc/aim/mmu_radix.c:3615:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mmu_radix_init()
                  ^
                   void
    sys/powerpc/aim/mmu_radix.c:6081:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mmu_radix_scan_init()
                       ^
                        void

This is because mmu_radix_tlbie_all(), mmu_radix_init(), and
mmu_radix_scan_init() are declared with (void) argument lists, but
defined with empty argument lists. Make the definitions match the
declarations.

MFC after: 3 days

(cherry picked from commit fb203abd9d399c23cd34361d78f956642e1f6567)

23 months agoFix unused variable warnings in tcp_hpts.c
Dimitry Andric [Mon, 15 Aug 2022 18:14:39 +0000 (20:14 +0200)]
Fix unused variable warnings in tcp_hpts.c

With clang 15, the following -Werror warning is produced:

    sys/netinet/tcp_hpts.c:1114:10: error: variable 'paced_cnt' set but not used [-Werror,-Wunused-but-set-variable]
            int32_t paced_cnt = 0;
                    ^
    sys/netinet/tcp_hpts.c:1112:11: error: variable 'total_slots_processed' set but not used [-Werror,-Wunused-but-set-variable]
            uint64_t total_slots_processed = 0;
                     ^

The 'paced_cnt' variable was in tcp_hpts.c when it was first added, and
the 'total_slots_processed' variable was added in d7955cc0ffdf9, but
both appear to have been debugging aids that have never been used, so
remove them.

MFC after: 3 days

(cherry picked from commit b33bfe6e157429ad764e9a883a5e3a194a6d1f9f)

23 months agoAdjust function definitions in mmu_oea64.c to avoid clang 15 warnings
Dimitry Andric [Mon, 15 Aug 2022 18:33:25 +0000 (20:33 +0200)]
Adjust function definitions in mmu_oea64.c to avoid clang 15 warnings

With clang 15, the following -Werror warnings are produced:

    sys/powerpc/aim/mmu_oea64.c:1947:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    moea64_init()
               ^
                void
    sys/powerpc/aim/mmu_oea64.c:3257:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    moea64_scan_init()
                    ^
                     void

This is because moea64_init() and moea64_scan_init() are declared with
(void) argument lists, but defined with empty argument lists. Make the
definitions match the declarations.

MFC after: 3 days

(cherry picked from commit 7a98c884f20f7835763d09f2edaccc874d5ee698)

23 months agoFix unused variable warning in mmu_radix.c
Dimitry Andric [Mon, 15 Aug 2022 18:42:51 +0000 (20:42 +0200)]
Fix unused variable warning in mmu_radix.c

With clang 15, the following -Werror warning is produced:

    sys/powerpc/aim/mmu_radix.c:5409:22: error: variable 'freed' set but not used [-Werror,-Wunused-but-set-variable]
            int allfree, field, freed, idx;
                                ^

The 'freed' variable is only used when PV_STATS is defined. Ensure it is
only declared and set in that case.

MFC after: 3 days

(cherry picked from commit 3446738e8deb6d475f88ca16fbb7b11473d17010)

23 months agoAdjust function definition in aim_machdep.c to avoid clang 15 warning
Dimitry Andric [Mon, 15 Aug 2022 18:27:56 +0000 (20:27 +0200)]
Adjust function definition in aim_machdep.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/powerpc/aim/aim_machdep.c:750:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mpc745x_sleep()
                 ^
                  void

This is because mpc745x_sleep() is declared with a (void) argument list,
but defined with an empty argument list. Make the definition match the
declaration.

MFC after: 3 days

(cherry picked from commit 06fce030e79ecce57365bc537e38ee0f25861d70)

23 months agoAdjust function definition in tcp_hpts.c to avoid clang 15 warning
Dimitry Andric [Mon, 15 Aug 2022 18:05:34 +0000 (20:05 +0200)]
Adjust function definition in tcp_hpts.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/netinet/tcp_hpts.c:1594:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    tcp_choose_hpts_to_run()
                          ^
                           void

This is because tcp_choose_hpts_to_run() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after: 3 days

(cherry picked from commit db6b32867d6ed996f8a9aad41ca6ffbaa2088e59)

23 months agoAdjust function definition in arm64's db_trace.c to avoid clang 15 warning
Dimitry Andric [Mon, 15 Aug 2022 18:03:39 +0000 (20:03 +0200)]
Adjust function definition in arm64's db_trace.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/arm64/arm64/db_trace.c:53:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    db_md_list_watchpoints()
                          ^
                           void

This is because db_md_list_watchpoints() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after: 3 days

(cherry picked from commit 940740891516c31a993cb0d267bd19f2d07ede49)

23 months agoAdjust function definition in arm's mv_common.c to avoid clang 15 warning
Dimitry Andric [Mon, 15 Aug 2022 18:02:13 +0000 (20:02 +0200)]
Adjust function definition in arm's mv_common.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/arm/mv/mv_common.c:414:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    mv_check_soc_family()
                       ^
                        void

This is because mv_check_soc_family() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 402dbdd98acc7fa94d1d4cd01903e987d2409336)

23 months agoSuppress unused variable warning in tcp_stacks's rack.c
Dimitry Andric [Sun, 14 Aug 2022 19:27:16 +0000 (21:27 +0200)]
Suppress unused variable warning in tcp_stacks's rack.c

With clang 15, the following -Werror warning is produced:

    sys/netinet/tcp_stacks/rack.c:17405:12: error: variable 'outstanding' set but not used [-Werror,-Wunused-but-set-variable]
                    uint32_t outstanding;
                             ^

The 'outstanding' variable was used later in the rack_output() function,
but refactoring in 35c7bb340788f removed the usage. To avoid too much
code churn, mark the variable unused to supress the warning.

MFC after: 3 days

(cherry picked from commit 57cdd13d072e56bf68c7b3d3b446aaf01288e12b)

23 months agoFix unused variable warning in tcp_stacks's rack.c
Dimitry Andric [Sun, 14 Aug 2022 19:13:40 +0000 (21:13 +0200)]
Fix unused variable warning in tcp_stacks's rack.c

With clang 15, the following -Werror warning is produced:

    sys/netinet/tcp_stacks/rack.c:16148:6: error: variable 'cnt_thru' set but not used [-Werror,-Wunused-but-set-variable]
            int cnt_thru = 1;
                ^

The 'cnt_thru' variable is only used when TCP_ACCOUNTING is defined.
Ensure it is only declared and set in that case.

MFC after: 3 days

(cherry picked from commit e967183cb030dfc349c264520e5710bac70bcdd4)

23 months agoAdjust function definition in kern_poll.c to avoid clang 15 warning
Dimitry Andric [Sun, 14 Aug 2022 19:03:39 +0000 (21:03 +0200)]
Adjust function definition in kern_poll.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/kern/kern_poll.c:374:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    netisr_pollmore()
                   ^
                    void

This is because netisr_pollmore() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 9762d48b7f12f7085d3f6ad83b3ca5ebd226b697)

23 months agoAdjust function definition in drm_fb_helper.c to avoid clang 15 warning
Dimitry Andric [Sun, 14 Aug 2022 19:01:31 +0000 (21:01 +0200)]
Adjust function definition in drm_fb_helper.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/dev/drm2/drm_fb_helper.c:86:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    framebuffer_alloc()
                     ^
                      void

This is because framebuffer_alloc() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 7a7bbe10216e0fbcf3af7a122d249cb000d517c7)

23 months agoAdjust function definition in powerpc's dtrace_subr.c to avoid clang 15 warning
Dimitry Andric [Sun, 14 Aug 2022 18:57:59 +0000 (20:57 +0200)]
Adjust function definition in powerpc's dtrace_subr.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/cddl/dev/dtrace/powerpc/dtrace_subr.c:237:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    dtrace_gethrtime()
                    ^
                     void

This is because dtrace_gethrtime() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 7701f3015948f4ff25d4d26586c64847289325b2)

23 months agoFix unused variable warning in tcp_stacks's bbr.c
Dimitry Andric [Sun, 14 Aug 2022 19:06:07 +0000 (21:06 +0200)]
Fix unused variable warning in tcp_stacks's bbr.c

With clang 15, the following -Werror warning is produced:

sys/netinet/tcp_stacks/bbr.c:11925:11: error: variable 'rtr_cnt' set but not used [-Werror,-Wunused-but-set-variable]
        uint32_t rtr_cnt = 0;
                 ^

The 'rtr_cnt' variable was in bbr.c when it was first added, but it
appears to have been a debugging aid that has never been used, so remove
it.

MFC after: 3 days

(cherry picked from commit 762489657117037d963aa840374280583acd32c2)

23 months agoAdjust function definition in arm's dtrace_subr.c to avoid clang 15 warning
Dimitry Andric [Sun, 14 Aug 2022 18:49:20 +0000 (20:49 +0200)]
Adjust function definition in arm's dtrace_subr.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/cddl/dev/dtrace/arm/dtrace_subr.c:174:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    dtrace_gethrtime()
                    ^
                     void

This is because dtrace_gethrtime() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 7357c2e5a6a7c74eaf5c6732723df375ef4188b5)

23 months agoFix unused variable warning in rockchip's rk_spi.c
Dimitry Andric [Sun, 14 Aug 2022 18:36:13 +0000 (20:36 +0200)]
Fix unused variable warning in rockchip's rk_spi.c

With clang 15, the following -Werror warning is produced:

    sys/arm64/rockchip/rk_spi.c:229:6: error: variable 'cnt' set but not used [-Werror,-Wunused-but-set-variable]
            int cnt = 0;
                ^

The 'cnt' variable was in rk_spi.c when it was first added, but it
appears to have been a debugging aid that has never been used, so remove
it.

MFC after: 3 days

(cherry picked from commit 0fe8ab6851687dc7249e3c5b5df3d6723d1c3e7a)

23 months agoAdjust function definition in riscv's dtrace_subr.c to avoid clang 15 warning
Dimitry Andric [Sun, 14 Aug 2022 19:00:34 +0000 (21:00 +0200)]
Adjust function definition in riscv's dtrace_subr.c to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/cddl/dev/dtrace/riscv/dtrace_subr.c:165:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    dtrace_gethrtime()
                    ^
                     void

This is because dtrace_gethrtime() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

(cherry picked from commit 0beb88a242afbf7923e97cf317640d0f29310ca1)

23 months agogpio: mark more INVARIANTS variables as __diagused
Dimitry Andric [Sun, 14 Aug 2022 12:12:42 +0000 (14:12 +0200)]
gpio: mark more INVARIANTS variables as __diagused

Mark another set of variables that are only used in INVARIANTS builds,
which otherwise result in set-but-not-used warnings.

Fixes: 7dc4d5118c02
MFC after: 3 days

(cherry picked from commit 6e62d9a5a56c0cb8d314998e163096a454c84620)

23 months agoAvoid using TARGET_ARCH in llvm.build.mk
Dimitry Andric [Sun, 14 Aug 2022 11:10:48 +0000 (13:10 +0200)]
Avoid using TARGET_ARCH in llvm.build.mk

Apparently the TARGET_ARCH macro is not supposed to be used outside of
the top-level Makefiles. Directly use MACHINE_ARCH instead.

Noticed by: imp, jrtc27
MFC after: 1 week

(cherry picked from commit 8534e6be8110a8126268a38dc0557a2d15615ce9)

23 months agopfctl: fix FOM_ICMP/POM_STICKYADDRESS clash
Franco Fichtner [Sat, 6 Aug 2022 08:59:56 +0000 (10:59 +0200)]
pfctl: fix FOM_ICMP/POM_STICKYADDRESS clash

pass inet proto icmp icmp-type {unreach}
pass route-to (if0 127.0.0.1/8) sticky-address inet

The wrong struct was being tested. The parser tries to prevent
"sticky-address sticky-address" syntax but was actually cross-rule
enforcing that ICMP filter cannot be before the use of "sticky-address"
in next rule.

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

(cherry picked from commit 1e73fbd8b28946cb1341b51292082864943f0a89)

23 months agoip6(4): document IP_ORIGDSTADDR
Alan Somers [Sun, 24 Jul 2022 15:06:39 +0000 (09:06 -0600)]
ip6(4): document IP_ORIGDSTADDR

The option was originally added in r313524, but with incomplete
documentation.

Reviewed by: karels, gbe (manpages)
Differential Revision: https://reviews.freebsd.org/D35890

(cherry picked from commit a043594c211fd36228f4d84273885da50bb7f59c)

23 months agoAdd more aio tests
Alan Somers [Tue, 31 May 2022 02:20:55 +0000 (20:20 -0600)]
Add more aio tests

* Add tests for kqueue completion with all file types.
* Add a test for kqueue completion with EV_ONESHOT.
* Cleanup an unused variable.

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

(cherry picked from commit 57082ce8c43bd555439311984fdcf738ac31dad1)

Reap dead code in lio_kqueue_test and aio_kqueue_test

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

(cherry picked from commit f10dd8af4b4fb17173321fac13b3221bf096555a)

23 months agoprometheus_sysctl_exporter: ignore ENOENT for mibs specified on the CLI
Alan Somers [Tue, 21 Jun 2022 18:51:14 +0000 (12:51 -0600)]
prometheus_sysctl_exporter: ignore ENOENT for mibs specified on the CLI

They might belong to kernel modules not currently loaded, or to other
kernel versions.  Ignoring them allows the configuration to be shared
between multiple hosts.

Sponsored by: Axcient
Reviewed by: rew
Differential Revision: https://reviews.freebsd.org/D35540

(cherry picked from commit 982f980b86d6bab4d55452d17bf3f5eb04e5f01e)

23 months agopkgbase: split kerberos binaries and libs
Doug Rabson [Fri, 29 Jul 2022 09:14:34 +0000 (10:14 +0100)]
pkgbase: split kerberos binaries and libs

Summary:
This allows installing packages that depend on kerberos libraries
without pulling in all the binaries. It also moves libgssapi to runtime
to allow installing kerbereos libraries without adding a dependancy on
the large utilities package. It makes sense to put libgssapi in runtime
rather than kerberos-lib since this is a plugin layer which is intended
to support any GSS-API mechanisms, not just kerberos.

A good example of a package which uses kerberos libraries without
needing the kerberos utilities is sshd. This uses the kerberos GSS-API
libraries to implement its GSSAPIAuthentication option.

MFC after: 2 weeks

Subscribers: imp

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

(cherry picked from commit 6e4dbb7feff42275c3025dbc25d6ea6cce4e5fd7)

23 months agoMove sort to runtime
Doug Rabson [Fri, 29 Jul 2022 09:15:24 +0000 (10:15 +0100)]
Move sort to runtime

Allows pkg bootstrap without having to install FreeBSD-utilities

(cherry picked from commit 0c19c4db74aad465200797382f4a14f86cd4e146)

23 months agoarm: Clear TTBCR before enabling the MMU
Mark Johnston [Fri, 5 Aug 2022 20:21:09 +0000 (16:21 -0400)]
arm: Clear TTBCR before enabling the MMU

Upon reset, this register is supposed to have a value of zero.  But when
booting certain v7 CPUs in QEMU, we enter the kernel with several bits
set, including the EAE bit, which enables ARM's PAE extension.  I'm not
sure if QEMU is setting it or if it's the uboot loader.  Because FreeBSD
doesn't implement that extension and uses regular 32-bit page tables,
the kernel hangs immediately after enabling the MMU.

Just clear everything in TTBCR before enabling the MMU, to match the
reset value.  FreeBSD doesn't toggle anything in that register.

PR: 251187
Reviewed by: imp
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e9552d8b45d67ca44d91b3ec09c91253e7e99b28)

23 months agobpf: Fix BIOCPROMISC locking
Mark Johnston [Fri, 5 Aug 2022 20:25:05 +0000 (16:25 -0400)]
bpf: Fix BIOCPROMISC locking

BPF might put an interface in promiscuous mode when handling the
BIOCSDLT ioctl.  When this happens, a flag is set in the BPF descriptor
so that the old interface can be restored when the BPF descriptor is
destroyed.

The BIOCPROMISC ioctl can also be used to put a BPF descriptor's
interface into promiscuous mode, but there was nothing synchronizing the
flag.  Fix this by modifying the ioctl handler to acquire the global BPF
mutex, which is used to synchronize ifpromisc() calls elsewhere in BPF.

Reviewed by: kp, melifaro
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 220818ac030726c24cbf9df6df5c9d019993b875)

23 months agoaltq: improve pfctl config time for large numbers of queues
James Skon [Thu, 28 Jul 2022 19:58:31 +0000 (21:58 +0200)]
altq: improve pfctl config time for large numbers of queues

In the current implementation of altq_hfsc.c, whne new queues are being
added (by pfctl), each queue is added to the tail of the siblings linked
list under the parent queue.

On a system with many queues (50,000+) this leads to very long load
times at the insertion process must scan the entire list for every new
queue,

Since this list is unordered, this changes merely adds the new queue to
the head of the list rather than the tail.

Reviewed by: kp
MFC after: 3 weeks
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D35964

(cherry picked from commit 13890d30f8b215b84800cce3f161ad5148c82c00)

23 months agoctladm: Fix typo in command line help.
Alexander Motin [Thu, 11 Aug 2022 20:53:50 +0000 (16:53 -0400)]
ctladm: Fix typo in command line help.

MFC after: 1 week

(cherry picked from commit 5244006fea471bab9dabb7fff21d48d3ff006077)

23 months agoAllow forced r/w mount of UFS/FFS filesystem with a bad check hash.
Kirk McKusick [Tue, 16 Nov 2021 00:03:08 +0000 (16:03 -0800)]
Allow forced r/w mount of UFS/FFS filesystem with a bad check hash.

Normally a UFS/FFS filesystem with a bad check hash can only be
mounted read only. With this commit the mount(8) -f (force) option
can be used to force a read-write mount of a UFS/FFS filesystem with
a bad check hash. Conveniently the filesystem will proceed to
update its on-disk superblock with a corrected check hash.

(cherry picked from commit 9e9dcac95ad0a6c49a01619f82290fbf512fe25b)

23 months agocontrib/tzdata: import tzdata 2022b and 2022c
Philip Paeps [Thu, 11 Aug 2022 02:48:24 +0000 (10:48 +0800)]
contrib/tzdata: import tzdata 2022b and 2022c

Changes: https://github.com/eggert/tz/blob/2022b/NEWS
Changes: https://github.com/eggert/tz/blob/2022c/NEWS

The tzdata2022b import restored the zoneinfo/GMT link.
Don't delete it again with 'make delete-old'.

(cherry picked from commit 9f9fc6bb8028ea29da6b04c338c750cedc3040f3)
(cherry picked from commit f5d5282cf7d1181f933626dcdc3525db0d70a266)
(cherry picked from commit 5f33eb7266f938857ce2fc9ea59679ea46a0694b)

23 months agortld: fix display of the mapbase for the traced objects
Konstantin Belousov [Sun, 14 Aug 2022 14:57:40 +0000 (17:57 +0300)]
rtld: fix display of the mapbase for the traced objects

(cherry picked from commit 008475d3c83aecb496b2b08086427f68b2f741d5)

23 months agobasic_signal test: temporarily skip trap_signal_test on i386
Li-Wen Hsu [Tue, 16 Aug 2022 22:03:37 +0000 (06:03 +0800)]
basic_signal test: temporarily skip trap_signal_test on i386

This case crashes a bhyve VM.

PR: 265889
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c04721e35ff0e8220c88d5b10f068dba18629f7e)
(cherry picked from commit beeeb40bca06c8ebc8953274bbc5759fb432fab2)

23 months agoacpi(4): mention NONE as possible setting for hw.acpi.power_button_state
Yuri Pankov [Sun, 11 Apr 2021 20:17:06 +0000 (23:17 +0300)]
acpi(4): mention NONE as possible setting for hw.acpi.power_button_state

Reviewed by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D29577

(cherry picked from commit 970ffdcefe89c6814f14e2dd59565346e32f8c18)

23 months agoatomic: Add plain atomic_load/store_bool()
Mark Johnston [Tue, 9 Aug 2022 20:08:29 +0000 (16:08 -0400)]
atomic: Add plain atomic_load/store_bool()

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2bed73739aac352299222a18f669a03544c7c9e2)

23 months agoicmp6: Improve validation of PMTU
Kornel Dulęba [Tue, 16 Aug 2022 08:16:50 +0000 (10:16 +0200)]
icmp6: Improve validation of PMTU

Currently we accept any pmtu between IPV6_MMTU(1280B) and the link mtu.
In some network topologies could allow a bad actor to perform a DOS attack.
Contrary to IPv4 in IPv6 oversized packets are dropped, and a ICMP
PACKET_TOO_BIG message is sent back to the sender.
After receiving an ICMPv6 packet with pmtu bigger than the
current one the victim will start sending frames that will be dropped
a router with reduced MTU.
Although it will eventually receive another message with correct pmtu,
an attacker can still just inject their spoofed packets frequently
enough to overwrite the correct value.
This issue is described in detail in RFC8201, section 6.
Fix this by checking the current pmtu, and accepting the new one only
if it's smaller.

Approved by: mw(mentor)
Reviewed by: tuexen
MFC after: 1 week
Sponsored by: Stormshield
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D35871

(cherry picked from commit 82042465c3b5477fc4f44be36077eab11b6b511b)

23 months agorelease: ensure enforce_chs sysctl is 0
Ed Maste [Tue, 19 Jul 2022 20:47:49 +0000 (16:47 -0400)]
release: ensure enforce_chs sysctl is 0

We do not want CHS-based alignment for VM or SD card release images.

(Other images use makefs/mkimg, not kernel gpart and so do not depend
on this sysctl.)

Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
MFC after: 1 week

(cherry picked from commit 6b6367ba8fd2b29de29ce08e7432291e807c3bc0)

23 months agoDelay GEOM disk_create() until CAM periph probe completes.
Alexander Motin [Thu, 14 Jul 2022 19:38:14 +0000 (15:38 -0400)]
Delay GEOM disk_create() until CAM periph probe completes.

Before this patch CAM periph drivers called both disk_alloc() and
disk_create() same time on periph creation.  But then prevented disks
from opening until the periph probe completion with cam_periph_hold().
As result, especially if disk misbehaves during the probe, GEOM event
thread, triggered to taste the disk, got blocked on open attempt,
potentially for a long time, unable to process other events.

This patch moves disk_create() call from periph creation to the end of
the probe. To allow disk_create() calls from non-sleepable CAM contexts
some of its duties requiring memory allocations are moved either back
to disk_alloc() or forward to g_disk_create(), so now disk_alloc() and
disk_add_alias() are the only disk methods that require sleeping.  If
disk fails during the probe disk_create() may just be skipped, going
directly to disk_destroy().  Other method calls during that time are
just ignored.  Since GEOM may now see the disks after CAM bus scan is
already completed, introduce per-periph boot hold functions. Enclosure
driver already had such mechanism, so just generalize it.

Reviewed by: imp
MFC after: 1 month
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D35784

(cherry picked from commit 90bcc81bc35e89049a94a12c259b0c53fcf7a299)

23 months agonvme: Print CRD, M and DNR status bits on errors.
Alexander Motin [Fri, 5 Aug 2022 14:58:19 +0000 (10:58 -0400)]
nvme: Print CRD, M and DNR status bits on errors.

It may help with some issues debugging.

MFC after: 1 week

(cherry picked from commit a69c0964625f4e20a7d5f22d51e036e13eedbeeb)

23 months agoacpi_apei: Add sysctl to mute corrected errors.
Alexander Motin [Fri, 5 Aug 2022 17:45:35 +0000 (13:45 -0400)]
acpi_apei: Add sysctl to mute corrected errors.

Setting hw.acpi.apei.log_corrected to 0 will mute corrected errors logging.

MFC after: 1 week

(cherry picked from commit 52a54b96ed1b7c0a1c04fc7651a1fc036bdc5bbc)

23 months agomca: Add sysctl to mute corrected errors.
Alexander Motin [Fri, 5 Aug 2022 17:40:57 +0000 (13:40 -0400)]
mca: Add sysctl to mute corrected errors.

Setting hw.mca.log_corrected to 0 will mute corrected errors logging
except ones marked as reaching Yellow threshold by hardware.

MFC after: 1 week

(cherry picked from commit ac64943ca8514382289e6054e8127726a7c40ea3)

23 months agoMerge libcxxrt commit 5d8a15823a103bbc27f1bfdcf2b5aa008fab57dd
Mark Johnston [Mon, 8 Aug 2022 16:30:56 +0000 (12:30 -0400)]
Merge libcxxrt commit 5d8a15823a103bbc27f1bfdcf2b5aa008fab57dd

  Fix two bugs in __cxa_end_cleanup()

  Per the EHABI32 specification, __cxa_end_cleanup must take care to
  preserve registers before calling _Unwind_Resume().  So, libcxxrt uses
  an assembly stub which preserves caller-saved registers around the call
  to __cxa_get_cleanup().  But:
  - it failed to restore them properly,
  - it did not preserve the link register.

  Fix both of these problems.  This is needed to fix exception unwinding
  on FreeBSD with LLVM 14.  Note that r4 is callee-saved but is pushed
  onto the stack to preserve stack pointer alignment.

Sponsored-by: The FreeBSD Foundation
(cherry picked from commit cbd1e83154af8bae3daa3919bb2746d587436515)

23 months agoDeprecate minigzip(1) in preparation of removing it from base system.
Xin LI [Sun, 31 Jul 2022 22:16:22 +0000 (15:16 -0700)]
Deprecate minigzip(1) in preparation of removing it from base system.

Reviewed by: emaste, pauamma
Differential Revision: https://reviews.freebsd.org/D36000

(cherry picked from commit 0404b8c88fd857aae9ecf73ab9e1b1c2a8fd7ae1)