]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 months agolinprocfs: Rework according to the new ABI altroot facility
Dmitry Chagin [Mon, 29 May 2023 08:18:37 +0000 (11:18 +0300)]
linprocfs: Rework according to the new ABI altroot facility

By 3d2fec7d the ABI prefix path added to the struct pwd.
Use it in the mounts, mountinfo filler functions.

Differential revision: https://reviews.freebsd.org/D39438
MFC after: 2 month

13 months agosysentvec: Retire sv_imgact_try as unneeded anymore
Dmitry Chagin [Mon, 29 May 2023 08:18:11 +0000 (11:18 +0300)]
sysentvec: Retire sv_imgact_try as unneeded anymore

The sysentvec sv_imgact_try was used by kern_exec() to allow
non-native ABI to fixup shell path according to ABI root directory.
Since the non-native ABI can now specify its root directory directly
to namei() via pwd_altroot() call this facility is not needed anymore.

Differential Revision: https://reviews.freebsd.org/D40092
MFC after: 2 month

13 months agoBrandinfo: Retire emul_path as unneeded anymore
Dmitry Chagin [Mon, 29 May 2023 08:17:28 +0000 (11:17 +0300)]
Brandinfo: Retire emul_path as unneeded anymore

The Barndinfo emul_path was used by the Elf image activator to fixup
interpreter file name according to ABI root directory. Since the
non-native ABI can now specify its root directory directly to namei()
via pwd_altroot() call this facility is not needed anymore.

Differential Revision: https://reviews.freebsd.org/D40091
MFC after: 2 month

13 months agolinux(4): Use pwd_altroot() to tell namei() about ABI root path
Dmitry Chagin [Mon, 29 May 2023 08:16:46 +0000 (11:16 +0300)]
linux(4): Use pwd_altroot() to tell namei() about ABI root path

PR: 72920
Differential Revision: https://reviews.freebsd.org/D40090
MFC after: 2 month

13 months agonamei: Add the abilty for the ABI to specify an alternate root path
Dmitry Chagin [Mon, 29 May 2023 08:15:28 +0000 (11:15 +0300)]
namei: Add the abilty for the ABI to specify an alternate root path

For now a non-native ABI (i.e., Linux) uses the kern_alternate_path()
facility to dynamically reroot lookups. First, an attempt is made to
lookup the file in /compat/linux/original-path. If that fails, the
lookup is done in /original-path. Thats requires a bit of code in
every ABI syscall implementation where path name translation is needed.
Also our kern_alternate_path() does not properly lookups absolute symlinks
in second attempt, i.e., does not append /compat/linux part to the resolved
link.
The change is intended to avoid this by specifiyng the ABI root directory
for namei(), using one call to pwd_altroot() during exec-time into the ABI.
In that case namei() will dynamically reroot lookups as mentioned above.

PR: 72920
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D38933
MFC after: 2 month

13 months agoavx_sig: Print statistics by interval enstead of by pressing ^T
Dmitry Chagin [Mon, 29 May 2023 08:09:17 +0000 (11:09 +0300)]
avx_sig: Print statistics by interval enstead of by pressing ^T

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

13 months agoavx_sig: Avoid libbsd dependency for modern Glibc
Dmitry Chagin [Mon, 29 May 2023 08:08:35 +0000 (11:08 +0300)]
avx_sig: Avoid libbsd dependency for modern Glibc

Due to arc4random functions are povided by Glibc 2.36.

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

13 months agoFix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Kirk McKusick [Sun, 28 May 2023 22:23:16 +0000 (15:23 -0700)]
Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.

Check for valid block numbers while loading journal entries that
contain block numbers. If an invalid block number is found, fall
back to full fsck.

Reported-by: Robert Morris
PR:           271383
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
13 months agostand: libefi: avoid a null pointer deref in eficom
Kyle Evans [Sun, 28 May 2023 18:50:46 +0000 (13:50 -0500)]
stand: libefi: avoid a null pointer deref in eficom

We don't keep comc_port around anymore if the console's not present, but
some things might still try to set one of the environment variables we
hook.  In particular, one need not even set efi_com_port/efi_com_speed
in loader.conf; loader may do it itself and induce the crash if ConOut
depicts an available uart.

Probably reported by: dch
OK for now: imp

13 months agogssd: Improve failure message when running in a jail
Rick Macklem [Sun, 28 May 2023 18:06:27 +0000 (11:06 -0700)]
gssd: Improve failure message when running in a jail

If a jail is not correctly configured to run nfsd(8)
in the jail, gssd(8) cannot run.
This patch improves the failure message for this case.

MFC after: 2 weeks

13 months agolibc: locale: fix collation file size validation
Kyle Evans [Sun, 28 May 2023 17:52:51 +0000 (12:52 -0500)]
libc: locale: fix collation file size validation

At a minimum, we need enough for the colllation format version string +
locale definition version string and a full collate_info definition,
rather than just the first two and a pointer.

Sponsored by: Klara, Inc.

