]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agohidbus(4): Align refcount checks for hidbus_intr_start() and hidbus_intr_stop().
Hans Petter Selasky [Thu, 23 Jun 2022 13:44:25 +0000 (15:44 +0200)]
hidbus(4): Align refcount checks for hidbus_intr_start() and hidbus_intr_stop().

No functional change intended.

Discussed with: wulf @
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoriscv: Avoid passing invalid addresses to pmap_fault()
Mark Johnston [Thu, 28 Jul 2022 13:38:52 +0000 (09:38 -0400)]
riscv: Avoid passing invalid addresses to pmap_fault()

After the addition of SV48 support, VIRT_IS_VALID() did not exclude
addresses that are in the SV39 address space hole but not in the SV48
address space hole.  This can result in mishandling of accesses to that
range when in SV39 mode.

Fix the problem by modifying VIRT_IS_VALID() to use the runtime address
space bounds.  Then, if the address is invalid, and pcb_onfault is set,
give vm_fault_trap() a chance to veto the access instead of panicking.

PR: 265439
Reviewed by: jhb
Reported and tested by: Robert Morris <rtm@lcs.mit.edu>
Fixes: 31218f3209ac ("riscv: Add support for enabling SV48 mode")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35952

2 years agosrc.libnames.mk: NEED/WANT_COMPAT+static support
Brooks Davis [Thu, 28 Jul 2022 17:54:35 +0000 (18:54 +0100)]
src.libnames.mk: NEED/WANT_COMPAT+static support

Look in _LIB_OBJTOP for all static libraries not just INTERNALLIBs. In
normal operation this is a no-op, but improves the consistency of this
file.

Reviewed by: imp, jhb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35822

2 years agoncal: LT is the country code for Lithuania
Warner Losh [Thu, 28 Jul 2022 17:34:38 +0000 (11:34 -0600)]
ncal: LT is the country code for Lithuania

PR: 265479
MFC After: 3 days

2 years ago/usr/sbin/pkg: don't sleep on fetch failure
John Hood [Thu, 21 Apr 2022 21:39:14 +0000 (17:39 -0400)]
/usr/sbin/pkg: don't sleep on fetch failure

PR: 263458

2 years agodate: remove some ambiguity in tzdata references
Kyle Evans [Wed, 27 Jul 2022 17:30:18 +0000 (12:30 -0500)]
date: remove some ambiguity in tzdata references

The use of 'package' in this could be understood to mean a FreeBSD
package provided by pkg, rather than the fact that we use data provided
by IANA.  Re-word it to clearly identify `tzdata` as the IANA Time Zone
Database on first use, then drop subsequent uses of the word 'package'.

Reviewed by: 0mp, pauamma, philip
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35966

2 years agolagg: fix lagg ifioctl after SIOCSIFCAPNV
Andrew Gallatin [Thu, 28 Jul 2022 14:36:22 +0000 (10:36 -0400)]
lagg: fix lagg ifioctl after SIOCSIFCAPNV

Lagg was broken by SIOCSIFCAPNV when all underlying devices
support SIOCSIFCAPNV.  This change updates lagg to work with
SIOCSIFCAPNV and if_capabilities2.

Reviewed by: kib, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35865

2 years agolibc: ANSIfy div / ldiv function definitions
Ed Maste [Thu, 28 Jul 2022 14:17:33 +0000 (10:17 -0400)]
libc: ANSIfy div / ldiv function definitions

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoqat: Add a required MODULE_DEPEND for firmware(9)
Mark Johnston [Thu, 28 Jul 2022 13:48:58 +0000 (09:48 -0400)]
qat: Add a required MODULE_DEPEND for firmware(9)

Reported by: kib
Sponsored by: The FreeBSD Foundation

2 years agoqat_c2xxx: Add a required MODULE_DEPEND for firmware(9)
Mark Johnston [Thu, 28 Jul 2022 13:47:34 +0000 (09:47 -0400)]
qat_c2xxx: Add a required MODULE_DEPEND for firmware(9)

Reported by: kib
Sponsored by: The FreeBSD Foundation

2 years agostyle: Tighten up one use of 'may'
Warner Losh [Thu, 28 Jul 2022 14:01:09 +0000 (08:01 -0600)]
style: Tighten up one use of 'may'

Declarations of variables must be placed before the statements of a
block, by convention. Use 'must' instead of 'may' here and clarify
langauge.

Sponsored by: Netflix
Reviewed by: pstef, rpokala, hselasky
Differential Revision: https://reviews.freebsd.org/D35959

2 years agostyle: Use oxford comma in one place.
Warner Losh [Thu, 28 Jul 2022 13:59:56 +0000 (07:59 -0600)]
style: Use oxford comma in one place.

Suggested by: pauamma
Sponsored by: Netflix

2 years agoStyle(9): Strengthen statements about not using K&R function definitions
Warner Losh [Thu, 28 Jul 2022 13:58:32 +0000 (07:58 -0600)]
Style(9): Strengthen statements about not using K&R function definitions

K&R function definitions will soon be obsolete. Work has been underway
to remove all K&R function definitions from the tree for a while now. A
future C version will remove this construct from the language. So
strengthen existing statements about K&R function definitions and
declarations.

While here, remove __P macro reference. It's not been in active use for
almost two decades apart from legacy contrib code.

Sponsored by: Netflix
Reviewed by: pauamma, rpokala, hselasky, kp, brooks, markm, emaste
Differential Revision: https://reviews.freebsd.org/D35945

2 years agoRevert "csu: test: explicitly add libm as build parameter"
Alfredo Dal'Ava Junior [Wed, 27 Jul 2022 22:10:56 +0000 (19:10 -0300)]
Revert "csu: test: explicitly add libm as build parameter"

This reverts commit 4f5890a0fb086324a657f3cd7ba1abc57274e0db.

9ef1127008ce94cf626daed346a3c1ee03063617 is a proper fix for
the problem we tried to address.

Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)

