]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 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)

22 months agonet80211: Remove tautological state display
Cy Schubert [Tue, 19 Jul 2022 04:10:40 +0000 (21:10 -0700)]
net80211: Remove tautological state display

When printing the current state name and the old state numeric value,
both are always the same. Remove the redundant ostate. It is always
the same as iv_state.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D35849

(cherry picked from commit 4f158a444ee7365454cc3ea1547b1b5c323dae55)

22 months agorc.d/wpa_supplicant: Remove the sleep to improve boot time
Cy Schubert [Sun, 12 Jun 2022 19:02:47 +0000 (12:02 -0700)]
rc.d/wpa_supplicant: Remove the sleep to improve boot time

bapt@ had discovered a noticeable boot improvement without the sleep.
Without the sleep does not affect warm or cold boot however a
service netif restart may cause dhclient to spend a few extra seconds
to rerequest the DHCP request.

Reported by: bapt
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D35457

(cherry picked from commit 116679b39cb94fdb94c02dceb1c2cae719bd3f42)

22 months agoinstallworld: improve portability of ldd use
Brooks Davis [Fri, 1 Jul 2022 07:33:16 +0000 (08:33 +0100)]
installworld: improve portability of ldd use

b3b462229f97 added a case statement to ignore lines containing strings
in square brackets such as "[vdso]" and "[preloaded]". On MacOS
Monterey where /bin/sh may be zsh, this fails with:

/bin/sh: -c: line 0: syntax error near unexpected token `;;'

Invoke grep in the pipeline to remove such lines instead.

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D35618

(cherry picked from commit bda5d2a45c8dcc9bbeb71cddeef930ffa6a47f23)

22 months agoAdd "heard" to the dictionary
Ed Maste [Mon, 8 Aug 2022 18:57:32 +0000 (14:57 -0400)]
Add "heard" to the dictionary

PR: 265671
Reported by: J.R. Oldroyd
MFC after: 3 days

(cherry picked from commit 711ee0591832857c4484dbc05f0d8e03e9c760e4)

22 months agobridge tests: Tests using pft_ping.py require scapy
Mark Johnston [Thu, 4 Aug 2022 13:41:52 +0000 (09:41 -0400)]
bridge tests: Tests using pft_ping.py require scapy

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 121e120883a227ce27a12f33699fac4e5bdec6a4)

22 months agofile: Move code to share fdtol structs into kern_descrip.c
Mark Johnston [Thu, 4 Aug 2022 13:39:25 +0000 (09:39 -0400)]
file: Move code to share fdtol structs into kern_descrip.c

This ensures the filedesc-to-leader code is consistently encapsulated in
kern_descrip.c.

No functional change intended.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit d07675a9352efce5e997e987080b3f98bbfdac96)

22 months agodomain: Use designated constants for timeout periods
Mark Johnston [Wed, 3 Aug 2022 00:31:29 +0000 (20:31 -0400)]
domain: Use designated constants for timeout periods

No functional change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 852695416c856abf6197d0345c1f6f9e3a70beab)

22 months agoctfconvert: Give bitfield types names distinct from the base type
Mark Johnston [Wed, 3 Aug 2022 00:32:17 +0000 (20:32 -0400)]
ctfconvert: Give bitfield types names distinct from the base type

CTF integers have an explicit width and so can be used to represent
bitfields.  Bitfield types emitted by ctfconvert(1) share the name of
the base integer type, so a struct field with type "unsigned int : 15"
will have a type named "unsigned int".

To avoid ambiguity when looking up types by name, add a suffix to names
of bitfield types to distinguish them from the base type.  Then, if
ctfmerge happens to order bitfield types before the corresponding base
type in a CTF file, a name lookup will return the base type, which is
always going to be the desired behaviour.

PR: 265403
Reported by: cy
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1165fc9a526630487a1feb63daef65c5aee1a583)

22 months agodtrace tests: Override RLIMIT_CORE for a test which triggers a core dump
Mark Johnston [Wed, 3 Aug 2022 00:32:04 +0000 (20:32 -0400)]
dtrace tests: Override RLIMIT_CORE for a test which triggers a core dump

Sponsored by: The FreeBSD Foundation

(cherry picked from commit e1700a36a9471a623c89f3112d69234ee6ac7fae)

22 months agodtrace tests: Rename some test type names to avoid a conflict
Mark Johnston [Wed, 3 Aug 2022 00:32:08 +0000 (20:32 -0400)]
dtrace tests: Rename some test type names to avoid a conflict

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6a05f1438145c2d8c3d0e29e1d5e24a05d394453)

22 months agoDB_COMMAND(9): update to mention additional macros
Mitchell Horne [Tue, 5 Jul 2022 14:55:18 +0000 (11:55 -0300)]
DB_COMMAND(9): update to mention additional macros

Document the existing alias definitions, and augment the example with
one of these. Also, describe the purpose of the newly added _FLAGS
variations of these command definitions.

Make some small style improvements to appease mandoc -Tlint.

Reviewed by: markj
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35664

(cherry picked from commit b83d53cb687e65372dd23496578c436243b11c93)
(cherry picked from commit 62bca9c4df3af8ddeb08f910959fdf6d5084679f)

22 months agoddb: use _FLAGS command macros where appropriate
Mitchell Horne [Tue, 5 Jul 2022 14:47:55 +0000 (11:47 -0300)]
ddb: use _FLAGS command macros where appropriate

Some command definitions were forced to use DB_FUNC in order to specify
their required flags, CS_OWN or CS_MORE. Use the new macros to simplify
these.

Reviewed by: markj, jhb
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35582

(cherry picked from commit 258958b3c7e017266080ae7fc9e3d8e64b6450d4)

22 months agoddb: add _FLAGS command variants
Mitchell Horne [Thu, 30 Jun 2022 15:58:22 +0000 (12:58 -0300)]
ddb: add _FLAGS command variants

Provide _FLAGS variants of the various command definition macros, in
anticipation of adding a new flag. This can also be used for some
existing commands which require special flag values.

Reviewed by: markj
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35581

(cherry picked from commit 7ce58d4e8c0cfcb42ec404aed6185b5eb7eef8a8)

22 months agodb_command.c: use designated initializers
Mitchell Horne [Tue, 5 Jul 2022 14:45:47 +0000 (11:45 -0300)]
db_command.c: use designated initializers

Provide separate helper macros for regular commands and next-level table
commands as they are mutually exclusive. This ensures proper
initialization of each element and allows us to exclude some redundant
fields, such as specifying .more = NULL for every regular command.

Reviewed by: markj, jhb
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35580

(cherry picked from commit 8a0994823365740f4d92842c2d6f7f524310ba64)

22 months agodb_command.c: style
Mitchell Horne [Tue, 5 Jul 2022 14:44:36 +0000 (11:44 -0300)]
db_command.c: style

Reviewed by: jhb
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35368

(cherry picked from commit 4f2ad6243f15ef325aa8daa680949b0ee1076c6e)

22 months agoriscv: implement db_show_mdpcpu()
Mitchell Horne [Mon, 4 Oct 2021 20:47:49 +0000 (17:47 -0300)]
riscv: implement db_show_mdpcpu()

This prints the machine-dependent members of struct pcpu when executing
the 'show pcpu' or 'show all pcpu' ddb(4) commands.

MFC after: 3 days

(cherry picked from commit 4fffc56c6e4c97aa76b31060e806ccdafb1afacd)