13 months agosqlite3: Vendor import of sqlite3 3.42.0
Cy Schubert [Sun, 28 May 2023 14:31:36 +0000 (07:31 -0700)]
sqlite3: Vendor import of sqlite3 3.42.0

Release notes at https://www.sqlite.org/releaselog/3_42_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3420000.tar.gz

Merge commit '92b2b066353ddd32e1d59f8c52c430d552d9a9a5' into sqlite3/main

13 months agosqlite3: Vendor import of sqlite3 3.42.0
Cy Schubert [Sun, 28 May 2023 14:07:30 +0000 (07:07 -0700)]
sqlite3: Vendor import of sqlite3 3.42.0

Release notes at https://www.sqlite.org/releaselog/3_42_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3420000.tar.gz

13 months agolinux(4): Fix stack unwinding across signal frame on x86_64
Dmitry Chagin [Sun, 28 May 2023 14:07:28 +0000 (17:07 +0300)]
linux(4): Fix stack unwinding across signal frame on x86_64

Get rid of using register numbers which is undefined in libunwind
on x86_64.

Differential Revision: https://reviews.freebsd.org/D40156
MFC after: 1 month

13 months agolinux(4): Preserve %rcx (return address) like a Linux do
Dmitry Chagin [Sun, 28 May 2023 14:06:47 +0000 (17:06 +0300)]
linux(4): Preserve %rcx (return address) like a Linux do

Perhaps, this does not makes much sense as destroyng %rcx declared by
the x86_64 Linux syscall ABI. However,:
a) if we get a signal while we are in the kernel, we should restore
   tf_rcx when preparing machine context for signal handlers.
b) the Linux world is strange, someone can depend on %rcx value
   after syscall, something like go.

Differential Revision: https://reviews.freebsd.org/D40155
MFC after: 1 month

13 months agolinux(4): Simplify %r10 restoring on amd64
Dmitry Chagin [Sun, 28 May 2023 14:06:23 +0000 (17:06 +0300)]
linux(4): Simplify %r10 restoring on amd64

Restore %r10 at system call entry to avoid doing this multiply times.

Differential Revision: https://reviews.freebsd.org/D40154
MFC after: 1 month

13 months agolinux(4): Add a comment explaining registers at syscall entry point on amd64
Dmitry Chagin [Sun, 28 May 2023 14:06:05 +0000 (17:06 +0300)]
linux(4): Add a comment explaining registers at syscall entry point on amd64

Differential Revision: https://reviews.freebsd.org/D40153
MFC after: 1 month

13 months agolinux(4): Drop a weird comment from linux_set_syscall_retval on amd64
Dmitry Chagin [Sun, 28 May 2023 14:05:44 +0000 (17:05 +0300)]
linux(4): Drop a weird comment from linux_set_syscall_retval on amd64

I agree, it would be great to avoid PCB_FULL_IRET, however we should
follow Linux system call ABI.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40152
MFC after: 1 month

13 months agoFix the build post-dcf5d5603b3af8
Enji Cooper [Sun, 28 May 2023 02:16:39 +0000 (19:16 -0700)]
Fix the build post-dcf5d5603b3af8

I didn't compile test the prior code before committing.

MFC after: 1 week
MFC with: dcf5d5603b3af831002caa7b2f64aec8bda14071

13 months agoFix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Kirk McKusick [Sun, 28 May 2023 00:09:02 +0000 (17:09 -0700)]
Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.

Check for valid file size before processing journal entries for it.
Done by extracting the file size check from pass1.c into chkfilesize()
then using it in the journal code in suj.c

Reported-by: Robert Morris
PR:           271378
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
13 months agoReduce ifdef soup by adding pre-3.0 compat support
Enji Cooper [Sat, 27 May 2023 21:07:45 +0000 (14:07 -0700)]
Reduce ifdef soup by adding pre-3.0 compat support

This change creates a static inline function, BN_check_prime, for
pre-3.0 use which is implemented with the previous (1.1) compatible call
under the covers, `BN_is_prime_ex`.

The `nchecks` parameter value is maintained, even though it has no
noticable behavior change, given that the documentation clearly states
that at least 64 or 128 rounds are executed on the backend, depending on
how many bits there are in the given number being factored out.

MFC after: 1 week
Differential Revision:  https://reviews.freebsd.org/D40305

13 months agoFix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Kirk McKusick [Sat, 27 May 2023 23:07:09 +0000 (16:07 -0700)]
Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.

The last valid inode in the filesystem is maxino - 1, not maxino.
Thus validity checks should ino < maxino, not ino <= maxino.

Reported-by: Robert Morris
PR:           271312
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
13 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Sat, 27 May 2023 19:23:39 +0000 (12:23 -0700)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Verify that the summary information does not extend past the end
of the filesystem.

No legitimate superblocks should fail as a result of these changes.

Reported-by: Robert Morris
PR:           271351
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
13 months agofactor: support OpenSSL 3
Enji Cooper [Sat, 27 May 2023 04:55:12 +0000 (21:55 -0700)]
factor: support OpenSSL 3

This change ports the BN APIs to an OpenSSL 3 compatible set of APIs.