2 years agokboot: Remove RELOC defines, it's unused
Warner Losh [Thu, 28 Jul 2022 05:11:12 +0000 (23:11 -0600)]
kboot: Remove RELOC defines, it's unused

This was copied from powerpc/ofw and has never been used. We also don't
care about -DAIM. It's only relevant for in-kernel structures, which we
don't use in this userland program.

Sponsored by: Netflix

2 years agokboot: Convert from getdents to getdents64
Warner Losh [Thu, 28 Jul 2022 04:24:50 +0000 (22:24 -0600)]
kboot: Convert from getdents to getdents64

Linux 2.4 introduced getdents64. Switch to using it because aarch64
doesn't have getdents as that syscall was obsoleted before that port was
created.

Sponsored by: Netflix

2 years agokboot: Do a style(9) pass on kbootfdt.c
Warner Losh [Thu, 28 Jul 2022 04:07:52 +0000 (22:07 -0600)]
kboot: Do a style(9) pass on kbootfdt.c

Mostly just properly indent.

Sponsored by: Netflix

2 years agoRemove unnecessary terminating slash in iscsi module Makefile
Dimitry Andric [Wed, 27 Jul 2022 19:04:22 +0000 (21:04 +0200)]
Remove unnecessary terminating slash in iscsi module Makefile

The additional slash causes double slashes in the filenames that
eventually get passed to the compiler.

MFC after: 3 days

2 years agoAdjust function definition in isa's pnp.c to avoid clang 15 warning
Dimitry Andric [Wed, 27 Jul 2022 19:02:51 +0000 (21:02 +0200)]
Adjust function definition in isa's pnp.c to avoid clang 15 warning

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

    sys/isa/pnp.c:118:24: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pnp_send_initiation_key()
                           ^
                            void

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

MFC after: 3 days

2 years agoSuppress possible unused variable warning for icl_soft.c
Dimitry Andric [Wed, 27 Jul 2022 19:00:22 +0000 (21:00 +0200)]
Suppress possible unused variable warning for icl_soft.c

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

    sys/dev/iscsi//icl_soft.c:1277:6: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
            int i;
                ^

The 'i' variable is used later in the icl_soft_conn_pdu_get_bio()
function, via the PHYS_TO_DMAP() macro. However, on i386 and some other
architectures, this macro is defined to panic immediately, so in those
cases, 'i' is indeed not used. Suppress the warning by marking 'i' as
unused.

MFC after: 3 days

2 years agobhyve: fix spelling mistake in passthru emulation
Corvin Köhne [Wed, 27 Jul 2022 14:43:01 +0000 (16:43 +0200)]
bhyve: fix spelling mistake in passthru emulation

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D35707
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agobhyve: Initialize more registers in vcpu_reset()
Corvin Köhne [Wed, 27 Jul 2022 14:41:02 +0000 (16:41 +0200)]
bhyve: Initialize more registers in vcpu_reset()

- Clear CR2, EFER, and R8-15 to zero.
- Reset DR6 and DR7 to their documented reset values.
- Reset interrupt shadow state.
- Document the reason CR0 is reset to a value that doesn't match its
documented value.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D35622
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agovmm: emulate INVD by ignoring it
Corvin Köhne [Wed, 27 Jul 2022 14:39:47 +0000 (16:39 +0200)]
vmm: emulate INVD by ignoring it

On physical systems the ram isn't initialized on boot. So, coreboot uses
the cache as ram in this boot phase. When exiting cache as ram, coreboot
calls INVD for making the cache consistent.

In a virtual environment ram is always initialized and the cache is
always consistent. So, we can safely ignore this call.

Reviewed by: jhb, imp
Differential Revision: https://reviews.freebsd.org/D35620
Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agoUpdate to bmake-20220726
Simon J. Gerraty [Wed, 27 Jul 2022 15:58:09 +0000 (08:58 -0700)]
Update to bmake-20220726

Merge commit '31a96ca5f0b6e5f8f7fa8cecf3a5c4354b3b096f'

2 years agoImport bmake-20220726
Simon J. Gerraty [Wed, 27 Jul 2022 15:56:53 +0000 (08:56 -0700)]
Import bmake-20220726

Relevant/interesting changes:

* Auto-create objdir for bmake/unit-tests if appropriate

2 years agoRELNOTES: Fix whitespace
Mark Johnston [Thu, 21 Jul 2022 15:07:33 +0000 (11:07 -0400)]
RELNOTES: Fix whitespace

2 years agoRELNOTES: Add an entry for the new QAT driver
Mark Johnston [Thu, 21 Jul 2022 15:07:11 +0000 (11:07 -0400)]
RELNOTES: Add an entry for the new QAT driver

Sponsored by: The FreeBSD Foundation

2 years agoqat: Import a new Intel (R) QAT driver
Julian Grajkowski [Tue, 19 Jul 2022 08:15:34 +0000 (09:15 +0100)]
qat: Import a new Intel (R) QAT driver

QAT in-tree driver ported from out-of-tree release available
from 01.org.

The driver exposes complete cryptography and data compression
API in the kernel and integrates with Open Crypto Framework.
Details of supported operations, devices and usage can be found
in man and on 01.org.

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Jaraczewski <michalx.jaraczewski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Julian Grajkowski <julianx.grajkowski@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Adam Czupryna <adamx.czupryna@intel.com>
Patch co-authored by: Konrad Zelazny <konradx.zelazny@intel.com>
Patch co-authored by: Katarzyna Rucinska <katarzynax.kargol@intel.com>
Patch co-authored by: Lukasz Kolodzinski <lukaszx.kolodzinski@intel.com>
Patch co-authored by: Zbigniew Jedlinski <zbigniewx.jedlinski@intel.com>

Reviewed by: markj, jhb (OCF integration)
Reviewed by: debdrup, pauamma (docs)
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D34632

