]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agosubr_unit.c: explain first/last special ranges
Konstantin Belousov [Sun, 14 May 2023 23:11:17 +0000 (02:11 +0300)]
subr_unit.c: explain first/last special ranges

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40089

14 months agokern/subr_unit.c: more uses for is_bitmap()
Konstantin Belousov [Fri, 12 May 2023 22:39:35 +0000 (01:39 +0300)]
kern/subr_unit.c: more uses for is_bitmap()

To facilitate it, move the is_bitmap() definition earlier.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40089

14 months agokern/subr_unit.c: some style
Konstantin Belousov [Fri, 12 May 2023 22:37:35 +0000 (01:37 +0300)]
kern/subr_unit.c: some style

Use NBBY instead of spelling '8' literally.
Put space into the type specifier.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40089

14 months agosetkey(8): document NAT-T and NAT-T MTU extensions syntax
Konstantin Belousov [Sat, 27 May 2023 06:00:24 +0000 (09:00 +0300)]
setkey(8): document NAT-T and NAT-T MTU extensions syntax

Reviewed by: ae
Discussed with: bz
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40300

14 months agosetkey(8): NAT-T manual configuration support
Konstantin Belousov [Thu, 25 May 2023 10:41:15 +0000 (13:41 +0300)]
setkey(8): NAT-T manual configuration support

This is needed for testing of offload capabilities.

Reviewed by: ae
Discussed with: bz
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40300

14 months agosetkey(8): extract prefixlen calculation info helper
Konstantin Belousov [Thu, 25 May 2023 12:20:00 +0000 (15:20 +0300)]
setkey(8): extract prefixlen calculation info helper

While there, hide AF_INET case under #ifdef INET.

Reviewed by: ae
Discussed with: bz
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40300

14 months agoFix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Kirk McKusick [Mon, 29 May 2023 21:58:20 +0000 (14:58 -0700)]
Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.

When loading the root directory ensure that it is a directory
and has a size greater than the minimum directory size. If an
invalid root directory is found, fall back to full fsck.

Reported-by: Robert Morris
PR:           271414
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
14 months agoCleanups to fsck_ffs(8).
Kirk McKusick [Mon, 29 May 2023 21:54:52 +0000 (14:54 -0700)]
Cleanups to fsck_ffs(8).

When checking an inode ensure that it does not have a negative size.
Stop scaning a directory when an unallocated block is found.
Fully clear an inode when it is first allocated.
Ensure that an inode is marked dirty whenever it is updated and that
it has a correct check hash when it is released.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
14 months agonfsuserd: Improve failure message when running in a jail
Rick Macklem [Mon, 29 May 2023 20:38:07 +0000 (13:38 -0700)]
nfsuserd: Improve failure message when running in a jail

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

MFC after: 2 weeks

14 months agosiftr: sync-up man page with recent code changes, and cleanup code
Cheng Cui [Mon, 29 May 2023 14:53:11 +0000 (10:53 -0400)]
siftr: sync-up man page with recent code changes, and cleanup code

Reviewers: rscheff, tuexen
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40322

14 months agosiftr: fix a build error for powerpc and arm platforms
Cheng Cui [Mon, 29 May 2023 13:33:09 +0000 (09:33 -0400)]
siftr: fix a build error for powerpc and arm platforms

Summary: This is introduced by commit aa61cff4249c.

Reviewers: rscheff, tuexen
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40320

14 months agobcm2835_gpio: Handle BCM2711 pin configuration
Tetsuya Uemura [Sun, 28 May 2023 12:56:21 +0000 (09:56 -0300)]
bcm2835_gpio: Handle BCM2711 pin configuration

Add support for GPIO internal pull up/down configuration on RPi4 family.

BCM2711 SoC on 4th generation Raspberry Pi changed the way to configure
its GPIO pins' internal pull up/down resistors. NetBSD already have
support for this change, and port it to FreeBSD is trivial.

This patch, based on the NetBSD commit adds the appropriate method for
BCM2711 and now we can properly configure the GPIO pins' pull status.

PR: 256372
Reviewed by: mhorne
Obtained from: NetBSD bb88cfa64ad8
Pull Request: https://github.com/freebsd/freebsd-src/pull/746

14 months agolibpcap: Update PACKAGE_VERSION definition to 1.10.4
Joseph Mingrone [Mon, 29 May 2023 17:28:15 +0000 (14:28 -0300)]
libpcap: Update PACKAGE_VERSION definition to 1.10.4

Reviewed by:    kp
Fixes: 6f9cba8f8b5e (libpcap: Update to 1.10.3)
Fixes: dd744a896be3 (libpcap: Update to 1.10.4)
Sponsored by:   The FreeBSD Foundation

14 months agoarm64 pmap: Make VM_PAGE_TO_PV_LIST_LOCK() a constant-time operation
Alan Cox [Mon, 29 May 2023 06:01:37 +0000 (01:01 -0500)]
arm64 pmap: Make VM_PAGE_TO_PV_LIST_LOCK() a constant-time operation

