]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 months agopam_krb5: Fix spoofing vulnerability
Cy Schubert [Wed, 31 May 2023 19:20:27 +0000 (12:20 -0700)]
pam_krb5: Fix spoofing vulnerability

An adversary on the network can log in via ssh as any user by spoofing
the KDC. When the machine has a keytab installed the keytab is used to
verify the service ticket. However, without a keytab there is no way
for pam_krb5 to verify the KDC's response and get a TGT with the
password.

If both the password _and_ the KDC are controlled by an adversary, the
adversary can provide a password that the adversary's spoofed KDC will
return a valid tgt for.  Currently, without a keytab, pam_krb5 is
vulnerable to this attack.

Reported by: Taylor R Campbell <riastradh@netbsd.org> via emaste@
Reviewed by: so
Approved by: so
Security: FreeBSD-SA-23:04.pam_krb5
Security: CVE-2023-3326

11 months agovm_radix: drop unused function; use bool.
Doug Moore [Wed, 21 Jun 2023 04:52:27 +0000 (23:52 -0500)]
vm_radix: drop unused function; use bool.

Replace boolean_t with bool in vm_radix.c. Drop the unused function
vm_radix_is_singleton, which is unused and has no corresponding
function in subr_pctrie.c.
Reviewed by: alc
Differential Revision: <https://reviews.freebsd.org/D40586>

11 months agotcp: expose AccECN mode and TCP FastOpen (TFO) in TCPI
Richard Scheffenegger [Tue, 20 Jun 2023 21:27:11 +0000 (23:27 +0200)]
tcp: expose AccECN mode and TCP FastOpen (TFO) in TCPI

Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D40621

11 months agoUpdate various sys/netinet source files to conform with the style(9)
Richard Scheffenegger [Tue, 20 Jun 2023 21:23:01 +0000 (23:23 +0200)]
Update various sys/netinet source files to conform with the style(9)
guide on how to label FALLTHOUGH in switch statements.

No functional chance.

Reviewed By: tuexen, cc, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D40622

11 months agofifolog: Trim some dead code and unused variables.
John Baldwin [Tue, 20 Jun 2023 21:03:35 +0000 (14:03 -0700)]
fifolog: Trim some dead code and unused variables.

The gmt_ptr and gmt variables are not used, so the call to gmtime can
be removed entirely.  In addition, there isn't a need to call
localtime twice.

Reported by: GCC -Wunused-but-set-variable
Reviewed by: phk, emaste
Differential Revision: https://reviews.freebsd.org/D40656

11 months agoWarn about nonfunctional WITHOUT options
Colin Percival [Tue, 20 Jun 2023 04:42:17 +0000 (21:42 -0700)]
Warn about nonfunctional WITHOUT options

Print a warning if we try to WITHOUT_ an option which is marked as
"required" (and forced on).

Suggested by: emaste, imp
Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D40613

11 months agobfe: add unmaintained / deprecation notice
Ed Maste [Tue, 20 Jun 2023 12:44:22 +0000 (08:44 -0400)]
bfe: add unmaintained / deprecation notice

The bfe (Broadcom BCM4401 10/100 Ethernet) driver has known bugs and no
active maintenance.  There have been no changes other than sweeping tree
changes, typo corrections etc. since 2008 a far as I can tell.  Add a
note in the man page so that users expectations are correctly set, and
indicate that it may be removed in the future.

I did not add a gone_in() call in the driver itself as there is no
specific target version for removal, and this driver has evidence of
recent use (dmesg, PRs).

PR: 201947, 213751
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40625

11 months agortld-elf: Mark tls_init_align __unused in free_tls for Variant I TLS.
John Baldwin [Tue, 20 Jun 2023 19:38:48 +0000 (12:38 -0700)]
rtld-elf: Mark tls_init_align __unused in free_tls for Variant I TLS.

Some architectures (powerpc and RISC-V) always use 0 for the post TLS
size in which case tls_init_align isn't used by
calculate_tls_post_size.  Use __unused to quiet the warning for these
platforms.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D40673

11 months agojail: Mute -Wunused-but-set-variable for yynerrs.
John Baldwin [Tue, 20 Jun 2023 19:38:20 +0000 (12:38 -0700)]
jail: Mute -Wunused-but-set-variable for yynerrs.

This is in the generated parser when using %pure-parser.

y.tab.c:382:14: error: variable 'yynerrs' set but not used [-Werror,-Wunused-but-set-variable]
    int      yynerrs;
             ^

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40671

11 months agoiasl: Disable -Wunused-but-set-variable for a couple of files.
John Baldwin [Tue, 20 Jun 2023 19:36:43 +0000 (12:36 -0700)]
iasl: Disable -Wunused-but-set-variable for a couple of files.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40669

