]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 months agopowerpc: better handling of shutdown flags
Mitchell Horne [Thu, 23 Nov 2023 15:25:05 +0000 (11:25 -0400)]
powerpc: better handling of shutdown flags

RB_HALT does not mean poweroff, RB_POWEROFF does.

Reviewed by: jhibbits
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42339

7 months agopst: improve shutdown_post_sync handler
Mitchell Horne [Thu, 23 Nov 2023 15:59:05 +0000 (11:59 -0400)]
pst: improve shutdown_post_sync handler

It is desirable to shut down the raid controller even in the face of a
panic. In the SCHEDULER_STOPPED() case, set the interrupt mask bits so
that we request a polled wait, rather than sleep(), from
iop_queue_wait_msg().

Tweak the function name and signature.

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

7 months agoshutdown: audit shutdown_post_sync event callbacks
Mitchell Horne [Thu, 23 Nov 2023 15:58:27 +0000 (11:58 -0400)]
shutdown: audit shutdown_post_sync event callbacks

Ensure they are all panic/debugger safe.

Most handlers for this event are for disk drivers/geom modules. There
are a mix of checks being used here (or not), so let's standardize on
checking the presence of the RB_NOSYNC flag.

This flag is set whenever:
 1. The kernel has panicked and kern.sync_on_panic=0*
 2. We reboot from within the kernel debugger (the "reset" command)
 3. Userspace requested it, e.g. by 'reboot -n'

Name the functions consistently.

*This sysctl is tuned to zero by default, but its existence means that
these handlers can be executed after a panic, at the user's discretion.
IMO this use-case is implicitly understood to be risky, and we'd be
better off eliminating it altogether.

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

7 months agopst-raid.c: sort #includes
Mitchell Horne [Thu, 23 Nov 2023 15:23:42 +0000 (11:23 -0400)]
pst-raid.c: sort #includes

Reviewed by: imp, jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42336

7 months agogeom: sort includes for some files
Mitchell Horne [Thu, 23 Nov 2023 15:23:07 +0000 (11:23 -0400)]
geom: sort includes for some files

This is not exhaustive, just done ahead of some upcoming changes to
these files.

Don't include sys/cdefs.h explicitly. No functional change intended.

Reviewed by: imp, jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42335

7 months agohptmv: remove vestigial EVENTHANDLER_DEREGISTER()
Mitchell Horne [Thu, 23 Nov 2023 15:22:33 +0000 (11:22 -0400)]
hptmv: remove vestigial EVENTHANDLER_DEREGISTER()

The registration was removed in favor of DEVICE_SHUTDOWN(). Drop the
unused eventhandler tag from the IAL_ADAPTER_T structure.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Fixes: cd3ef66680a8 ("Use DEVICE_SHUTDOWN(9) mechanism...")
Differential Revision: https://reviews.freebsd.org/D42334

7 months agoparam.h: Bump __FreeBSD_version to 1500004 for commit f5f277728ade
Rick Macklem [Thu, 23 Nov 2023 16:01:41 +0000 (08:01 -0800)]
param.h: Bump __FreeBSD_version to 1500004 for commit f5f277728ade

Commit f5f277728ade added a new VFS function called vfs_exjail_clone(),
which will be used by the ZFS module.  Bump the version for
this change.

7 months agonfsd: Fix NFS access to .zfs/snapshot snapshots
Rick Macklem [Thu, 23 Nov 2023 15:23:33 +0000 (07:23 -0800)]
nfsd: Fix NFS access to .zfs/snapshot snapshots

When a process attempts to access a snapshot under
/<dataset>/.zfs/snapshot, the snapshot is automounted.
However, without this patch, the automount does not
set mnt_exjail, which results in the snapshot not being
accessible over NFS.

This patch defines a new function called vfs_exjail_clone()
which sets mnt_exjail from another mount point and
then uses that function to set mnt_exjail in the snapshot
automount.  A separate patch that is currently a pull request
for OpenZFS, calls this function to fix the problem.

PR: 275200
Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42672

7 months agolibcasper: Fix a typo in a source code comment
Gordon Bergling [Thu, 23 Nov 2023 08:58:15 +0000 (09:58 +0100)]
libcasper: Fix a typo in a source code comment