2 years agoqat: Rename to qat_c2xxx and remove support for modern chipsets
Mark Johnston [Wed, 27 Jul 2022 14:55:40 +0000 (10:55 -0400)]
qat: Rename to qat_c2xxx and remove support for modern chipsets

A replacement QAT driver will be imported, but this replacement does not
support Atom C2xxx hardware.  So, the existing driver will be kept
around to provide opencrypto offload support for those chipsets.

Reviewed by: pauamma, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35817

2 years agostand: tftp.c doesn't need bootinfo.h
Warner Losh [Tue, 26 Jul 2022 03:45:35 +0000 (21:45 -0600)]
stand: tftp.c doesn't need bootinfo.h

tftp.c includes bootinfo.h, but doesn't need it. Remove it, and remove
the -Istand/common from CFALGS since that's the only reason we had it.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35928

2 years agostand: Make sure nobody has a NULL pointer for dv_cleanup
Warner Losh [Wed, 27 Jul 2022 14:46:21 +0000 (08:46 -0600)]
stand: Make sure nobody has a NULL pointer for dv_cleanup

dv_cleanup is specified almost everywhere. Use nullsys instead of NULL
to indicate 'do nothing'. Also, be consistent in trailing commas that
were missing before.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35913

2 years agostand: Small comment correction
Warner Losh [Wed, 27 Jul 2022 14:46:12 +0000 (08:46 -0600)]
stand: Small comment correction

While in theory, once upon a time, dv_type was arch specific, that's
never been the case in FreeBSD (and certaintly isn't in the surviving
drivers). Remove that notation.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35911

2 years agostand: Create DEV_NAMLEN for the length of a device name
Warner Losh [Wed, 27 Jul 2022 14:45:59 +0000 (08:45 -0600)]
stand: Create DEV_NAMLEN for the length of a device name

Rather than hard coding 8 for the device name length, create a #define for it.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35910

2 years agoipsec: Improve validation of PMTU
Kornel Dulęba [Wed, 27 Jul 2022 14:12:34 +0000 (16:12 +0200)]
ipsec: Improve validation of PMTU

Currently there is no upper bound on the PMTU value that is accepted.
Update hostcache only if the new pmtu is smaller than the current entry
and the link MTU.

Approved by: mw(mentor)
Sponsored by: Stormshield
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D35872

2 years agoicmp6: Improve validation of PMTU
Kornel Dulęba [Wed, 20 Jul 2022 07:22:34 +0000 (09:22 +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

2 years agostand: Spell License correctly
Warner Losh [Tue, 26 Jul 2022 22:29:56 +0000 (16:29 -0600)]
stand: Spell License correctly

An e got dropped and then cut and pasted into far too many places.

Sponsored by: Netflix
Noticed by: freqlabs on irc

2 years agosbin/md5.c: fix -q -c for BSD style versions
Stefan Eßer [Tue, 26 Jul 2022 21:04:57 +0000 (23:04 +0200)]
sbin/md5.c: fix -q -c for BSD style versions

The BSD style commands (with names not ending in "sum") ignored the -c
options and the passed digest value when invoked with -q.

The man page stated that -q causes only the calculated digest to be
printed, but did not consider the case of both the -q and -c being
used in combination.

Since there is no warning that -c will be ignored when the -q option
is used, users night (and did) expect that the exit code would reflect
the matching of the calculated digest and the argument passed with -c.

This update implements and documents this expected behavior.

PR: 265461
Reported by: Dmitrij <bugs.freebsd@1fff.net>
MFC after: 2 weeks

2 years agoAuto-create bmake/unit-tests objdir if appropriate
Simon J. Gerraty [Tue, 26 Jul 2022 20:24:34 +0000 (13:24 -0700)]
Auto-create bmake/unit-tests objdir if appropriate

Given the way bmake/unit-tests is visited, when doing 'test'
MK_AUTO_OBJ=yes will not be effective.
So create the objdir before running the sub-make.

Also ensure MAKEOBJDIR is passed to opt-m-include-dir

Reviewed by: deo

2 years agoSuppress unused variable warning for zfs_fm.c
Dimitry Andric [Tue, 26 Jul 2022 20:07:42 +0000 (22:07 +0200)]
Suppress unused variable warning for zfs_fm.c

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

    sys/contrib/openzfs/module/zfs/zfs_fm.c:256:6: error: variable 'cnt' set but not used [-Werror,-Wunused-but-set-variable]
            int cnt = 0;
                ^

The 'cnt' variable does not seem to be used for anything, but since this
is contributed code, suppress the warning instead.

MFC after: 3 days

2 years agoFix unused variable warning in amd64's pmap.c
Dimitry Andric [Tue, 26 Jul 2022 19:53:08 +0000 (21:53 +0200)]
Fix unused variable warning in amd64's pmap.c

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

    sys/amd64/amd64/pmap.c:8274:22: error: variable 'freed' set but not used [-Werror,-Wunused-but-set-variable]
            int allfree, field, freed, i, 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

2 years agoFix unused variable warning in usb's atp.c
Dimitry Andric [Tue, 26 Jul 2022 19:46:02 +0000 (21:46 +0200)]
Fix unused variable warning in usb's atp.c

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

    sys/dev/usb/input/atp.c:2018:11: error: variable 'n_vertical_scrolls' set but not used [-Werror,-Wunused-but-set-variable]
            u_int8_t n_vertical_scrolls = 0;
                     ^

The 'n_vertical_scrolls' variable is no longer used after 197b9a2ef003,
so remove it.

MFC after: 3 days

2 years agoAdjust function definition in acpi_timer.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 19:35:07 +0000 (21:35 +0200)]
Adjust function definition in acpi_timer.c to avoid clang 15 warnings

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

    sys/dev/acpica/acpi_timer.c:402:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    acpi_timer_test()
                   ^
                    void

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

MFC after: 3 days

2 years agoAdjust function definitions in ufs_dirhash.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 19:32:20 +0000 (21:32 +0200)]
Adjust function definitions in ufs_dirhash.c to avoid clang 15 warnings

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

    sys/ufs/ufs/ufs_dirhash.c:1303:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ufsdirhash_init()
                   ^
                    void
    sys/ufs/ufs/ufs_dirhash.c:1319:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ufsdirhash_uninit()
                     ^
                      void

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