11 months agobsd.sys.mk: Add NO_WUNUSED_BUT_SET_VARIABLE helper variable.
John Baldwin [Tue, 20 Jun 2023 19:36:15 +0000 (12:36 -0700)]
bsd.sys.mk: Add NO_WUNUSED_BUT_SET_VARIABLE helper variable.

This is already present in sys/conf/kern.mk and can be used to
selectively disable -Wunused-but-set-variable.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40663

11 months agotests/fusefs: Suppress false warning from GCC.
John Baldwin [Tue, 20 Jun 2023 19:34:39 +0000 (12:34 -0700)]
tests/fusefs: Suppress false warning from GCC.

GCC complains that DNAME in the inval_entry_below_root test is not
used, but EXPECT_LOOKUP() does pass DNAME to strcmp in an internal
lambda function.

Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D40661

11 months agoacpidump: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 19:33:37 +0000 (12:33 -0700)]
acpidump: Remove set but unused variable.

ACPICA's table dumper doesn't try to dump this subtable's contents
either.

Reported by: GCC
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40657

11 months agocamdd: Remove set but unused variables.
John Baldwin [Tue, 20 Jun 2023 19:32:57 +0000 (12:32 -0700)]
camdd: Remove set but unused variables.

Reported by: GCC
Reviewed by: ken
Differential Revision: https://reviews.freebsd.org/D40655

11 months agomt: Remove a set but unused variable.
John Baldwin [Tue, 20 Jun 2023 19:32:18 +0000 (12:32 -0700)]
mt: Remove a set but unused variable.

The variable is unused because the -v (verbose) flag to
'mt getdensity' is a no-op.

Reported by: GCC
Reviewed by: ken
Differential Revision: https://reviews.freebsd.org/D40653

11 months agolibpmc: Define a PMCLOG_SKIP32 helper macro to skip over a 32-bit field.
John Baldwin [Tue, 20 Jun 2023 19:31:43 +0000 (12:31 -0700)]
libpmc: Define a PMCLOG_SKIP32 helper macro to skip over a 32-bit field.

This replaces a set but unused noop variable with a more explicit
macro.

Reviewed by: jkoshy, mhorne
Differential Revision: https://reviews.freebsd.org/D40651

11 months agopf/libevent: Consistently pass evsignal to sigaction.
John Baldwin [Tue, 20 Jun 2023 19:31:19 +0000 (12:31 -0700)]
pf/libevent: Consistently pass evsignal to sigaction.

This silences a set but unused warning from GCC.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40649

11 months agoradix_trie: eliminate iteration in keydiff
Doug Moore [Tue, 20 Jun 2023 16:30:29 +0000 (11:30 -0500)]
radix_trie: eliminate iteration in keydiff

Use flsll(), instead of a loop, to find where two keys differ, and
then arithmetic to transform that to a trie level.
Approved by: alc, markj
Differential Revision: https://reviews.freebsd.org/D40585

11 months agobsnmpd snmp_bridge: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
bsnmpd snmp_bridge: Remove set but unused variable.

11 months agoiostat: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
iostat: Remove set but unused variable.

11 months agoprocstat: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
procstat: Remove set but unused variable.

11 months agodiff: Fully comment out the jackpot variable.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
diff: Fully comment out the jackpot variable.

This fixes a set but unused warning.

11 months agolibgssapi: Remove a set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
libgssapi: Remove a set but unused variable.

Reported by: clang -Wunused-but-set-variable

11 months agolibalias tests: Mark an unused variable with __unused.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
libalias tests: Mark an unused variable with __unused.

It is not trivial to remove this set but unused variable since it
assigned to inside of a macro body, so just mark it with __unused
instead.

11 months agounix_seqpacket_test: Consistently use datalen as length to send.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
unix_seqpacket_test: Consistently use datalen as length to send.

This matches the other tests in this file and quiets a set but unused
warning from GCC.

11 months agortld-elf: Remove set but unused variable on 32-bit arm.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
rtld-elf: Remove set but unused variable on 32-bit arm.

11 months agoac: Remove set but not used variable.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
ac: Remove set but not used variable.

Reported by: clang

11 months agoypldap: Remove set but unused variables.
John Baldwin [Tue, 20 Jun 2023 16:29:00 +0000 (09:29 -0700)]
ypldap: Remove set but unused variables.

Some of these were reported by GCC, others reported by clang.

11 months agonscd: Remove set but unused variables.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
nscd: Remove set but unused variables.

Reported by: GCC

11 months agobluetooth: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
bluetooth: Remove set but unused variable.

Reported by: GCC

11 months agobluetooth/ath3kfw: Propagate return value from ath3k_load_fwfile.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
bluetooth/ath3kfw: Propagate return value from ath3k_load_fwfile.

The caller ignores the return value so this is a no-op, but
ath3k_init_ar3012 returns the return values of its internal functions,
so this is more consistent.

Fix some misleading indentation while here.

Reported by: GCC -Wunused-but-set-variable (1)

