]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agofork_norfproc(): style
Konstantin Belousov [Fri, 12 Aug 2022 00:37:55 +0000 (03:37 +0300)]
fork_norfproc(): style

(cherry picked from commit bd76586bb705d62549f6df7ae8cebf7db252db63)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years 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)

2 years agobus_if: provide a default null rescan method
Mitchell Horne [Tue, 21 Jun 2022 13:29:53 +0000 (10:29 -0300)]
bus_if: provide a default null rescan method

There is an existing helper function, bus_null_rescan(), but most
drivers won't use it except to override an inherited rescan method. It
also returns the same error as an empty method. Make this the default
rescan method in bus_if.m and return a more sensible error code.

This gives a slightly more meaningful error message when attempting
'devctl rescan' on buses and devices alike:
  "Device not configured" --> "Operation not supported by device"

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

(cherry picked from commit 36a8572ee8f5db7ecb64bedc5738a363ec7cad36)
(cherry picked from commit 29afffb942b159511ad7d5ea5d086851f65ef4a0)

2 years agorelease: fix alignment for arm SoCs
Glen Barber [Mon, 8 Aug 2022 14:59:29 +0000 (10:59 -0400)]
release: fix alignment for arm SoCs

Submitted by: Mark Millard
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 45add40717c24ef0b5418664fae1718b15a0422b)

2 years agortld-elf: Fix leaks and wild frees in origin_subst
Jessica Clarke [Tue, 12 Jul 2022 16:47:47 +0000 (17:47 +0100)]
rtld-elf: Fix leaks and wild frees in origin_subst

55abf23dd36b inverted the value passed to origin_subst_one when rolling
up the existing code into a loop. If the first token is found ($ORIGIN),
this results in a wild free of part of strtab. Processing the second
token works fine and will act how the first should have regardless of
whether found, allocating memory for the string without freeing.
Processing subsequent tokens however will then leak, regardless of
whether found, as they will also believe they need to allocate memory
and can't free the string.

Found by: CHERI
Reviewed by: kib, markj
Fixes: 55abf23dd36b ("rtld: make token substitution table-driven")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35792

(cherry picked from commit becd9908beb8f1b47ddc6628cb005185a26ec85c)

2 years agoinet6(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Aug 2022 12:20:52 +0000 (14:20 +0200)]
inet6(4): Fix a typo in a source code comment

- s/Unreachablity/Unreachability/

(cherry picked from commit cd33039749356f613013ebf02795cafc0aba1968)

2 years agonullfs(5): Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Aug 2022 12:04:53 +0000 (14:04 +0200)]
nullfs(5): Fix a typo in a source code comment

- s/examing/examining/

(cherry picked from commit 4c399b044fc66b02e37110ca5c1f4ce0e3beb9d1)

2 years agolibutil: Fix mandoc warnings
Gordon Bergling [Sun, 7 Aug 2022 14:30:24 +0000 (16:30 +0200)]
libutil: Fix mandoc warnings

- missing comma before name
- possible typo in section name: Sh CAVEAT instead of CAVEATS
- useless macro: Tn
- blank line in fill mode, using .sp
- no blank before trailing delimiter: Dv NULL?

(cherry picked from commit 816ca3d10fd2f0c9283005a189fac156071d748d)

2 years agolibpathconv: bump man page dates
Gordon Bergling [Tue, 9 Aug 2022 08:05:31 +0000 (10:05 +0200)]
libpathconv: bump man page dates

- bump the man page dates to the date of mandoc fixes

Reported by: rpokala
X-MFC with: 094517119c62c23369d545a7475ae982d86330a3

(cherry picked from commit 948168c778e872552da7b3ef22a6d55df1215ed2)

2 years agolibpathconv: Fix mandoc warnings in abs2rel(3) and rel2abs(3)
Gordon Bergling [Sun, 7 Aug 2022 12:53:53 +0000 (14:53 +0200)]
libpathconv: Fix mandoc warnings in abs2rel(3) and rel2abs(3)

