]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 months agosysctl kern.supported_archs: return correct value
Konstantin Belousov [Thu, 16 Nov 2023 21:58:45 +0000 (23:58 +0200)]
sysctl kern.supported_archs: return correct value

in case COMPAT_FREEBSD32 was enabled in config but hardware does not
support executing 32bit binaries.

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

7 months agoFEATURE compat_freebsd_32bit: only report on arm64 when support is present
Konstantin Belousov [Thu, 16 Nov 2023 21:06:36 +0000 (23:06 +0200)]
FEATURE compat_freebsd_32bit: only report on arm64 when support is present

depending on hardware support for aarch32.

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

7 months agosys/sysctl.h: FEATURE_ADD()
Konstantin Belousov [Mon, 20 Nov 2023 22:43:07 +0000 (00:43 +0200)]
sys/sysctl.h: FEATURE_ADD()

A macro to dynamically register report of the kernel feature.

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

7 months agoarm64: Mark the armv8 crc32c as supporting BTI
Andrew Turner [Tue, 14 Nov 2023 15:01:58 +0000 (15:01 +0000)]
arm64: Mark the armv8 crc32c as supporting BTI

This is built into a test so needs the BTI elf note for the rest of the
test to be built with BTI support enabled.

As the assembly uses the ENTRY macro it already supports BTI, so mark
it as such.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42595

7 months agoarm64: Set the Guarded Page flag in the kernel
Andrew Turner [Tue, 3 Oct 2023 14:03:51 +0000 (15:03 +0100)]
arm64: Set the Guarded Page flag in the kernel

Now the kernel and modules are built with branch protection we can
enablethe Guarded Page flag in the page tables. This causes indirect
branches to a location without a correct landing pad instruction to
raise an exception.

This should help mitigate some attacks where a function pointer is
changed to point somewhere other than the start of the function,
however it doesn't stop an attacker pointing it to an unintended
function.

Reviewed by: alc, scottph (both earlier version), markj
Sponsored by: Arm Ltd
Sponsored by: The FreeBSD Foundation (earlier version)
Differential Revision: https://reviews.freebsd.org/D42080

7 months agolibc: Teach libc about the BTI elf note
Andrew Turner [Thu, 12 Oct 2023 14:22:18 +0000 (15:22 +0100)]
libc: Teach libc about the BTI elf note

Add the Branch Target Identification (BTI) note to libc assembly
sources. As all obect files need the note for the library to have it
we need to insert it in all asm files.

Reviewed by: emaste, markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42228

7 months agoarm64: Remove an old comment
Andrew Turner [Wed, 15 Nov 2023 18:18:15 +0000 (18:18 +0000)]
arm64: Remove an old comment

This was missed when removing kern_delta

Sponsored by: Arm Ltd

7 months agostand: bandaide for acpi
Warner Losh [Tue, 21 Nov 2023 03:30:16 +0000 (20:30 -0700)]
stand: bandaide for acpi

Old binaries do not set acpi.rsdp early enough. So when we boot with an
older loader.efi from an ESP that's not been updated, we assume there's
no ACPI on this system. This is unwise. Put a band-aide on this until we
can implement a proper 'feature' variable that the binary reports so we
can do conditionals for things like this in the future.

This is at best a rapid-response stop-gap.

Glanced at by: kevans
Sponsored by: Netflix

7 months agoMakefile.inc1: Remove beri straggler
Warner Losh [Tue, 21 Nov 2023 03:30:02 +0000 (20:30 -0700)]
Makefile.inc1: Remove beri straggler

Beri's boot loader needed md5 to build. It was the only thing that
needed that, so remove it (confirmed with univers and grep).

Sponsored by: Netflix

7 months agobhyve: increase fbuf display resolution limit
Robert Wing [Tue, 21 Nov 2023 01:17:53 +0000 (16:17 -0900)]
bhyve: increase fbuf display resolution limit

This enables connecting to the VNC server at a higher resolution.

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

7 months agozfs: merge openzfs/zfs@a94860a6d
Martin Matuska [Tue, 21 Nov 2023 00:39:04 +0000 (01:39 +0100)]
zfs: merge openzfs/zfs@a94860a6d

Notable upstream pull request merges:
 #15511 92dc4ad83 Consider `dnode_t` allocations in dbuf cache size accounting
 #15514 22c8c33a5 Use abd_zero_off() where applicable
 #15515 5a3bffab1 ZIO: Optimize zio_flush()
 #15527 cd67bc0ae freebsd: remove __FBSDID macro use

Obtained from: OpenZFS
OpenZFS commit: a94860a6dee1c07bb96ee36dafcba40b804560cc

7 months agopf: Remove __FBSDID() macro use
Brooks Davis [Tue, 21 Nov 2023 00:21:11 +0000 (00:21 +0000)]
pf: Remove __FBSDID() macro use

These are local additions that no longer make sense with the transition
to git.

This partially reverts a10f530f936b7b2e3a19c406ae199b91a48f34d3.

Reviewed by: kp, imp
Differential Revision: https://reviews.freebsd.org/D42687

7 months agoRemove __FBSDID from netbsd libc sources
Brooks Davis [Tue, 21 Nov 2023 00:21:11 +0000 (00:21 +0000)]
Remove __FBSDID from netbsd libc sources

I added them per then-current practice when I imported them, but now
they are just gratuious local diffs.

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

7 months agovis: relocate _DIAGASSERT() define
Brooks Davis [Tue, 21 Nov 2023 00:21:11 +0000 (00:21 +0000)]
vis: relocate _DIAGASSERT() define