11 months agomptable: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
mptable: Remove set but unused variable.

Reported by: GCC

11 months agotraceroute: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
traceroute: Remove set but unused variable.

Reported by: GCC

11 months agorpc.lockd: Remove set but unused variables.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
rpc.lockd: Remove set but unused variables.

Reported by: GCC

11 months agounits: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
units: Remove set but unused variable.

Reported by: GCC

11 months agomkuzip: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
mkuzip: Remove set but unused variable.

Reported by: GCC

11 months agolibvgl: Remove set but unused andmask variable from VGLMouseInit.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
libvgl: Remove set but unused andmask variable from VGLMouseInit.

Reported by: GCC

11 months agolib9p: Remove set but unused sockets[] array from l9p_start_server.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
lib9p: Remove set but unused sockets[] array from l9p_start_server.

Reported by: GCC

11 months agolibkvm: Remove set but unused variable from ppc64mmu_hpt_init.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
libkvm: Remove set but unused variable from ppc64mmu_hpt_init.

Reported by: GCC

11 months agolibgssapi: Remove set but unused variable.
John Baldwin [Tue, 20 Jun 2023 16:28:59 +0000 (09:28 -0700)]
libgssapi: Remove set but unused variable.

Reported by: GCC

11 months agoriscv: improve KTR_TRAP trace entries
Mitchell Horne [Tue, 20 Jun 2023 14:52:26 +0000 (11:52 -0300)]
riscv: improve KTR_TRAP trace entries

For more informative records of exceptions, include key details such as
the exception code and stval register contents. Remove the curthread
argument as it is redundant (saved with every ktr entry), and the
trapframe as it is somewhat meaningless.

Add a new KTR_TRAP trace record for interrupts.

Reviewed by: markj, jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40584

11 months agoossl: Don't try to initialize the cipher for Chacha20+Poly1305.
John Baldwin [Tue, 20 Jun 2023 14:53:50 +0000 (07:53 -0700)]
ossl: Don't try to initialize the cipher for Chacha20+Poly1305.

Chacha20+Poly1305 doesn't use an ossl_cipher instance the way AES-GCM
does, so ossl_lookup_cipher() failed causing ossl_newsession() to
always fail for Chacha20+Poly1305 sessions.

Reported by: gallatin (ktls_test fails with ossl.ko loaded)
Fixes: 9a3444d91c70 ossl: Add a VAES-based AES-GCM implementation for amd64
Tested by: gallatin
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40580

11 months agopf: Add code to enable filtering for locally delivered packets
Doug Rabson [Tue, 20 Jun 2023 13:01:58 +0000 (14:01 +0100)]
pf: Add code to enable filtering for locally delivered packets

This is disabled by default since it potentially changes the behavior of
existing filter rule sets. To enable this extra filter for packets being
delivered locally, use:

sysctl net.pf.filter_local=1
service pf restart

PR:             268717
Reviewed-by: kp
MFC-after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40373

11 months agoifconfig.8: Document limitation of groupname
Koichiro Iwao [Tue, 20 Jun 2023 10:14:39 +0000 (19:14 +0900)]
ifconfig.8: Document limitation of groupname

Approved by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40645

11 months agopf: fix build without VIMAGE
Kristof Provost [Tue, 20 Jun 2023 11:20:11 +0000 (13:20 +0200)]
pf: fix build without VIMAGE

Remove the name conflict between the pfsync_defer_tmo variable and
function.

This worked fine in kernels with VIMAGE (the default), but not in those
without.

Reported by: des@
Sponsored by: Rubicon Communications, LLC ("Netgate")

11 months agotarfs: Don't use IO_DIRECT when reading from tarball.
Dag-Erling Smørgrav [Tue, 20 Jun 2023 09:37:24 +0000 (09:37 +0000)]
tarfs: Don't use IO_DIRECT when reading from tarball.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D40612

11 months agobhyve: dos2unix
Corvin Köhne [Tue, 20 Jun 2023 09:47:42 +0000 (11:47 +0200)]
bhyve: dos2unix

tpm_intf.h was incorrectly committed with dos line endings.

Fixes: 0917f925b46e3142c4373d1591bf22014d0f338e ("bhyve: add basic CRB interface for TPM devices")
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

11 months agopf tests: make pfsync:defer test more robust
Kristof Provost [Mon, 19 Jun 2023 14:41:13 +0000 (16:41 +0200)]
pf tests: make pfsync:defer test more robust

Set the defer timeout to 2.5 seconds, and only make sure that there's at
least a second of delay between the pfsync packet and the ping packet.
The intent is to allow the test to pass even when there's considerable
jitter on the timing measurement (e.g. when the test runs in a VM, such
as during the CI tests).

Allow the test to run in CI.

Sponsored by: Rubicon Communications, LLC ("Netgate")

11 months agopf: allow defer timeout to be configured
Kristof Provost [Mon, 19 Jun 2023 14:37:19 +0000 (16:37 +0200)]
pf: allow defer timeout to be configured