- s/mutiple/multiple/

MFC after: 3 days

7 months agoath(4): Fix a typo in a source code comment
Gordon Bergling [Thu, 23 Nov 2023 08:57:28 +0000 (09:57 +0100)]
ath(4): Fix a typo in a source code comment

- s/mutiple/multiple/

MFC after: 3 days

7 months agoUPDATING: Add unset hint.acpi.0.disabled as workaround for no ACPI
Warner Losh [Thu, 23 Nov 2023 04:12:28 +0000 (21:12 -0700)]
UPDATING: Add unset hint.acpi.0.disabled as workaround for no ACPI

Explicitly add the 'unset hint.acpi.0.disabled' command to work around
this problem.

Sponsored by: Netflix

7 months agoCAM: Replace random sbuf_printf() with cheaper cat/putc.
Alexander Motin [Wed, 22 Nov 2023 23:04:05 +0000 (18:04 -0500)]
CAM: Replace random sbuf_printf() with cheaper cat/putc.

7 months agobitstring: Support large bit strings.
Dag-Erling Smørgrav [Wed, 22 Nov 2023 22:30:03 +0000 (23:30 +0100)]
bitstring: Support large bit strings.

Replace int with either size_t or ssize_t (depending on context) in
order to support bit strings up to SSIZE_MAX bits in length.  Since
some of the arguments that need to change type are pointers, we must
resort to light preprocessor trickery to avoid breaking existing code.

MFC after: 3 weeks
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D42698

7 months agoReplace random sbuf_printf() with cheaper cat/putc.
Alexander Motin [Wed, 22 Nov 2023 22:27:17 +0000 (17:27 -0500)]
Replace random sbuf_printf() with cheaper cat/putc.

7 months agoCAM: Use sbuf_new_for_sysctl() in more places
Alexander Motin [Wed, 22 Nov 2023 20:32:16 +0000 (15:32 -0500)]
CAM: Use sbuf_new_for_sysctl() in more places

There is no need to allocate buffer, worry about overflows, etc.

MFC after: 2 weeks

7 months agoRELNOTES: Add an entry about bhyve's slirp backend
Mark Johnston [Wed, 22 Nov 2023 19:14:53 +0000 (14:14 -0500)]
RELNOTES: Add an entry about bhyve's slirp backend

Sponsored by: Innovate UK

7 months agobhyve: Add a slirp network backend
Mark Johnston [Wed, 22 Nov 2023 19:11:03 +0000 (14:11 -0500)]
bhyve: Add a slirp network backend

This enables a subset of the functionality provided by QEMU's user
networking implementation.  In particular, it uses net/libslirp, the
same library as QEMU.

libslirp is permissively licensed but has some dependencies which make
it impractical to bring into the base system (glib in particular).  I
thus opted to make bhyve dlopen the libslirp.so, which can be installed
via pkg.  The library header is imported into bhyve.

The slirp backend takes a "hostfwd" which is identical to QEMU's
hostfwd.  When configured, bhyve opens a host socket and listens for
connections, which get forwarded to the guest.  For instance,
"hostfwd=tcp::1234-:22" allows one to ssh into the guest by ssh'ing to
port 1234 on the host, e.g., via 127.0.0.1.  I didn't try to hook up
guestfwd support since I don't personally have a use-case for it yet,
and I think it won't interact nicely with the capsicum sandbox.

Reviewed by: jhb
Tested by: rew
MFC after: 1 month
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D42510

7 months agobhyve: Split backends into separate files
Mark Johnston [Wed, 22 Nov 2023 19:10:27 +0000 (14:10 -0500)]
bhyve: Split backends into separate files

Currently the net_backend structure definition is private to
net_backends.c, so all of the backend definitions are there.  While
adding a new backend to use libslirp, it was noted that this file is
somewhat cluttered.  Move the netmap and netgraph backends to their own
files and clean up includes a bit.  No functional change intended.

Reviewed by: corvink, jhb
MFC after: 3 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D42689

7 months agoCAM: Remove return value from xpt_path_sbuf()
Alexander Motin [Wed, 22 Nov 2023 20:10:57 +0000 (15:10 -0500)]
CAM: Remove return value from xpt_path_sbuf()

