]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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

13 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).

13 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

13 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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();
                ^

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

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

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

14 months agovm_radix_init: use initializer
Doug Moore [Fri, 14 Jul 2023 06:49:55 +0000 (01:49 -0500)]
vm_radix_init: use initializer

Several vm_radix tries are not initialized with vm_radix_init. That
works, for now, since static initialization zeroes the root field
anyway, but if initialization changes, these tries will fail. Add
missing initializer calls.

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

14 months agoMakefile.libcompat: Make quoting for CC/CXX/CPP more future-proof
Jessica Clarke [Fri, 14 Jul 2023 04:34:03 +0000 (05:34 +0100)]
Makefile.libcompat: Make quoting for CC/CXX/CPP more future-proof

bmake's :Q is for quoting outside of double quotes, but here is inside
double quotes, and as a result it ends up quoting characters that don't
have a special meaning inside double quotes. On the surface this would
seem harmless, but POSIX sh has a strange behaviour (differing from
outside double quotes) that, inside double quotes, a backslash before a
character that never has a special meaning inside double quotes is
passed through. As a result, should LIB${_LIBCOMPAT}CFLAGS contain
something like -DFOO\(x\)=x, we would form "... -DFOO\\\(x\\\)=x ...",
which would be parsed as -DFOO\\(x\\)=x, since the parentheses are never
special inside double quotes (but the backslash itself is), not the
original -DFOO\(x\)=x as intended.

Instead, construct the whole string as a bmake expression and use :Q on
that, without the manual double quotes around everything. Note that the
:L modifier lets you treat an expression like a variable expansion and
apply modifiers to it, i.e. ${expr:L:...} is the same as tmp=expr
${tmp:...} (in essence, ignoring possible differences due to deferred
substitution).

Improves: 537f945fc89f ("Makefile.libcompat: Quote CFLAGS and CXXFLAGS for sub-make")

14 months agoMakefile.libcompat: Be consistent about not installing includes
Jessica Clarke [Fri, 14 Jul 2023 01:36:04 +0000 (02:36 +0100)]
Makefile.libcompat: Be consistent about not installing includes

Currently we only pass MK_INCLUDES=no for distribute and install, since
it's only in LIB${_LIBCOMPAT}IMAKE, which means that we enable includes
during libraries and thus install includes into worldtmp, despite it
being shared these days across native and libcompats. This also means
we're at risk of having headers needed for building against a libcompat
that don't get installed to the system, but do end up being installed to
worldtmp. In particular, lib/msun has different fenv.h for aarch64 and
arm, so aarch64 will need arm's copy when it grows lib32 support, and
this would be installed to worldtmp, but not to the system, meaning any
programs that use fenv.h wouldn't be able to be built.

Instead, be consistent, and don't install includes at all during any of
the libcompat phases, so that we can detect these issues and ensure any
needed headers are installed for both worldtmp and the system.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D41030

14 months agorpcgen: Perform shell-style word expansion on RPCGEN_CPP
Jessica Clarke [Fri, 14 Jul 2023 01:35:25 +0000 (02:35 +0100)]
rpcgen: Perform shell-style word expansion on RPCGEN_CPP

Up until recently, CPP has been a list of space-separated words, with no
quotes, backslashes or other characters with special meaning to a shell.
However, as of 8fad2cda93c7, (escaped) quotes appear in CPP, and the
rudimentary parser in rpcgen is insufficient, since it will leave the
escaped quotes as escaped rather than performing one level of expansion
as would be done by a shell (whether in a script or a Makefile).