Add the net.pfsync.defer_delay sysctl to allow the defer timeout (i.e.
how long pf holds onto packets waiting for the peer to ack the new
state) to be changed.

This is intended to make testing of the defer code more robust, by
allowing longer timeouts to mitigate scheduling/measurement jitter.

Sponsored by: Rubicon Communications, LLC ("Netgate")

11 months agobhyve/tpm: create crb thread for sending tpm commands
Corvin Köhne [Mon, 29 Aug 2022 10:10:44 +0000 (12:10 +0200)]
bhyve/tpm: create crb thread for sending tpm commands

Commands send to a tpm are very slow. They can take up to several
seconds for completion. For that reason, create a thread which issues
the commands to the tpm device.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40458

11 months agobhyve/tpm: build TPM2 table by tpm interface
Corvin Köhne [Mon, 29 Aug 2022 10:10:43 +0000 (12:10 +0200)]
bhyve/tpm: build TPM2 table by tpm interface

Each tpm has a device specific table. Which table a tpm uses depends on
the tpm interface.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40457

11 months agobhyve: maintain RSDT and XSDT by basl
Corvin Köhne [Thu, 15 Jun 2023 09:12:53 +0000 (11:12 +0200)]
bhyve: maintain RSDT and XSDT by basl

In a subsquent commit the TPM emulation will build it's own TPM2 table.
This needs to be registered to the RSDT and XSDT. Instead of making the
rsdt and xsdt variables global, we can simply add a helper to basl.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40559

11 months agobhyve: add bootindex option for several devices
Corvin Köhne [Mon, 16 Aug 2021 07:50:15 +0000 (09:50 +0200)]
bhyve: add bootindex option for several devices

The bootindex option creates an entry in the "bootorder" fwcfg file.
This file can be picked up by the guest firmware to determine the
bootorder. Nevertheless, it's not guaranteed that the guest firmware
uses the bootorder. At the moment, our OVMF ignores the bootorder. This
will change in the future.

If guest firmware supports the "bootorder" fwcfg file and no device uses
the bootindex option, the boot order is determined by the firmware
itself. If one or more devices specify a bootindex, the first bootable
device with the lowest bootindex will be booted. It's not garanteed that
devices without a bootindex will be recognized as bootable from the
firmware in that case.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39285

11 months agobhyve: add helper to create a bootorder
Corvin Köhne [Mon, 16 Aug 2021 07:47:53 +0000 (09:47 +0200)]
bhyve: add helper to create a bootorder

Qemu's fwcfg allows to define a bootorder. Therefore, the hypervisor has
to create a fwcfg item named bootorder, which has a newline seperated
list of boot entries. Qemu's OVMF will pick up the bootorder and applies
it.

Add the moment, bhyve's OVMF doesn't support a custom bootorder by
qemu's fwcfg. However, in the future bhyve will gain support for qemu's
OVMF. Additonally, we can port relevant parts from qemu's to bhyve's
OVMF implementation.

Reviewed by: jhb, markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39284

11 months agoRestore dummy WITHOUT_{CAPSICUM,CASPER} descriptions
Ed Maste [Tue, 20 Jun 2023 01:49:59 +0000 (21:49 -0400)]
Restore dummy WITHOUT_{CAPSICUM,CASPER} descriptions

The makeman CI job ensures that all options have description files.

Bring the CI job back to green by adding back WITHOUT_CAPSICUM and
WITHOUT_CASPER description files (that now state the assoicated options
have no effect).

Fixes: c24c117b9644 ("Remove WITHOUT_{CAPSICUM,CASPER} options")
Sponsored by: The FreeBSD Foundation

11 months agoRemove WITHOUT_{CAPSICUM,CASPER} options
Colin Percival [Sun, 18 Jun 2023 00:03:56 +0000 (17:03 -0700)]
Remove WITHOUT_{CAPSICUM,CASPER} options

At this point CAPSICUM and CASPER are merely forced on via the newly
added __REQUIRED_OPTIONS list; after stable/14 branches I'll sweep
the tree for MK_{CAPSICUM,CASPER}.

This change will not be MFCed.

Discussed on: freebsd-arch
Differential Revision: https://reviews.freebsd.org/D40592

11 months agooptions/makeman: Handle __REQUIRED_OPTIONS
Colin Percival [Sun, 18 Jun 2023 00:01:52 +0000 (17:01 -0700)]
options/makeman: Handle __REQUIRED_OPTIONS

Teach the code which generates src.conf.5 about __REQUIRED_OPTIONS;
without this change it gets confused and thinks that every option
turns the required options on.

Reviewed by: sjg, imp
Differential Revision: https://reviews.freebsd.org/D40591

