]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
12 months agolibarchive: Avoid a build failure with OpenSSL 3.0
Pierre Pronchery [Thu, 1 Jun 2023 18:17:10 +0000 (20:17 +0200)]
libarchive: Avoid a build failure with OpenSSL 3.0

This is a minimal workaround; a proper fix will come via a future update
from upstream.

Sponsored by: The FreeBSD Foundation

12 months agokerberos: Request the OpenSSL 1.1 API
Pierre Pronchery [Thu, 25 May 2023 06:25:18 +0000 (08:25 +0200)]
kerberos: Request the OpenSSL 1.1 API

This is needed to build with OpenSSL 3.0; a future update should switch
to using native OpenSSL 3 APIs.

Sponsored by: The FreeBSD Foundation

12 months agoMerge OpenSSL 3.0.9
Pierre Pronchery [Fri, 23 Jun 2023 22:53:35 +0000 (18:53 -0400)]
Merge OpenSSL 3.0.9

Migrate to OpenSSL 3.0 in advance of FreeBSD 14.0.  OpenSSL 1.1.1 (the
version we were previously using) will be EOL as of 2023-09-11.

Most of the base system has already been updated for a seamless switch
to OpenSSL 3.0.  For many components we've added
`-DOPENSSL_API_COMPAT=0x10100000L` to CFLAGS to specify the API version,
which avoids deprecation warnings from OpenSSL 3.0.  Changes have also
been made to avoid OpenSSL APIs that were already deprecated in OpenSSL
1.1.1.  The process of updating to contemporary APIs can continue after
this merge.

Additional changes are still required for libarchive and Kerberos-
related libraries or tools; workarounds will immediately follow this
commit.  Fixes are in progress in the upstream projects and will be
incorporated when those are next updated.

There are some performance regressions in benchmarks (certain tests in
`openssl speed`) and in some OpenSSL consumers in ports (e.g.  haproxy).
Investigation will continue for these.

Netflix's testing showed no functional regression and a rather small,
albeit statistically significant, increase in CPU consumption with
OpenSSL 3.0.

Thanks to ngie@ and des@ for updating base system components, to
antoine@ and bofh@ for ports exp-runs and port fixes/workarounds, and to
Netflix and everyone who tested prior to commit or contributed to this
update in other ways.

PR: 271615
PR: 271656 [exp-run]
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

12 months agowg: fix a number of issues with module load failure handling
Kyle Evans [Wed, 21 Jun 2023 18:56:58 +0000 (13:56 -0500)]
wg: fix a number of issues with module load failure handling

If MOD_LOAD fails, then MOD_UNLOAD will be called to unwind module
state, but wg_module_init() will have already deinitialized everything
it needs to in a manner that renders it unsafe to call MOD_UNLOAD
after (e.g., freed zone not reset to NULL, wg_osd_jail_slot not reset
to 0).  Let's simply stop trying to handle freeing everything in
wg_module_init() to simplify it; let the subsequent MOD_UNLOAD deal with
it, and let's make that robust against partially-constructed state.

jhb@ notes that MOD_UNLOAD being called if MOD_LOAD fails is kind of an
anomaly that doesn't match other paradigms in the kernel; e.g., if
device_attach() fails, we don't invoke device_detach().  It's likely
that a future commit will revert this and instead stop calling
MOD_UNLOAD if MOD_LOAD fails, expecting modules to clean up after
themselves in MOD_LOAD upon failure.  Some other modules already do this
and may see similar problems to the wg module (see: carp).  The proper
fix is decidedly a bit too invasive to do this close to 14 branching,
and it requires auditing all kmods (base + ports) for potential leaks.

PR: 272089
Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D40708

12 months agowg: fix MOD_LOAD to fail properly if cookie_init() fails
Kyle Evans [Fri, 23 Jun 2023 16:41:07 +0000 (11:41 -0500)]
wg: fix MOD_LOAD to fail properly if cookie_init() fails

Previously we'd jump to the `free_crypto` label, but never set `ret` to
a failure value -- it would retain success from the call just prior.

Set ret up properly.

This is part of D40708, but not the main point of the change.

12 months agoarm64 iommu: Fix build without INVARIANTS.
John Baldwin [Fri, 23 Jun 2023 16:33:41 +0000 (09:33 -0700)]
arm64 iommu: Fix build without INVARIANTS.

Obtained from: CheriBSD
Sponsored by: DARPA

