]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agom4: Support long options.
Dag-Erling Smørgrav [Wed, 21 Jun 2023 20:58:40 +0000 (20:58 +0000)]
m4: Support long options.

The option names are identical to those of the equivalent options in GNU m4, except of course for --gnu which does not exist in GNU m4.

While here, make the argument to -d / --debug optional, with the same default behavior as in GNU m4, and document it properly.

Sponsored by: Klara, Inc.
Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D40694

14 months agotcp: fix TCP MD5 computation for the BBR and RACK stack
Michael Tuexen [Wed, 21 Jun 2023 20:54:33 +0000 (22:54 +0200)]
tcp: fix TCP MD5 computation for the BBR and RACK stack

PR: 253096
Reviewed by: cc, rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D40597

14 months agotcp: fix TCP MD5 digest computation for TCP over UDP
Michael Tuexen [Wed, 21 Jun 2023 20:48:12 +0000 (22:48 +0200)]
tcp: fix TCP MD5 digest computation for TCP over UDP

Skip the UDP header for the computation. This is similar to
skipping IPv6 extension headers.

Reviewed by: cc, rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D40596

14 months agounix tests: Add a regression test for getpeername(2)
Mark Johnston [Wed, 21 Jun 2023 18:33:52 +0000 (14:33 -0400)]
unix tests: Add a regression test for getpeername(2)

Ensure that it works as expected when applied to a self-connected
socket.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

14 months agounix: Fix uipc_peeraddr() to handle self-connected sockets
Mark Johnston [Wed, 21 Jun 2023 18:20:16 +0000 (14:20 -0400)]
unix: Fix uipc_peeraddr() to handle self-connected sockets

Reported by: syzbot+c2da2dbae5fe006556bc@syzkaller.appspotmail.com
Reported by: syzbot+b4d6b093b1d78bfa859b@syzkaller.appspotmail.com
Fixes: e8f6e5b2d969 ("unix: Fix locking in uipc_peeraddr()")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

14 months agodev/pci: simplify PCI VPD access functions
Stefan Eßer [Wed, 21 Jun 2023 17:36:39 +0000 (19:36 +0200)]
dev/pci: simplify PCI VPD access functions

This update contains a rewrite of the VPD parser based on the
definition of the structure of the VPD data (ident, R/O resource
data, optional R/W data, end tag).

The parser it replaces was based on a state machine, with the tags
and the parsed data controlling the state changes. The flexibility
of this parser is actually not required, and it has caused kernel
panics when operating on malformed data.

Analysis of the VPD code to make it more robust lead me to believe
that it was easier to write a "strict" parser than to restrict the
flexible state machine to detect and reject non-well-formed data.
A number of restrictions had already been added, but they make the
state machine ever more complex and harder to understand.

This updated parser has been verified to return identical parsed data
as the current implementation for the example VPD data given in the
PCI standard and in some actual PCIe VPD data.

It is strict in the sense that it detects and rejects any deviation
from a well-formed VPD structure.

PR: 272018
Approved by: kib
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D34268

14 months agoarm64: print '0x' before hex values
Christos Margiolis [Wed, 21 Jun 2023 15:47:06 +0000 (18:47 +0300)]
arm64: print '0x' before hex values

Not making it explicit that we're printing values in hex can be
misleading when the number doesn't contain hex-only symbols (a-f). A
good example of this is print_gp_register(), where we print "(func +
offset)"; if the offset doesn't contain a-f symbols, it's not
immediately clear if that value is in decimal or hex. Using '%#' instead
of '0x%' also isn't a better option, it doesn't print '0x' if the value
is 0, and it also messes up column alignment.

Reviewed by: imp, markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40583

14 months agocap_net.3: fix typo
Shawn Webb [Wed, 21 Jun 2023 00:47:19 +0000 (20:47 -0400)]
cap_net.3: fix typo

Signed-off-by: Shawn Webb <shawn.webb@hardenedbsd.org>

14 months agoarm64: Enable the Hyper-V keyboard driver
Andrew Turner [Wed, 14 Jun 2023 12:56:36 +0000 (13:56 +0100)]
arm64: Enable the Hyper-V keyboard driver