11 months agobsd.mkopt.mk: Add REQUIRED_OPTIONS list
Colin Percival [Sat, 17 Jun 2023 20:08:37 +0000 (13:08 -0700)]
bsd.mkopt.mk: Add REQUIRED_OPTIONS list

Options on this list will be forced to 'yes'.  This is intended for use
as a transitional measure when an option is ceasing to be optional,
before all of the associated make logic is removed.

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

11 months agocamcontrol: Include stdbool.h rather than relying on namespace pollution
Warner Losh [Mon, 19 Jun 2023 20:52:58 +0000 (14:52 -0600)]
camcontrol: Include stdbool.h rather than relying on namespace pollution

I have several environments, and at least one of them fails to build
because bool is undefined. Since we use bool, always include stdbool.h
rather than relying on any indirect definitions to pull it in.

Sponsored by: Netflix

11 months agocamcontrol: Zone fix two warnings
Warner Losh [Mon, 19 Jun 2023 20:51:07 +0000 (14:51 -0600)]
camcontrol: Zone fix two warnings

Remove a set but never used variable, and use the protocol variable for
its intended purpose.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D40528

11 months agocam: Remove duplicate definition for READ_DEFECT_DATA_10
Warner Losh [Mon, 19 Jun 2023 20:43:45 +0000 (14:43 -0600)]
cam: Remove duplicate definition for READ_DEFECT_DATA_10

This isn't needed by all devices and is only used by the da device (in
camcontrol). All the other da specific da scsi opcodes are only in
scsi_da.h.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D40527

11 months agocamcontrol: In defects make -S actually imply 12-byte command
Warner Losh [Mon, 19 Jun 2023 20:43:37 +0000 (14:43 -0600)]
camcontrol: In defects make -S actually imply 12-byte command

camcontrol(8) says that -S to start at a different offset implies that
we're using the 12 byte command. But really, we're using the 10-byte
command. Fix this by setting use_12byte for -S.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D40526

11 months agocamcontrol: simplify summary logic for defects
Warner Losh [Mon, 19 Jun 2023 20:43:30 +0000 (14:43 -0600)]
camcontrol: simplify summary logic for defects

We don't need to count the number of lists requested. Instead, use the
more general form of checking to see if any of the non-defect format
bits are set. Also, check summary boolean to control summary reporting
behavior.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D40524

11 months agocamcontrol: No need to set CAM_ARG_[PG]LIST in defects
Warner Losh [Mon, 19 Jun 2023 20:43:12 +0000 (14:43 -0600)]
camcontrol: No need to set CAM_ARG_[PG]LIST in defects

We can or in the the list_format bits directly if we or in the
list_format when we look it up the first time. Free up CAM_ARG_[PG]LIST
from the CAM_ARG_xxx enum.

Sponsored by: Netflix
Reviewed by: mav (I made his suggested change)
Differential Revision: https://reviews.freebsd.org/D40523

11 months agocamcontrol: Simplfiy 12-byte retry logic in defects command
Warner Losh [Mon, 19 Jun 2023 20:43:05 +0000 (14:43 -0600)]
camcontrol: Simplfiy 12-byte retry logic in defects command

We always start out using the 10-byte version of READ DEFECT DATA, and
then switch to 12-byte when necessary due to errors or data length
requirements. We always need to get the length again when we do this,
and we're always going to be using 12-byte commands from that point
forward. Simplify the logic a bit based on this observation.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D40522

11 months agocamcontrol: Convert int used as booleans to bools
Warner Losh [Mon, 19 Jun 2023 20:42:57 +0000 (14:42 -0600)]
camcontrol: Convert int used as booleans to bools

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D40521

11 months agocamcontrol: Label the unused command args
Warner Losh [Mon, 19 Jun 2023 20:42:48 +0000 (14:42 -0600)]
camcontrol: Label the unused command args

Remove CAM_ARG_FORMAT_{BLOCK,BLI,PHYS} since they are not used.  Label
all the unused CAM_ARG_ bits as unused in comments to make them stand
out.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D40520

11 months agobhyve: Refactor vmexit_suspend() a bit
Mark Johnston [Mon, 19 Jun 2023 19:46:32 +0000 (15:46 -0400)]
bhyve: Refactor vmexit_suspend() a bit

Move some of its logic into fbsdrun_deletecpu().  This makes it easier
to split vmexit handlers into a separate file, which in turn makes
landing arm64 support easier.  Also increase the scope of the mutex and
use it to synchronize updates to the vcpu mask.  No functional change
intended.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40573

11 months agobhyve: Register hlt and pause vmexit handlers unconditionally
Mark Johnston [Mon, 19 Jun 2023 19:46:02 +0000 (15:46 -0400)]
bhyve: Register hlt and pause vmexit handlers unconditionally

These exit handlers might not be used if the corresponding VM
capabilities are not set, but there is no harm in putting them into the
handler table regardless.  Doing so simplifies initialization code,
makes it easier to split vmexit handlers into a separate file, and lets
us declare the handler table as const.

Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D40572