This removes the need for requesting OpenSSL 1.1 compatible APIs.

MFC after: 1 week
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40298

13 months agoAdd simple factor/primes regression tests
Enji Cooper [Sat, 27 May 2023 04:51:24 +0000 (21:51 -0700)]
Add simple factor/primes regression tests

This will help ensure that the change following this
one to support OpenSSL 3 is sane.

MFC after: 1 week
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40297

13 months agonetgdb: Fix netgdb double ack, print proxy address
John Reimer [Sat, 27 May 2023 02:48:14 +0000 (19:48 -0700)]
netgdb: Fix netgdb double ack, print proxy address

- Fixes netgdb's double ack
- Moving ack responsibility to debugnet, decision to ack made by netdump/netgdb.
- Finish responsibility moved to debugnet, new finish handler.
- netgdb now prints the address to connect to in case the user doesn't have
  access to the proxy machine.

Sponsored by: Dell EMC
Reviewed By: markj, bdrewery (earlier version)
Differential Revision: https://reviews.freebsd.org/D40064

13 months agoApply libc++ fix for compiling <type_traits> with clang 16
Dimitry Andric [Sat, 27 May 2023 16:19:37 +0000 (18:19 +0200)]
Apply libc++ fix for compiling <type_traits> with clang 16

Merge commit 0e7971154ecb from llvm-project (by Christopher Di Bella):

  [libcxx][NFC] utilises compiler builtins for unary transform type-traits

  Depends on D116203

  Reviewed By: #libc, philnik

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

Clang 16 got new builtins that are equivalent to hand-written parts of
<type_traits>. When building world with the devel/llvm16 package
installed and CROSS_TOOLCHAIN=llvm16 set, this would lead to -Werror
warnings about those builtins being overridden.

Reported by: emaste
MFC after: 3 days

13 months agolibpcap: Update PACKAGE_STRING to 1.10.4
Joseph Mingrone [Sat, 27 May 2023 01:45:43 +0000 (22:45 -0300)]
libpcap: Update PACKAGE_STRING to 1.10.4

Reviewed by: emaste
Fixes: 6f9cba8f8b5e (libpcap: Update to 1.10.3)
Fixes: dd744a896be3 (libpcap: Update to 1.10.4)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40295

13 months agonetlink: update rta_multipath conditions in arp/ndp after 656a39c1a062
Alexander V. Chernikov [Sat, 27 May 2023 13:25:16 +0000 (13:25 +0000)]
netlink: update rta_multipath conditions in arp/ndp after 656a39c1a062

13 months agonetlink: fix build
Alexander V. Chernikov [Sat, 27 May 2023 12:29:14 +0000 (12:29 +0000)]
netlink: fix build

13 months agonetlink: add snl(3) support for listing genetlink multicast groups
Alexander V. Chernikov [Sat, 27 May 2023 11:12:04 +0000 (11:12 +0000)]
netlink: add snl(3) support for listing genetlink multicast groups

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D40282
MFC after: 2 weeks

13 months agonetlink: use newly-added snl(3) array parsing for handling multipath
Alexander V. Chernikov [Sat, 27 May 2023 11:11:04 +0000 (11:11 +0000)]
netlink: use newly-added snl(3) array parsing for handling multipath
routes.

MFC after: 2 weeks

13 months agonetlink: add snl(3) support for parsing unknown-size arrays
Alexander V. Chernikov [Sat, 27 May 2023 11:09:01 +0000 (11:09 +0000)]
netlink: add snl(3) support for parsing unknown-size arrays

Reviewed by: bapt
Differential Review: https://reviews.freebsd.org/D40282
MFC after: 2 weeks

13 months agonetlink: fix bulding with NOINET6
Alexander V. Chernikov [Sat, 27 May 2023 10:46:25 +0000 (10:46 +0000)]
netlink: fix bulding with NOINET6

13 months agonetlink: call IPv6 hook after the ifaddr operation when ifp is brought
Alexander V. Chernikov [Sat, 27 May 2023 10:38:32 +0000 (10:38 +0000)]
netlink: call IPv6 hook after the ifaddr operation when ifp is brought
up.

This change fixes the case when the first address added to the interface
 is IPv6 GU address. Before the change, IPv6 LL addition was not
triggered.

PR: 271661
MFC after: 2 weeks

13 months agostress2: Initialize variable
Peter Holm [Sat, 27 May 2023 08:34:48 +0000 (10:34 +0200)]
stress2: Initialize variable

13 months agostress2: Tune to get more slightly broken file systems
Peter Holm [Sat, 27 May 2023 08:31:44 +0000 (10:31 +0200)]
stress2: Tune to get more slightly broken file systems

13 months agostress2: Fix warnings
Peter Holm [Sat, 27 May 2023 08:31:00 +0000 (10:31 +0200)]
stress2: Fix warnings

13 months agoarm64 pmap: Eliminate an unused global variable
Alan Cox [Sat, 27 May 2023 06:23:48 +0000 (01:23 -0500)]
arm64 pmap: Eliminate an unused global variable