- cannot parse date, using it verbatim: Dec 15, 1997"
- sections out of conventional order: Sh SEE ALSO
- possible typo in section name: Sh EXAMPLE instead of EXAMPLES
- AUTHORS section without An macro

(cherry picked from commit 094517119c62c23369d545a7475ae982d86330a3)

2 years agodebugnet: Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Aug 2022 14:07:01 +0000 (16:07 +0200)]
debugnet: Fix a typo in a source code comment

- s/paramaters/parameters/

(cherry picked from commit b2b1bb041056e45acae537feb6d1b28d22f53a2a)

2 years agomfiutil.8: Fix some mandoc warnings
Gordon Bergling [Sun, 7 Aug 2022 15:24:48 +0000 (17:24 +0200)]
mfiutil.8: Fix some mandoc warnings

- new sentence, new line
- no blank before trailing delimiter

(cherry picked from commit 75f8dcc831bf80c7efc93d3461699f95033c1d28)

2 years agoisci(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Aug 2022 14:05:08 +0000 (16:05 +0200)]
isci(4): Fix a typo in a source code comment

- s/paramater/parameter/

(cherry picked from commit 0702f4f0409e39d6b85b0b008a4e4cdf9690beb9)

2 years agonet80211(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Aug 2022 14:00:07 +0000 (16:00 +0200)]
net80211(4): Fix a typo in a source code comment

- s/paramaters/parameters/

(cherry picked from commit 044169efe0b7f8a3c30f33ae081054def91acc7d)

2 years agovnode(9): Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Aug 2022 14:08:43 +0000 (16:08 +0200)]
vnode(9): Fix a typo in a source code comment

- s/paramater/parameter/

(cherry picked from commit fa1ac9693a6d9253edb139358f79cacdd45bc10a)

2 years agothread_create(): call cpu_copy_thread() after td_pflags is zeroed
Konstantin Belousov [Sun, 7 Aug 2022 17:00:02 +0000 (20:00 +0300)]
thread_create(): call cpu_copy_thread() after td_pflags is zeroed

(cherry picked from commit 1b0a4974c5004216daf4a2ac4375074ce56bc55b)

2 years agotree.3: explain RB_FIND() and RB_NFIND()
Konstantin Belousov [Mon, 1 Aug 2022 09:43:10 +0000 (12:43 +0300)]
tree.3: explain RB_FIND() and RB_NFIND()

(cherry picked from commit 08349b18ea26d1e191333f9b3550cd95b09cfe34)

2 years agovm_fault: Shoot down shared mappings in vm_fault_copy_entry()
Mark Johnston [Mon, 25 Jul 2022 20:53:21 +0000 (16:53 -0400)]
vm_fault: Shoot down shared mappings in vm_fault_copy_entry()

As in vm_fault_cow(), it's possible, albeit rare, for multiple vm_maps
to share a shadow object.  When copying a page from a backing object
into the shadow, all mappings of the source page must therefore be
removed.  Otherwise, future operations on the object tree may detect
that the source page is fully shadowed and thus can be freed.

Approved by: so
Security: FreeBSD-SA-22:11.vm
Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35635

(cherry picked from commit 5c50e900ad779fccbf0a230bfb6a68a3e93ccf60)

2 years agoelf_note_prpsinfo: handle more failures from proc_getargv()
Konstantin Belousov [Fri, 3 Jun 2022 08:21:23 +0000 (11:21 +0300)]
elf_note_prpsinfo: handle more failures from proc_getargv()

Resulting sbuf_len() from proc_getargv() might return 0 if user mangled
ps_strings enough. Also, sbuf_len() API contract is to return -1 if the
buffer overflowed. The later should not occur because get_ps_strings()
checks for catenated length, but check for this subtle detail explicitly
as well to be more resilent.

The end result is that p_comm is used in this situations.