11 months agobhyve: Include vmm.h via the usual path
Mark Johnston [Thu, 8 Jun 2023 21:25:25 +0000 (17:25 -0400)]
bhyve: Include vmm.h via the usual path

No functional change intended.

MFC after: 1 week
Sponsored by: Innovate UK

11 months agobhyve: Remove some unneeded includes of segments.h
Mark Johnston [Thu, 8 Jun 2023 21:24:45 +0000 (17:24 -0400)]
bhyve: Remove some unneeded includes of segments.h

They are not needed and are specific to x86.  No functional change
intended.

MFC after: 1 week
Sponsored by: Innovate UK

11 months agoApply llvm fix for hanging gcc builds on 32-bit arm
Dimitry Andric [Mon, 19 Jun 2023 18:32:40 +0000 (20:32 +0200)]
Apply llvm fix for hanging gcc builds on 32-bit arm

Merge commit 962c306a11d0 from llvm-project (by Florian Hahn):

  [LV] Don't consider pointer as uniform if it is also stored.

  Update isVectorizedMemAccessUse to also check if the pointer is stored.
  This prevents LV to incorrectly consider a pointer as uniform if it is
  used as both pointer and stored by the same StoreInst.

  Fixes #61396.

PR: 271992
Reported by: John F. Carr <jfc@mit.edu>
MFC after: 3 days

11 months agoservice: Add -E option to set environment variables before starting a service.
Alexander Leidinger [Wed, 30 Nov 2022 18:31:41 +0000 (19:31 +0100)]
service: Add -E option to set environment variables before starting a service.

This allows for quicker testing/debugging of rc scripts and is a pre-req
for automatic service jails.

Differential Revision: https://reviews.freebsd.org/D40369
Reviewed by: se

11 months agoifconfig: Pacify a sign comparison warning in regdomain_sort.
John Baldwin [Mon, 19 Jun 2023 17:38:18 +0000 (10:38 -0700)]
ifconfig: Pacify a sign comparison warning in regdomain_sort.

Both ic_flags values are unsigned (uint32_t), so cast them to a signed
int to generate a signed result.  Both ic_req values are also
unsigned, but since they are uint16_t, they are implicitly promited to
int before the subtraction.

Reported by: GCC -Wsign-compare
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40610

11 months agoifconfig: Consistently use uint32_t for wireless channel flags.
John Baldwin [Mon, 19 Jun 2023 17:38:07 +0000 (10:38 -0700)]
ifconfig: Consistently use uint32_t for wireless channel flags.

Reported by: GCC -Wsign-compare
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40609

11 months agoifconfig: Avoid issues with trying to negate unsigned values.
John Baldwin [Mon, 19 Jun 2023 17:37:52 +0000 (10:37 -0700)]
ifconfig: Avoid issues with trying to negate unsigned values.

The if_flags and if_cap fields hold a bitmask of flags.  If a flag is
the MSB of the field, then the logic in setifflags and setifcap which
uses a < 0 check does the wrong thing (it tries to clear the flag
rather than setting it).  Also, trying to use -<FOO> doesn't actually
work as the result is a nop.  To fix, stop overloading setifcap and
setifflags and instead add new dedicated action functions clearifcap
and clearifflags for clearing a flag.  The value passed in the
argument to the command is now always the raw flag.

This was reported by a GCC warning after raising WARNS:

sbin/ifconfig/ifconfig.c:2061:33: error: integer overflow in expression '-2147483648' of type 'int' results in '-2147483648' [-Werror=overflow]
 2061 |         DEF_CMD("-txtlsrtlmt",  -IFCAP_TXTLS_RTLMT,     setifcap),
      |                                 ^

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40608

11 months agox86: Add defines for a couple of thermal and PM bits
Mark Johnston [Mon, 19 Jun 2023 17:26:07 +0000 (13:26 -0400)]
x86: Add defines for a couple of thermal and PM bits

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

11 months agosh: also auto-complete built-ins
Piotr Pawel Stefaniak [Sat, 29 Apr 2023 15:53:58 +0000 (17:53 +0200)]
sh: also auto-complete built-ins

Reported in a comment in PR 261728.

Reported by: Oleg
Reviewed by: jilles (previous version), bapt
Differential Revision: https://reviews.freebsd.org/D39839

11 months agompi3mr: fix GCC kernel build
Ed Maste [Mon, 19 Jun 2023 13:23:45 +0000 (09:23 -0400)]
mpi3mr: fix GCC kernel build

Previously every file that included mpi3mr_app.h but did not use
mpi3mr_mgmt_info reported error: 'mpi3mr_mgmt_info' defined but not
used.

Fixes: 2d1d418e1e7b ("mpi3mr: 3rd Generation Tri-Mode NVMe/SAS/SATA...")
Reported by: amd64-gcc12 Cirrus-CI job
Sponsored by: The FreeBSD Foundation