The global variable "pmap_last_pa" was copied from the amd64 pmap as a
part of commit c15085278cb5 "arm64 pmap: implement per-superpage locks"
but it is neither used nor needed by the arm64 pmap.

13 months agoDo not try to adjust a directory depth when its reconnection is declined.
Kirk McKusick [Sat, 27 May 2023 05:55:11 +0000 (22:55 -0700)]
Do not try to adjust a directory depth when its reconnection is declined.

MFC after:    1 week
Sponsored by: The FreeBSD Foundation

13 months agoCorrect two bugs in fsck_ffs(8) triggered by corrupted filesystems.
Kirk McKusick [Sat, 27 May 2023 05:41:57 +0000 (22:41 -0700)]
Correct two bugs in fsck_ffs(8) triggered by corrupted filesystems.

Always create a directory inode structure when a directory inode is
found in Pass 1 as it is not known whether it will be saved or removed
in later passes. If it is to be saved the directory inode structure
is needed to track its status and fsck_ffs(8) will segment fault if
it does not exist.

Reported-by: Robert Morris
PR:           271310
PR:           271354
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
13 months agodumpon: provide diag info when `PEM_read_RSA_PUBKEY` fails
Enji Cooper [Sat, 27 May 2023 01:02:34 +0000 (18:02 -0700)]
dumpon: provide diag info when `PEM_read_RSA_PUBKEY` fails

This change modifies dumpon to print out the last error from OpenSSL
when `PEM_read_RSA_PUBKEY` fails. This allows end-users to diagnose why
reading in RSA pubkey files fails so they can adjust the usage to meet
the needs of the command.

MFC after: 1 week

13 months agotests: Fix format strings
Mark Johnston [Fri, 26 May 2023 21:38:06 +0000 (17:38 -0400)]
tests: Fix format strings

Reported by: Jenkins
Fixes: 844942888f7d ("tests: Add a simple regression test for ptrace(PT_SC_REMOTE)")

13 months agonexus: Consistently return a pointer in failure paths
Mark Johnston [Wed, 26 Apr 2023 21:19:28 +0000 (17:19 -0400)]
nexus: Consistently return a pointer in failure paths

No functional change intended.

MFC after: 1 week

13 months agobitset: Remove BITSET_FOREACH_ADVANCE
Mark Johnston [Wed, 24 May 2023 17:05:03 +0000 (13:05 -0400)]
bitset: Remove BITSET_FOREACH_ADVANCE

__BITSET_FOREACH_ADVANCE is a helper macro for
__BITSET_FOREACH_IS(SET|CLR) and wasn't meant to be used directly by
consumers.

While here, fix some whitespace and move a comment back to where it
belongs.

Fixes: 5e04571cf3cf ("sys/bitset.h: reduce visibility of BIT_* macros")
MFC after: 1 week

13 months agotop: Use a cpuset_t to represent a CPU mask
Mark Johnston [Fri, 26 May 2023 19:14:21 +0000 (15:14 -0400)]
top: Use a cpuset_t to represent a CPU mask

The code attempts to detect holes in the CPU ID space, but previously
this would only work for up to sizeof(long)*8 CPUs.

MFC after: 2 weeks

13 months agomakefs/zfs: Avoid generating a GUID of zero
Mark Johnston [Fri, 26 May 2023 19:14:00 +0000 (15:14 -0400)]
makefs/zfs: Avoid generating a GUID of zero

13 months agotests: Add a simple regression test for ptrace(PT_SC_REMOTE)
Mark Johnston [Fri, 26 May 2023 19:13:20 +0000 (15:13 -0400)]
tests: Add a simple regression test for ptrace(PT_SC_REMOTE)

MFC after: 1 week

13 months agokdump: Add a facility to print numbers in decimal format always
Dmitry Chagin [Fri, 26 May 2023 16:35:08 +0000 (19:35 +0300)]
kdump: Add a facility to print numbers in decimal format always

To help grepping kdump output by pid or tid it makes sence to print
some numbers in decimal format always. Eg, process or thread identifier
at least, as they already printed in decimal format.
Switch to print pid/tid arguments of some Linux signal related syscalls
in decimal format.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D40099
MFC after: 1 week

13 months agokdump: Decode linux_clone syscall flags
Dmitry Chagin [Fri, 26 May 2023 16:34:33 +0000 (19:34 +0300)]
kdump: Decode linux_clone syscall flags

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40151
MFC after: 1 week

13 months agolibsysdecode: Decode linux_clone syscall flags
Dmitry Chagin [Fri, 26 May 2023 16:32:20 +0000 (19:32 +0300)]
libsysdecode: Decode linux_clone syscall flags

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40150
MFC after: 1 week

13 months agolinux(4): Guard linux_fork.h by _KERNEL for use by libsysdecode
Dmitry Chagin [Fri, 26 May 2023 16:31:47 +0000 (19:31 +0300)]
linux(4): Guard linux_fork.h by _KERNEL for use by libsysdecode

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40149
MFC after: 1 month