It is wrong to call sbuf_len() on third-party sbuf.  If that sbuf
has a drain function, it ends up in assertion.  But even would it
work, it would return not newly written length, but the full one.
Searching through the sources I don't see this value used.

7 months agokern_racct.c: Don't compile if RACCT undefined
Olivier Certner [Tue, 21 Nov 2023 17:33:08 +0000 (18:33 +0100)]
kern_racct.c: Don't compile if RACCT undefined

Just skip compiling this file if RACCT isn't defined.  This allows to
skip including headers that no code uses at all, and also to remove the
whole file's #ifdef/#endif bracketing.

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

7 months agokern_rctl.c: Minimal includes when RCTL not defined
Olivier Certner [Thu, 19 Oct 2023 14:28:06 +0000 (16:28 +0200)]
kern_rctl.c: Minimal includes when RCTL not defined

If RCTL is not defined, only the system call stubs returning ENOSYS are
compiled in.  In this case, don't waste time including most headers
since their code is not used.

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

7 months agocompiler-rt: avoid segfaults when re-exec'ing with ASLR
Dimitry Andric [Wed, 22 Nov 2023 18:23:06 +0000 (19:23 +0100)]
compiler-rt: avoid segfaults when re-exec'ing with ASLR

After 930a7c2ac67e ("compiler-rt: re-exec with ASLR disabled when
necessary") and 96fe7c8ab0f6 ("compiler-rt: support ReExec() on
FreeBSD"), binaries linked against the sanitizer libraries may segfault
due to procctl(2) being intercepted. Instead, the non-intercepted
internal_procctl() should be called.

Similarly, the ReExec() function that re-executes the binary after
turning off ASLR should not call elf_aux_info(3) and realpath(3), since
these will also be intercepted. Instead, loop directly over the elf aux
info vector to find the executable path, and avoid calling realpath(3)
since it is actually unwanted for this use case.

Fixes: 930a7c2ac67e96fe7c8ab0f6
MFC after: 3 days

7 months agoarm64/amd64/riscv nexus: Use bus_generic_rl_*
John Baldwin [Wed, 22 Nov 2023 17:06:33 +0000 (09:06 -0800)]
arm64/amd64/riscv nexus: Use bus_generic_rl_*

Reviewed by: mhorne, imp
Differential Revision: https://reviews.freebsd.org/D42716

7 months agogpiobus: Use bus_generic_rl_* methods
John Baldwin [Wed, 22 Nov 2023 17:06:22 +0000 (09:06 -0800)]
gpiobus: Use bus_generic_rl_* methods

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

7 months agoip_mroute: handle V_mfchashtbl allocation failure
Kristof Provost [Wed, 22 Nov 2023 13:44:03 +0000 (14:44 +0100)]
ip_mroute: handle V_mfchashtbl allocation failure

We allocate V_mfchashtbl with HASH_NOWAIT (which maps to M_NOWAIT), so
this allocation may fail. As we didn't handle that failure we could end
up dereferencing a NULL pointer later (e.g. during X_ip_mrouter_done()).

Do the obvious thing and fail out if we cannot allocate the table.

See also: https://redmine.pfsense.org/issues/14917
Sponsored by: Rubicon Communications, LLC ("Netgate")

7 months agoloader.efi.8: Fix a typo
Mateusz Piotrowski [Wed, 22 Nov 2023 12:24:41 +0000 (13:24 +0100)]
loader.efi.8: Fix a typo

MFC after: 3 days
Sponsored by: Klara, Inc.

7 months agostand/efi: Consolidate integer types
Warner Losh [Wed, 22 Nov 2023 02:58:20 +0000 (19:58 -0700)]
stand/efi: Consolidate integer types

We have no need for 5 different copies of these.

Sponsored by: Netflix
Reviewed by: rcm, kevans, andrew
Differential Revision: https://reviews.freebsd.org/D42699

7 months agolibc: remove some obsolete VCS data
Brooks Davis [Tue, 21 Nov 2023 22:46:43 +0000 (22:46 +0000)]
libc: remove some obsolete VCS data

These wide char support files were copied from the previous versions
with expanded $FreeBSD$ strings in #if 0 blocks.  Remove them and the
scssid definitions in the same #if 0 blocks.

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

7 months agops: s/kern.max_pid/kern.pid_max/ in a comment
Brooks Davis [Tue, 21 Nov 2023 22:43:14 +0000 (22:43 +0000)]
ps: s/kern.max_pid/kern.pid_max/ in a comment

Sponsored by: DARPA

7 months agostand/efi: Define ACPI_USE_SYSTEM_INTTYPES to be 1 instead of blank
Warner Losh [Tue, 21 Nov 2023 18:36:18 +0000 (11:36 -0700)]
stand/efi: Define ACPI_USE_SYSTEM_INTTYPES to be 1 instead of blank

To avoid a redefinition warning... This needs to be redone correctly,
but this gets amd64 building again...  My amd64 environment is polluted
with something that caues earlier failures which I ignored...

Fixes: 488bc7e9a777
Sponsored by: Netflix

7 months agoRemove sysctl 'kern.smp.forward_signal_enabled'
Olivier Certner [Fri, 20 Oct 2023 13:43:29 +0000 (15:43 +0200)]
Remove sysctl 'kern.smp.forward_signal_enabled'

It seems this was an "emergency" knob to revert a newly introduced
behavior.  Overall, we want better system-wide signal receive latency,
and it doesn't seem that some contrary policy was ever needed (and if
that comes up, it should rather be implemented, e.g., per-process).

