]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 months agoatf_pytest_wrapper: fix use with pytest-7.4
Kristof Provost [Tue, 18 Jul 2023 14:20:47 +0000 (16:20 +0200)]
atf_pytest_wrapper: fix use with pytest-7.4

As of pytest 7.4 it no longer walks all the way to the root directory
of the file system to find conftest files. As a result we don't find /
usr/tests/conftest.py, and don't load atf_python. That in turn causes
atf_python tests to fail.

Explicitly set the confcutdir, as advised by the pytest changelog.

See also: https://github.com/pytest-dev/pytest/pull/11043
MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D41064

11 months agoxen: move vcpu_info to common, leave hook for setup
Elliott Mitchell [Thu, 8 Jun 2023 21:13:17 +0000 (14:13 -0700)]
xen: move vcpu_info to common, leave hook for setup

vcpu_info is crucial for the Xen event channel core.  Since both the
data and setup steps are identical between architectures, move them to
the common file.  Since there is no cross-architecture method to call
a function on every processor during bring-up, simply leave the setup
function.

The number of vcpu_info structures available on the shared information
page varies by architecture.  Instead of hard-coding the count use
nitems().  Add a warning message for this being used.

Switch to XEN_VCPUID() and use Xen's typedefs.

panic() on failure since >32 processors is no longer unusual.

royger: Specify 64-byte alignment for vcpu_info to try to defend
against vcpu_info crossing a page boundary.  Add detection for this
limit.

Reviewed by: royger

11 months agocam: Add CAM_NVME_STATUS_ERROR error code
Warner Losh [Fri, 21 Jul 2023 04:22:37 +0000 (22:22 -0600)]
cam: Add CAM_NVME_STATUS_ERROR error code

Add CAM_NVME_STATUS_ERROR error code. Flag all NVME commands that
completed with an error status as CAM_NVME_STATUS_ERROR (a new value)
instaead of CAM_REQ_CMP_ERR. This indicates to the upper layers of CAM
that the 'cpl' field for nvmeio CCBs is valid and can be examined for
error recovery, if desired.

No functional change. nda will still see these as errors, call
ndaerror() to get the error recovery action, etc. cam_periph_error will
select the same case as before (even w/o the change, though the change
makes it explicit).

Sponsored by: Netflix
Reviewed by: chuck, mav, jhb
Differential Revision: https://reviews.freebsd.org/D41085

11 months agocam/nda: Remove impossible CAM codes
Warner Losh [Fri, 21 Jul 2023 04:22:27 +0000 (22:22 -0600)]
cam/nda: Remove impossible CAM codes

The NVME SIM does not generate these status values, so remove them.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D41084

11 months agocam: Be explict about CAM_SMP_STATUS_ERROR
Warner Losh [Fri, 21 Jul 2023 04:22:18 +0000 (22:22 -0600)]
cam: Be explict about CAM_SMP_STATUS_ERROR

This is normally caught by default:, but no harm in making it explicit
that we'll retry valid periphs.

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

11 months agocam/scsi: Better action for ASC/ASCQ 0x18/0x08
Warner Losh [Fri, 21 Jul 2023 04:22:07 +0000 (22:22 -0600)]
cam/scsi: Better action for ASC/ASCQ 0x18/0x08

0x18/0x8 is another code to indicate that the data was recovered
successfully, so complete the command w/o an error rather than retry the
operation.

Sponsored by: Netflix
Reviewed by: mav, jhb
Differential Revision: https://reviews.freebsd.org/D41082

11 months agocam: Add comment about recovery ccbs
Warner Losh [Fri, 21 Jul 2023 04:21:57 +0000 (22:21 -0600)]
cam: Add comment about recovery ccbs

SS_START and higher actions (currently only SS_TUR) allocate a recovery
CCB to send a command to the periph. Add a quick comment about that here.

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

11 months agolibc: locale: flesh out an incomplete comment
Kyle Evans [Fri, 21 Jul 2023 04:27:24 +0000 (23:27 -0500)]
libc: locale: flesh out an incomplete comment

Extrapolate from the context what the intention for the rest of the
comment probably was -- that the C/POSIX (and now C.UTF-8) locales may
avoid an allocation and reuse a global table.

Reviewed by: bapt
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D41087

11 months agoe1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes
Kevin Bowling [Fri, 21 Jul 2023 03:30:00 +0000 (20:30 -0700)]
e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes

* em(4) obey administrative ifcaps for using hwcsum offload
* em(4) obey administrative ifcaps for hw vlan receive tagging
* em(4) add additional TSO6 ifcap, but disabled by default as is TSO4
* lem(4) obey administrative ifcaps for using hwcsum offload
* lem(4) add support for hw vlan receive tagging
* lem(4) Add ifcaps for TSO offload experimentation, but disabled by
  default due to errata and possibly missing txrx code.
* lem(4) disable HWCSUM ifcaps by default on 82547 due to errata around
  full duplex links.  It may still be administratively enabled.