The prior implementation of VM_PAGE_TO_PV_LIST_LOCK() performed a
linear-time search of the vm_phys_segs[] array.  However, in contrast to
PHYS_TO_PV_LIST_LOCK(), that search is unnecessary because every (non-
fictitious) vm_page contains the index of the vm_phys_seg in which it
resides.

Change most of the remaining uses of CHANGE_PV_LIST_LOCK_TO_PHYS() and
PHYS_TO_PV_LIST_LOCK() to CHANGE_PV_LIST_LOCK_TO_VM_PAGE() and
VM_PAGE_TO_PV_LIST_LOCK(), respectively.

Collectively, these changes also reduce the size of a GENERIC-NODEBUG
kernel's pmap.

Before:

  text   data    bss     dec       hex   filename
 70144   3200   2248   75592   0x12748   pmap.o

After:

  text   data    bss     dec       hex   filename
 69192   3200   2248   74640   0x12390   pmap.o

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

14 months agoApply clang fixes for crashes compiling ARM/AArch64 CRC intrinsics
Dimitry Andric [Mon, 29 May 2023 14:27:58 +0000 (16:27 +0200)]
Apply clang fixes for crashes compiling ARM/AArch64 CRC intrinsics

Merge commit 069ecd0c6e2c from llvm-project (by Fangrui Song):

  [ARM] Check target feature support for __builtin_arm_crc*

  `__builtin_arm_crc*` requires the target feature crc which is available on armv8
  and above. Calling the fuctions for armv7 leads to a SelectionDAG crash.

  ```
  % clang -c --target=armv7-unknown-linux-gnueabi -c a.c
  fatal error: error in backend: Cannot select: intrinsic %llvm.arm.crc32b
  PLEASE submit a bug report to ...
  ```

  Add `TARGET_BUILTIN` and define required features for these builtins to
  report an error in `CodeGenFunction::checkTargetFeatures`. The problem is quite widespread.
  I will add `TARGET_BUILTIN` for more builtins later.

  Fix https://github.com/llvm/llvm-project/issues/57802

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

Merge commit b2d7a0dcf1ff from llvm-project (by Fangrui Song):

  [AArch64] Check target feature support for __builtin_arm_crc*

  This is the AArch64 counterpart of D134127.
  Daniel Kiss will change more `BUILTIN` to `TARGET_BUILTIN`.

  Fix #57802

Note that programs attempting to use ARM/AArch64 CRC intrinsics, when
they are not supported by the targeted CPU, will still receive a regular
compilation error (instead of a fatal backend error) similar to:

  7zCrc.c:4:10: error: '__builtin_arm_crc32b' needs target feature crc
    return __builtin_arm_crc32b(a, b);
           ^

Reported by: Alastair Hogge <agh@riseup.net>
PR: 271624
MFC after: 3 days

14 months agosiftr: three changes that improve performance
Cheng Cui [Sat, 27 May 2023 09:02:11 +0000 (05:02 -0400)]
siftr: three changes that improve performance

Summary:
(1) use inp_flowid or a new packet hash for a flow identification
(2) cache constant connection info into struct flow_hash_node
(3) use compressed notation for IPv6 address representation

Reviewers: rscheff, tuexen
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40302

14 months agolinux(4): Regen for linux_execve
Dmitry Chagin [Mon, 29 May 2023 09:18:30 +0000 (12:18 +0300)]
linux(4): Regen for linux_execve

MFC after: 2 month

14 months agolinux(4): Add a dedicated linux_exec_copyin_args()
Dmitry Chagin [Mon, 29 May 2023 09:18:16 +0000 (12:18 +0300)]
linux(4): Add a dedicated linux_exec_copyin_args()

Because Linux allows to exec binaries with 0 argc.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D40148
MFC after: 2 month

14 months agovfs: Retire kern_alternate_path() as unused anymore
Dmitry Chagin [Mon, 29 May 2023 08:19:41 +0000 (11:19 +0300)]
vfs: Retire kern_alternate_path() as unused anymore

From now a non-native ABI should use pwd_altroot() ability to tell
to the namei() its root directory to dynamically reroots lookups.

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

14 months agolinux(4): Make linux_emul_path private
Dmitry Chagin [Mon, 29 May 2023 08:19:08 +0000 (11:19 +0300)]
linux(4): Make linux_emul_path private

There is no need to refer to linux_emul_path from outside anymore.

MFC after: 2 month

14 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

14 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

14 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

14 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

14 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

14 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

14 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

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

14 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

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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

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

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

14 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

14 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

14 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

14 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

14 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

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

14 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

14 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

14 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

14 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

14 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

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

14 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

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

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

14 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

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

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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

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

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

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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

14 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

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

14 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