11 months agopcib: Allocate the memory BAR with the MSI-X table.
John Baldwin [Mon, 19 Jun 2023 16:15:48 +0000 (09:15 -0700)]
pcib: Allocate the memory BAR with the MSI-X table.

This is required for pci_alloc_msix() to work and to thus use
MSI-X interrupts for PCI-e hotplug.

Reported by: cperciva
Reviewed by: cperciva
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40581

11 months agoseq: fix check for rounding error/truncation
Ed Maste [Mon, 19 Jun 2023 01:37:06 +0000 (21:37 -0400)]
seq: fix check for rounding error/truncation

Based on OpenBSD 30f0fd29ba6c:
> We need to compare the printable version of the last value displayed,
> not the floating point representation.  Otherwise, we may print the
> last value twice.

PR: 271964
Reported by: Daniel Kolesa
Reviewed by: yuripv
Obtained from: OpenBSD
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40601

11 months agoifconfig: set boolean to true rather than incrementing
Ed Maste [Mon, 19 Jun 2023 15:01:08 +0000 (11:01 -0400)]
ifconfig: set boolean to true rather than incrementing

GCC warns about "increment of a boolean expression."

Reported by: amd64-gcc12 Cirrus-CI run
Sponsored by: The FreeBSD Foundation

11 months agonameser: Fix a typo in a source code comment
Gordon Bergling [Mon, 19 Jun 2023 11:49:23 +0000 (13:49 +0200)]
nameser: Fix a typo in a source code comment

-s /unknwon/unknown/

MFC after: 3 days

11 months agoFix some shell issues by adding quotes and replace backticks with $()
Benedict Reuschling [Mon, 19 Jun 2023 11:03:06 +0000 (11:03 +0000)]
Fix some shell issues by adding quotes and replace backticks with $()

This patch fixes the following issues reported by shellcheck:
- Quote default assignments (SC2223)
- Use $() instead of backticks (SC2006)
- Double quote $@ (SC2068)
- Double quote variables in if-statements and other places (SC2086)

While here, fix a whitespace at one end of line instance in the license
text.

Approved by: manu
Differential Revision: https://reviews.freebsd.org/D40604

11 months agopf: Fix usage of pf tags with syncookies
Kajetan Staszkiewicz [Mon, 19 Jun 2023 08:21:29 +0000 (10:21 +0200)]
pf: Fix usage of pf tags with syncookies

The value stored in pf_mtag->tag comes from "tag" and "match tag"
keywords in pf.conf and must not be abused for storing other
information. A ruleset with enough tags could set or remove the bits
responsible for PF_TAG_SYNCOOKIE_RECREATED.

Move this syncookie status to pf_mtag->flags. Rename this and other
related constants in a way that will prevent such mistakes in the
future. Move PF_REASSEMBLED constant to mbuf.h and rename accordingly
because it's not a flag stored in pf_mtag, but an identifier of a
different m_tag. Change the value of the constant to avoid conflicts
with other m_tags using MTAG_ABI_COMPAT.

Rename the variables in pf_build_tcp() and pf_send_tcp() in to reduce
confusion.

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D40587

11 months agopf: extend use of skip steps for Ethernet rules
Kristof Provost [Thu, 15 Jun 2023 15:12:11 +0000 (17:12 +0200)]
pf: extend use of skip steps for Ethernet rules

Use the already populated PFE_SKIP_DST_ADDR and extend the skip
infrastructure to also skip on IP source/destination addresses.

This should make evaluating the rules slightly faster.

Reported by: R. Christian McDonald <rcm@rcm.sh>
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40567

11 months agomotd: unbreak for source upgrade
Eugene Grosbein [Mon, 19 Jun 2023 07:49:35 +0000 (14:49 +0700)]
motd: unbreak for source upgrade

In case of source upgrade path from 12.x proper merge of new /etc
installs /etc/motd.template. Becase of that, the system in left
without symlink /etc/motd -> /var/run/motd but with stale /etc/motd contents.

Fix it creating symlink despite of presence of /etc/motd.template.

MFC after: 1 week

11 months agobhyve: add command line parameter and parsing for migration
Mihai Burcea [Mon, 19 Jun 2023 06:46:28 +0000 (08:46 +0200)]
bhyve: add command line parameter and parsing for migration

This covers warm and live migration.

Reviewed by: corvink
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34717

11 months agobhyve: use pci_next() to save/restore pci devices
Vitaliy Gusev [Mon, 15 May 2023 14:29:04 +0000 (14:29 +0000)]
bhyve: use pci_next() to save/restore pci devices

Current snapshot implementation doesn't support multiple devices with
similar type. For example, two virtio-blk or two CD-ROM-s, etc.

So the following configuration cannot be restored.

bhyve \
-s 3,virtio-blk,disk.img \
-s 4,virtio-blk,disk2.img