Tested on Hyper-V on a Windows Dev Kit 2023

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D40533

14 months agoHyper-V: vmbus: Prevent load/store reordering when access ring buffer index
Wei Hu [Wed, 21 Jun 2023 09:31:46 +0000 (09:31 +0000)]
Hyper-V: vmbus: Prevent load/store reordering when access ring buffer index

When running VM on ARM64 Hyper-V, we have seen netvsc/hn driver hit
assert on reading duplicated network completion packets over vmbus
channel or one of the tx channels stalls completely. This seems to
caused by processor reordering the instructions when vmbus driver
reading or updating its channel ring buffer indexes.

Fix this by using load acquire and store release instructions to
enforce the order of these memory accesses.

PR: 271764
Reported by: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Reviewed by: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Tested by: whu
Sponsored by: Microsoft

14 months agostress2: Added two syzkaller reproducers
Peter Holm [Wed, 21 Jun 2023 09:10:13 +0000 (11:10 +0200)]
stress2: Added two syzkaller reproducers

14 months agosctp: fix man page for socket option controlling delayed acks
Michael Tuexen [Wed, 21 Jun 2023 07:03:30 +0000 (09:03 +0200)]
sctp: fix man page for socket option controlling delayed acks

The SCTP_DELAYED_ACK_TIME socket option was replaced by the
SCTP_DELAYED_SACK in the socket API specification in
draft-ietf-tsvwg-sctpsocket-14.
The code was updated in r170056, but the man page was not.

PR: 272124
MFC after: 3 days

14 months agoRevert "bhyve: add command line parameter and parsing for migration"
Corvin Köhne [Wed, 21 Jun 2023 06:55:34 +0000 (08:55 +0200)]
Revert "bhyve: add command line parameter and parsing for migration"

Unfortunately, this feature didn't receive much feedback in the past.
However, after committing this, some people came up and complain that
this feature requires some more discussion before upstreaming it.
Additionally, it wasn't a good idea to start this new feature by adding
a new command line parameter as it fixes the user interface.

This reverts commit c9fdd4f3cc18c03683de85318ba8d318f96b58c4.

14 months agotop(8): restore erronously removed SWAIT array element
Konstantin Belousov [Wed, 21 Jun 2023 05:43:11 +0000 (08:43 +0300)]
top(8): restore erronously removed SWAIT array element

due to bad rebase.

Noted by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Fixes: 6a5e6a50bd55c3fb4933abe1edaad3a928700c42ESC

14 months agotop(8): add missed SLOCK state to the sorted_state[]
Konstantin Belousov [Mon, 19 Jun 2023 16:00:15 +0000 (19:00 +0300)]
top(8): add missed SLOCK state to the sorted_state[]

Put it near/after the sleep state.

Noted by: Mark Millard <marklmi@yahoo.com>
Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40607

14 months agotop(8): document the actual sort order for process sorting
Konstantin Belousov [Mon, 19 Jun 2023 15:57:00 +0000 (18:57 +0300)]
top(8): document the actual sort order for process sorting

Noted by: Mark Millard <marklmi@yahoo.com>
Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40607

14 months agotop(8): use designated initializers for sorted_state[]
Konstantin Belousov [Mon, 19 Jun 2023 13:52:05 +0000 (16:52 +0300)]
top(8): use designated initializers for sorted_state[]

Also correct comments for individual state, duplicating the S* constants
descriptions from sys/proc.h [*].

Reviewed by: kevans (previous version)
Noted by: Mark Millard <marklmi@yahoo.com> [*]
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40607

14 months agotop(8): designate the sorted_state[] array as constant
Konstantin Belousov [Mon, 19 Jun 2023 13:49:19 +0000 (16:49 +0300)]
top(8): designate the sorted_state[] array as constant

Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40607

14 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

14 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>

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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.

14 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.

14 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.

14 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.

14 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

14 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.

14 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.

14 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.

14 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

14 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.

14 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

14 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

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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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")

14 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

14 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

14 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")

14 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")

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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