Reviewed by: markj (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30072

11 months agoe1000: Some fixes for em(4) TSO setup
Kevin Bowling [Fri, 21 Jul 2023 01:51:02 +0000 (18:51 -0700)]
e1000: Some fixes for em(4) TSO setup

Always set TXD_CMD_IP for 82544
Otherwise set TXD_CMD_IP for IPv4, not IPv6

Reviewed by: markj (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30072

11 months agoshare/mk: Pass -znoexecstack to ld.bfd when linking libraries and programs.
John Baldwin [Thu, 20 Jul 2023 23:36:35 +0000 (16:36 -0700)]
share/mk: Pass -znoexecstack to ld.bfd when linking libraries and programs.

lld assumes -znoexecstack by default whereas ld.bfd still defaults to
-zexecstack in the absence of .note.GNU-stack annotations.  Adding the
flags centrally avoids having to patch various libraries in the tree
as one-offs (e.g. OpenSSL 3 is the current thing generating new
warnings with ld.bfd).

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

11 months agompr: Fix minor 'typos' comment
Warner Losh [Thu, 20 Jul 2023 23:16:04 +0000 (17:16 -0600)]
mpr: Fix minor 'typos' comment

moving -> removing (we're removing the device)
CAM_REQ_CMO_ERROR -> CAM_REQ_ERR (the former isn't a thing)

Sponsored by: Netflix

11 months agoixl(4): Add link state polling
Krzysztof Galazka [Thu, 20 Jul 2023 22:33:52 +0000 (15:33 -0700)]
ixl(4): Add link state polling

In some cases driver may ask FW about link state before FW finishes
configuration of a (Q)SFP+ transceiver. If first attempt of using Get Link
Status AQC after loading driver or handling a reset fails, then re-try
periodically for 5 seconds.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Tested by: jeffrey.e.pieper@intel.com
Approved by: erj@
MFC after: 2 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D40899

11 months agotcp_wrappers: recognize IPv6 addresses/prefixes
Gleb Smirnoff [Thu, 20 Jul 2023 21:56:20 +0000 (14:56 -0700)]
tcp_wrappers: recognize IPv6 addresses/prefixes

Intentionally or not, but the libwrap was written in such manner that
if your /etc/hosts.allow doesn't have any domain names, neither smart
keywords like LOCAL or KNOWN, then it will not try to resolve the
client address during the hosts check.  This was achieved with the
NOT_INADDR() check that matched IPv4 addresses/prefixes.  Extend this
to also skip resolve if client list token looks like IPv6.

Reviewed by: philip, emaste
PR: 269456
Differential revision: https://reviews.freebsd.org/D40070

11 months agosshd: do not resolve refused client hostname
Gleb Smirnoff [Thu, 20 Jul 2023 21:56:20 +0000 (14:56 -0700)]
sshd: do not resolve refused client hostname

This is a compromise between POLA and practical reasoning.  We don't
want to block the main server loop in an attempt to resolve.  But we
need to keep the format of the logged message as is, for sake of
sshguard and other scripts.  So let's print just the IP address twice,
this is what libwrap's refuse() would do if it failed to resolve.

Reviewed by: philip
PR: 269456
Differential revision: https://reviews.freebsd.org/D40069

11 months agosshd: remove unneeded initialization of libwrap logging severities
Gleb Smirnoff [Thu, 20 Jul 2023 21:56:20 +0000 (14:56 -0700)]
sshd: remove unneeded initialization of libwrap logging severities

This part of ca573c9a177 proved to be unnecessary.  As the removed
comment says, we set them merely for logging syntax errors, as we log
refusals ourselves.  However, inside the libwrap the parser logs any
syntax errors with tcpd_warn() which has hardcoded LOG_WARNING inside.

Reviewed by: philip, emaste
Differential revision: https://reviews.freebsd.org/D40068

11 months agoRevert "tftpd: fix double-colon typo in option string"
Dmitry Morozovsky [Thu, 20 Jul 2023 21:38:30 +0000 (00:38 +0300)]
Revert "tftpd: fix double-colon typo in option string"

It was not a typo: -d takes an optional argument, which is indicated with
a double colon.

This reverts commit 3cbc8e752b92442c784306731e94fd904de3373c.

Spotted by: kevans

11 months agotftpd: fix double-colon typo in option string
Dmitry Morozovsky [Thu, 20 Jul 2023 21:24:28 +0000 (00:24 +0300)]
tftpd: fix double-colon typo in option string

MFC after: 1 month
X-MFC-With: 273a307d0b80743fb08e23237b3f74dc94a8fa2a
X-MFC-With: 03c2616dc530e5b23f06f9aa421012154590e578

11 months agotftpd: unbreak getopt()
Eugene Grosbein [Thu, 20 Jul 2023 20:26:32 +0000 (03:26 +0700)]
tftpd: unbreak getopt()

Unbreak getopt() broken by recent commit.

Fixes: 273a307d0b80743fb08e23237b3f74dc94a8fa2a
MFC after: 1 month

11 months agotftpd: introduce new option -S
Eugene Grosbein [Thu, 20 Jul 2023 20:11:33 +0000 (03:11 +0700)]
tftpd: introduce new option -S

Historically, tftpd disallowed write requests to existing files
that are not publicly writable. Such requirement is questionable at least.
Let us make it possible to run tftpd in chrooted environment
keeping files non-world writable.

New option -S enables write requests to existing files
for chrooted run according to generic file permissions.
It is ignored unless tftpd runs chrooted.

MFC after: 1 month
Requested by: marck
Differential: https://reviews.freebsd.org/D41090 (based on)

11 months agolibcrypto: add missing symbols to the FIPS provider
Pierre Pronchery [Thu, 20 Jul 2023 18:16:14 +0000 (14:16 -0400)]
libcrypto: add missing symbols to the FIPS provider

The fips.so provider module exposing FIPS-validated algorithms was still
missing a number of symbols.

PR: 272454
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41018

11 months agovmspace_fork(): do not override offset for the guard entries
Konstantin Belousov [Thu, 20 Jul 2023 17:45:01 +0000 (20:45 +0300)]
vmspace_fork(): do not override offset for the guard entries

The offset field contains protection for the stack guards.

Reported by: cy
Fixes: 21e45c30c35c9aa732073f725924caf581c93460
MFC after: 1 week

11 months agoifconfig_netlink.c: whitespace cleanup.
Navdeep Parhar [Thu, 20 Jul 2023 17:47:34 +0000 (10:47 -0700)]
ifconfig_netlink.c: whitespace cleanup.

No functional change.

11 months agoifconfig: Shift unsigned value to avoid UB.
Navdeep Parhar [Thu, 20 Jul 2023 17:42:15 +0000 (10:42 -0700)]
ifconfig: Shift unsigned value to avoid UB.

Reported by: kib@

11 months agopciconf: add PCIe 5.0 and PCIe 6.0 link speeds
Ed Maste [Wed, 21 Jun 2023 20:23:18 +0000 (16:23 -0400)]
pciconf: add PCIe 5.0 and PCIe 6.0 link speeds

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40710

11 months agoRemove perforce tools and references
Minsoo Choo [Thu, 20 Jul 2023 17:28:18 +0000 (13:28 -0400)]
Remove perforce tools and references

Perforce has been retired since 2019 (commit feea78990c2f), so there is
no need anymore to keep perforce tools.  Plus, there is no need to
mention perforce admin.

Reviewed by: emaste, Olivier Certner
Differential Revision: https://reviews.freebsd.org/D41106

11 months agoifconfig: Fix the display of capabilities in the netlink based code.
Navdeep Parhar [Thu, 20 Jul 2023 01:05:12 +0000 (18:05 -0700)]
ifconfig: Fix the display of capabilities in the netlink based code.

The capabilities in if_capabilities2/if_capenable2 are reported in the
second 32b and were not being displayed correctly.  v does not need to
be advanced because v[i / 32] is the correct 32b value already.

Sponsored by: Chelsio Communications

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

11 months agommap(MAP_STACK): on stack grow, use original protection
Konstantin Belousov [Wed, 19 Jul 2023 11:05:32 +0000 (14:05 +0300)]
mmap(MAP_STACK): on stack grow, use original protection

If mprotect(2) changed protection in the bottom of the currently grown
stack region, currently the changed protection would be used for the
stack grow on next fault.  This is arguably unexpected.

Store the original protection for the entry at mmap(2) time in the
offset member of the gap vm_map_entry, and use it for protection of the
grown stack region.

PR: 272585
Reported by: John F. Carr <jfc@mit.edu>
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41089

11 months agoiflib: Unlock ctx lock around call to ether_ifattach()
Eric Joyner [Wed, 19 Jul 2023 22:40:46 +0000 (15:40 -0700)]
iflib: Unlock ctx lock around call to ether_ifattach()

Panic occurs during loading driver using kldload. It exists since netlink is
enabled.  There is problem with double locking ctx. This fix allows to call
ether_ifattach() without locked ctx.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
PR: 271768
Reviewed by: erj@, jhb@
MFC after: 1 day
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D40557

11 months agoamd64 crt1: Explicitly use a PLT entry for main in the PIC case.
John Baldwin [Wed, 19 Jul 2023 18:53:33 +0000 (11:53 -0700)]
amd64 crt1: Explicitly use a PLT entry for main in the PIC case.

This ensures GNU as generates a R_X86_64_PLT32 relocation instead of
R_X86_64_32.

Reviewed by: kib
Fixes: c969310c992a csu: Implement _start using as to satisfy unwinders on x86_64
Differential Revision: https://reviews.freebsd.org/D41101

11 months agoi386: Switch to PIC kernel modules
Dmitry Chagin [Wed, 19 Jul 2023 18:21:04 +0000 (21:21 +0300)]
i386: Switch to PIC kernel modules

It seems since the last llvm project update, the lld linker has started
creating a PLT dependent kernel module object files.

Reviewed by: kib, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D41088

11 months agoktls_alloc_rcv_tag: Fix capability checks for RXTLS4/6.
Navdeep Parhar [Wed, 19 Jul 2023 17:56:03 +0000 (10:56 -0700)]
ktls_alloc_rcv_tag: Fix capability checks for RXTLS4/6.

IFCAP2_* has the bit position and not the shifted value.

Reviewed by: kib@
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41100

11 months agoMerge commit 9ca395b5ade1 from llvm-project (by Haojian Wu):
Dimitry Andric [Wed, 19 Jul 2023 09:18:50 +0000 (11:18 +0200)]
Merge commit 9ca395b5ade1 from llvm-project (by Haojian Wu):

  [clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer.

  Similar to the https://reviews.llvm.org/D86048 (it only sets the bit for C++
  code), we propagate the contains-errors bit for C-code path.

  Fixes https://github.com/llvm/llvm-project/issues/50236
  Fixes https://github.com/llvm/llvm-project/issues/50243
  Fixes https://github.com/llvm/llvm-project/issues/48636
  Fixes https://github.com/llvm/llvm-project/issues/50320

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

This fixes an assertion ('Assertion failed: ((LHSExpr->containsErrors()
|| RHSExpr->containsErrors()) && "Should only occur in error-recovery
path."), function BuildBinOp') when building parts of dtrace in certain
scenarios.

Reported by: dstolfa
PR: 271047
MFC after: 1 month

11 months agossh: Update to OpenSSH 9.3p2
Ed Maste [Wed, 19 Jul 2023 17:02:33 +0000 (13:02 -0400)]
ssh: Update to OpenSSH 9.3p2

From the release notes:

Changes since OpenSSH 9.3
=========================

This release fixes a security bug.

Security
========

Fix CVE-2023-38408 - a condition where specific libaries loaded via
ssh-agent(1)'s PKCS#11 support could be abused to achieve remote
code execution via a forwarded agent socket if the following
conditions are met:

* Exploitation requires the presence of specific libraries on
  the victim system.
* Remote exploitation requires that the agent was forwarded
  to an attacker-controlled system.

Exploitation can also be prevented by starting ssh-agent(1) with an
empty PKCS#11/FIDO allowlist (ssh-agent -P '') or by configuring
an allowlist that contains only specific provider libraries.

This vulnerability was discovered and demonstrated to be exploitable
by the Qualys Security Advisory team.

In addition to removing the main precondition for exploitation,
this release removes the ability for remote ssh-agent(1) clients
to load PKCS#11 modules by default (see below).

Potentially-incompatible changes
--------------------------------

 * ssh-agent(8): the agent will now refuse requests to load PKCS#11
   modules issued by remote clients by default. A flag has been added
   to restore the previous behaviour "-Oallow-remote-pkcs11".

   Note that ssh-agent(8) depends on the SSH client to identify
   requests that are remote. The OpenSSH >=8.9 ssh(1) client does
   this, but forwarding access to an agent socket using other tools
   may circumvent this restriction.

CVE: CVE-2023-38408
Sponsored by: The FreeBSD Foundation

11 months agoObsoleteFiles.inc: Remove leading slash from 20230714 entry
Marius Strobl [Wed, 19 Jul 2023 16:56:35 +0000 (18:56 +0200)]
ObsoleteFiles.inc: Remove leading slash from 20230714 entry

Fixes: c3f58005d92e signal: Remove gsignal references from manuals

11 months agoenic(4): Remove unused dupe prototype
Marius Strobl [Sun, 16 Jul 2023 07:43:13 +0000 (09:43 +0200)]
enic(4): Remove unused dupe prototype

11 months agokinst.h: make pointer to probe in kinst_cpu_state const
Christos Margiolis [Wed, 19 Jul 2023 16:56:10 +0000 (19:56 +0300)]
kinst.h: make pointer to probe in kinst_cpu_state const

Fixes: 5b701ed19c2e ("kinst: start moving towards per-probe
trampolines")

Sponsored by: The FreeBSD Foundation

11 months agoVendor import of OpenSSH 9.3p2
Ed Maste [Wed, 19 Jul 2023 15:49:33 +0000 (11:49 -0400)]
Vendor import of OpenSSH 9.3p2

11 months agoRevert "dtrace: cache current probe in kdtrace_thread_t"
Christos Margiolis [Wed, 19 Jul 2023 14:58:49 +0000 (17:58 +0300)]
Revert "dtrace: cache current probe in kdtrace_thread_t"

This reverts commit 22508c8b6c284ad9ad1385c703e224e1ed3fbd7c.

The t_kinst_curprobe field is no longer needed by kinst.

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

11 months agokinst: port to arm64
Christos Margiolis [Wed, 19 Jul 2023 14:58:18 +0000 (17:58 +0300)]
kinst: port to arm64

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

11 months agokinst: use per-probe trampolines in riscv
Christos Margiolis [Wed, 19 Jul 2023 14:57:59 +0000 (17:57 +0300)]
kinst: use per-probe trampolines in riscv

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

11 months agokinst: start moving towards per-probe trampolines
Christos Margiolis [Wed, 19 Jul 2023 14:57:21 +0000 (17:57 +0300)]
kinst: start moving towards per-probe trampolines

Using per-CPU and per-thread trampolines is expensive and error-prone,
since we're rewriting the same memory blocks constantly. Per-probe
trampolines solve this problem by giving each probe its own block of
executable memory, which more or less remains the same after the initial
write.

What this patch does, is get rid of the initialization code which
allocates a trampoline for each thread, and instead let each port of
kinst allocate a trampoline for each new probe created. It also sets up
the infrastructure needed to support the new trampoline scheme.

This change is not currently supported on amd64, as the amd64 port needs
further changes to work, so this is a temporary/gradual patch to fix the
riscv and arm64 ports.

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

11 months agokinst: exclude cpu_switch
Christos Margiolis [Wed, 19 Jul 2023 14:56:29 +0000 (17:56 +0300)]
kinst: exclude cpu_switch

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

11 months agokinst: check for 'push %rbp' anywhere in the function
Christos Margiolis [Wed, 19 Jul 2023 14:53:08 +0000 (17:53 +0300)]
kinst: check for 'push %rbp' anywhere in the function

Currently kinst checks if only the first instruction is 'push %rbp',
essentially excluding functions that do push RBP, but not in the first
instruction. This patch modifies kinst to check for 'push %rbp', as
well, as a following 'pop %rbp', anywhere in the function. This behavior
also matches that of FBT.

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

11 months agokinst.h: reorder function declarations based on implementation file
Christos Margiolis [Wed, 19 Jul 2023 14:50:24 +0000 (17:50 +0300)]
kinst.h: reorder function declarations based on implementation file

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

11 months agounifdef: Fix case where a multiline comment follows a directive.
Dag-Erling Smørgrav [Wed, 19 Jul 2023 14:25:56 +0000 (14:25 +0000)]
unifdef: Fix case where a multiline comment follows a directive.

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

11 months agoradix_trie: simplify ge, le lookups
Doug Moore [Wed, 19 Jul 2023 14:43:31 +0000 (09:43 -0500)]
radix_trie: simplify ge, le lookups

Replace the implementations of lookup_le and lookup_ge with ones
that do not use a stack or climb back up the tree, and instead
exploit the popmap field to quickly identify the place to resume
searching if the straightforward indexed search fails.

The code size of the original functions shrinks by a combined 160
bytes on amd64, and the cumulative cycle count per invocation of
the two functions together is reduced 20% in a buildworld test.

Reviewed by: alc, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D40936

11 months agovfs: Add a parenthese to vn_lock_pair() asserts to silence gcc
Dmitry Chagin [Wed, 19 Jul 2023 13:51:07 +0000 (16:51 +0300)]
vfs: Add a parenthese to vn_lock_pair() asserts to silence gcc

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D41070

11 months agopw: Add regression tests for useradd bug fixes
Naman Sood [Wed, 19 Jul 2023 13:27:14 +0000 (10:27 -0300)]
pw: Add regression tests for useradd bug fixes

PR: 238995
Reviewed by: jrm
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41080

11 months agopw: Use existing group entry, even if it already has members
Naman Sood [Wed, 19 Jul 2023 13:06:06 +0000 (10:06 -0300)]
pw: Use existing group entry, even if it already has members

Fix the following problem:

1. A nonexistent user, someuser, is added to /etc/group as
   someuser:*:12345:someuser.
2. someuser is then created with the default login group.

A second group entry for someuser will be created.

   someuser:*:12345:someuser
   someuser:*:12346:

With this fix, the existing group entry will be used.

PR: 238995
Reviewed by: bapt, jrm
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41057

11 months agopw: Ensure group membership is not duplicated
Naman Sood [Wed, 19 Jul 2023 12:44:21 +0000 (09:44 -0300)]
pw: Ensure group membership is not duplicated

Fix the following problem:

1. A nonexistent user, someuser, is added to somegroup in /etc/group.
2. someuser is then created with membership in somegroup.

The entry for somegroup in /etc/group will then contain

    somegroup:*:12345:someuser,someuser

With this fix, the entry will be

    somegroup:*:12345:someuser

PR: 238995
Reviewed by: bapt, jrm
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41076

11 months agotcp: improve layout of struct tcpcb
Michael Tuexen [Wed, 19 Jul 2023 12:47:36 +0000 (14:47 +0200)]
tcp: improve layout of struct tcpcb

Put optional fields at the end to minimize run time problems in
case CC modules are build from within its directory.

Reviewed by: cc, gallatin, glebius, imp
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D41059

11 months agocam: Move bus_dmamap_load_ccb into cam.c.
John Baldwin [Wed, 19 Jul 2023 01:19:27 +0000 (18:19 -0700)]
cam: Move bus_dmamap_load_ccb into cam.c.

This routine is specific to CAM and no longer assumes any internal
bus_dma knowledge as it is simple wrapper around bus_dmamap_load_mem.

Fixes: 60381fd1ee86 memdesc: Retire MEMDESC_CCB.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D41058

11 months agolinux(4): Use M_LINUX for malloc type of proc emuldata
Dmitry Chagin [Tue, 18 Jul 2023 21:44:17 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type of proc emuldata

MFC after: 2 weeks

11 months agolinux(4): Use M_LINUX for malloc type in getdents
Dmitry Chagin [Tue, 18 Jul 2023 21:44:16 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type in getdents

MFC after: 2 weeks

11 months agolinux(4): Use M_LINUX for malloc type in getdents64
Dmitry Chagin [Tue, 18 Jul 2023 21:44:16 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type in getdents64

MFC after: 2 weeks

11 months agolinux(4): Delete a useless variable in getdents64
Dmitry Chagin [Tue, 18 Jul 2023 21:44:16 +0000 (00:44 +0300)]
linux(4): Delete a useless variable in getdents64

MFC after: 2 weeks

11 months agolinux(4): Use M_LINUX for malloc type in readdir
Dmitry Chagin [Tue, 18 Jul 2023 21:44:15 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type in readdir

MFC after: 2 weeks

11 months agolinux(4): Delete a useless variable in readdir
Dmitry Chagin [Tue, 18 Jul 2023 21:44:15 +0000 (00:44 +0300)]
linux(4): Delete a useless variable in readdir

MFC after: 2 weeks

11 months agolinux(4): Properly allocate buffer for kern_getdirentries in readdir
Dmitry Chagin [Tue, 18 Jul 2023 21:44:15 +0000 (00:44 +0300)]
linux(4): Properly allocate buffer for kern_getdirentries in readdir

Looks like prior to ino64 project the size of the struct linux_dirent
was greater (or equal) to the size of the native struct dirent so the
native dirent fit into the buffer. After ino64 project the size of the
native struct dirent has increased.

Spotted by gcc12.
MFC after: 2 weeks

11 months agoadd defaults for adduser.sh (OK? [yes] & additional user [no])
Sven Ruediger [Tue, 18 Jul 2023 17:37:48 +0000 (10:37 -0700)]
add defaults for adduser.sh (OK? [yes] & additional user [no])

Event: Kitchener-Waterloo Hackathon 202305
Differential Revision: https://reviews.freebsd.org/D40157

11 months agols: Improve POSIX compatibility for -g and -n.
Minsoo Choo [Tue, 18 Jul 2023 16:49:59 +0000 (09:49 -0700)]
ls: Improve POSIX compatibility for -g and -n.

- Change -g (ignored for BSD 4.3 compatibility since BSD 4.4)
  to use POSIX semantics of implying -l but omitting the owner's
  name.

- Change -n to imply -l.

The -o option remains unchanged (POSIX defines -o as a complement to
-g that implies -l but omits group names whereas BSD defines -o to add
file flags to -l).  This compromise is the same used by both NetBSD
and OpenBSD.

PR: 70813
Reviewed by: jhb, Pau Amma <pauamma@gundo.com>
Co-authored-by: John Baldwin <jhb@FreeBSD.org>
Differential Revision: https://reviews.freebsd.org/D34747

11 months agoopenssh: document a locally-applied workaround
Ed Maste [Tue, 18 Jul 2023 16:23:31 +0000 (12:23 -0400)]
openssh: document a locally-applied workaround

We have a local hacky workaround for an issue caused by a hacky
upstream autoconf test.  Reported upstream on the OpenSSH mailing list:
https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-May/040242.html

PR: 209441
Sponsored by: The FreeBSD Foundation

11 months agozfs: set autotrim default to 'off'
Yuri Pankov [Mon, 17 Jul 2023 09:12:53 +0000 (11:12 +0200)]
zfs: set autotrim default to 'off'

As it turns out having autotrim default to 'on' on FreeBSD never really
worked due to mess with defines where userland and kernel module were
getting different default values (userland was defaulting to 'off',
module was thinking it's 'on').

PR: 264234
Reviewed by: mav (zfs)
Differential Revision: https://reviews.freebsd.org/D41056

11 months agoText format cleanups. No functional changes intended.
Kirk McKusick [Tue, 18 Jul 2023 00:28:07 +0000 (17:28 -0700)]
Text format cleanups. No functional changes intended.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agorelease: adjust lang/python* dependencies for GCE
Glen Barber [Mon, 17 Jul 2023 20:16:46 +0000 (16:16 -0400)]
release: adjust lang/python* dependencies for GCE

The lang/python3 port had failed to properly install because
it did in fact already exist and FORCE_PKG_REGISTER was not
set.  So, behaviorally everything here was correct.  However,
installing lang/python3 is in fact not correct and not needed,
so only install the lang/python port to provide symbolic links.

PR: 272354
MFC after: 3 days
MFC with: 510fd83138001b0a6e45b3fa6a7249377f806171
MFC with: cd8cad0ef5cd534dc7ae1dd9a470cac2057ed957
MFC with: 0ed426276fd52e917506ab87c05a61c6641ae298
Sponsored by: GoFundMe https://www.gofundme.com/f/gjbbsd

11 months agolibbe: recursively promote deep BE datasets
R. Christian McDonald [Mon, 17 Jul 2023 19:06:28 +0000 (14:06 -0500)]
libbe: recursively promote deep BE datasets

beadm will recursively promote deep BE datasets. In order to match the
beadm behavior, we need to recursively iterate over child filesystems
and promote them along the way.

This patch further refines the work from D40903, completing the fix for
promotion.

Reviewed by: kevans, rew
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40972

11 months agokern.post.mk allow NEWVERS_{ENV,ARGS}
Simon J. Gerraty [Mon, 17 Jul 2023 19:03:35 +0000 (12:03 -0700)]
kern.post.mk allow NEWVERS_{ENV,ARGS}

Allow makefiles better control of newvers.sh env and args.
Also allow variable overrides on command line.

Reviewed by: imp, stevek
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D41012

11 months agotcbpcb: Always define t_osd
Warner Losh [Mon, 17 Jul 2023 17:22:45 +0000 (11:22 -0600)]
tcbpcb: Always define t_osd

Always define t_osd. congestion control modules access it
unconditionally. This fixes the build.

However, this is, at best, a temporary band-aide until the
larger issues are sorted.

Sponsored by: Netflix

11 months agobhyve: Remove an unneeded vm_get_register() call in main()
Mark Johnston [Wed, 5 Jul 2023 20:59:20 +0000 (16:59 -0400)]
bhyve: Remove an unneeded vm_get_register() call in main()

At one point the RIP value was passed to fbsdrun_addcpu(), but this is
no longer the case.  No functional change intended.

Reviewed by: jhb, corvink
Sponsored by: Innovate UK
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40988

11 months agobhyve: Fix whitespace in bhyverun.c
Mark Johnston [Mon, 17 Jul 2023 15:11:20 +0000 (11:11 -0400)]
bhyve: Fix whitespace in bhyverun.c

No functional change intended.

MFC after: 1 week

11 months agostyle.Makefile.5: Wordsmith .PATH description
Mateusz Piotrowski [Mon, 17 Jul 2023 13:06:02 +0000 (15:06 +0200)]
style.Makefile.5: Wordsmith .PATH description

MFC after: 3 days
Fixes: 1ac5586c6d86 style.Makefile.5: Do not require $FreeBSD$ SCM IDs

11 months agostyle.Makefile.5: Remove $FreeBSD$ from examples
Mateusz Piotrowski [Mon, 17 Jul 2023 13:01:52 +0000 (15:01 +0200)]
style.Makefile.5: Remove $FreeBSD$ from examples

MFC after: 3 days

11 months agostyle.Makefile.5: Stop documenting NO_MAN
Mateusz Piotrowski [Mon, 17 Jul 2023 12:50:33 +0000 (14:50 +0200)]
style.Makefile.5: Stop documenting NO_MAN

NO_MAN has been an error since 2020 according to UPDATING.

PR: 231357
MFC after: 3 days

11 months agolibm: correctly test for for NaN and Infinity in sinpi(), cospi(), and tanpi()
Steve Kargl [Mon, 17 Jul 2023 05:19:28 +0000 (08:19 +0300)]
libm: correctly test for for NaN and Infinity in sinpi(), cospi(), and tanpi()

The current versions of lib/msun/src/s_cospi.c, s_sinpi.c and s_tanpi.c
all exhibit the same defect. After checking for various numeric ranges,
they check to see whether the input argument is a NaN or an Infinity.
However, the code uses a value of 0x7f80000 instead of the correct value
of 0x7ff00000.

If you review s_cospif.c, s_sinpif.c, and s_tanpif.c, you will see that
the equivalent statements in these functions are accurate and have
appropriate source comments.

The impact of these defects is to flag some valid input values as
invalid and raise a pole error (divide by zero).

Reported by: Paul Green <Paul.Green@stratus.com>
PR: 272539
MFC after: 1 week

11 months agoriscv pmap: another vm_radix_init
Doug Moore [Sun, 16 Jul 2023 20:48:43 +0000 (15:48 -0500)]
riscv pmap: another vm_radix_init

pmap_pinit0 also needs to initialize a vm_radix, in case vm_radix_init
does anything but zeroing fields.

Reported by: alc
Reviewed by: alc
Differential Revision: https://reviews.freebsd.org/D41055

11 months agoMerge commit 8757ce490130 from llvm-project (by Simon Pilgrim):
Dimitry Andric [Sun, 16 Jul 2023 18:45:29 +0000 (20:45 +0200)]
Merge commit 8757ce490130 from llvm-project (by Simon Pilgrim):

    [PowerPC] Replace PPCISD::VABSD cases with generic ISD::ABDU(X,Y) node

    A move towards using the generic ISD::ABDU nodes on more backends

    Also support ISD::ABDS for v4i32 types using the existing signbit flip trick

    PowerPC has a select(icmp_ugt(x,y),sub(x,y),sub(y,x)) -> abdu(x,y) combine that I intend to move to DAGCombiner in a future patch.

    The ABS(SUB(X,Y)) -> PPCISD::VABSD(X,Y,1) v4i32 combine wasn't legal (https://alive2.llvm.org/ce/z/jc2hLU) - so I've removed it, having already added the legal sub nsw tests equivalent.

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

This fixes a "Wasn't expecting to be able to lower this!" fatal error
when compiling graphics/opencv for PowerPC.

Requested by: pkubaj
PR: 271047
MFC after: 1 month

11 months agolib/libc/string/bcmp.c: fix integer overflow bug
Robert Clausecker [Wed, 12 Jul 2023 18:23:21 +0000 (20:23 +0200)]
lib/libc/string/bcmp.c: fix integer overflow bug

bcmp() returned the number of remaining bytes when the main loop exits.
In case of a match, this is zero, else a positive integer.  On systems
where SIZE_MAX > INT_MAX, the implicit conversion from size_t to int in
the return value may cause the number of remaining bytes to overflow,
becoming zero and falsely indicating a successful comparison.

Fix the bug by always returning 0 on equality, 1 otherwise.

PR: 272474
Approved by: emaste
Reviewed by: imp
MFC After: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41011

11 months agolibexec/rtld-elf/rtld-libc/Makefile.inc: do not use machdep string functions
Robert Clausecker [Wed, 28 Jun 2023 17:18:15 +0000 (17:18 +0000)]
libexec/rtld-elf/rtld-libc/Makefile.inc: do not use machdep string functions

With ifunc based SIMD dispatch, we cannot use the amd64 assembly
implementations of string functions.  Modify rtld to instead use
the generic functions.  To avoid an architecture-specific special
case, this change is applied to all architectures.

This change is a prerequisite to and formerly part of D40693.

Sponsored by: FreeBSD Foundation
Approved by: kib
See also: D40693
Differential Revision: https://reviews.freebsd.org/D41050

11 months agortld: fix dlopen() for an object that is already mapped but not yet initialized
Konstantin Belousov [Fri, 14 Jul 2023 13:38:03 +0000 (16:38 +0300)]
rtld: fix dlopen() for an object that is already mapped but not yet initialized

For instance, dso might be mapped as needed but not yet initialized from
the other subtree of needed objects, while current object' constructor
does dlopen() for the dso.  Right now rtld does relocations and other
processing based on the arrival of new objects in the global list, which
is not happens there.  Directly check for the initialization state of
the object, for which we would return the handle.

One practical use case of this support is e.g. dlopen("libthr.so",
RTLD_NOLOAD) by libraries that are threading-aware but happy to live
with libc pthread shims if the program is not multithreaded.

Reviewed by: tijl
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

11 months agolibthr: trigger library initialization on rwlock calls
Konstantin Belousov [Thu, 13 Jul 2023 15:56:11 +0000 (18:56 +0300)]
libthr: trigger library initialization on rwlock calls

Reviewed by: tijl
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

11 months agolibthr: some style in thr_rwlock.c
Konstantin Belousov [Thu, 13 Jul 2023 15:55:50 +0000 (18:55 +0300)]
libthr: some style in thr_rwlock.c

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

11 months agoMerge LUA 5.4.6
Warner Losh [Sat, 15 Jul 2023 17:31:04 +0000 (11:31 -0600)]
Merge LUA 5.4.6

This is a bug fix to Lua 5.4.4 (5.4.5 was withdrawn due to ABI issues
and 5.4.6 is 5.4.5 with those fixed).

11 months agolua: Update to 5.4.6
Warner Losh [Sat, 15 Jul 2023 17:25:52 +0000 (11:25 -0600)]
lua: Update to 5.4.6

Sponsored by: Netflix

11 months ago/etc/rc.subr: rename sysctl.conf.d to sysctl.kld.d
Doug Rabson [Sat, 15 Jul 2023 07:40:50 +0000 (08:40 +0100)]
/etc/rc.subr: rename sysctl.conf.d to sysctl.kld.d

This better reflects the intent that this directory is indexed by kld
name and removes a conflict with D32128 which aims to split sysctl.conf.

Reviewed by: kevans imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D41043

11 months agoFix zfsd unittests after 92642bba4db
Alan Somers [Fri, 14 Jul 2023 21:57:40 +0000 (15:57 -0600)]
Fix zfsd unittests after 92642bba4db

At the time we ensured that the more important functional tests were
working, but neglected to update the unit tests.

MFC after: 2 weeks
MFC with: 92642bba4db4bf1719758ac7233468bc09a0bd59
Sponsored by: Axcient

11 months agolib/libc/string/ffs*.c: work around gcc warning
Robert Clausecker [Mon, 10 Jul 2023 22:10:52 +0000 (22:10 +0000)]
lib/libc/string/ffs*.c: work around gcc warning

Gcc warns of infinite recursion if we use __builtin_ffs*() to
implement ffs*().  This is because gcc uses ffs() to implement
these on some platforms.  Sidestep the warning by using
__builtin_ctz*() for these.

Sponsored by: FreeBSD Foundation
Reported by: jlduran@gmail.com, jhb
Fixes: ee8b0c43 (D40730)
Reviewed by: jhb, mhorne
Approved by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40966

11 months agolib/libc/string/ffs*.c: fix problems introduced with D40730
Kyle Evans [Fri, 7 Jul 2023 18:59:26 +0000 (13:59 -0500)]
lib/libc/string/ffs*.c: fix problems introduced with D40730

Remove stale dependencies on the remaining old assembly
ffs*/fls* implementations.

Sponsored by: FreeBSD Foundation
Reported by: jlduran@gmail.com, jhb
Fixes: ee8b0c43 (D40730)
Approved by: jhb
Differential Revision: https://reviews.freebsd.org/D40966

11 months agomemdesc: Retire MEMDESC_BIO.
John Baldwin [Fri, 14 Jul 2023 18:32:40 +0000 (11:32 -0700)]
memdesc: Retire MEMDESC_BIO.

Instead, change memdesc_bio to examine the bio and return a memdesc of
a more generic type describing the data buffer.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41029

11 months agomemdesc: Add a MEMDESC_VMPAGES descriptor type.
John Baldwin [Fri, 14 Jul 2023 18:31:42 +0000 (11:31 -0700)]
memdesc: Add a MEMDESC_VMPAGES descriptor type.

This memory descriptor is backed by an array of VM pages.  This type
requires adding a new field to 'struct memdesc' to hold the offset
within the first page.  For LP64 systems, this new field is added in
an existing padding hole so does not increase the size.  For ILP32
systems, this grows 'struct memdesc' from 12 to 16 bytes.

Reviewed by: imp, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41028

11 months agomemdesc: Replace md_opaque with a union of type-specific fields.
John Baldwin [Fri, 14 Jul 2023 18:30:57 +0000 (11:30 -0700)]
memdesc: Replace md_opaque with a union of type-specific fields.

Reviewed by: imp, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41027

11 months agomemdesc: Retire MEMDESC_CCB.
John Baldwin [Fri, 14 Jul 2023 18:30:31 +0000 (11:30 -0700)]
memdesc: Retire MEMDESC_CCB.

Instead, change memdesc_ccb to examine the CCB and return a memdesc of
a more generic type describing the data buffer.

Reviewed by: imp, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D40880

11 months agoPCI DEN0115: Reliably check for a memory resource during probe.
John Baldwin [Fri, 14 Jul 2023 17:27:40 +0000 (10:27 -0700)]
PCI DEN0115: Reliably check for a memory resource during probe.

rid was stack garbage, so the bus_alloc_resource_any() call could fail
and fall through to the SMCCC version check even if a bridge had a
memory resource.

Debugging help: jrtc27
Reviewed by: jrtc27
Fixes: c9a05c072270 Add a PCI driver that follows the Arm DEN0115 spec
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41025

11 months agoObsoletefiles.inc: A few OpenSSL 3 cleanups.
John Baldwin [Fri, 14 Jul 2023 17:25:54 +0000 (10:25 -0700)]
Obsoletefiles.inc: A few OpenSSL 3 cleanups.

- Treat old engine DSOs from OpenSSL 1.1.1 as OLD_LIBS, not OLD_FILES.
  These should only be deleted by make delete-old-libs similar to how
  PAM modules are treated.

- Add /usr/lib32/engines to OLD_DIRS.  lib32 automation does not apply
  to OLD_DIRS.

Reviewed by: Pierre Pronchery <pierre@freebsdfoundation.org>
Differential Revision: https://reviews.freebsd.org/D41034

11 months agovn_lock_pair(): Support passing LK_NODDLKTREAT
Olivier Certner [Sun, 9 Jul 2023 17:12:52 +0000 (19:12 +0200)]
vn_lock_pair(): Support passing LK_NODDLKTREAT

Since this function ultimately calls vn_lock() or VOP_LOCK1(), allows it to
receive and pass this flag which is used in the lookup code and doesn't
interfere with the function's operation.

Reviewed by:    kib, markj
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D40954

11 months ago/etc/rc.subr: add support for kld sysctl variables
Doug Rabson [Wed, 21 Jun 2023 12:26:17 +0000 (13:26 +0100)]
/etc/rc.subr: add support for kld sysctl variables

For kernel modules loaded by scripts in /etc/rc.d and
/usr/local/etc/rc.d, if there is a file in /etc/sysctl.conf.d named <kld
name>.conf, then this will be loaded using the sysctl(8) utility. For
instance, sysctl variable changes for the pf kernel module would be
placed in the file /etc/sysctl.conf.d/pf.conf.

PR: 272129
Reviewed by: imp freebsd_igalic.co
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40886

11 months agoFix i386 MINIMAL build
Kristof Provost [Thu, 13 Jul 2023 18:31:06 +0000 (20:31 +0200)]
Fix i386 MINIMAL build

Include systm.h in i386's counter.h, so it can use critical_*().

In file included from /usr/src/sys/netinet6/ip6_var.h:250:
In file included from /usr/src/sys/sys/counter.h:37:
./machine/counter.h:191:3: error: call to undeclared function 'critical_enter'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
                critical_enter();
                ^
./machine/counter.h:193:3: error: call to undeclared function 'critical_exit'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
                critical_exit();
                ^

11 months agoFix MINIMAL build
Kristof Provost [Thu, 13 Jul 2023 18:30:01 +0000 (20:30 +0200)]
Fix MINIMAL build

Pre-declare struct ucred, to fix build issues on the MINIMAL config:

In file included from /usr/src/sys/netpfil/pf/pfsync_nv.c:40:
/usr/src/sys/netinet6/ip6_var.h:384:31: error: declaration of 'struct ucred' will not be visible outside of this function [-Werror,-Wvisibility]
        struct ip6_pktopts *, struct ucred *, int);
                                     ^
/usr/src/sys/netinet6/ip6_var.h:408:28: error: declaration of 'struct ucred' will not be visible outside of this function [-Werror,-Wvisibility]
    struct inpcb *, struct ucred *, int, struct in6_addr *, int *);
                           ^
2 errors generated.

11 months agoFix MINIMAL build on amd64
Kristof Provost [Thu, 13 Jul 2023 12:44:26 +0000 (14:44 +0200)]
Fix MINIMAL build on amd64

amd64/include/counter.h uses KASSERT, but failed to include the
kassert.h header.

11 months agopfsync: fix NOINET6 build
Kristof Provost [Thu, 13 Jul 2023 12:39:25 +0000 (14:39 +0200)]
pfsync: fix NOINET6 build

While here also fix a few minor style(9) issues.