MFC after: 3 days

2 years agoFix unused variable warning in ffs_snapshot.c
Dimitry Andric [Tue, 26 Jul 2022 19:30:41 +0000 (21:30 +0200)]
Fix unused variable warning in ffs_snapshot.c

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

    sys/ufs/ffs/ffs_snapshot.c:204:7: error: variable 'redo' set but not used [-Werror,-Wunused-but-set-variable]
            long redo = 0, snaplistsize = 0;
                 ^

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

MFC after: 3 days

2 years agoAdjust function definition in ufs_dirhash.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 19:22:58 +0000 (21:22 +0200)]
Adjust function definition in ufs_dirhash.c to avoid clang 15 warnings

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

    sys/ufs/ufs/ufs_dirhash.c:1252:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ufsdirhash_lowmem()
                     ^
                      void

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

MFC after: 3 days

2 years agoFix unused variable warning in netipsec's key_debug.c
Dimitry Andric [Tue, 26 Jul 2022 19:21:44 +0000 (21:21 +0200)]
Fix unused variable warning in netipsec's key_debug.c

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

    sys/netipsec/key_debug.c:923:9: error: variable 'j' set but not used [-Werror,-Wunused-but-set-variable]
            int i, j;
                   ^

The 'j' variable was in key_debug.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

2 years agoAdjust function definitions in netipsec's key.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 19:15:37 +0000 (21:15 +0200)]
Adjust function definitions in netipsec's key.c to avoid clang 15 warnings

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

    sys/netipsec/key.c:6432:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    key_getcomb_ah()
                  ^
                   void
    sys/netipsec/key.c:6489:19: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    key_getcomb_ipcomp()
                      ^
                       void

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

MFC after: 3 days

2 years agoAdjust function definition in nd6.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 19:10:58 +0000 (21:10 +0200)]
Adjust function definition in nd6.c to avoid clang 15 warnings

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

    sys/netinet6/nd6.c:247:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    nd6_destroy()
               ^
                void

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

MFC after: 3 days

2 years agoFix unused variable warning in ieee80211_proto.c
Dimitry Andric [Tue, 26 Jul 2022 19:05:36 +0000 (21:05 +0200)]
Fix unused variable warning in ieee80211_proto.c

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

    sys/net80211/ieee80211_proto.c:1070:34: error: variable 'num_mixed' set but not used [-Werror,-Wunused-but-set-variable]
            int num_vaps = 0, num_pure = 0, num_mixed = 0;
                                            ^

The 'num_mixed' variable was in ieee80211_proto.c when the function
vap_update_ht_protmode() was added, but it was never used for anything,
so remove it.

MFC after: 3 days

2 years agoAdjust function definitions in route_ctl.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 18:28:25 +0000 (20:28 +0200)]
Adjust function definitions in route_ctl.c to avoid clang 15 warnings

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

    sys/net/route/route_ctl.c:130:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    vnet_rtzone_init()
                    ^
                     void
    sys/net/route/route_ctl.c:139:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    vnet_rtzone_destroy()
                       ^
                        void

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

MFC after: 3 days

2 years agoAdjust function definition in nhop_ctl.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 18:26:46 +0000 (20:26 +0200)]
Adjust function definition in nhop_ctl.c to avoid clang 15 warnings

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

    sys/net/route/nhop_ctl.c:508:21: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    alloc_nhop_structure()
                        ^
                         void

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

MFC after: 3 days

2 years agoSuppress -Wstrict-prototypes for several zlib files
Dimitry Andric [Tue, 26 Jul 2022 18:24:58 +0000 (20:24 +0200)]
Suppress -Wstrict-prototypes for several zlib files

Clang 15 is more strict about function definitions not matching
declarations, and zlib has a lot of these, but since it is contributed
code (and in K&R style to boot), suppress those warnings instead.

MFC after: 3 days

2 years agoFinish update to bmake-20220724
Simon J. Gerraty [Tue, 26 Jul 2022 18:06:27 +0000 (11:06 -0700)]
Finish update to bmake-20220724

2 years agoAdjust function definition in vfs_bio.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 17:48:20 +0000 (19:48 +0200)]
Adjust function definition in vfs_bio.c to avoid clang 15 warnings

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

    sys/kern/vfs_bio.c:3430:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    buf_daemon()
              ^
               void

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

MFC after: 3 days

2 years agoAdjust function definitions in sysv_msg.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 17:46:15 +0000 (19:46 +0200)]
Adjust function definitions in sysv_msg.c to avoid clang 15 warnings

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

    sys/kern/sysv_msg.c:213:8: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    msginit()
           ^
            void
    sys/kern/sysv_msg.c:316:10: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    msgunload()
             ^
              void

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

MFC after: 3 days

2 years agoAdjust function definition in subr_bus.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 16:01:16 +0000 (18:01 +0200)]
Adjust function definition in subr_bus.c to avoid clang 15 warnings

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

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

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

MFC after: 3 days

2 years agoAdjust function definition in subr_autoconf.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 15:27:54 +0000 (17:27 +0200)]
Adjust function definition in subr_autoconf.c to avoid clang 15 warnings

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

    sys/kern/subr_autoconf.c:119:34: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    run_interrupt_driven_config_hooks()
                                     ^
                                      void

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

MFC after: 3 days

2 years agoAdjust function definitions in kern_resource.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 14:14:50 +0000 (16:14 +0200)]
Adjust function definitions in kern_resource.c to avoid clang 15 warnings

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

    sys/kern/kern_resource.c:1212:10: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    lim_alloc()
             ^
              void
    sys/kern/kern_resource.c:1365:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    uihashinit()
              ^
               void

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