Other similar files from NetBSD define it unconditionally as a local
diff.

Reviewed by: imp (as part of D42686)

7 months agoZTS: Fix 'could not unmount datasets' on Alma 9 (#15542)
Tony Hutter [Tue, 21 Nov 2023 00:07:32 +0000 (16:07 -0800)]
ZTS: Fix 'could not unmount datasets' on Alma 9 (#15542)

Many tests are failing on AlmaLinux 9 because ZTS could not destroy the
pool in cleanup.  This was due to $PWD being set to '.' instead of the
expected full path.  This patch sets $PWD to the full path.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Don Brady <don.brady@delphix.com>
7 months agoinpcb: garbage collect in_pcbnotifyall()
Gleb Smirnoff [Mon, 20 Nov 2023 22:38:31 +0000 (14:38 -0800)]
inpcb: garbage collect in_pcbnotifyall()

7 months agotests/netgraph: start ng_socket test suite
Gleb Smirnoff [Mon, 20 Nov 2023 22:36:58 +0000 (14:36 -0800)]
tests/netgraph: start ng_socket test suite

Just one check now, check node name.

7 months agoFix share/zoneinfo for DIRDEPS_BUILD
Simon J. Gerraty [Mon, 20 Nov 2023 20:51:25 +0000 (12:51 -0800)]
Fix share/zoneinfo for DIRDEPS_BUILD

The tranditional build makes multiple passes through the tree.
The DIRDEPS_BUILD visits each directory only once per architecture,
thus makefiles should be able to everything they need in a single pass.

The use of TZS!= when doing make(*install*)
only works if the directory has previously been visited to do zoneinfo
since before the zoneinfo target is run TZS will be empty.

To fix this, have the zoneinfo target capture the list of files to
zoneinfo, and install-zoneinfo use that list.
Rename that target to zonefiles - since that is now what it does.

This is more efficient - we only gather the list of zones when it is
likely to have changed, and allows the makefile to do everything in a
single pass.

Reviewed by: stevek
Differential Revision: https://reviews.freebsd.org/D42624

7 months agoAdd myself (akiyano) to calendar.freebsd
Arthur Kiyanovski [Sun, 19 Nov 2023 14:35:37 +0000 (14:35 +0000)]
Add myself (akiyano) to calendar.freebsd

Approved by: cperciva (mentor)

7 months agoloader: improve lua ACPI detection and handling
R. Christian McDonald [Mon, 20 Nov 2023 17:13:08 +0000 (12:13 -0500)]
loader: improve lua ACPI detection and handling

This is a follow-up patch to https://reviews.freebsd.org/D42459
that modifies the loader lua to use the correct loader variables
for determining ACPI availability.

This also fixes a bug where ACPI can be inadvertently disabled when
setting System Defaults at the loader menu.

Reviewed by: imp, kevans
Approved by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D42483

7 months agoloader: fix EFI ACPI detection
R. Christian McDonald [Mon, 20 Nov 2023 17:02:24 +0000 (12:02 -0500)]
loader: fix EFI ACPI detection

lua was previously unable to determine ACPI presence because this
probing was postponed until the final loading and execution of the
kernel.

This patch resolves that by detecting ACPI early (similar to
the order of operations in the legacy i386 loader).

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

7 months agocommitters-src: Add rcm as a src committer and kp as mentor
R. Christian McDonald [Mon, 20 Nov 2023 14:43:23 +0000 (09:43 -0500)]
committers-src: Add rcm as a src committer and kp as mentor

Approved by: kp

7 months agopf tests: fix name and description of divert-to cases
Igor Ostapenko [Sun, 19 Nov 2023 12:23:44 +0000 (14:23 +0200)]
pf tests: fix name and description of divert-to cases

Reflect the correct order of events for dummynet+ipdivert.

7 months agopf.conf.5: revise divert-to and divert-reply
Igor Ostapenko [Fri, 17 Nov 2023 20:01:17 +0000 (22:01 +0200)]
pf.conf.5: revise divert-to and divert-reply

7 months agoldconfig: filter out non-existing directories from default path
Konstantin Belousov [Thu, 16 Nov 2023 05:38:00 +0000 (07:38 +0200)]
ldconfig: filter out non-existing directories from default path

This is done only for ld-elf32.so.1, where /lib32 is kept in the path
due to the way STANDARD_LIBRARY_PATH is defined in rtld_paths.h.

This change fixes innocent warning appearing after
99132daf6f70cb0cc969c555d3612547fa3cf1db

Reviewed by: dim, emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42626

7 months agopseudofs: fix off by one in hash iteration in pfs_purge
Alvin Chen [Mon, 20 Nov 2023 05:55:35 +0000 (05:55 +0000)]
pseudofs: fix off by one in hash iteration in pfs_purge

Sponsored by: Dell Technologies
Differential Revision: https://reviews.freebsd.org/D42628

7 months agomath: Move to const instead of __const
Warner Losh [Mon, 20 Nov 2023 03:48:30 +0000 (20:48 -0700)]
math: Move to const instead of __const

There's no reason to use the __const construct here. This is a left-over
from supporting K&R and ANSI compilers in the original Sun msun. All
other K&R crutches have been removed. Remove these as well. There's no
semantic difference. And there's already several others in math.h.

Sponsored by: Netflix

7 months agocdefs: remove __GNUCLIKE_MATH_BUILTIN_CONSTANTS
Warner Losh [Mon, 20 Nov 2023 02:36:51 +0000 (19:36 -0700)]
cdefs: remove __GNUCLIKE_MATH_BUILTIN_CONSTANTS

Exp Run PR: 275123
Sponsored by: Netflix

7 months agocdefs: Remove __GNUCLIKE_ASM
Warner Losh [Mon, 20 Nov 2023 02:36:46 +0000 (19:36 -0700)]
cdefs: Remove __GNUCLIKE_ASM

It's no longer used in the tree.

Exp Run PR: 275123
Sponsored by: Netflix

7 months agocdefs: Remove __GNUCLIKE___TYPEOF from cdefs.h
Warner Losh [Mon, 20 Nov 2023 02:35:53 +0000 (19:35 -0700)]
cdefs: Remove __GNUCLIKE___TYPEOF from cdefs.h

It's been unused for quite some time, so remove it from sys/cdefs.h.

Exp Run PR: 275123
Sponsored by: Netflix

7 months agovfs: dodge locking for lseek(fd, 0, SEEK_CUR)
Mateusz Guzik [Sun, 19 Nov 2023 22:23:20 +0000 (22:23 +0000)]
vfs: dodge locking for lseek(fd, 0, SEEK_CUR)

It is very common and according to dtrace while running poudriere almost
all calls with SEEK_CUR pass 0.

7 months agoif_tuntap: add LRO support to tap devices
Michael Tuexen [Sun, 19 Nov 2023 14:57:53 +0000 (15:57 +0100)]
if_tuntap: add LRO support to tap devices

This allows testing the LRO code with packetdrill in local mode.

Reviewed by: rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D42548

7 months agoAdd akiyano as src committer and cperciva as mentor
Arthur Kiyanovski [Thu, 16 Nov 2023 22:54:51 +0000 (22:54 +0000)]
Add akiyano as src committer and cperciva as mentor

Approved by: cperciva (mentor)

7 months agocat: fallback on EISDIR with copy_file_range(2)
Martin Matuska [Sun, 19 Nov 2023 01:09:34 +0000 (02:09 +0100)]
cat: fallback on EISDIR with copy_file_range(2)

The filesystem may support reading directories directly
when security.bsd.allow_read_dir is set.

MFC after: 1 week
PR: 275099

7 months agoMove "jail -e" out of the rest of jail(8) flow.
Jamie Gritton [Sat, 18 Nov 2023 20:47:50 +0000 (12:47 -0800)]
Move "jail -e" out of the rest of jail(8) flow.

7 months agobsdinstall.8: Clarify the description of ZFSBOOT_FORCE_4K_SECTORS
John Baldwin [Sat, 18 Nov 2023 19:31:07 +0000 (11:31 -0800)]
bsdinstall.8: Clarify the description of ZFSBOOT_FORCE_4K_SECTORS

This variable does not set the exact sector size of the pool, but
controls the minimum sector size.  The sector size of the underlying
disks can always be larger than the minium controlled by this knob.

PR: 274513
Reported by: Albin "a12l" Otterhäll <bugs.freebsd.org@a12l.xyz>

7 months agobsdinstall zfsboot: Don't override ZFSBOOT_FORCE_4K_SECTORS if it is null.
John Baldwin [Sat, 18 Nov 2023 19:18:29 +0000 (11:18 -0800)]
bsdinstall zfsboot: Don't override ZFSBOOT_FORCE_4K_SECTORS if it is null.

Only set a default value of 1 if the shell variable is unset.  This allows
installer scripts to disable the variable.

PR: 274513
Reported by: Albin "a12l" Otterhäll <bugs.freebsd.org@a12l.xyz>
Differential Revision: https://reviews.freebsd.org/D42319

7 months agovfs mount: Consistently use ENODEV internally for an invalid fstype
John Baldwin [Sat, 18 Nov 2023 19:08:34 +0000 (11:08 -0800)]
vfs mount: Consistently use ENODEV internally for an invalid fstype

Change vfs_byname_kld to always return an error value of ENODEV to
indicate an unsupported fstype leaving ENOENT to indicate errors such
as a missing mount point or invalid path.  This allows nmount(2) to
better distinguish these cases and avoid treating a missing device
node as an invalid fstype after commit 6e8272f317b8.

While here, change mount(2) to return EINVAL instead of ENODEV for an
invalid fstype to match nmount(2).

PR: 274600
Reviewed by: pstef, markj
Differential Revision: https://reviews.freebsd.org/D42327

7 months agoSpaces to tabs for consistency. No content change.
Jens Schweikhardt [Sat, 18 Nov 2023 15:05:22 +0000 (16:05 +0100)]
Spaces to tabs for consistency. No content change.

7 months agoApply non-abrasive script-cleaning fluid.
Jens Schweikhardt [Sat, 18 Nov 2023 10:58:26 +0000 (11:58 +0100)]
Apply non-abrasive script-cleaning fluid.

* consistent use of tabs
* consistent quoting of parameters
* if/then cosmetics to match rc.subr style

7 months agoAdd a HISTORY section for memcpy(3) and mempcpy(3)
Gordon Bergling [Sat, 18 Nov 2023 09:09:40 +0000 (10:09 +0100)]
Add a HISTORY section for memcpy(3) and mempcpy(3)

The memcpy() function first appeared in AT&T System V UNIX and was
reimplemented for 4.3BSD-Tahoe. The mempcpy() function first appeared in
FreeBSD 13.1.

PR: 272227
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42630

7 months agogetpeerid.3: Clarify the 's' argument
Gordon Bergling [Sat, 18 Nov 2023 09:02:12 +0000 (10:02 +0100)]
getpeerid.3: Clarify the 's' argument

The argument 's' of getpeerid(3) must be a connected UNIX-domain socket,
so document it.

PR: 248614
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42629

7 months agonvme: Don't use version to listen for events for ns and fw changes
Warner Losh [Sat, 18 Nov 2023 04:24:00 +0000 (21:24 -0700)]
nvme: Don't use version to listen for events for ns and fw changes

Instead, use the attribtue bits from the identification data to
determine if we should listen to namespace changes and firmware
activation. Should have no functional change, though we may stop
listening for events that will never happen.

Sponsored by: Netflix

7 months agotraceroute: Remove stray __P
Warner Losh [Sat, 18 Nov 2023 03:48:48 +0000 (20:48 -0700)]
traceroute: Remove stray __P

Remove stray __P(). It's no longer needed, and since the whole rest of
the file lacks them, it's not very useful.

Sponsored by: Netflix

7 months agopnpinfo: Remove __P
Warner Losh [Sat, 18 Nov 2023 03:46:20 +0000 (20:46 -0700)]
pnpinfo: Remove __P

We don't need to compile on a K&R compiler (and we've long ago lost the
ability to do so). It's not even clear if it ever worked with a pure K&R
compiler, but maybe it once did...

Sponsored by: Netflix

7 months agomakesyscalls: don't make syscall.mk by default
Brooks Davis [Sat, 18 Nov 2023 00:48:14 +0000 (00:48 +0000)]
makesyscalls: don't make syscall.mk by default

We only want to produce syscall.mk for the main syscall table so default
to not producing it (send it to /dev/null) and add a syscalls.conf to
sys/kern to trigger the creation of sys/sys/syscall.mk.  This eliminates
the need for entries in other syscalls.conf files and is a cleaner
pattern going forward.

Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D42663

7 months agoSpacing and alignment cleanups.
Kirk McKusick [Fri, 17 Nov 2023 22:39:13 +0000 (14:39 -0800)]
Spacing and alignment cleanups.

No functional change.

MFC-after: 1 week

7 months agopf: sctp heartbeats confirm a connection
Kristof Provost [Fri, 17 Nov 2023 12:52:34 +0000 (13:52 +0100)]
pf: sctp heartbeats confirm a connection

When we create a new state for multihomed sctp connections (i.e.
based on INIT/INIT_ACK or ASCONF parameters) the new connection will
never see a COOKIE/COOKIE_ACK exchange. We should consider HEARTBEAT_ACK
to be a confirmation that the connection is established.

This ensures that such connections do not time out earlier than
expected.

MFC after: 1 week
Sponsored by: Orange Business Services

7 months agopf: skip urpf check for sctp multihomed states
Kristof Provost [Thu, 16 Nov 2023 19:55:02 +0000 (20:55 +0100)]
pf: skip urpf check for sctp multihomed states

When we create a new state for multihomed sctp connections (i.e.
based on INIT/INIT_ACK or ASCONF parameters) we cannot know what
interfaces we'll be seeing that traffic on. These states are floating
states, i.e. on "all" interfaces. We cannot do reverse path filtering
for these states, so do not do so.

MFC after: 1 week
Sponsored by: Orange Business Services

7 months agopf: always create multihomed states as floating
Kristof Provost [Thu, 16 Nov 2023 16:06:29 +0000 (17:06 +0100)]
pf: always create multihomed states as floating

When we create a new state for multihomed sctp connections (i.e.
based on INIT/INIT_ACK or ASCONF parameters) we cannot know what
interfaces we'll be seeing that traffic on. Make those states floating,
irrespective of state policy.

MFC after: 1 week
Sponsored by: Orange Business Services

7 months agoEnsure I/O buffers in libufs(3) are 128-byte aligned.
Kirk McKusick [Fri, 17 Nov 2023 22:10:29 +0000 (14:10 -0800)]
Ensure I/O buffers in libufs(3) are 128-byte aligned.

Various disk controllers require their buffers to be aligned to a
cache-line size (128 bytes). For buffers allocated in structures,
ensure that they are 128-byte aligned. Use aligned_malloc to allocate
memory to ensure that the returned memory is 128-byte aligned.

While we are here, we replace the dynamically allocated inode buffer
with a buffer allocated in the uufsd structure just as the superblock
and cylinder group buffers do.

This can be removed if/when the kernel is fixed. Because this problem
has existed on one I/O subsystem or another since the 1990's, we
are probably stuck with dealing with it forever.

The problem most recent showed up in Azure, see:
    https://reviews.freebsd.org/D41728
    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267654
Before these fixes were applied, it was confirmed that the changes
in this commit also fixed the issue in Azure.

Reviewed-by: Warner Losh, kib
Tested-by: Souradeep Chakrabarti of Microsoft (earlier version)
PR:          267654
Differential Revision: https://reviews.freebsd.org/D41724

7 months agofreebsd: remove __FBSDID macro use
Brooks Davis [Fri, 17 Nov 2023 22:02:09 +0000 (14:02 -0800)]
freebsd: remove __FBSDID macro use

With FreeBSD's switch to git the $FreeBSD$ string is no longer expanded
and they have mostly been removed upstream.  Stop using __FBSDID and
remove the no-longer needed sys/cdefs.h includes.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Brooks Davis <brooks.davis@sri.com>
Closes #15527

7 months agoZIO: Optimize zio_flush()
Alexander Motin [Fri, 17 Nov 2023 22:00:59 +0000 (17:00 -0500)]
ZIO: Optimize zio_flush()

- Generalize vdev_nowritecache handling by traversing through the
VDEV tree and skipping children ZIOs where not supported.
 - Remove intermediate zio_null() in case of several VDEV children.
 - Remove children handling from zio_ioctl().  There are no other
use cases for this code beside DKIOCFLUSHWRITECACHED, and would there
be, I doubt they would so straightforward apply to all VDEV children.

Comparing to removed previous optimization this should improve cases
of redundant ZILs/SLOGs.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15515

7 months agoUse abd_zero_off() where applicable
Alexander Motin [Fri, 17 Nov 2023 21:28:32 +0000 (16:28 -0500)]
Use abd_zero_off() where applicable

In several places abd_zero() cleaned ABD filled at the next line.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15514

7 months agoConsider `dnode_t` allocations in dbuf cache size accounting
Rob N [Fri, 17 Nov 2023 21:25:53 +0000 (08:25 +1100)]
Consider `dnode_t` allocations in dbuf cache size accounting

Entries in the dbuf cache contribute only the size of the dbuf data to
the cache size. Attached "user" data is not counted. This can lead to
the data currently "owned" by the cache consuming more memory accounting
appears to show. In some cases (eg a metadnode data block with all child
dnode_t slots allocated), the actual size can be as much as 3x as what
the cache believes it to be.

This is arguably correct behaviour, as the cache is only tracking the
size of the dbuf data, not even the overhead of the dbuf_t. On the other
hand, in the above case of dnodes, evicting cached metadnode dbufs is
the only current way to reclaim the dnode objects, and can lead to the
situation where the dbuf cache appears to be comfortably within its
target memory window and yet is holding enormous amounts of slab memory
that cannot be reclaimed.

This commit adds a facility for a dbuf user to artificially inflate the
apparent size of the dbuf for caching purposes. This at least allows for
cache tuning to be adjusted to match something closer to the real memory
overhead.

metadnode dbufs carry a >1KiB allocation per dnode in their user data.
This informs the dbuf cache machinery of that fact, allowing it to make
better decisions when evicting dbufs.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #15511

7 months agoFix memory leak in zfs_setprocinit code
Paul Dagnelie [Fri, 17 Nov 2023 21:21:04 +0000 (13:21 -0800)]
Fix memory leak in zfs_setprocinit code

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #15508

7 months agokhelp: suppress useless warning message on shutdown
Mike Karels [Fri, 17 Nov 2023 18:51:18 +0000 (12:51 -0600)]
khelp: suppress useless warning message on shutdown

If a module (e.g. the ertt hhook for TCP) can't clean up at
shutdown, there is nothing to be done about it.  In the ertt case,
cleanup is just shutting down a UMA zone, which doesn't need to be
done.  Suppress EBUSY warnings on shutdown.

PR: 271677
Reviewed by: tuexen, imp
Differential Revision: https://reviews.freebsd.org/D42650

7 months agoSEE ALSO section improvements for tuning(7), tunefs(8) and fsck_ffs(8)
Gordon Bergling [Fri, 17 Nov 2023 18:24:22 +0000 (19:24 +0100)]
SEE ALSO section improvements for tuning(7), tunefs(8) and fsck_ffs(8)

cross-reference ffs(7) in fsck_ffs(8)
cross-reference ffs(7) and tuning(7) in tunefs(8)
cross-reference ffs(7) in tuning(7)

PR: 263433
Reviewed by: bcr
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D42631

7 months agoFix typo in previous d282baddb0b02, breaking DTrace.
Alexander Motin [Fri, 17 Nov 2023 17:41:41 +0000 (12:41 -0500)]
Fix typo in previous d282baddb0b02, breaking DTrace.

7 months agong_ksocket: fix accept(2)
Gleb Smirnoff [Fri, 17 Nov 2023 17:24:30 +0000 (09:24 -0800)]
ng_ksocket: fix accept(2)

- Provide listen upcall and set it on NGM_KSOCKET_LISTEN
- Mask EWOULDBLOCK on NGM_KSOCKET_ACCEPT

Reviewed by: afedorov
Differential Revision: https://reviews.freebsd.org/D42637
PR: 272319
PR: 275106
Fixes: 779f106aa169256b7010a1d8f963ff656b881e92

7 months agong_ksocket: fix upcall clearing on node shutdown
Gleb Smirnoff [Fri, 17 Nov 2023 17:23:58 +0000 (09:23 -0800)]
ng_ksocket: fix upcall clearing on node shutdown

Note: imho, the proper solution would be to guarantee that upcalls
won't ever be called after soclose(), but this isn't the case, yet.
This change at least makes the node work the way it always worked.

Reviewed by: afedorov
Differential Revision: https://reviews.freebsd.org/D42636
PR: 272319
PR: 275106
Fixes: 779f106aa169256b7010a1d8f963ff656b881e92

7 months agoFix a comment typo.
Brad Davis [Fri, 17 Nov 2023 17:06:36 +0000 (10:06 -0700)]
Fix a comment typo.

7 months agopf: fix dummynet + ipdivert use case
Igor Ostapenko [Fri, 17 Nov 2023 16:04:01 +0000 (17:04 +0100)]
pf: fix dummynet + ipdivert use case

Dummynet re-injects an mbuf with MTAG_IPFW_RULE added, and the same mtag
is used by divert(4) as parameters for packet diversion.

If according to pf rule set a packet should go through dummynet first
and through ipdivert after then mentioned mtag must be removed after
dummynet not to make ipdivert think that this is its input parameters.

At the very beginning ipfw consumes this mtag what means the same
behavior with tag clearing after dummynet.

And after fabf705f4b5a pf passes parameters to ipdivert using its
personal MTAG_PF_DIVERT mtag.

PR: 274850
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D42609

7 months agodirdeps: Fix libpcap Makefile.depend.options
Ka Ho Ng [Fri, 17 Nov 2023 16:34:57 +0000 (11:34 -0500)]
dirdeps: Fix libpcap Makefile.depend.options

This prevents libpcap's Makefile.depend from flip-flopping when OFED is
enabled.

Sponsored by : Juniper Networks, Inc.
MFC after: 7 days
Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D42649

7 months agoktls tests: Relax error checking for shutdown(2) a bit
Mark Johnston [Fri, 17 Nov 2023 14:29:28 +0000 (09:29 -0500)]
ktls tests: Relax error checking for shutdown(2) a bit

In my test suite runs I occasionally see shutdown(2) fail with
ECONNRESET rather than ENOTCONN.  soshutdown(2) will return ENOTCONN if
the socket has been disconnected (synchronized by the socket lock), and
tcp_usr_shutdown() will return ECONNRESET if the inpcb has been dropped
(synchronized by the inpcb lock).  I think it's possible to pass the
first check in soshutdown() but fail the second check in
tcp_usr_shutdown(), so modify the KTLS tests to permit this.

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

7 months agomii: add Vitesse/Microsemi VSC8514
Bjoern A. Zeeb [Fri, 17 Nov 2023 12:31:36 +0000 (12:31 +0000)]
mii: add Vitesse/Microsemi VSC8514

The VSC8514 Quad-Port 10/100/1000BASE-T PHY seems to match the handling
for the VSC8504 (for the little we support of what we could) and while
it works with our generic ukphy add it as vscphy for porper display of
names in the system message buffer and the like (or in case we decide
to implement some extra features).

Tested on: Ten64
MFC after: 3 days

7 months agomii: resort VSC8641 entry in miidevs
Bjoern A. Zeeb [Fri, 17 Nov 2023 12:26:28 +0000 (12:26 +0000)]
mii: resort VSC8641 entry in miidevs

VSC8641 is a ciphy not a vscphy.
Sort it with the other entries of ciphy to avoid confusion.

MFC after: 3 days

7 months agolibpfctl: handle pfctl_do_ioctl() failures better
Kristof Provost [Fri, 17 Nov 2023 09:19:38 +0000 (10:19 +0100)]
libpfctl: handle pfctl_do_ioctl() failures better

Ensure that we free nvlists and other allocations if pfctl_do_ioctl()
fails.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

7 months agolibpfctl: handle allocation failure
Kristof Provost [Fri, 17 Nov 2023 09:14:59 +0000 (10:14 +0100)]
libpfctl: handle allocation failure

While it's unlikely for userspace to fail to allocate memory it is still
possible. Handle malloc() returning NULL.

Reported by: Bill Meeks <bill@themeeks.net>
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

7 months agodpaa2: fdt improve detection for dpmac/phys
Bjoern A. Zeeb [Wed, 15 Nov 2023 13:13:22 +0000 (13:13 +0000)]
dpaa2: fdt improve detection for dpmac/phys

'pcs-handles' are not mandatory in the device tree here so do not
enforce them.  This allows us to find dpmac entries needed for phys
on the WHLE-LS1 as well.

MFC after: 3 days
Reviewed by: jceel, dsl
Differential Revision: https://reviews.freebsd.org/D42644

7 months agodpaa2: defer link_state updates until we are up
Bjoern A. Zeeb [Fri, 17 Nov 2023 00:47:11 +0000 (00:47 +0000)]
dpaa2: defer link_state updates until we are up

dpaa2_ni_media_change() was called in early setup stages, before we
were fully setup.  That lead to internal driver state being all synched
and fine but hardware state was lost/never setup corrently.

Introduce dpaa2_ni_media_change_locked() so we can avoid reccursive
locking and call "dpaa2_ni_media_change()" instead of mii_mediachg()
as the latter does not setup our state there either.

In order for this all to work, call if_setdrvflagbits() just before
rather than after the above.

Also remove an unecessary direct call to dpaa2_ni_miibus_statchg()
which mii_mediachg() will trigger anyway.

This all fixes a problem [1] that one had to lose the link (either
unplugging/replugging the cable or using ifconfig media none;
ifconfig media auto) to re-trigger the all updates and get the
full state programmed when hardware expected.

MFC after: 3 days
GH-Issue: https://github.com/mcusim/freebsd-src/issues/21 [1]
Reviewed by: dsl, dch
Differential Revision: https://reviews.freebsd.org/D42643

7 months agodpaa2: make software VLANs usable on dpni
Bjoern A. Zeeb [Wed, 15 Nov 2023 11:46:44 +0000 (11:46 +0000)]
dpaa2: make software VLANs usable on dpni

dpni announces IFCAP_VLAN_MTU but internally does not increase the
maximum frame length.  Createing a vlan interface on top of a dpni
interface will result in full-sized frames not passing.
Extend the maximum frame length by ETHER_VLAN_ENCAP_LEN to allow at
least for one layer of (software) vlans for now

MFC after: 3 days
GH-Issue: https://github.com/mcusim/freebsd-src/issues/22
Reviewed by: dsl
Differential Revision: https://reviews.freebsd.org/D42645

7 months agoAdd a tunable to disable BRT support.
Rich Ercolani [Thu, 16 Nov 2023 19:35:22 +0000 (14:35 -0500)]
Add a tunable to disable BRT support.

Copy the disable parameter that FreeBSD implemented, and extend it to
work on Linux as well, until we're sure this is stable.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #15529

7 months agoPackaging: Auto-generate changelog during configure (#15528)
Umer Saleem [Thu, 16 Nov 2023 16:58:47 +0000 (21:58 +0500)]
Packaging: Auto-generate changelog during configure (#15528)

Auto-generate changelog based off on @VERSION@ during configure,
so that it is not needed to be update with new releases / version
updates.

Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
7 months ago[tcp] add PRR 6937bis heuristic and retire prr_conservative sysctl
Richard Scheffenegger [Wed, 15 Nov 2023 21:37:42 +0000 (22:37 +0100)]
[tcp] add PRR 6937bis heuristic and retire prr_conservative sysctl

Improve Proportional Rate Reduction (RFC6937) by using a
heuristic, which automatically chooses between
conservative CRB and more aggressive SSRB modes.
Only when snd_una advances (a partial ACK), SSRB may be
used. Also, that ACK must not have any indication of
ongoing loss - using the addition of new holes into the
scoreboard as proxy for such an event.

MFC after: 4 weeks
Reviewed By: #transport, kbowling, rrs
Sponsored By: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28822

7 months agozfs: update zfs_config.h and zfs_gitrev.h missed in 47bb16f8f0
Martin Matuska [Fri, 17 Nov 2023 09:00:16 +0000 (10:00 +0100)]
zfs: update zfs_config.h and zfs_gitrev.h missed in 47bb16f8f0

7 months agozfs: merge openzfs/zfs@03e9caaec
Martin Matuska [Fri, 17 Nov 2023 08:39:42 +0000 (09:39 +0100)]
zfs: merge openzfs/zfs@03e9caaec

Notable upstream pull request merges:
 #15516 da51bd17e Fix snap_obj_array memory leak in check_filesystem()
 #15519 35da34516 L2ARC: Restrict write size to 1/4 of the device
 #15529 03e9caaec Add a tunable to disable BRT support

Obtained from: OpenZFS
OpenZFS commit: 03e9caaec006134b3db9d02ac40fe9369ee78b03

7 months agotcp: remove extraneous network epoch entry
Gleb Smirnoff [Fri, 17 Nov 2023 02:30:35 +0000 (18:30 -0800)]
tcp: remove extraneous network epoch entry

accept(2) on IPv6 TCP doesn't need epoch.  Some leaf functions may
need it, but they will enter accordingly, see sa6_recoverscope().

Reviewed by: rscheff, tuexen (implicitly, see deleted XXXMT)
Differential Revision: https://reviews.freebsd.org/D42634

7 months agovn_lock_pair(): reasonably handle vp1 == vp2 case
Konstantin Belousov [Thu, 16 Nov 2023 22:42:25 +0000 (00:42 +0200)]
vn_lock_pair(): reasonably handle vp1 == vp2 case

Lock the vnode in the most exclusive lock mode requested, once.
All callers already ensure that vp1 != vp2 or are careful enough to only
unlock once otherwise.

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

7 months agokernel: add missed FEATUREs compat_freebsd 8-14
Konstantin Belousov [Thu, 16 Nov 2023 20:47:18 +0000 (22:47 +0200)]
kernel: add missed FEATUREs compat_freebsd 8-14

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 months agoarm64: do not register elf32 brand if hardware cannot exec aarch32
Konstantin Belousov [Thu, 16 Nov 2023 19:45:52 +0000 (21:45 +0200)]
arm64: do not register elf32 brand if hardware cannot exec aarch32

Reviewed by: imp, jrtc27
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42639

7 months agofuse_vnop_copy_file_range(): add safety
Konstantin Belousov [Tue, 14 Nov 2023 22:49:35 +0000 (00:49 +0200)]
fuse_vnop_copy_file_range(): add safety

v_mount for unlocked vnode could be NULL, check for it.  Explain why it
is safe to access fs-specific data for mp if it is read as non-NULL.

Reviewed by: asomers, jah
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42625

7 months agofuse_vnop_copy_file_range(): use vn_lock_pair()
Konstantin Belousov [Tue, 14 Nov 2023 22:48:47 +0000 (00:48 +0200)]
fuse_vnop_copy_file_range(): use vn_lock_pair()

Reviewed by: asomers, jah
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42625

7 months agogenoffset.sh: fix build break on MacOS
Jonathan T. Looney [Thu, 16 Nov 2023 17:45:02 +0000 (17:45 +0000)]
genoffset.sh: fix build break on MacOS

Switch from using the shell's builtin echo command to using the
builtin printf command to print the asserts.

Reported by: jrtc27
Suggested by: imp
Fixes: accfb4cc9346
Sponsored by: Netflix

7 months agosocket tests: add socket_accept
Gleb Smirnoff [Thu, 16 Nov 2023 16:23:48 +0000 (08:23 -0800)]
socket tests: add socket_accept

Start with most basic functionality on a TCP socket.

7 months agogenoffset.sh: stop using a temporary file
Jonathan T. Looney [Thu, 16 Nov 2023 15:02:32 +0000 (15:02 +0000)]
genoffset.sh: stop using a temporary file

Instead, use a here document for the input. This allows us to run the
while loop in the main script so we can build the list of asserts in
a shell variable. We then print out the list of asserts at the end of
the loop.

Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42407

7 months agomlx5_core: fix deadlock when using RXTLS
Martin Matuska [Mon, 13 Nov 2023 13:29:27 +0000 (14:29 +0100)]
mlx5_core: fix deadlock when using RXTLS

If removing a node of type FS_TYPE_FLOW_DEST we lock the flow group too
late. This can lead to a deadlock with fs_add_dst_fg().

PR: 274715
MFC after: 1 week
Reviewed by: kib
Tested by: mm
Differential Revision: https://reviews.freebsd.org/D42368

7 months agoFix /root permissions after 'make installworld'
Thomas Eberhardt [Thu, 16 Nov 2023 09:59:38 +0000 (10:59 +0100)]
Fix /root permissions after 'make installworld'

According to /etc/mtree/BSD.root.dist /root should have
0750 permissions, but the build target 'make installworld'
changes these to 0755.

This is caused by the installation of the configuration
files of sh(1) and csh(1).

Correct this by specifying the correct default /root permissions.

PR: 273342
Reviewed by: jilles
Approved by: jilles
MFC after: 2 weeks
Differential Revision:https://reviews.freebsd.org/D42395

7 months agoDocument library types in the intro(3) manual page
Gordon Bergling [Thu, 16 Nov 2023 09:48:09 +0000 (10:48 +0100)]
Document library types in the intro(3) manual page

Add a paragraph about library types to the intro(3)
manual page. Document library types, locations
and versioning.

Reviewed by: emaste, jilles, mhorne, pauamma_gundo.com
Obtained from: OpenBSD (partial)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D36594

7 months agoAdd tests for gunion(8)
Yan-Hao Wang [Thu, 16 Nov 2023 07:58:49 +0000 (15:58 +0800)]
Add tests for gunion(8)

Reviewed by: mckusick (earlier version)
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41645

7 months agoiostat: Restore lost spaces after tout
Alexander Motin [Thu, 16 Nov 2023 04:45:22 +0000 (23:45 -0500)]
iostat: Restore lost spaces after tout

MFC after: 2 weeks

7 months agoAdd interface NVME to devstat
Alexander Motin [Thu, 16 Nov 2023 04:03:40 +0000 (23:03 -0500)]
Add interface NVME to devstat

This allows to list only NVMe devices in systat, iostat, vmstat, etc.
Previously those were counted as OTHER.

7 months agovmstat: Make disks reporting some more reasonable
Alexander Motin [Thu, 16 Nov 2023 03:56:51 +0000 (22:56 -0500)]
vmstat: Make disks reporting some more reasonable

MFC after: 1 month

7 months agopkg: Allocate a suitably-sized string for the local ABI
John Baldwin [Thu, 16 Nov 2023 00:53:53 +0000 (16:53 -0800)]
pkg: Allocate a suitably-sized string for the local ABI

Previously the local ABI string was written to an on-stack buffer and
the pointer to that buffer was saved in a global before the function
returned.  This had two issues: c[ABI].val pointed to a
no-longer-valid on-stack buffer after config_init returned, and the
string could potentially be truncated.  Fix both of those by changing
pkg_get_myabi to return a pointer to a string allocated by asprintf.

Note that the allocated string is left in the global config array
until it is implicitly freed on process exit.

Reported by: GCC 13 -Wdangling-pointer
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D42623

7 months agoig4(4): Add an EMAG device type
Andrew Gallatin [Thu, 16 Nov 2023 00:51:28 +0000 (19:51 -0500)]
ig4(4): Add an EMAG device type

Sponsored by: Ampere Computing LLC, Netflix
Submitted by: allanjude
Differential Revision: https://reviews.freebsd.org/D28746
Reviewed by: imp

7 months agolibc: remove unused stub vdso timecounter implementations
Brooks Davis [Wed, 15 Nov 2023 23:43:56 +0000 (23:43 +0000)]
libc: remove unused stub vdso timecounter implementations

All supported architectures have shared page support so remove this
unused stub.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D42619

7 months agolibc: centralize a few numeric symbols
Brooks Davis [Wed, 15 Nov 2023 23:42:37 +0000 (23:42 +0000)]
libc: centralize a few numeric symbols

fabs, __infinity, and __nan are universally implemented so declare them
in gen/Symbol.map.

We would also include __flt_rounds, but  it's under FBSD_1.3 on arm so
until that's gone we're stuck with it.  Likewise, everyone but i386
implements fp[gs]etmask.

Reviewed by: imp, kib, emaste
Differential Revision: https://reviews.freebsd.org/D42618

7 months agolibc: centralize makecontext symbols
Brooks Davis [Wed, 15 Nov 2023 23:42:18 +0000 (23:42 +0000)]
libc: centralize makecontext symbols

Declare makecontext() and __makecontext() symbols centrally as they are
always implemented.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D42617

7 months agolibc: centralize {_,sig,}{set,long}jmp symbols
Brooks Davis [Wed, 15 Nov 2023 23:41:35 +0000 (23:41 +0000)]
libc: centralize {_,sig,}{set,long}jmp symbols

These symbols are universally exposed and documented so declare them
centrally.  Double- and triple-underscore versions exist on some
platforms, but leave those alone for now.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D42616

7 months agolibc: centralize ntoh symbols
Brooks Davis [Wed, 15 Nov 2023 23:40:54 +0000 (23:40 +0000)]
libc: centralize ntoh symbols

These are implemented by net/ntoh.c via headers and compiler intrinsics
so declare them in net/Symbol.map.

Reviewed by: imp, kib, emaste
Differential Revision: https://reviews.freebsd.org/D42615