12 months agonetinet tests: Add a test which connects a disconnected socket
Mark Johnston [Fri, 23 Jun 2023 14:06:13 +0000 (10:06 -0400)]
netinet tests: Add a test which connects a disconnected socket

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

12 months agotcp: Disallow connecting a disconnected socket
Mark Johnston [Fri, 23 Jun 2023 13:59:52 +0000 (09:59 -0400)]
tcp: Disallow connecting a disconnected socket

Currently nothing prevents tcp_usr_connect() from attempting to connect
when the socket has been disconnected.  At the moment, doing so triggers
an assertion in in_pcbconnect() because inp_faddr is not unspecified.  I
believe this may have been caught in the past by TIMEWAIT checks, but
those are now removed.

Check for additional socket states in tcp_connect().

Reported by: syzbot+f0f7871ec5397602b446@syzkaller.appspotmail.com
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40579

12 months agonetinet6: Implement in6_cksum_partial() using m_apply()
Mark Johnston [Fri, 23 Jun 2023 13:55:43 +0000 (09:55 -0400)]
netinet6: Implement in6_cksum_partial() using m_apply()

This ensures that in6_cksum_partial() can be applied to unmapped mbufs,
which can happen at least when icmp6_reflect() quotes a packet.

The basic idea is to restructure in6_cksum_partial() to operate on one
mbuf at a time.  If the buffer length is odd or unaligned, an extra
residual byte may be returned, to be incorporated into the checksum when
processing the next buffer.

PR: 268400
Reviewed by: cy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40598

12 months agopseudofs: Fix a potential out-of-bounds access in pfs_lookup()
Mark Johnston [Fri, 23 Jun 2023 13:54:39 +0000 (09:54 -0400)]
pseudofs: Fix a potential out-of-bounds access in pfs_lookup()

pseudofs nodes store their name in a flexible array member, so the node
allocation is sized using the length of the name, including a nul
terminator.  pfs_lookup() scans a directory of nodes, comparing names to
find a match.  The comparison was incorrect and assumed that all node
names were at least as long as the name being looked up, which of course
isn't true.

I believe the bug is mostly harmless since it cannot result in false
positive or negative matches from the lookup, but it triggers a KASAN
check.

Reported by: pho
Reviewed by: kib, Olivier Certner <olce.freebsd@certner.fr>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40692

12 months agoopenssl: Vendor import of OpenSSL-3.0.9
Pierre Pronchery [Wed, 31 May 2023 22:06:50 +0000 (00:06 +0200)]
openssl: Vendor import of OpenSSL-3.0.9

Summary:

Release notes can be found at
https://www.openssl.org/news/openssl-3.0-notes.html .

Obtained from:  https://www.openssl.org/source/openssl-3.0.9.tar.gz

Test Plan:
```
$ git status
On branch vendor/openssl-3.0
Your branch is up to date with 'origin/vendor/openssl-3.0'.

nothing to commit, working tree clean
$ (cd ..; fetch http://www.openssl.org/source/openssl-${OSSLVER}.tar.gz http://www.openssl.org/source/openssl-${OSSLVER}.tar.gz.asc)
openssl-3.0.9.tar.gz                                    14 MB   74 MBps    01s
openssl-3.0.9.tar.gz.asc                               833  B   10 MBps    00s
$ set | egrep '(XLIST|OSSLVER)='
OSSLVER=3.0.9
XLIST=FREEBSD-Xlist
$ gpg --list-keys
/home/khorben/.gnupg/pubring.kbx
--------------------------------
pub   rsa4096 2021-07-16 [SC] [expires: 2031-07-14]
      A21FAB74B0088AA361152586B8EF1A6BA9DA2D5C
uid           [ unknown] Tomáš Mráz <tm@t8m.info>
uid           [ unknown] Tomáš Mráz <tomas@arleto.cz>
uid           [ unknown] Tomáš Mráz <tomas@openssl.org>
sub   rsa4096 2021-07-16 [S] [expires: 2027-07-15]
sub   rsa4096 2021-07-16 [E] [expires: 2031-07-14]

$ gpg --verify ../openssl-${OSSLVER}.tar.gz.asc ../openssl-${OSSLVER}.tar.gz
gpg: Signature made Tue May 30 14:32:24 2023 CEST
gpg:                using RSA key DC7032662AF885E2F47F243F527466A21CA79E6D
gpg: Good signature from "Tomáš Mráz <tm@t8m.info>" [unknown]
gpg:                 aka "Tomáš Mráz <tomas@arleto.cz>" [unknown]
gpg:                 aka "Tomáš Mráz <tomas@openssl.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: A21F AB74 B008 8AA3 6115  2586 B8EF 1A6B A9DA 2D5C
     Subkey fingerprint: DC70 3266 2AF8 85E2 F47F  243F 5274 66A2 1CA7 9E6D

$ tar -x -X $XLIST -f ../openssl-${OSSLVER}.tar.gz -C ..
$ rsync --exclude FREEBSD.* --delete -avzz ../openssl-${OSSLVER}/* .
[...]
$ diff -arq ../openssl-${OSSLVER}  .
Only in .: .git
Only in .: FREEBSD-Xlist
Only in .: FREEBSD-upgrade
$ git status FREEBSD*
On branch vendor/openssl-3.0
Your branch is up to date with 'origin/vendor/openssl-3.0'.

nothing to commit, working tree clean
```