MFC after: 3 days

2 years agoAdjust function definitions in kern_dtrace.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 14:11:05 +0000 (16:11 +0200)]
Adjust function definitions in kern_dtrace.c to avoid clang 15 warnings

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

    sys/kern/kern_dtrace.c:64:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    kdtrace_proc_size()
                     ^
                      void
    sys/kern/kern_dtrace.c:87:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    kdtrace_thread_size()
                       ^
                        void

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

MFC after: 3 days

2 years agoAdjust function definitions in kern_cons.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 14:03:35 +0000 (16:03 +0200)]
Adjust function definitions in kern_cons.c to avoid clang 15 warnings

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

    sys/kern/kern_cons.c:201:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    cninit_finish()
                 ^
                  void
    sys/kern/kern_cons.c:376:7: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    cngrab()
          ^
           void
    sys/kern/kern_cons.c:389:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    cnungrab()
            ^
             void
    sys/kern/kern_cons.c:402:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    cnresume()
            ^
             void

This is because cninit_finish(), cngrab(), cnungrab(), and cnresume()
are declared with (void) argument lists, but defined with empty argument
lists. Make the definitions match the declarations.

MFC after: 3 days

2 years agoAdjust function definition in geom_subr.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 14:01:04 +0000 (16:01 +0200)]
Adjust function definition in geom_subr.c to avoid clang 15 warnings

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

    sys/geom/geom_subr.c:484:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    g_wither_washer()
                   ^
                    void

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

MFC after: 3 days

2 years agoAdjust function definition in geom_io.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 14:00:08 +0000 (16:00 +0200)]
Adjust function definition in geom_io.c to avoid clang 15 warnings

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

    sys/geom/geom_io.c:272:10: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    g_io_init()
             ^
              void

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

MFC after: 3 days

2 years agoAdjust function definitions in geom_event.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 13:58:31 +0000 (15:58 +0200)]
Adjust function definitions in geom_event.c to avoid clang 15 warnings

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

    sys/geom/geom_event.c:261:13: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    g_run_events()
                ^
                 void
    sys/geom/geom_event.c:405:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    g_do_wither()
               ^
                void
    sys/geom/geom_event.c:449:13: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    g_event_init()
                ^
                 void

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

MFC after: 3 days

2 years agoFix unused variable warning in sfxge's ef10_tx.c
Dimitry Andric [Tue, 26 Jul 2022 13:17:05 +0000 (15:17 +0200)]
Fix unused variable warning in sfxge's ef10_tx.c

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

    sys/dev/sfxge/common/ef10_tx.c:345:15: error: variable 'eqp' set but not used [-Werror,-Wunused-but-set-variable]
            efx_qword_t *eqp;
                         ^

The 'eqp' variable is passed as an argument to the EFSYS_BAR_WC_WRITEQ()
macro, but currently this macro ignores the argument, similar to its
other _esbp argument. Silence the warning by casting the _eqp argument
to void in the macro.

MFC after: 3 days

2 years agoAdjust function definitions in xen's control.c to avoid clang 15 warnings
Dimitry Andric [Tue, 26 Jul 2022 12:11:09 +0000 (14:11 +0200)]
Adjust function definitions in xen's control.c to avoid clang 15 warnings

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

    sys/dev/xen/control/control.c:188:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    xctrl_poweroff()
                  ^
                   void
    sys/dev/xen/control/control.c:194:13: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    xctrl_reboot()
                ^
                 void
    sys/dev/xen/control/control.c:207:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    xctrl_suspend()
                 ^
                  void
    sys/dev/xen/control/control.c:344:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    xctrl_crash()
               ^
                void

This is because xctrl_poweroff(), xctrl_reboot(), xctrl_suspend(), and
xctrl_crash() are declared with (void) argument lists, but defined with
empty argument lists. Make the definitions match the declarations.

MFC after: 3 days

2 years agoFix unused variable warning in xen's blkback.c
Dimitry Andric [Tue, 26 Jul 2022 12:02:36 +0000 (14:02 +0200)]
Fix unused variable warning in xen's blkback.c

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

    sys/dev/xen/blkback/blkback.c:1561:12: error: variable 'req_seg_idx' set but not used [-Werror,-Wunused-but-set-variable]
                    u_int                    req_seg_idx;
                                             ^

The 'req_seg_idx' variable was used in the for loop later in the
xbb_dispatch_io() function, but refactoring in 112cacaee408 got rid of
it. Remove the variable since it no longer serves any purpose.

MFC after: 3 days

2 years agoFix unused variable warning in xen's blkfront.c
Dimitry Andric [Tue, 26 Jul 2022 12:01:26 +0000 (14:01 +0200)]
Fix unused variable warning in xen's blkfront.c

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

    sys/dev/xen/blkfront/blkfront.c:602:6: error: variable 'sbp' set but not used [-Werror,-Wunused-but-set-variable]
            int sbp;
                ^

The 'sbp' variable was used in the for loop later in the xb_dump()
function, but refactoring in e4808c4b2dba got rid of it. Remove the
variable since it no longer serves any purpose.

MFC after:      3 days

2 years agoAdjust playinit() definition to avoid clang 15 warning
Dimitry Andric [Tue, 26 Jul 2022 11:43:46 +0000 (13:43 +0200)]
Adjust playinit() definition to avoid clang 15 warning

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

    sys/dev/speaker/spkr.c:182:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    playinit()
            ^
             void

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

MFC after: 3 days

2 years agoAdjust check_struct_sizes() definition to avoid clang 15 warning
Dimitry Andric [Tue, 26 Jul 2022 11:20:58 +0000 (13:20 +0200)]
Adjust check_struct_sizes() definition to avoid clang 15 warning

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

    sys/dev/smartpqi/smartpqi_helper.c:374:19: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    check_struct_sizes()
                      ^
                       void

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

MFC after: 3 days