Suggested by:           kib
Reviewed by:            kib, jhb
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42315

7 months agomakesyscall: Simplify a bit emitting syscall declarations
Olivier Certner [Thu, 12 Oct 2023 13:47:03 +0000 (15:47 +0200)]
makesyscall: Simplify a bit emitting syscall declarations

Reviewed by:            kevans, imp
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42168

7 months agoCompile RACK when options TCP_RACK, not TCP_BBR
Alex Xu (Hello71) [Tue, 21 Nov 2023 00:09:56 +0000 (19:09 -0500)]
Compile RACK when options TCP_RACK, not TCP_BBR

Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Fixes: 3a338c5341 ("Add the BBR and RACK stacks to the LINT kernel.")
Pull Request: https://github.com/freebsd/freebsd-src/pull/907

7 months agohpts: install kernel module
Gleb Smirnoff [Tue, 21 Nov 2023 17:22:46 +0000 (09:22 -0800)]
hpts: install kernel module

It is important to instantly load tcp_rack.ko and tcp_bbr.ko

Reviewed by: tuexen, imp
Differential Revision: https://reviews.freebsd.org/D42697

7 months agotcp: uninline tcp_account_for_send()
Gleb Smirnoff [Tue, 21 Nov 2023 17:21:41 +0000 (09:21 -0800)]
tcp: uninline tcp_account_for_send()

This allows to clear inclusion of "opt_kern_tls.h" from a system header.

Reviewed by: rscheff, tuexen
Differential Revision: https://reviews.freebsd.org/D42696

7 months agoaio_read.2: correct the description of aio_buf
Alan Somers [Wed, 15 Nov 2023 17:31:24 +0000 (10:31 -0700)]
aio_read.2: correct the description of aio_buf

Looks like a copypasta from aio_write.2.

[skip ci]

Reported by: Paul Floyd <pjfloyd@wanadoo.fr>
MFC after: 1 week
Sponsored by: Axcient
Reviewed by: jilles (manpages)
Differential Revision: https://reviews.freebsd.org/D42621

7 months agostand/efi: Request ACPI use the system inttypes
Warner Losh [Tue, 21 Nov 2023 15:56:35 +0000 (08:56 -0700)]
stand/efi: Request ACPI use the system inttypes

With the system inttypes, we build on all platforms again.

Suggested by: andrew
Fixes: 0b01d45783c3
Sponsored by: Netflix

7 months agoTweak compat_freebsd32_bit feature name
Konstantin Belousov [Sat, 18 Nov 2023 22:40:58 +0000 (00:40 +0200)]
Tweak compat_freebsd32_bit feature name

Mark the current name 'compat_freebsd_32bit' as legacy, and add the
new name 'compat_freebsd32'.  This seems to help with some make and
shell uses.

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

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.