13 months agokinst: fix memcpy() tracing crash
Christos Margiolis [Fri, 26 May 2023 15:43:37 +0000 (18:43 +0300)]
kinst: fix memcpy() tracing crash

Tracing memcpy() would crash the kernel, because we'd also trace the
memcpy() calls from kinst_invop(). To fix this, introduce kinst_memcpy()
whose arguments are 'volatile', so that we avoid having the compiler
replace it with a regular memcpy().

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

13 months agokinst: add kinst_excluded()
Christos Margiolis [Fri, 26 May 2023 13:54:08 +0000 (16:54 +0300)]
kinst: add kinst_excluded()

Exclude functions that are not safe-to-trace.

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

13 months agoauditdistd: Request the OpenSSL 1.1 API
Pierre Pronchery [Thu, 25 May 2023 17:44:36 +0000 (19:44 +0200)]
auditdistd: Request the OpenSSL 1.1 API

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future change should migrate to use the OpenSSL 3.0 APIs.

PR: 271615
Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation

13 months agoauditdistd: Avoid calling deprecated OpenSSL functions
Ed Maste [Thu, 25 May 2023 19:17:13 +0000 (15:17 -0400)]
auditdistd: Avoid calling deprecated OpenSSL functions

As of OpenSSL 1.1 SSL_library_init() and SSL_load_error_strings() are
deprecated.  There are replacement initialization functions but they do
not need to be called: "As of version 1.1.0 OpenSSL will automatically
allocate all resources that it needs so no explicit initialisation is
required."

Wrap both calls in an OPENSSL_VERSION_NUMBER block.

Upstream pull request submitted at
https://github.com/openbsm/openbsm/pull/82

PR: 271615
Reviewed by: ngie
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40273

13 months agotcp: fix a bug where unshifting should be put last in tcp_get_srtt()
Cheng Cui [Thu, 25 May 2023 13:14:38 +0000 (09:14 -0400)]
tcp: fix a bug where unshifting should be put last in tcp_get_srtt()

Reported by: Bhaskar Pardeshi from VMware.
Reviewers: rscheff, tuexen, #transport!
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40267

13 months agoAdd the ability to adjust directory depths to background fsck_ffs(8).
Kirk McKusick [Fri, 26 May 2023 02:27:04 +0000 (19:27 -0700)]
Add the ability to adjust directory depths to background fsck_ffs(8).

Commit fe5e6e2 improved FFS directory placement when creating new
directories. It is done by keeping track of the depth of directories
in the filesystem and placing those lower in the tree closer together
while spreading out those higher in the tree.

Fsck_ffs(8) checks these depths and if incorrect adjusts them to
their correct value. When running in background fsck_ffs(8) needs
to be able to make an adjustment to the depth. This commit adds
the sysctl to make such an adjustment and adds the code to fsck_ffs(8)
to use the new sysctl.

MFC after:    1 week
Sponsored by: The FreeBSD Foundation

13 months agoWhen running fsck_ffs(8) in background ensure that a superblock has been read.
Kirk McKusick [Fri, 26 May 2023 01:56:22 +0000 (18:56 -0700)]
When running fsck_ffs(8) in background ensure that a superblock has been read.

Reported by:  Mikhail T.
PR:       271352
MFC after:    1 week
Sponsored by: The FreeBSD Foundation

13 months agolldb: dereference stoppcbs based on target kernel version
Ed Maste [Tue, 2 May 2023 20:24:46 +0000 (16:24 -0400)]
lldb: dereference stoppcbs based on target kernel version

As of 9fb6718d1b18 / __FreeBSD_version 1400089 stoppcbs is a pointer to
the pcbs array.  Dereference stoppcbs on sufficiently new kernels.

Reviewed by: markj (earlier)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39939

13 months agoposixshmcontrol.1: Document posixshmcontrol create -l
Mark Johnston [Thu, 25 May 2023 21:08:55 +0000 (17:08 -0400)]
posixshmcontrol.1: Document posixshmcontrol create -l

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

13 months agosmp: Dynamically allocate the stoppcbs array
Mark Johnston [Tue, 25 Apr 2023 16:09:24 +0000 (12:09 -0400)]
smp: Dynamically allocate the stoppcbs array

This avoids bloating the kernel image when MAXCPU is large.

A follow-up patch for kgdb and other kernel debuggers is needed since
the stoppcbs symbol is now a pointer.  Bump __FreeBSD_version so that
debuggers can use osreldate to figure out how to handle stoppcbs.

PR: 269572
MFC after: never
Reviewed by: mjg, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39806

13 months agofactor: Request the OpenSSL 1.1 API
Pierre Pronchery [Thu, 25 May 2023 17:44:47 +0000 (19:44 +0200)]
factor: Request the OpenSSL 1.1 API

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future change should migrate to use the OpenSSL 3.0 APIs.

PR: 271615
Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation

13 months agoofw: remove redundant calls in ofwbus_attach()
Christos Margiolis [Thu, 25 May 2023 20:47:41 +0000 (23:47 +0300)]
ofw: remove redundant calls in ofwbus_attach()