2 years agoAdjust sctp_drain() definition to avoid clang 15 warning
Dimitry Andric [Tue, 26 Jul 2022 11:19:39 +0000 (13:19 +0200)]
Adjust sctp_drain() definition to avoid clang 15 warning

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

    sys/netinet/sctp_pcb.c:6946:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    sctp_drain()
              ^
               void

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

MFC after: 3 days

2 years agoUpdate to bmake-20220724
Simon J. Gerraty [Tue, 26 Jul 2022 16:07:25 +0000 (09:07 -0700)]
Update to bmake-20220724

Merge commit '308a28d6cd2e87028e535eabccb89a9dc2fd9515'

2 years agoImport bmake-20220724
Simon J. Gerraty [Tue, 26 Jul 2022 15:52:53 +0000 (08:52 -0700)]
Import bmake-20220724

Relevant/interesting changes:

o parse.c: fix out-of-bounds read when parsing an invalid line
        https://bugs.freebsd.org/265119
fix memory leak in wildcard targets and sources
fix off-by-one error in buffer for .WAIT nodes
o allow to randomize build order of targets
.MAKE.MODE += randomize-targets can help uncover dependency bugs

2 years agorc: Start testing the rc(8) framework (beginning with *_oomprotect)
Mateusz Piotrowski [Thu, 7 Jul 2022 18:24:27 +0000 (20:24 +0200)]
rc: Start testing the rc(8) framework (beginning with *_oomprotect)

This change adds 2 tests to make sure that the *_oomprotect variable
sets the protection against OOM killer properly within rc(8) scripts.

This is also adding the first tests for the rc(8) framework. More tests
will be added as we go.

PR: 256148
Approved by: des
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35745

2 years agoAdd pmc.dmc-620(3) man page.
Aleksandr Rybalko [Wed, 16 Feb 2022 00:19:46 +0000 (00:19 +0000)]
Add pmc.dmc-620(3) man page.

Reviewed by: pauamma
Sponsored By: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D32669

2 years agox86/iommu: Correct a recent change to iommu_domain_unload_entry()
Alan Cox [Tue, 26 Jul 2022 04:53:15 +0000 (23:53 -0500)]
x86/iommu: Correct a recent change to iommu_domain_unload_entry()

Correct 8bc367384745.  When iommu_domain_unload_entry() performs a
synchronous IOTLB invalidation, it must call dmar_domain_free_entry()
to remove the entry from the domain's RB_TREE.

Push down the acquisition and release of the DMAR lock into the
recently introduced function dmar_qi_invalidate_sync_locked() and
remove the _locked suffix.

MFC with: 8bc367384745

2 years agostand: Fix set but unused warning
Warner Losh [Tue, 26 Jul 2022 04:48:31 +0000 (22:48 -0600)]
stand: Fix set but unused warning

Make interp_identifier global to avoid a set but not used warning. For a
global, llvm can't optimize it out (yet?)

Sponsored by: Netflix

2 years agocdefs: Add some notes about the different versions of POSIX
Warner Losh [Mon, 25 Jul 2022 22:19:28 +0000 (16:19 -0600)]
cdefs: Add some notes about the different versions of POSIX

POSIX versions are a bit weird, so add some notes here.

Sponsored by: Netflix

2 years agoatomic: Add some type checking to plain atomic_load/store helpers
Mark Johnston [Mon, 25 Jul 2022 21:48:46 +0000 (17:48 -0400)]
atomic: Add some type checking to plain atomic_load/store helpers

Reviewed by: rpokala, mjg, imp, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35828

2 years agoAdjust sctp_init_sysctls() definition to avoid clang 15 warning
Dimitry Andric [Mon, 25 Jul 2022 20:07:49 +0000 (22:07 +0200)]
Adjust sctp_init_sysctls() definition to avoid clang 15 warning

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

    sys/netinet/sctp_sysctl.c:55:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    sctp_init_sysctls()
                     ^
                      void

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

MFC after: 3 days

2 years agoFix unused variable warning in sctp_timer.c
Dimitry Andric [Mon, 25 Jul 2022 20:06:28 +0000 (22:06 +0200)]
Fix unused variable warning in sctp_timer.c

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

    sys/netinet/sctp_timer.c:510:6: error: variable 'recovery_cnt' set but not used [-Werror,-Wunused-but-set-variable]
            int recovery_cnt = 0;
                ^

The 'recovery_cnt' variable is only used when INVARIANTS is undefined.
Ensure it is only declared and set in that case.

MFC after: 3 days

2 years agoFix unused variable warning in sctp_output.c
Dimitry Andric [Mon, 25 Jul 2022 19:50:40 +0000 (21:50 +0200)]
Fix unused variable warning in sctp_output.c

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

    sys/netinet/sctp_output.c:9367:33: error: variable 'cnt_thru' set but not used [-Werror,-Wunused-but-set-variable]
            int no_fragmentflg, bundle_at, cnt_thru;
                                           ^

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

MFC after: 3 days

2 years agoFix unused variable warnings in sctp_indata.c
Dimitry Andric [Mon, 25 Jul 2022 19:15:52 +0000 (21:15 +0200)]
Fix unused variable warnings in sctp_indata.c

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

    sys/netinet/sctp_indata.c:3309:6: error: variable 'tot_retrans' set but not used [-Werror,-Wunused-but-set-variable]
            int tot_retrans = 0;
                ^
    sys/netinet/sctp_indata.c:3842:20: error: variable 'resend' set but not used [-Werror,-Wunused-but-set-variable]
            int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0;
                              ^
    sys/netinet/sctp_indata.c:3842:47: error: variable 'acked' set but not used [-Werror,-Wunused-but-set-variable]
            int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0;
                                                         ^
    sys/netinet/sctp_indata.c:3842:58: error: variable 'above' set but not used [-Werror,-Wunused-but-set-variable]
            int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0;
                                                                    ^