Rather than hack around this in all the places RPCGEN_CPP gets set,
implement proper expansion inside rpcgen. Note that this only deals with
a subset of shell syntax, since we don't handle any of:

  | & ; < > ( ) $ ` * ? [ # ˜ = %

having special meaning (with the exception of how a backslash behaves
inside double quotes, where \$ means a literal $ inside double quotes
but \a means a literal \a), instead using their literal value, but those
are all reasonable restrictions, and can be worked around by avoiding
their use; what's important is that we get the quoting and splitting
right.

This fixes -Winvalid-pp-token spew during build${libcompat}.

Reviewed by: brooks
Fixes: 8fad2cda93c7 ("bsd.compat.mk: Provide new CPP and sub-make variables")
Differential Revision: https://reviews.freebsd.org/D41013

14 months agonvmecontrol.8: Fix a few formatting nits.
John Baldwin [Fri, 14 Jul 2023 00:08:36 +0000 (17:08 -0700)]
nvmecontrol.8: Fix a few formatting nits.

14 months agoxargs: Install missing test output.
Jose Luis Duran [Thu, 13 Jul 2023 23:39:06 +0000 (23:39 +0000)]
xargs: Install missing test output.

Fixes: eab91d008165e7bbf8ca7b87eabe4dc8bf3da191
MFC after: 1 week
Reviewed by: des
Differential Revision: https://reviews.freebsd.org/D41033

14 months agoxargs: Fix test case count.
Dag-Erling Smørgrav [Thu, 13 Jul 2023 21:40:36 +0000 (21:40 +0000)]
xargs: Fix test case count.

MFC after: 1 week
Sponsored by: Klara, Inc.

14 months agoxargs: Prevent overflow in linelen calculation if nargs is large.
Dag-Erling Smørgrav [Thu, 13 Jul 2023 20:06:40 +0000 (20:06 +0000)]
xargs: Prevent overflow in linelen calculation if nargs is large.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41023

14 months agoxargs: disallow -R0 and -L0
Daniel Tameling [Thu, 13 Jul 2023 20:06:31 +0000 (20:06 +0000)]
xargs: disallow -R0 and -L0

Both cases were interpreted as these flags are unset. This meant that
-R0 got converted to -R5 and that -L0 didn't have any effect at all.
Since make at most 0 replacements isn't useful and since call utility
for every 0 lines read doesn't make sense, throw an error for these
two cases.

MFC after: 1 week
Reviewed by: des, kevans
Differential Revision: https://reviews.freebsd.org/D41022

14 months agoxargs: fix -R so that it accepts negative numbers again
Daniel Tameling [Thu, 13 Jul 2023 20:06:14 +0000 (20:06 +0000)]
xargs: fix -R so that it accepts negative numbers again

fbc445addf9 converted the parsing of arguments to strtonum but made
the accepted range for -R too restrictive. As documented in the man
page, it should accept negative numbers.

Added a test for this, which was provided by Jose Luis Duran.

Fixes: fbc445addf9
MFC after: 1 week
Reviewed by: des, kevans
Differential Revision: https://reviews.freebsd.org/D41021

14 months agosignal: Remove gsignal references from manuals
Dmitry Chagin [Thu, 13 Jul 2023 21:15:47 +0000 (00:15 +0300)]
signal: Remove gsignal references from manuals

Reported by: Mina Galić, mhorne
Reviewed by: Mina Galić, mhorne
Differential Revision: https://reviews.freebsd.org/D41020
MFC after: 1 week

14 months agotcp: fix build issue for some cc modules
Michael Tuexen [Thu, 13 Jul 2023 16:56:25 +0000 (18:56 +0200)]
tcp: fix build issue for some cc modules

The TCP_HHOOK option was moved from opt_inet.h to opt_global.h in
https://cgit.FreeBSD.org/src/commit/?id=e68b3792440cac248347afe08ba5881a00ba6523
The corresponding changes in two Makefiles were missed, which resulted
in not building cc_cdg, cc_chd, cc_hd, and cc_vegas anymore.

Reported by: void@f-m.fm
Reviewed by: rrs, rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D41010

14 months agoMerge commit fde5924dcc69 from llvm-project (by Serge Pavlov):
Dimitry Andric [Thu, 13 Jul 2023 18:57:22 +0000 (20:57 +0200)]
Merge commit fde5924dcc69 from llvm-project (by Serge Pavlov):

  [clang] Reset FP options before template instantiation

  AST nodes that may depend on FP options keep them as a difference
  relative to the options outside the AST node. At the moment of
  instantiation the FP options may be different from the default values,
  defined by command-line option. In such case FP attributes would have
  unexpected values. For example, the code:

      template <class C> void func_01(int last, C) {
        func_01(last, int());
      }
      void func_02() { func_01(0, 1); }
      #pragma STDC FENV_ACCESS ON

  caused compiler crash, because template instantiation takes place at the
  end of translation unit, where pragma STDC FENV_ACCESS is in effect. As
  a result, code in the template instantiation would use constrained
  intrinsics while the function does not have StrictFP attribute.

  To solve this problem, FP attributes in Sema must be set to default
  values, defined by command line options.

  This change resolves https://github.com/llvm/llvm-project/issues/63542.

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

Requested by: pkubaj
PR: 265755, 265758
MFC after: 1 month

14 months agovfs_bio: initialize pctries
Doug Moore [Thu, 13 Jul 2023 18:28:21 +0000 (13:28 -0500)]
vfs_bio: initialize pctries

bufobj_init depends on fields bo_dirty.bv_root and bo_clean.bv_root
being zeroed on entry and pctrie_init zeroing whatever is passed to
them, and so does not call pctrie_init for either of them. That fails
if pctrie_init ever changes to do something other that zeroing data,
so add explicit calls to them.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D40978

14 months agopfsync: transport over IPv6
Luiz Amaral [Thu, 13 Jul 2023 06:06:24 +0000 (08:06 +0200)]
pfsync: transport over IPv6

Implement pfsync over IPv6.

Submitted by: Luiz Amaral <email@luiz.eng.br>
Submitted by: Naman Sood <naman@freebsdfoundation.org>
Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D40102

14 months agosignal: Get rid of gsignal() as it not used anywhere
Dmitry Chagin [Thu, 13 Jul 2023 07:41:51 +0000 (10:41 +0300)]
signal: Get rid of gsignal() as it not used anywhere

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

14 months agopf: Simplify rule actions logic
Kajetan Staszkiewicz [Thu, 13 Jul 2023 05:08:24 +0000 (07:08 +0200)]
pf: Simplify rule actions logic

Actions applied to a processed packet come in case of stateless
firewalling from a rule or in case of statefull firewalling from a
state. The state obtains the actions from a rule when it is created by a
rule or by pfsync. The logic for deciding if actions come from a rule or
a state is spread across many places in pf.

There already is struct pf_rule_actions in struct pf_pdesc and thus it
can be used as a central place for storing actions and their parameters.
OpenBSD does something similar: they also store the actions in struct
pf_pdesc and have no variables in pf_test() but they use separate
variables instead of a structure. By using struct pf_rule_actions we can
simplify the code even further. Applying of actions is done *only* in
pf_rule_to_actions() no matter if for the legacy scrub rules or for the
normal match / pass rules. The logic of choosing if rule or state
actions are used is applied only once in pf_test() by copying the whole
struct.

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

14 months agorpcgen: Clarify behaviour for idx
Jessica Clarke [Thu, 13 Jul 2023 05:22:52 +0000 (06:22 +0100)]
rpcgen: Clarify behaviour for idx

The re-initialisation of idx in the later else branch is a bit hidden,
and results in deviation from the earlier two paths. Use more consistent
code instead to make it abundantly clear what's going on.

14 months agoDocument fdescfs mount option "rdlnk"
Konstantin Belousov [Tue, 11 Jul 2023 05:09:11 +0000 (08:09 +0300)]
Document fdescfs mount option "rdlnk"

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

14 months agofdescfs: add a mount option rdlnk
Konstantin Belousov [Tue, 11 Jul 2023 05:03:49 +0000 (08:03 +0300)]
fdescfs: add a mount option rdlnk

which changes /dev/fd/N files types to symbolic link with the behavior
of symbolic links.

PR: 272127
Reported by: Peter Eriksson <pen@lysator.liu.se>
Reviewed by: dchagin
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40969

14 months agoRevert "VFS: Remove VV_READLINK flag" and "fdescfs: improve linrdlnk mount option"
Konstantin Belousov [Tue, 11 Jul 2023 04:58:06 +0000 (07:58 +0300)]
Revert "VFS: Remove VV_READLINK flag" and "fdescfs: improve linrdlnk mount option"

This reverts commits 4a402dfe0bc44770c9eac6e58a501e4805e29413 and
3bffa2262328e4ff1737516f176107f607e7bc76.

The fix will be implemented in somewhat different manner.  The semantic
adjustment is incompatible with linuxolator expectations.

Reported and reviewed by: dchagin
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40969

14 months agorelease: remove a stray backslash
Glen Barber [Wed, 12 Jul 2023 20:57:57 +0000 (16:57 -0400)]
release: remove a stray backslash

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

14 months agorelease: follow-up to previous commit to install lang/python{,3}
Glen Barber [Wed, 12 Jul 2023 20:49:53 +0000 (16:49 -0400)]
release: follow-up to previous commit to install lang/python{,3}

PR: 272354
Sponsored by: GoFundMe https://www.gofundme.com/f/gjbbsd

14 months agorelease: ensure gce-check-depends installs lang/python{,3}
Glen Barber [Wed, 12 Jul 2023 20:08:40 +0000 (16:08 -0400)]
release: ensure gce-check-depends installs lang/python{,3}

PR: 272354
Sponsored by: GoFundMe https://www.gofundme.com/f/gjbbsd

14 months agopf: Fix duplicate storage of direction
Kajetan Staszkiewicz [Wed, 12 Jul 2023 16:04:56 +0000 (18:04 +0200)]
pf: Fix duplicate storage of direction

The variable storing the direction of a processed packet is passed
around to many functions. Most of those functions already have a pointer
to struct pf_pdesc which also contains the direction. By using the one
in struct pf_pdesc we can reduce the amount of arguments passed around.

Reviewed by: kp
Sponsored by: InnGames GmbH
Differential Revision: https://reviews.freebsd.org/D41008

14 months agoamd64 pmap: Fix compilation when superpage reservations are disabled
Yufeng Zhou [Wed, 12 Jul 2023 07:52:02 +0000 (02:52 -0500)]
amd64 pmap: Fix compilation when superpage reservations are disabled

The function pmap_pde_ept_executable() should not be conditionally
compiled based on VM_NRESERVLEVEL. It is required indirectly by
pmap_enter(..., psind=1) even when reservation-based allocation is
disabled at compile time.

Reviewed by: alc
MFC after: 1 week

14 months agovmm: don't leak locks exiting vmmdev_ioctl()
Gleb Smirnoff [Wed, 12 Jul 2023 16:16:40 +0000 (09:16 -0700)]
vmm: don't leak locks exiting vmmdev_ioctl()

At least an error from vcpu_lock_all() at line 553 would leak
memseg lock.  There might be other cases as well.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D40981

14 months agovmm: don't return random error from vcpu_lock_all() if vcpu is empty
Gleb Smirnoff [Wed, 12 Jul 2023 16:16:40 +0000 (09:16 -0700)]
vmm: don't return random error from vcpu_lock_all() if vcpu is empty

When vcpu array is empty, function would return random value from
stack.  What I observed was -1.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D40980

14 months agodtrace: prevent forked child from running after an error condition
Eric van Gyzen [Tue, 11 Jul 2023 17:58:29 +0000 (12:58 -0500)]
dtrace: prevent forked child from running after an error condition

The pid/killonerror test uses an invalid probe specifier to verify that
the child process is killed.  It occasionally fails because the "date"
command is allowed to run long enough to print the date.  This is harmless
in this case, but is clearly not ideal.

When the dt_proc_control thread is about to exit, and the dtrace command
forked the child, do not make the child runnable.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D40976

14 months agopf: fix error descriptions in the man page
Kristof Provost [Wed, 12 Jul 2023 11:17:14 +0000 (13:17 +0200)]
pf: fix error descriptions in the man page

PR: 272459
Submitted by: alex@inferiorhumanorgans.com
MFC after: 1 week

14 months agopf: fix pfi_kif definition in the man page
Kristof Provost [Wed, 12 Jul 2023 09:43:43 +0000 (11:43 +0200)]
pf: fix pfi_kif definition in the man page

PR: 272455
Submitted by: alex@inferiorhumanorgans.com
MFC after: 1 week

14 months agogetlocalbase: Make default path actually configurable
Jessica Clarke [Tue, 11 Jul 2023 20:49:22 +0000 (21:49 +0100)]
getlocalbase: Make default path actually configurable

We include paths.h in getlocalbase.c, which defines _PATH_LOCALBASE.
This will override a definition on the command line, meaning it is
impossible to override like how the manpage says you can, and it means
the code to provide a fallback default is dead as the macro is always
defined.

Instead, introduce a new LOCALBASE_PATH macro like LOCALBASE_CTL_LEN
that can be set on the command line and will default to the system's
existing _PATH_LOCALBASE to avoid duplicating the default here.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D40975