Since commit ecaecbc7d8bc212d8e854088106b3b21e631bb52, calling
ofw_bus_gen_setup_devinfo() is redundant, as the call to
device_set_ivars() now happens inside simplebus_add_device().

Reviewed by: markj
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D40271

13 months agokinst: be explicit about trampoline placement
Christos Margiolis [Thu, 25 May 2023 20:40:46 +0000 (23:40 +0300)]
kinst: be explicit about trampoline placement

The current implementation and comment was specific to amd64. Even
though in the case of kinst's supported architectures (RISC-V and ARM64)
VM_MIN_KERNEL_ADDRESS is equal to KERNBASE, it's better to be explicit.

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

13 months agolibarchive: Request the OpenSSL 1.1 API
Pierre Pronchery [Thu, 25 May 2023 07:26:58 +0000 (09:26 +0200)]
libarchive: Request the OpenSSL 1.1 API

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update should migrate to use the OpenSSL 3.0 APIs.

PR: 271615
Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation

13 months agoctags: Recognize __attribute__ in function declarations.
Dag-Erling Smørgrav [Thu, 25 May 2023 17:07:25 +0000 (17:07 +0000)]
ctags: Recognize __attribute__ in function declarations.

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

13 months agosys: Enable -Wunused-but-set-variable for clang 15+.
John Baldwin [Thu, 25 May 2023 17:44:53 +0000 (10:44 -0700)]
sys: Enable -Wunused-but-set-variable for clang 15+.

It was already enabled for older clang versions and GCC.

13 months agoriscv pmap: Add an __unused wrapper for a variable only used under PV_STATS.
John Baldwin [Thu, 25 May 2023 17:44:53 +0000 (10:44 -0700)]
riscv pmap: Add an __unused wrapper for a variable only used under PV_STATS.

13 months agopowerpc booke: Add an __unused wrapper for a variable only used under DEBUG.
John Baldwin [Thu, 25 May 2023 17:44:53 +0000 (10:44 -0700)]
powerpc booke: Add an __unused wrapper for a variable only used under DEBUG.

13 months agolibradius: specify OpenSSL 1.1 APIs
Pierre Pronchery [Thu, 25 May 2023 05:42:38 +0000 (07:42 +0200)]
libradius: specify OpenSSL 1.1 APIs

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

Future work should migrate to use the OpenSSL 3.0 APIs.

PR: 271615
Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation

13 months agolibfetch: specify OpenSSL 1.1 APIs
Pierre Pronchery [Thu, 25 May 2023 06:46:02 +0000 (08:46 +0200)]
libfetch: specify OpenSSL 1.1 APIs

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

Future work should migrate to use the OpenSSL 3.0 APIs.

PR: 271615
Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation

13 months agoriscv timer: use stimecmp CSR when available
Mitchell Horne [Thu, 25 May 2023 17:07:49 +0000 (14:07 -0300)]
riscv timer: use stimecmp CSR when available

The Sstc extension defines a new stimecmp CSR, allowing supervisor
software to set the timer, rather than just read it. When supported,
using this avoids the frequent trips through the SBI every time the
CPU's timer expires.

Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40241

13 months agoriscv: S-mode extension parsing
Mitchell Horne [Thu, 25 May 2023 17:07:26 +0000 (14:07 -0300)]
riscv: S-mode extension parsing

There are now several Supervisor-mode extensions that have entered the
'ratified' status, so begin parsing and reporting a few of these.

Recognize the following extensions:
 - Sstc: stimecmp/vstimecmp CSR
 - Svnapot: NAPOT* translation contiguity
 - Svpbmt: page-based memory types
 - Svinval: fine-grained TLB invalidation instructions
 - Sscofpmf: performance counter overflow

*i.e. "naturally aligned power-of-2" page granularity

For now, provide globals for Sstc and Sscofpmf, as we will make use of
these in the near future.

Plus, update the copyright statement after my recent work on this file.

Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40240

13 months agoriscv: Use PMAP_MAPDEV_EARLY_SIZE in locore and pmap_bootstrap
Alfredo Mazzinghi [Thu, 25 May 2023 15:33:12 +0000 (16:33 +0100)]
riscv: Use PMAP_MAPDEV_EARLY_SIZE in locore and pmap_bootstrap

Use PMAP_MAPDEV_EARLY_SIZE instead of assuming that its value is always
L2_SIZE. Add compile-time assertions to check that the size matches the
expectations in locore.

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

13 months agoarm64/disassem.c: Add shifted register instruction definitions
Mykola Hohsadze [Thu, 25 May 2023 14:41:55 +0000 (11:41 -0300)]
arm64/disassem.c: Add shifted register instruction definitions

Add disassembly support for the following shifted register instructions:
 * adds
 * subs
 * sub
 * neg
 * negs
 * cmp
 * cmn

The 'Mandatory Tokens' checks are relaxed to allow for the alias
instructions (e.g. cmp) which hard-code one or more registers as xzr.

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