The 'tot_retrans' variable was used in sctp_strike_gap_ack_chunks(), but
refactoring in 493d8e5a830e got rid of it. Remove the variable since it
no longer serves any purpose.

The 'resend', 'acked', and 'above' variables are only used when
INVARIANTS is undefined. Ensure they are only declared and set in that
case.

MFC after: 3 days

2 years agoAdjust function definitions in if_pfsync.c to avoid clang 15 warnings
Dimitry Andric [Mon, 25 Jul 2022 18:53:32 +0000 (20:53 +0200)]
Adjust function definitions in if_pfsync.c to avoid clang 15 warnings

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

    sys/netpfil/pf/if_pfsync.c:2439:21: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pfsync_pointers_init()
                        ^
                         void
    sys/netpfil/pf/if_pfsync.c:2453:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pfsync_pointers_uninit()
                          ^
                           void
    sys/netpfil/pf/if_pfsync.c:2503:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pfsync_init()
               ^
                void
    sys/netpfil/pf/if_pfsync.c:2524:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pfsync_uninit()
                 ^
                  void

This is because pfsync_pointers_init(), pfsync_pointers_uninit(),
pfsync_init(), and pfsync_uninit() are declared with (void) argument
lists, but defined with empty argument lists. Make the definitions match
the declarations.

MFC after: 3 days

2 years agoFix unused variable warning in if_pfsync.c
Dimitry Andric [Mon, 25 Jul 2022 18:15:51 +0000 (20:15 +0200)]
Fix unused variable warning in if_pfsync.c

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

    sys/netpfil/pf/if_pfsync.c:2153:9: error: variable 'sent' set but not used [-Werror,-Wunused-but-set-variable]
            int i, sent = 0;
                   ^

The 'sent' variable was used in the for loop later in the
pfsync_bulk_update() function, but refactoring in 4fc65bcbe3fb7 got rid
of it. Remove the variable since it no longer serves any purpose.

MFC after: 3 days

2 years agoAdjust function definitions in pf.c to avoid clang 15 warnings
Dimitry Andric [Mon, 25 Jul 2022 17:59:59 +0000 (19:59 +0200)]
Adjust function definitions in pf.c to avoid clang 15 warnings

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

    sys/netpfil/pf/pf.c:985:19: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pf_mtag_initialize()
                      ^
                       void
    sys/netpfil/pf/pf.c:995:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pf_initialize()
                 ^
                  void
    sys/netpfil/pf/pf.c:1089:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pf_mtag_cleanup()
                   ^
                    void
    sys/netpfil/pf/pf.c:1096:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pf_cleanup()
              ^
               void
    sys/netpfil/pf/pf.c:1989:27: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pf_purge_expired_src_nodes()
                              ^
                               void
    sys/netpfil/pf/pf.c:2174:24: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pf_purge_unlinked_rules()
                           ^
                            void

This is because pf_mtag_initialize(), pf_initialize(),
pf_mtag_cleanup(), pf_cleanup(), pf_purge_expired_src_nodes(), and
pf_purge_unlinked_rules() are declared with (void) argument lists, but
defined with empty argument lists. Make the definitions match the
declarations.

MFC after: 3 days

2 years agoAdjust ng_{name,ID}_rehash() definitions to avoid clang 15 warnings
Dimitry Andric [Mon, 25 Jul 2022 11:04:29 +0000 (13:04 +0200)]
Adjust ng_{name,ID}_rehash() definitions to avoid clang 15 warnings

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

    sys/netgraph/ng_base.c:981:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ng_name_rehash()
                  ^
                   void
    sys/netgraph/ng_base.c:1012:13: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    ng_ID_rehash()
                ^
                 void

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

MFC after: 3 days

2 years agolibcrypto: Work around strict aliasing violations in bn_nist.c
Jessica Clarke [Mon, 25 Jul 2022 17:17:50 +0000 (18:17 +0100)]
libcrypto: Work around strict aliasing violations in bn_nist.c

This file is full of strict aliasing violations. Previously it was only
optimised in ways that broke the code by CHERI LLVM, but now it appears
that the in-tree LLVM also breaks it for RISC-V, resulting in broken
ECDSA signature validation with error messages like the following:

  root@unmatched:/usr/src # ssh-keygen -l -f /etc/ssh/ssh_host_ecdsa_key
  /etc/ssh/ssh_host_ecdsa_key is not a key file.
  root@unmatched:/usr/src # git fetch
  fatal: unable to access 'https://git.FreeBSD.org/src.git/': error:1012606B:elliptic curve routines:EC_POINT_set_affine_coordinates:point is not on curve

Reviewed by: dim, jkim
Obtained from: CheriBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35885

2 years agoiommu_gas: Eliminate a possible case of use-after-free
Alan Cox [Fri, 22 Jul 2022 17:00:26 +0000 (12:00 -0500)]
iommu_gas: Eliminate a possible case of use-after-free

Eliminate a possible case of use-after-free in an error handling path
after a mapping failure.  Specifically, eliminate IOMMU_MAP_ENTRY_QI_NF
and instead perform the IOTLB invalidation synchronously.  Otherwise,
when iommu_domain_unload_entry() is called and told not to free the
IOMMU map entry, the caller could free the entry before dmar_qi_task()
is finished with it.

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

2 years agoasmc: Add support for MacBookPro6,2
ed crowe [Mon, 25 Jul 2022 15:35:46 +0000 (11:35 -0400)]
asmc: Add support for MacBookPro6,2

Modify asmc_sms_printintr() to be silent when the ambient light sensor
interrupt fires on this model, since the messages can otherwise fill up
the dmesg.

PR: 265005
Reviewed by: markj
MFC after: 2 weeks

2 years agoAdd ELFCOMPRESS_ZSTD ELF compression constant
Ed Maste [Tue, 28 Jun 2022 13:06:12 +0000 (09:06 -0400)]
Add ELFCOMPRESS_ZSTD ELF compression constant