12 months agoFix spelling of "behavior" to be consistent with the rest of the file
Benedict Reuschling [Fri, 23 Jun 2023 05:48:01 +0000 (05:48 +0000)]
Fix spelling of "behavior" to be consistent with the rest of the file

12 months agobug: efi_print_global only checks for the first 5 letters of "Driver"
Alfonso Gregory [Mon, 8 May 2023 21:48:50 +0000 (17:48 -0400)]
bug: efi_print_global only checks for the first 5 letters of "Driver"

As a result, it is only really checking for the word Drive, making
"Drive" appended to anything else considered for efi env.

Reviewed by: imp, kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/738

12 months agoscsi_all.c: Update to latest asc-num.txt at T10
Warner Losh [Fri, 23 Jun 2023 02:51:30 +0000 (20:51 -0600)]
scsi_all.c: Update to latest asc-num.txt at T10

This updates our table to Sat Mar 25 2023 at 04:30 of the T10
asc-num.txt. I added all the codes that weren't present in the tree,
corrected a couple of the 'alphabet' comments about where the ASC/ASCQ
was defined. I did not, however, make the transition that the
asc-num.txt file made (it deleted W between P and R and added Z after D
so the first few letters shifted a bit). I've not removed the 'W' nor
added the 'Z' at this time. I'm looking for some way to do this
automatically. Try to pick reasonable responses for new entries. When in
doubt, I selected SS_RDEF.

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

12 months agoscsi_all.c: Minor formatting nits
Warner Losh [Fri, 23 Jun 2023 02:51:25 +0000 (20:51 -0600)]
scsi_all.c: Minor formatting nits

Noticed the whitespace nits when updating for other reasons.

Sponsored by: Netflix

12 months agoReplace BSD-2-Clause-FreeBSD with BSD-2-Clause
Warner Losh [Fri, 23 Jun 2023 02:51:22 +0000 (20:51 -0600)]
Replace BSD-2-Clause-FreeBSD with BSD-2-Clause

Sponsored by: Netflix

12 months agoCirrus-CI: use llvm16 job by default and make llvm15 manual
Ed Maste [Thu, 22 Jun 2023 23:20:34 +0000 (19:20 -0400)]
Cirrus-CI: use llvm16 job by default and make llvm15 manual

With commit e048f78b2143 the default tool chain is Clang/LLVM 16, so
follow along in the llvm pkg used by Cirrus-CI.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

12 months agoBump __FreeBSD_version for llvm 16.0.6 merge
Dimitry Andric [Thu, 22 Jun 2023 18:24:04 +0000 (20:24 +0200)]
Bump __FreeBSD_version for llvm 16.0.6 merge

PR: 271047
MFC after: 1 month

12 months agoMerge llvm-project release/16.x llvmorg-16.0.6-0-g7cbf1a259152
Dimitry Andric [Thu, 22 Jun 2023 17:47:54 +0000 (19:47 +0200)]
Merge llvm-project release/16.x llvmorg-16.0.6-0-g7cbf1a259152

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.6-0-g7cbf1a259152 (aka 16.0.6 release).

PR: 271047
MFC after: 1 month