13 months agoarm64/disassem.c: Make output lowercase
Mykola Hohsadze [Thu, 25 May 2023 14:40:38 +0000 (11:40 -0300)]
arm64/disassem.c: Make output lowercase

Update the few uppercase fields fields to be consistent with others.

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

13 months agolibfetch: do not call deprecated OpenSSL functions
Ed Maste [Thu, 25 May 2023 15:24:48 +0000 (11:24 -0400)]
libfetch: do not call deprecated OpenSSL functions

As of OpenSSL 1.1 SSL_library_init() and SSL_load_error_strings() are
deprecated.  There are replacement initialization functions but they do
not need to be called: "As of version 1.1.0 OpenSSL will automatically
allocate all resources that it needs so no explicit initialisation is
required."

Wrap both calls in an OPENSSL_VERSION_NUMBER block.

PR: 271615
Reviewed by: Pierre Pronchery <pierre@freebsdfoundation.org>
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40265

13 months agoless: Re-enable -Wdeprecated-non-prototype warnings.
John Baldwin [Thu, 25 May 2023 16:16:20 +0000 (09:16 -0700)]
less: Re-enable -Wdeprecated-non-prototype warnings.

These were fixed in the most recent update to contrib/less.

13 months agocontrib/bc: upgrade to version 6.6.0
Stefan Eßer [Thu, 25 May 2023 15:55:31 +0000 (17:55 +0200)]
contrib/bc: upgrade to version 6.6.0

This update removes printing of a leading zero in scientific or
engineering output modes (which are an extended feature of this
implementation).

(cherry-picked from commit 8b83ef067441f6d3a4a55e92d1738724954a057c)

MFC after: 2 weeks

13 months agosuperio: Add device ID for ITE IT8613
Johannes Totz [Thu, 25 May 2023 14:23:06 +0000 (10:23 -0400)]
superio: Add device ID for ITE IT8613

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

13 months agoifconfig: fix ifconfig IFX inet[6] ADDR -alias
Alexander V. Chernikov [Thu, 25 May 2023 14:50:57 +0000 (14:50 +0000)]
ifconfig: fix ifconfig IFX inet[6] ADDR -alias

Internally, inet and inet6 family handlers store state for
 address addition and deletion separately, as, for example,
 "ifconfig lo0 inet 127.0.0.2/32" triggers a) deletion of the
 first interface address and b) addition of a new one.
The current logic behind handling "-alias" being the last argument
 is to copy the address from "addition" state to the "deletion"
 state. It is done by the generic ifconfig code, which explicitly
 typecasts opaque handler state pointers to "struct ifreq", which
 doesn't work in the Netlink case.

Fix this by introducing family-specific "af_copyaddr" handler,
 which removes the peeking & typecasting logic from the generic code.

Reported by: otis
Tested by: otis

13 months agoEnable -Wstrict-prototypes by default in the kernel for clang 15+.
John Baldwin [Thu, 25 May 2023 14:11:38 +0000 (07:11 -0700)]
Enable -Wstrict-prototypes by default in the kernel for clang 15+.

PR: 271072 (exp-run)
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39734

13 months agoEnable -Wstrict-prototypes for all clang versions at WARNS >= 3.
John Baldwin [Thu, 25 May 2023 14:11:38 +0000 (07:11 -0700)]
Enable -Wstrict-prototypes for all clang versions at WARNS >= 3.

Previously clang 15+ only enabled it for WARNS >= 5.

PR: 271072 (exp-run)
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39732

13 months agoldns: Silence -Wstrict-prototypes warnings.
John Baldwin [Thu, 25 May 2023 14:11:38 +0000 (07:11 -0700)]
ldns: Silence -Wstrict-prototypes warnings.

Hopefully upstream will fix the function declaration of
ldns_edns_option_list_new in the future.

13 months agozfs: Fix build on 32-bit platforms after most recent import.
John Baldwin [Thu, 25 May 2023 14:11:38 +0000 (07:11 -0700)]
zfs: Fix build on 32-bit platforms after most recent import.

unsigned long is not a uint64_t on 32-bit platforms.  The zfs.4
manpage documents this variable as a uint, and it is only compared
with other variables of type int, so uint_t makes more sense than
unsigned long.