ELFCOMPRESS_ZSTD indicates that an ELF section is compressed with zstd.
It is the second compression type, after the existing ELFCOMPRESS_ZLIB.
Zstd generally provides a compelling tradeoff of speed and compression
(other algorithms may compress slightly better but take a lot longer,
or run faster but do not compress nearly as well).

See https://groups.google.com/g/generic-abi/c/satyPkuMisk for details.
ELFCOMPRESS_ZSTD will be supported in a future Clang/LLVM update.  ELF
Tool Chain tools also need updating.

Reviewed by: Fangrui Song
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agostand/disk: Trivial formatting nit
Warner Losh [Mon, 25 Jul 2022 13:32:15 +0000 (07:32 -0600)]
stand/disk: Trivial formatting nit

style(9) wants a space here.

Sponsored by: Netflix

2 years agohier(7): document libdata/pkgconfig
Baptiste Daroussin [Mon, 25 Jul 2022 09:14:50 +0000 (11:14 +0200)]
hier(7): document libdata/pkgconfig

2 years agoAdd d_sblockloc to libufs(3) disk structure to allow options to be added.
Kirk McKusick [Mon, 25 Jul 2022 01:10:39 +0000 (18:10 -0700)]
Add d_sblockloc to libufs(3) disk structure to allow options to be added.

By making the disk block parameter used by the libufs(3) sbread(3)
function visible, applications using sbread(3) can set their own
addition options such as using the STDSB_NOHASHFAIL request to
say that they want the superblock read to succeed even when
the superblock checkhash is incorrect.

While here also add an error message when a check-hash failure
is detected.

2 years agoHave dumpfs(8) ignore superblock check-hash failures.
Kirk McKusick [Mon, 25 Jul 2022 01:01:43 +0000 (18:01 -0700)]
Have dumpfs(8) ignore superblock check-hash failures.

Set the STDSB_NOHASHFAIL request so that dumpfs(8) can print out
filesystem details even when the superblock checksum is incorrect.

2 years agoOutput fs_csaddr rather than fs_old_csaddr for UFS1 filesystems.
Kirk McKusick [Mon, 25 Jul 2022 00:33:19 +0000 (17:33 -0700)]
Output fs_csaddr rather than fs_old_csaddr for UFS1 filesystems.

Since fs_csaddr is what will actually be used, show that value rather
than the historic and possibly incorrect value for UFS1 filesystems.

2 years agostand/zfs: Update comment about blake3_impl_hack.c
Warner Losh [Sun, 24 Jul 2022 21:55:49 +0000 (15:55 -0600)]
stand/zfs: Update comment about blake3_impl_hack.c

Fix a typo by reworking the comment for blake3_impl_hack.c and amplify
the nature of the hack and its temporary reason for existing.

Sponsored by: Netflix
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D35895

2 years agostand/libsa: zfs use standard ZFS_EARLY stuff
Warner Losh [Sun, 24 Jul 2022 21:53:56 +0000 (15:53 -0600)]
stand/libsa: zfs use standard ZFS_EARLY stuff

Now that the minor issues preventing zfs.c from using CFLAGS_EARLY have
been fixed, use that mechanism like everything else that needs the
OpenZFS spl headers. This simplifies things somewhat. Update comments to
document why zfs.c is still special, though in different ways.

Note: We also use the fact that NEED_SOLARIS_BOOLEAN is only defined in
an environment where the solaris compat boolean stuff will be defined
prior to this point (eg, when we're building zfs.c in libsa), but not in
other environments (like when we're building mkimage and stand-alone
boot loaders that don't use libsa). These latter uses should be changed
to use the same ZFS compile env, but aren't as part of this commit.
This has to be done in the same change as the ZFS_EARLY change to not
break zfs.c building for one commit affecting bisectabiltiy.

Sponsored by: Netflix
Reviewed by: tsoome, delphij
Differential Revision: https://reviews.freebsd.org/D35894

2 years agozfs: Increase compatibility for different environments
Warner Losh [Sun, 24 Jul 2022 21:53:14 +0000 (15:53 -0600)]
zfs: Increase compatibility for different environments

libsa uses the full OpenZFS compilation environment when we build this
included in zfs.c there. Other parts of the tree have not been adapted
to the full OpenZFS environment yet and need these ASSERT* defines to
build properly. Since the ASSERT* macros are normally defined in
sys/debug.h in the OpenZFS compatibility spl, only define them when
ASSERT3S is not defined to cope with the parts of the loader that don't
yet use the full OpenZFS environment.

Sponsored by: Netflix
Reviewed by: tsoome, delphij
Differential Revision: https://reviews.freebsd.org/D35893

2 years agoskein: Update guard define check
Warner Losh [Sun, 24 Jul 2022 21:52:20 +0000 (15:52 -0600)]
skein: Update guard define check

OpenZFS changed the define _OPENSOLARIS_SYS_TYPES_H_ to
_SPL_SYS_TYPES_H_ to guard the sys/types.h compatibility file
inclusion. Follow the change here. The only place in the tree
_OPENSOLARIS_SYS_TYPES_H_ is mentioned is in the /*
_OPENSOLARIS_SYS_TYPES_H_ */ at the end of sys/types.h. That needs to be
changed upstream in OpenZFS since we don't like changing things in
FreeBSD's tree.

Sponsored by: Netflix
Reviewed by: tsoome, delphij
Differential Revision: https://reviews.freebsd.org/D35891

2 years agostand/zfs: Limit flags further for ZFS
Warner Losh [Sun, 24 Jul 2022 21:51:53 +0000 (15:51 -0600)]
stand/zfs: Limit flags further for ZFS

Constrain CFLAGS for ZFS: don't add anything globally. Add the includes
to only the files that need them. Add -DHAS_ZSTD_ZFS to zfs.c (which
includes zfsimpl.c which includes zfssubr.c both of which need this
defined). Also add it to efi/boot1/Makefile since zfs_module.c also
includes zfsimple.c.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35887