12 months agoMerge commit 69d42eef4bec from llvm-project (by Dimitry Andric):
Dimitry Andric [Wed, 14 Jun 2023 18:49:59 +0000 (20:49 +0200)]
Merge commit 69d42eef4bec from llvm-project (by Dimitry Andric):

  [Clang] Show type in enum out of range diagnostic

  When the diagnostic for an out of range enum value is printed, it
  currently does not show the actual enum type in question, for example:

      v8/src/base/bit-field.h:43:29: error: integer value 7 is outside the valid range of values [0, 3] for this enumeration type [-Wenum-constexpr-conversion]
        static constexpr T kMax = static_cast<T>(kNumValues - 1);
                                  ^

  This can make it cumbersome to find the cause for the problem. Add the
  enum type to the diagnostic message, to make it easier.

  Reviewed By: aaron.ballman

  Differential Revision: https://reviews.llvm.org/D152788

PR: 271047
MFC after: 1 month

12 months agoMerge llvm-project release/16.x llvmorg-16.0.5-0-g185b81e034ba
Dimitry Andric [Sun, 4 Jun 2023 19:01:35 +0000 (21:01 +0200)]
Merge llvm-project release/16.x llvmorg-16.0.5-0-g185b81e034ba

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.5-0-g185b81e034ba (aka 16.0.5 release).

PR: 271047
MFC after: 1 month

12 months agoMerge llvm-project release/16.x llvmorg-16.0.4-0-gae42196bc493
Dimitry Andric [Mon, 22 May 2023 17:29:55 +0000 (19:29 +0200)]
Merge llvm-project release/16.x llvmorg-16.0.4-0-gae42196bc493

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.4-0-gae42196bc493 (aka 16.0.4 release).

PR: 271047
MFC after: 1 month

12 months agoMerge llvm-project release/16.x llvmorg-16.0.3-0-gda3cd333bea5
Dimitry Andric [Fri, 5 May 2023 17:37:33 +0000 (19:37 +0200)]
Merge llvm-project release/16.x llvmorg-16.0.3-0-gda3cd333bea5

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.3-0-gda3cd333bea5 (aka 16.0.3 release).

PR: 271047
MFC after: 1 month

12 months agoclang: re-downgrade implicit int/function declarations to warning only
Dimitry Andric [Tue, 25 Apr 2023 19:24:04 +0000 (21:24 +0200)]
clang: re-downgrade implicit int/function declarations to warning only

This reapplies upstream commit c0141f3c300f by Aaron Ballman:

  Downgrade implicit int and implicit function declaration to warning only

  The changes in Clang 15.0.0 which enabled these diagnostics as a
  warning which defaulted to an error caused disruption for people
  working on distributions such as Gentoo. There was an explicit request
  to downgrade these to be warning-only in Clang 15.0.1 with the
  expectation that Clang 16 will default the diagnostics to an error.

  See
  https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213
  for more details on the discussion.

  See https://reviews.llvm.org/D133800 for the public review of these
  changes.

As noted in the upstream discussion, there are many programs that fail
to configure or build correctly, if these warnings are turned into
errors by default.

Note that most affected programs in ports are relatively old, and are
unlikely to be fixed by actually adjusting their declarations, but by
compiling with -std=gnu89, which downgrades the errors back to warning
again. Lots of tedious work for very little gain.

12 months agoMerge llvm-project release/16.x llvmorg-16.0.2-0-g18ddebe1a1a9
Dimitry Andric [Sat, 22 Apr 2023 17:27:13 +0000 (19:27 +0200)]
Merge llvm-project release/16.x llvmorg-16.0.2-0-g18ddebe1a1a9

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.2-0-g18ddebe1a1a9 (aka 16.0.2 release).

PR: 271047
MFC after: 1 month

12 months agoMerge commit db492316399a from llvm-project (by Dimitry Andric):
Dimitry Andric [Thu, 20 Apr 2023 19:22:59 +0000 (21:22 +0200)]
Merge commit db492316399a from llvm-project (by Dimitry Andric):

  [clang][BFloat] Avoid redefining bfloat16_t in arm_neon.h

  As of https://reviews.llvm.org/D79708, clang-tblgen generates `arm_neon.h`,
  `arm_sve.h` and `arm_bf16.h`, and all those generated files will contain a
  typedef of `bfloat16_t`. However, `arm_neon.h` and `arm_sve.h` include
  `arm_bf16.h` immediately before their own typedef:

      #include <arm_bf16.h>
      typedef __bf16 bfloat16_t;

  With a recent version of clang (I used 16.0.1) this results in warnings:

      /usr/lib/clang/16/include/arm_neon.h:38:16: error: redefinition of typedef 'bfloat16_t' is a C11 feature [-Werror,-Wtypedef-redefinition]

  Since `arm_bf16.h` is very likely supposed to be the one true place where
  `bfloat16_t` is defined, I propose to delete the duplicate typedefs from the
  generated `arm_neon.h` and `arm_sve.h`.

  Reviewed By: sdesmalen, simonbutcher

  Differential Revision: https://reviews.llvm.org/D148822