(I also wasn't sure if ULONG would work as a ZFS_MODULE_PARAM type
on other OS's)

13 months agoRevert "When stopping powerd, set the CPU frequency back to its maximum value"
Andrew Gallatin [Mon, 22 May 2023 00:47:28 +0000 (20:47 -0400)]
Revert "When stopping powerd, set the CPU frequency back to its maximum value"

This reverts commit 1dcb6ad173e57b489a859ea59ed6eaa733bdb5bc.

As of "8cb16fdbea6b Restore original frequency on exit.", powerd
restores the original frequency itself.

Further, if the original frequency is not the same as the
first frequency found in the frequency list, then the restoration
done by the powerd_poststop will restore the wrong frequency.
This can happen on Intel machines where Turbo is not enabled,
but the turbo frequency is first in the list of frequencies.
In this case, turbo will be enabled when the user did not want
it to be.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D40197
Reviewed by: imp, mav

13 months agoctags: Support writing to stdout instead of a file.
Dag-Erling Smørgrav [Thu, 25 May 2023 11:55:56 +0000 (11:55 +0000)]
ctags: Support writing to stdout instead of a file.

* Understand "-" to mean stdout as per convention.
* Check that the output is a regular file and ignore -u if not, otherwise we might try to rm /dev/stdout.
* As a bonus, if -u was specified but the output file does not exist, proceed as if -u had not been specified instead of erroring out.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: cracauer, debdrup
Differential Revision: https://reviews.freebsd.org/D40237

13 months agoifconfig: switch IPv4/IPv6 address manipulations to Netlink.
Alexander V. Chernikov [Sat, 20 May 2023 11:53:46 +0000 (11:53 +0000)]
ifconfig: switch IPv4/IPv6 address manipulations to Netlink.

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

13 months agoAdd brackets around GICv3 redistributor macros
Andrew Turner [Thu, 25 May 2023 08:35:14 +0000 (09:35 +0100)]
Add brackets around GICv3 redistributor macros

The GICv3 redistributor register access macros take arguments that are
used as variables. Add brackets around them as is the style, and for
safety.

Sponsored by: Arm Ltd

13 months agomptutil: document that disabled/enabled are also supported
Enji Cooper [Thu, 25 May 2023 04:54:02 +0000 (21:54 -0700)]
mptutil: document that disabled/enabled are also supported

This change officially documents the fact that the `volume cache
enabled` and `volume cache disabled` are also supported.

While here, remove an unnecessary newline at the end of a warn*(3) call.
warn*(3) adds a newline automatically.

MFC after: 1 week

13 months agostand/efi/eficom: Free comc_port if we can't find the serial port
Warner Losh [Wed, 24 May 2023 22:34:51 +0000 (16:34 -0600)]
stand/efi/eficom: Free comc_port if we can't find the serial port

If we can't find the serial port, free comc_port and return early. The
serial port just isn't there.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40223

13 months agostand/efi/eficom: Make aarch64 compat code probe correctly
Warner Losh [Wed, 24 May 2023 22:34:44 +0000 (16:34 -0600)]
stand/efi/eficom: Make aarch64 compat code probe correctly

Make the compat code more correct by probing using the eficom console
structure, not the comconsole one.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40222

13 months agostand/efi/eficom: Don't allow this for !HYPERV machines
Warner Losh [Wed, 24 May 2023 22:34:37 +0000 (16:34 -0600)]
stand/efi/eficom: Don't allow this for !HYPERV machines

If the machine isn't hyperv on amd64, then this driver fails the probe
and will do nothing further now, even if explicitly listed in a config.

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40221

13 months agostand/efi/eficom: better handling of absent device
Warner Losh [Wed, 24 May 2023 22:34:31 +0000 (16:34 -0600)]
stand/efi/eficom: better handling of absent device

Don't even have a comc_port when the port doesn't exist: always free it
if we probe that it's not there. Also, when it's not present, clear the
flags indicating presence to avoid disturbing other flags.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D40220

13 months agostand/efi/smbios: Move detection of smbios earlier.
Warner Losh [Wed, 24 May 2023 22:34:21 +0000 (16:34 -0600)]
stand/efi/smbios: Move detection of smbios earlier.

It would be nice to make decisions early in boot, about maybe consoles,
based on smbios variables. Set them just after we setup the archsw so we
can use them everywhere.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D40219

13 months agobectl.8: update /home
Mike Karels [Thu, 25 May 2023 03:08:39 +0000 (22:08 -0500)]
bectl.8: update /home

The default location for home directories is moving from /usr/home
to /home, including the default zfs datasets.  Update accordingly.
Add zroot/usr/src as replacement example of nested datasets.

While here, mark zroot/var as "canmount off" as per current setup.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40206

13 months agoldns: specify OpenSSL 1.1 APIs
Pierre Pronchery [Sat, 13 May 2023 02:38:18 +0000 (19:38 -0700)]
ldns: specify OpenSSL 1.1 APIs

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future ldns update should migrate to use the OpenSSL 3.0 APIs.

This is a recommit of c6750ddec917 after the ldns update in
5afab0e5e56f.

PR: 271615
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40082

13 months agotcpdump: specify OpenSSL 1.1 APIs
Pierre Pronchery [Tue, 9 May 2023 13:04:45 +0000 (15:04 +0200)]
tcpdump: specify OpenSSL 1.1 APIs

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update should migrate to use the OpenSSL 3.0 APIs.

PR: 271615
Reviewed by: emaste
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation

13 months agoice(4): Update to 1.37.11-k
Eric Joyner [Wed, 24 May 2023 23:38:02 +0000 (16:38 -0700)]
ice(4): Update to 1.37.11-k

This driver update has no corresponding ice_ddp update, and doesn't
contain very many functional changes:
- Some refactoring for future SR-IOV PF support
- Various minor fixes

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Tested by: jeffrey.e.pieper@intel.com
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D39821