In some cases it is restored silently, but doesn't work. In some cases
it fails during restore stage.

This commit fixes that issue.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40109

11 months agobhyve: add .pe_snapshot method for PCI 'hostbridge'
Vitaliy Gusev [Mon, 15 May 2023 16:29:56 +0000 (16:29 +0000)]
bhyve: add .pe_snapshot method for PCI 'hostbridge'

There is no error when dump doesn't have it, but to be more
consistent this PCI devices should be saved as well.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40108

11 months agobhyve: add bus, slot and func to device name
Vitaliy Gusev [Mon, 15 May 2023 14:28:45 +0000 (14:28 +0000)]
bhyve: add bus, slot and func to device name

Each device needs a unique identifier to store and restore snapshots
properly. Adding the pci bsf information to the device name creates a
unique identifier as a bsf can't be occupied twice.

Reviewed by: corvink
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40107

11 months agobhyve: rename 'user_dev' with 'devices'
Vitaliy Gusev [Mon, 15 May 2023 14:28:14 +0000 (14:28 +0000)]
bhyve: rename 'user_dev' with 'devices'

Bhyve don't use 'user' specifier for emulated devices. And
using 'user' adds duality.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40106

11 months agobhyve: simplify restore of kernel structs
Vitaliy Gusev [Mon, 15 May 2023 14:27:29 +0000 (14:27 +0000)]
bhyve: simplify restore of kernel structs

Both devices and kernel struct can use the same 'lookup_dev'
function instead of having duplicated code.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40105

11 months agobhyve: rename 'structs' snapshot key with 'kern_structs'
Vitaliy Gusev [Mon, 15 May 2023 14:25:15 +0000 (14:25 +0000)]
bhyve: rename 'structs' snapshot key with 'kern_structs'

Using key 'structs' is ambiguous. This section contains data
related to the kernel. It should use a more informative naming.

Reviewed by: corvink, rew
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D40104

11 months agoacl_is_trivial_np(3): minor fixes
Kyle Evans [Mon, 19 Jun 2023 05:31:16 +0000 (00:31 -0500)]
acl_is_trivial_np(3): minor fixes

- Correct the document title
- This function has an _np suffix
- acl_strip_np has a manpage, xref it
- RETURN VALUES should describe acl_is_trivial_np, not acl_get_tag_type

Sponsored by: Klara, Inc.

11 months agomount_nfs.8: Note a case where the "nconnect" option does not work
Rick Macklem [Sun, 18 Jun 2023 20:02:20 +0000 (13:02 -0700)]
mount_nfs.8: Note a case where the "nconnect" option does not work

The "nconnect" NFS mount option will not work
correctly for servers where the TCP connections
might connect to different NFS clusters that do not
share NFSv4.1/4.2 state information, such as file locks.

This patch adds a sentence to the "nconnect" section
of mount_nfs.8 noting this case.

This is a content change.

Reviewed by: karels, pauamma_gundo.com (manpages)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40547

11 months agoexamples/kld/syscall: unbreak compilation
Maxim Konovalov [Sun, 18 Jun 2023 05:52:01 +0000 (05:52 +0000)]
examples/kld/syscall: unbreak compilation

modfind(9)/modstat(9) need sys/param.h.

11 months agomlx4en(4): add missing newline to debug messages
Kevin Lo [Sun, 18 Jun 2023 04:14:41 +0000 (12:14 +0800)]
mlx4en(4): add missing newline to debug messages

Add newline to debug messages after dumping uar_page_shift and reserved_uars.

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40582

11 months agoamdtemp: Fix missing 49 degree offset on current EPYC CPUs
Val Packett [Sat, 17 Jun 2023 16:29:53 +0000 (13:29 -0300)]
amdtemp: Fix missing 49 degree offset on current EPYC CPUs

On an EPYC 7313P, the temperature reported by amdtemp was off, because
the offset was not applied. Turns out it needs to be applied with one
more condition: https://lkml.org/lkml/2023/4/13/1095

Reviewed by: mhorne
Tested by: mike.jakubik@gmail.com
MFC after: 1 week
Sponsored by: https://www.patreon.com/valpackett
Pull Request: https://github.com/freebsd/freebsd-src/pull/754

11 months agoarm64/disassem.c: Add shifted register definitions with ror
Mykola Hohsadze [Sat, 17 Jun 2023 15:31:25 +0000 (12:31 -0300)]
arm64/disassem.c: Add shifted register definitions with ror

Add disassembly support for the following shifted register instructions:
* mvn
* orn
* orr
* and
* ands
* bic
* bics
* eon
* eor
* tst

According to Arm64 documenation, operational pseuducode of shifted
register instruction must return `UNDEFINED` if shift type is `RESERVED`
('11'). Hence, removed "rsv" from `shift_2` array and add "ror". In case
of shift type is 3 and this type is `RESERVED`, we will return
`undefined`.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40386