PR: 271047
MFC after: 1 month

12 months agoMerge commit 16949c5c48ab from llvm-project (by Dimitry Andric):
Dimitry Andric [Thu, 20 Apr 2023 19:21:37 +0000 (21:21 +0200)]
Merge commit 16949c5c48ab from llvm-project (by Dimitry Andric):

  [compiler-rt] Include system headers before optionally defining HWCAP macros

  In https://reviews.llvm.org/D141285 the optional definitions of `HWCAP`
  macros were moved to before their usage. However, they were also moved
  to before the inclusion of system headers which can optionally define
  them. If any of those system headers then actually defined any of the
  `HWCAP` macros, it would result in a redefinition error.

  Move the system header includes to just before the optional definitions,
  to avoid this problem.

  Reviewed By: ilinpv

  Differential Revision: https://reviews.llvm.org/D148819

PR: 271047
MFC after: 1 month

12 months agoMerge llvm-project release/16.x llvmorg-16.0.1-0-gcd89023f7979
Dimitry Andric [Mon, 17 Apr 2023 17:14:23 +0000 (19:14 +0200)]
Merge llvm-project release/16.x llvmorg-16.0.1-0-gcd89023f7979

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.1-0-gcd89023f7979 (aka 16.0.1 release).

PR: 271047
MFC after: 1 month

12 months agoMerge llvm-project main llvmorg-16-init-18548-gb0daacf58f41
Dimitry Andric [Fri, 14 Apr 2023 21:41:27 +0000 (23:41 +0200)]
Merge llvm-project main llvmorg-16-init-18548-gb0daacf58f41

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16-init-18548-gb0daacf58f41.

PR: 271047
MFC after: 1 month

12 months agoVendor import of llvm-project branch release/16.x llvmorg-16.0.6-0-g7cbf1a259152...
Dimitry Andric [Thu, 22 Jun 2023 09:50:25 +0000 (11:50 +0200)]
Vendor import of llvm-project branch release/16.x llvmorg-16.0.6-0-g7cbf1a259152 (aka 16.0.6 release).

12 months agogetfacl: free `acl` in print_acl error path
Kyle Evans [Thu, 22 Jun 2023 04:58:33 +0000 (23:58 -0500)]
getfacl: free `acl` in print_acl error path

Sponsored by: Klara, Inc.

12 months agole(4): deprecate and mark for removal before 15.0
Brooks Davis [Wed, 21 Jun 2023 23:50:12 +0000 (00:50 +0100)]
le(4): deprecate and mark for removal before 15.0

We kept le(4) in the pre-12.0 purge because it was needed for Qemu/MIPS
(virtio networking didn't work) but the MIPS port has been removed.

Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D40683

12 months agoFix prebuild race between libpam and libtacplus.
Dag-Erling Smørgrav [Wed, 21 Jun 2023 20:58:54 +0000 (20:58 +0000)]
Fix prebuild race between libpam and libtacplus.

Fixes: 21850106fdda
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans, emaste
Differential Revision: https://reviews.freebsd.org/D40702

12 months agom4: Miscellaneous man page fixes.
Dag-Erling Smørgrav [Wed, 21 Jun 2023 20:58:50 +0000 (20:58 +0000)]
m4: Miscellaneous man page fixes.

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

12 months agom4: Add -G option which reverses -g.
Dag-Erling Smørgrav [Wed, 21 Jun 2023 20:58:45 +0000 (20:58 +0000)]
m4: Add -G option which reverses -g.

This matches GNU m4's -G / --traditional option, and although BSD m4 in non-GNU mode is not exactly identical to GNU mode in traditional mode, it's close enough.

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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

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

12 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

12 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

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

12 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

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

12 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

12 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

12 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

12 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

12 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

12 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

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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

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

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

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

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

12 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

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

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

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

12 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

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

12 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

12 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

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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

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

12 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

12 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