Approved by: so
Security: FreeBSD-SA-22:09.elf
Reported by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: delphij, markj
admbugs: 988
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35391

(cherry picked from commit 00d17cf342cd9f4f8fd1dcd79c8caec359145532)

2 years agobsd-family-tree: fix a typo for NetBSD 9.3 release date
Sergey A. Osokin [Sun, 7 Aug 2022 13:57:14 +0000 (09:57 -0400)]
bsd-family-tree: fix a typo for NetBSD 9.3 release date

Reported by: Adrian Steinmann <ast@NetBSD.org>
Fixes: a3d933cc4f2300b476151c2dd3fa455882f3aa97

(cherry picked from commit ffcec862aaea0f1984767f2c9614c8b3dbc846ae)

2 years agobsd-family-tree: add NetBSD 9.3
Sergey A. Osokin [Sat, 6 Aug 2022 19:02:42 +0000 (15:02 -0400)]
bsd-family-tree: add NetBSD 9.3

Add NetBSD 9.3, it's been released two days ago.

(cherry picked from commit a3d933cc4f2300b476151c2dd3fa455882f3aa97)

2 years agobsd-family-tree: OpenBSD 7.1 and DragonFly BSD 6.2.2
Sergey A. Osokin [Sat, 6 Aug 2022 18:56:22 +0000 (14:56 -0400)]
bsd-family-tree: OpenBSD 7.1 and DragonFly BSD 6.2.2

Add two releases to the tree.

(cherry picked from commit 69893a0e8fc87fec294f597c81e27c52a5c6af0c)

2 years agobsd-family-tree: FreeBSD 13.1
Warner Losh [Wed, 18 May 2022 00:02:42 +0000 (18:02 -0600)]
bsd-family-tree: FreeBSD 13.1

Now that 13.1 has been announced, add today's date UTC as the release
date.

(cherry picked from commit f8f1e9cd1ceeac4d3a9d2f703f937f67148bd513)

2 years agobsd-family-tree: Update various URLs in file
Elliott Mitchell [Fri, 1 Apr 2022 14:28:28 +0000 (08:28 -0600)]
bsd-family-tree: Update various URLs in file

Been some time since 364fe18b8c8 when the URL was first in this file.
Update from svnweb to cgit for the URL listed at the end of this file.
In addition, update all URLs to HTTPS. Replace two URLs with links to
archive.org as the original URLs are no longer valid.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D34730

(cherry picked from commit 2b68a79b73d7a5b9ed43ad199413705f5935f01c)

2 years agozlib: Fix a bug when getting a gzip header extra field with inflate().
Mark Adler [Sat, 30 Jul 2022 22:51:11 +0000 (15:51 -0700)]
zlib: Fix a bug when getting a gzip header extra field with inflate().

If the extra field was larger than the space the user provided with
inflateGetHeader(), and if multiple calls of inflate() delivered
the extra header data, then there could be a buffer overflow of the
provided space. This commit assures that provided space is not
exceeded.

(cherry picked from zlib commit eff308af425b67093bab25f80f1ae950166bece1)
(cherry picked from zlib commit 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d)

(cherry picked from commit dc3509f1aafcd966f3dd9226115cf94b691ff3c7)
(cherry picked from commit 2969066f73fc67a614144ac09b9f3f5291937fed)

2 years agoipsec: replace SECASVAR mtx by rmlock
Kristof Provost [Thu, 23 Jun 2022 20:35:29 +0000 (22:35 +0200)]
ipsec: replace SECASVAR  mtx by rmlock

This mutex is a significant point of contention in the ipsec code, and
can be relatively trivially replaced by a read-mostly lock.
It does require a separate lock for the replay protection, which we do
here by adding a separate mutex.

This improves throughput (without replay protection) by 10-15%.

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D35763

(cherry picked from commit 0361f165f2193a098cfbfeef3a58ec2f1eaac0a1)