]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 weeks agosys/netpfil/pf: fix non-INET module build
Lexi Winter [Mon, 22 Apr 2024 21:59:12 +0000 (15:59 -0600)]
sys/netpfil/pf: fix non-INET module build

pf.ko, when built as a module without 'options INET' but with 'options
VIMAGE', won't load:

link_elf_obj: symbol vnet_entry_in_loopback_mask undefined

This is because it uses IN_LOOPBACK(), which in the VIMAGE case uses
INET-specific symbols.

Fix by making this check conditional on #ifdef INET.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1157

6 weeks agosys/net/if_bridge: support non-INET kernels
Lexi Winter [Tue, 23 Apr 2024 21:12:57 +0000 (15:12 -0600)]
sys/net/if_bridge: support non-INET kernels

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1159

6 weeks agoahc(4)/ahd(4): target mode: cancel outstanding AIOs and INOTs
HP van Braam [Tue, 23 Apr 2024 20:47:12 +0000 (14:47 -0600)]
ahc(4)/ahd(4): target mode: cancel outstanding AIOs and INOTs

When disabling a lun there can still be outstanding AIOs and INOTs, when
this happens previously the lun would just fail to disable and trying to
re-use the lun would break the card.

isp(4) in target mode does the same thing when disabling a lun, in
testing this allows re-starting of ctld(8) with connected initiators and
allows initiators to gracefully resume afterwards.

Signed-off-by: HP van Braam <hp@tmm.cx>
Reviewed by: imp, mav
Pull Request: https://github.com/freebsd/freebsd-src/pull/1190

6 weeks agoahc(4) clean up old Linux defines
HP van Braam [Tue, 23 Apr 2024 20:55:36 +0000 (14:55 -0600)]
ahc(4) clean up old Linux defines

Linux removed theirs starting in 2018 in commit:
"scsi: aic7xxx: Fix build using bare-metal toolchain"

Also remove now-useless sys/cdefs.h includes

Signed-off-by: HP van Braam <hp@tmm.cx>
Reviewed by: imp, mav, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1189

6 weeks agocheckstyle9.pl: Warn if there's no SOB line
Warner Losh [Tue, 23 Apr 2024 20:03:28 +0000 (14:03 -0600)]
checkstyle9.pl: Warn if there's no SOB line

If there's no Signed-off-by: line, complain.

Sponsored by: Netflix

6 weeks agopow,powf(3),__ieee754_rem_pio2(f): Avoid negative integer left shift UB
Karl Tomlinson [Tue, 23 Apr 2024 18:18:25 +0000 (12:18 -0600)]
pow,powf(3),__ieee754_rem_pio2(f): Avoid negative integer left shift UB

A compiler clever enough to know that z is positive with a non-zero
biased exponent could, for example, optimize away the scalbnf(z,n) in
pow() because behavior for left shift of negative values is undefined.
`n` is negative when y*log2(|x|) < -0.5.  i.e. |x^y| < sqrt(0.5)

The intended behavior for operator<< in this code is to shift the two's
complement representation of the first operand.

In the pow() functions, the result is added to the IEEE 754 exponent of
z = 2^y'.  n may be negative enough to underflow the biased IEEE 754
exponent below zero, which is manifested in the sign bit of j
(which would correspond to the IEEE 754 sign bit).

The conversion from uint32_t to int32_t for out-of-int32_t-range values
is implementation defined.  The assumed behavior of interpreting the
uint32_t value as a two's complement representation of a signed value
is already assumed in many parts of the code, such as uses of
GET_FLOAT_WORD() with signed integers.

This code passes all the current tests, and makes some out of tree
fuzzing tests pass again rather than hit UB (detailed in the commentary
of the pull request).

Signed-off-by: Karl Tomlinson <karlt+@karlt.net>
Reviewed by: imp, steve kargl, dim
Pull Request: https://github.com/freebsd/freebsd-src/pull/1137

6 weeks agolibc printf_render_errno(): do not use strerror()
Konstantin Belousov [Tue, 23 Apr 2024 17:15:22 +0000 (20:15 +0300)]
libc printf_render_errno(): do not use strerror()

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

6 weeks agolibc: minor style, wrap long lines
Konstantin Belousov [Tue, 23 Apr 2024 17:14:34 +0000 (20:14 +0300)]
libc: minor style, wrap long lines

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

6 weeks ago__vprintf(): switch from strerror() to strerror_rl()
Konstantin Belousov [Tue, 23 Apr 2024 17:10:30 +0000 (20:10 +0300)]
__vprintf(): switch from strerror() to strerror_rl()

This eliminates the use of non-thread-safe function in printf*() family,
and make the call locale-aware.  Also, it stops obliterating the
strerror() static buffer, which aligns with the POSIX requirement that
implementations must behave as if no standard-mandated functions call
strerror().

PR: 278556
Reported by: Jonathan Gruber <jonathan.gruber.jg@gmail.com>
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44916

6 weeks agolibc: make strerror_rl() usable for libc
Konstantin Belousov [Tue, 23 Apr 2024 17:04:29 +0000 (20:04 +0300)]
libc: make strerror_rl() usable for libc

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

6 weeks agosrc.conf.5: Regen after removing MK_NVME
John Baldwin [Tue, 23 Apr 2024 18:48:50 +0000 (11:48 -0700)]
src.conf.5: Regen after removing MK_NVME

6 weeks agoRemove the MK_NVME build option
John Baldwin [Tue, 23 Apr 2024 18:47:44 +0000 (11:47 -0700)]
Remove the MK_NVME build option

The drivers and utilities are now built and installed unconditionally.

Reviewed by: imp, emaste
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44843

6 weeks agonvmecontrol: Always build instead of being conditional on WITH_NVME
John Baldwin [Tue, 23 Apr 2024 18:47:26 +0000 (11:47 -0700)]
nvmecontrol: Always build instead of being conditional on WITH_NVME

This now builds fine on all platforms so always include it similar
to other tools such as camcontrol.

Reviewed by: imp, emaste
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44842

6 weeks agocamcontrol: Enable WITH_NVME unconditionally
John Baldwin [Tue, 23 Apr 2024 18:46:53 +0000 (11:46 -0700)]
camcontrol: Enable WITH_NVME unconditionally

MK_NVME is no longer marked broken for any platforms, so just include
support for it always as we do for ATA and SCSI.

Reviewed by: emaste
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44841

6 weeks agoUse MOVED_LIBS for usr/lib/libcxxrt.so.1 ObsoleteFiles.inc entry
Dimitry Andric [Tue, 23 Apr 2024 17:40:29 +0000 (19:40 +0200)]
Use MOVED_LIBS for usr/lib/libcxxrt.so.1 ObsoleteFiles.inc entry

Otherwise, the "make delete-old-libs" mechanism also deletes 32-bit
copies, such as in /usr/lib32.

Reported by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Fixes: 911a6479e18b

6 weeks agoRELNOTES: Add an entry for the nfs_reserved_port_only default change
Mark Johnston [Tue, 23 Apr 2024 16:52:30 +0000 (12:52 -0400)]
RELNOTES: Add an entry for the nfs_reserved_port_only default change

Sponsored by: The FreeBSD Foundation

6 weeks agonfsserver: Default to nfs_reserved_port_only="YES"
Mark Johnston [Tue, 23 Apr 2024 16:51:03 +0000 (12:51 -0400)]
nfsserver: Default to nfs_reserved_port_only="YES"

This setting causes the NFS server to check that all RPCs are sent from
a privileged (<= 1023) port, rejecting those that are not.  This
slightly raises the bar for a user with network access to an
unauthenticated NFS server to access exported NFS filesystems.

Users that use traditional NFS clients (e.g., those provided by FreeBSD
or Linux) should not see any difference, assuming that unprivileged
filesystem mounting is disallowed.

Note that the setting is per-VNET, so may be overridden in VNET jails
without affecting the rest of the system.

Discussed with: freebsd-arch@
Reviewed by: rmacklem, bz, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44906

6 weeks agoAdd test for pthread_sigqueue(3)
Konstantin Belousov [Sat, 20 Apr 2024 19:59:14 +0000 (22:59 +0300)]
Add test for pthread_sigqueue(3)

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

6 weeks agopthread_sigqueue(3): document
Konstantin Belousov [Sat, 20 Apr 2024 22:16:08 +0000 (01:16 +0300)]
pthread_sigqueue(3): document

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

6 weeks agolibthr: add pthread_sigqueue(3)
Konstantin Belousov [Fri, 19 Apr 2024 14:40:40 +0000 (17:40 +0300)]
libthr: add pthread_sigqueue(3)

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

6 weeks agosys/signal.h: move union sigval into dedicated private header sys/_sigval.h
Konstantin Belousov [Fri, 19 Apr 2024 14:57:51 +0000 (17:57 +0300)]
sys/signal.h: move union sigval into dedicated private header sys/_sigval.h

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

6 weeks agosigqueue(2): Document __SIGQUEUE_TID
Konstantin Belousov [Sat, 20 Apr 2024 21:58:15 +0000 (00:58 +0300)]
sigqueue(2): Document __SIGQUEUE_TID

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

6 weeks agosigqueue(2): add impl-specific flag __SIGQUEUE_TID
Konstantin Belousov [Fri, 19 Apr 2024 14:29:05 +0000 (17:29 +0300)]
sigqueue(2): add impl-specific flag __SIGQUEUE_TID

The flag allows the pid argument to designate a thread from the calling
process.  The flag value is carved from the high bit of the signal
number, which slightly changes the ABI of syscall.

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

6 weeks agokern_thr.c: normalize includes
Konstantin Belousov [Fri, 19 Apr 2024 14:27:42 +0000 (17:27 +0300)]
kern_thr.c: normalize includes

Remove extra sys/param.h, provided by sys/systm.h.
Order the rest alphabetically.

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

6 weeks agokern_thr.c/kern_sig.c: remove sys/cdefs.h
Konstantin Belousov [Fri, 19 Apr 2024 14:25:04 +0000 (17:25 +0300)]
kern_thr.c/kern_sig.c: remove sys/cdefs.h

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

6 weeks agokern_thread.c: remove unneeded include of sys/param.h
Konstantin Belousov [Fri, 19 Apr 2024 14:46:08 +0000 (17:46 +0300)]
kern_thread.c: remove unneeded include of sys/param.h

Handled by sys/systm.h already.

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

6 weeks agoSupport ARP for 802 networks
Denny Page [Sat, 13 Apr 2024 17:16:08 +0000 (10:16 -0700)]
Support ARP for 802 networks

This is used by 802.3 Ethernet.  (Also be used by 802.4 Token Bus and
802.5 Token Ring, but we don't support those.)

This was accidentally removed along with FDDI support in commit
0437c8e3b198, presumably because comments implied it was used only by
FDDI or Token Ring.

Fixes: 0437c8e3b198 ("Remove support for FDDI networks.")
Reviewed-by: emaste
Signed-off-by: Denny Page <dennypage@me.com>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1166

6 weeks agoieee80211_vap(9): fix the title
Mitchell Horne [Sun, 19 Mar 2023 22:58:56 +0000 (19:58 -0300)]
ieee80211_vap(9): fix the title

MFC after: 3 days

6 weeks agoUpdate manual page references and macros to align to mandoc syntax
Christopher Davidson [Fri, 9 Feb 2024 03:57:52 +0000 (22:57 -0500)]
Update manual page references and macros to align to mandoc syntax

xlocale.3: Comment out reference to atof_l(3), atoi_l(3), atol_l(3), atoll_l(3)
  These manual page references do not exist.

lagg.4: Change the reference for /etc/rc.conf from a reference link
  .Xr -> .Pa based on the context within the manual page it is used.

buf.9: Remove .Xr entries from the file
  The buf.9 manual page contains a commented out .Xr reference.
  The <filmmein> 9 entry is a placeholder and has been removed for
  clarity.

Reviewed by: mhorne
Pull Request: https://github.com/freebsd/freebsd-src/pull/1114

6 weeks agosrc.conf: regen after 91d35fb663e0, WITHOUT_CAPSICUM removal
Ed Maste [Tue, 23 Apr 2024 12:48:18 +0000 (08:48 -0400)]
src.conf: regen after 91d35fb663e0, WITHOUT_CAPSICUM removal

Sponsored by: The FreeBSD Foundation

6 weeks agoRemove WITHOUT_CAPSICUM build support
Ed Maste [Tue, 23 Apr 2024 11:20:59 +0000 (07:20 -0400)]
Remove WITHOUT_CAPSICUM build support

Capsicum is non-optional as of c24c117b9644 ("Remove
WITHOUT_{CAPSICUM,CASPER} options").

`#ifndef WITHOUT_CAPSICUM` is left in the source for the benefit of
downstream consumers, but is never defined in FreeBSD.

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42077

6 weeks agozfsbootcfg(8), zpool_influxdb(8): move to the zfs package
Lexi Winter [Mon, 22 Apr 2024 22:07:30 +0000 (16:07 -0600)]
zfsbootcfg(8), zpool_influxdb(8): move to the zfs package

These tools are only useful on a system running ZFS.

Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1175

6 weeks agoswab.c(libc): use a simplified version of byte swapping
rilysh [Mon, 22 Apr 2024 21:52:25 +0000 (15:52 -0600)]
swab.c(libc): use a simplified version of byte swapping

This version of swab function simplifies the logic of swapping adjacent
bytes. Previous version of swab() used an arbitrary unrolling, which was
relevant back in the day but unnecessary for modern compilers, as if the
input size is known at compile time, they can do it automatically.

This version of swab() is inspired by musl.
A similar version can be found at: https://github.com/openbsd/src/blob/master/lib/libc/string/swab.c

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1086

6 weeks agoifconfig tunnelfib is implemented in wg(4)
Gregory Shapiro [Mon, 22 Apr 2024 22:10:00 +0000 (16:10 -0600)]
ifconfig tunnelfib is implemented in wg(4)

MFC After: 1 week
Reviewed by: imp, zlei, kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/1186

6 weeks agoalc(4): disable MSI-X by default on Killer cards
Lexi Winter [Mon, 22 Apr 2024 22:09:26 +0000 (16:09 -0600)]
alc(4): disable MSI-X by default on Killer cards

Several users with alc(4)-based "Killer" Ethernet cards have reported
issues with this driver not passing traffic, which are solved by
disabling MSI-X using the provided tunable.

To work around this issue, disable MSI-X by default on this card.

This is done by having msix_disable default to 2, which means
"auto-detect".  The user can still override this to either 0 or 1 as
desired.

Since these are slow (1Gbps) Ethernet ICs used in low-end systems, it's
unlikely this will cause any practical performance issues; on the other
hand, the card not working by default likely causes issues for many new
FreeBSD users who find their network port doesn't work and have no idea
why.

PR: 230807
MFC after: 1 week

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1185

6 weeks agoumount: Support partitions & slices with -d option
Ricardo Branco [Mon, 22 Apr 2024 22:08:58 +0000 (16:08 -0600)]
umount: Support partitions & slices with -d option

Signed-off-by: Ricardo Branco <rbranco@suse.de>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1183

6 weeks agoshare/examples: move examples into appropriate packages
Lexi Winter [Mon, 22 Apr 2024 22:08:22 +0000 (16:08 -0600)]
share/examples: move examples into appropriate packages

Allow a new variable SE_xxxPACKAGE to be used to place an example group
into a package.

Move the following examples into existing appropriate packages:

- bhyve examples into FreeBSD-bhyve
- bootforth examples into FreeBSD-bootloader
- csh examples into FreeBSD-csh
- ipfw examples into FreeBSD-ipfw
- jail examples into FreeBSD-jail
- pf examples into FreeBSD-pf
- ppp examples into FreeBSD-ppp
- printing examples into FreeBSD-lp
- uefisign examples into FreeBSD-efi-tools
- ypldap examples into FreeBSD-yp
- hast examples into FreeBSD-hast

Move all other examples into the new 'FreeBSD-examples' package.

This removes a significant number of files from the FreeBSD-utilities
package.

Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1176

6 weeks agopackage: add DESC and COMMENT for cron package
Lexi Winter [Mon, 22 Apr 2024 22:05:54 +0000 (16:05 -0600)]
package: add DESC and COMMENT for cron package

Reviewed by: imp, manu, Mina Galic
Pull Request: https://github.com/freebsd/freebsd-src/pull/1172

6 weeks agopackage: move cron into its own package
Lexi Winter [Mon, 22 Apr 2024 22:05:53 +0000 (16:05 -0600)]
package: move cron into its own package

Reviewed by: imp, manu, Mina Galic
Pull Request: https://github.com/freebsd/freebsd-src/pull/1172

6 weeks agopackage: move hv_{vss,kvp}_daemon into hyperv-tools
Lexi Winter [Mon, 22 Apr 2024 22:00:55 +0000 (16:00 -0600)]
package: move hv_{vss,kvp}_daemon into hyperv-tools

Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1170

6 weeks agolinux: ignore setsockopt(IPV6_RECVERR)
Lexi Winter [Mon, 22 Apr 2024 21:58:11 +0000 (15:58 -0600)]
linux: ignore setsockopt(IPV6_RECVERR)

Under Linux, the socket options IP_RECVERR and IPV6_RECVERR are used to
receive socket errors via a dedicated 'error queue' which can be
retrieved via recvmsg().  FreeBSD does not support this functionality.

For IPv4, the sysctl compat.linux.ignore_ip_recverr can be set to 1 to
silently ignore attempts to set IP_RECVERR and return success to the
application, which is wrong, but is required for (among other things)
a functional DNS client in recent versions of glibc.

Add support for ignoring IPV6_RECVERR, controlled by the same sysctl.
This fixes DNS in Linux when using IPv6 resolvers.

Reviewed by: imp, Jose Luis Duran
Pull Request: https://github.com/freebsd/freebsd-src/pull/1118

6 weeks agolibipsec: make const-correct
Lexi Winter [Mon, 22 Apr 2024 21:56:24 +0000 (15:56 -0600)]
libipsec: make const-correct

- add const to the appropriate places in the libipsec public API and the
  relevant internal functions needed to support that.

- replace caddr_t with c_caddr_t in ipsec_dump_policy()

- update the ipsec_dump_policy manpage to use c_caddr_t (this manpage
  was already wrong as it had "char *" instead of caddr_t previously).

While here, update pfkeyv2.h to not cast away const in the PFKEY_*()
macros.

This should not cause any ABI changes as the actual types have not
changed.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1099

6 weeks agogeli.8: minor proofreading
Alan Somers [Mon, 22 Apr 2024 21:11:09 +0000 (15:11 -0600)]
geli.8: minor proofreading

MFC after: 3 days
Sponsored by: Axcient
Reviewed by: imp, pauamma (manpages)
Differential Revision: https://reviews.freebsd.org/D44907

6 weeks agolibcxxrt: align more with libc/Makefile
Brooks Davis [Mon, 22 Apr 2024 18:37:17 +0000 (19:37 +0100)]
libcxxrt: align more with libc/Makefile

Use src.opts.mk instead of bsd.own.mk and define PACKAGE first.

Fixes: da77a1b4f0dff libcxxrt: don't export nonexistant symbols

6 weeks agolibsys/arm: make vfork less of an outlier
Brooks Davis [Mon, 22 Apr 2024 19:13:35 +0000 (20:13 +0100)]
libsys/arm: make vfork less of an outlier

Following the pattern of other architectures, make __sys_vfork the main
symbol and _vfork and vfork weak aliases.  This avoids the need to
special case vfork in the generated list of symbols.

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

6 weeks agoopenssl: don't export nonexistant symbols
Brooks Davis [Mon, 22 Apr 2024 19:13:28 +0000 (20:13 +0100)]
openssl: don't export nonexistant symbols

These are all OpenSSL 1.1.0 and 1.1.1 symbols that aren't present in our
OpenSSL 3.0 builds.

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

6 weeks agosrc.conf.5: rebuild after WITH_NVME changes
Brooks Davis [Mon, 22 Apr 2024 18:41:44 +0000 (19:41 +0100)]
src.conf.5: rebuild after WITH_NVME changes

WITH_NVME is no longer marked broken on armv7, riscv64, or powerpc.

Fixes: 2fda3ab0ac19 WITH_NVME: Remove from broken.
Differential Revision: https://reviews.freebsd.org/D44850

6 weeks agoMake __libsys_interposing_slot libsys only
Brooks Davis [Mon, 22 Apr 2024 18:24:36 +0000 (19:24 +0100)]
Make __libsys_interposing_slot libsys only

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

6 weeks agolibthr: always use __libc_interposing_slot()
Brooks Davis [Mon, 22 Apr 2024 18:24:26 +0000 (19:24 +0100)]
libthr: always use __libc_interposing_slot()

Use __libc_interposing_slot() in favor of __libsys_interposing_slot() so
that the interposing interface is entierly between libc and libthr with
libsys only involved as an implementation detail.

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

6 weeks agogeli: add a read-only kern.geom.eli.use_uma_bytes sysctl
Alan Somers [Mon, 22 Apr 2024 18:03:40 +0000 (12:03 -0600)]
geli: add a read-only kern.geom.eli.use_uma_bytes sysctl

It reports the value of the g_eli_alloc_sz variable.  Allocations of
this size or less will use UMA.  Larger allocations will use malloc.
Since malloc is slower, it is useful for users to know this variable so
they can avoid such allocations.  For example, ZFS users can set
vfs.zfs.vdev.aggregation_limit to this value.

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: markj, imp
Differential Revision: https://reviews.freebsd.org/D44904

6 weeks agoadduser: Fix a syntax error
Joseph Mingrone [Mon, 22 Apr 2024 19:04:13 +0000 (16:04 -0300)]
adduser: Fix a syntax error

Reported by: Jose Luis Duran <jlduran@gmail.com>
Fixes: b37333899bd2
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44871

6 weeks agolibcxxrt: define SHLIBDIR before including bsd.own.mk
Dimitry Andric [Mon, 22 Apr 2024 18:43:27 +0000 (20:43 +0200)]
libcxxrt: define SHLIBDIR before including bsd.own.mk

Otherwise bsd.own.mk overrides it, causing libcxxrt.so.1 to be
erroneously installed into /usr/lib.

Also add an ObsoleteFiles.inc entry, for removing the bad copy.

Reported by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Fixes: da77a1b4f0df

6 weeks agomfc-candidates: use stable/14 as default MFC-to branch
Ed Maste [Mon, 22 Apr 2024 17:54:52 +0000 (13:54 -0400)]
mfc-candidates: use stable/14 as default MFC-to branch

This tool is typically invoked from within a working tree containing the
desired MFC target branch, which is detected automatically.  It also has
a default for when it is invoked from elsewhere.  Switch the default to
the most recent branch, stable/14.

Sponsored by: The FreeBSD Foundation

6 weeks agothread: Add a missing include of asan.h
Mark Johnston [Mon, 22 Apr 2024 17:07:53 +0000 (13:07 -0400)]
thread: Add a missing include of asan.h

I didn't notice this during testing because invariants-enabled kernels
implicitly include asan.h via kassert.h.

Reported by: Lexi Winter <lexi@le-Fay.org>
Fixes: 800da341bc4a ("thread: Simplify sanitizer integration with thread creation")

6 weeks agoif_bridge: clean up INET/INET6 handling
Lexi Winter [Sun, 21 Apr 2024 18:56:23 +0000 (19:56 +0100)]
if_bridge: clean up INET/INET6 handling

The if_bridge contains several instances of:

if (AF_INET code ...
#ifdef INET6
    AF_INET6 code ...
#endif
) {
...

Clean this up by adding a couple of macros at the top of the file that
are conditionally defined based on whether INET and/or INET6 are enabled,
which makes the code more readable and easier to maintain.

No functional change intended.

Reviewed by: zlei, markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1191

6 weeks agong_hci: Add sockaddr validation to sendto()
Mark Johnston [Mon, 22 Apr 2024 15:48:00 +0000 (11:48 -0400)]
ng_hci: Add sockaddr validation to sendto()

ng_btsocket_hci_raw_send() wasn't verifying that the destination address
specified by sendto() is large enough to fill a struct sockaddr_hci.
Thus, when copying the socket address into an mbuf,
ng_btsocket_hci_raw_send() may read past the end of the input sockaddr
while copying.

In practice this is effectively harmless since
ng_btsocket_hci_raw_output() only uses the address to identify a
netgraph node.

Reported by: Oliver Sieber <oliver@secfault-security.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 weeks agothread: Simplify sanitizer integration with thread creation
Mark Johnston [Mon, 22 Apr 2024 15:43:17 +0000 (11:43 -0400)]
thread: Simplify sanitizer integration with thread creation

fork() may allocate a new thread in one of two ways: from UMA, or cached
in a freed proc that was just allocated from UMA.  In either case, KASAN
and KMSAN need to initialize some state; in particular they need to
initialize the shadow mapping of the new thread's stack.

This is done differently between KASAN and KMSAN, which is confusing.
This patch improves things a bit:
- Add a new thread_recycle() function, which moves all kernel stack
  handling out of kern_fork.c, since it doesn't really belong there.
- Then, thread_alloc_stack() has only one local caller, so just inline
  it.
- Avoid redundant shadow stack initialization: thread_alloc()
  initializes the KMSAN shadow stack (via kmsan_thread_alloc()) even
  through vm_thread_new() already did that.
- Add kasan_thread_alloc(), for consistency with kmsan_thread_alloc().

No functional change intended.

Reviewed by: khng
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44891

6 weeks agoriscv: create a convenience composite macro
Doug Moore [Sun, 21 Apr 2024 22:24:29 +0000 (17:24 -0500)]
riscv: create a convenience composite macro

Define PTE_TO_VM_PAGE to compose the PHYS_TO_VM_PAGE and PTE_TO_PHYS
macros. Use it where appropriate, and drop some variables that it
makes unnecessary.

Reviewed by: jhb (previous version)
Differential Revision: https://reviews.freebsd.org/D44700

6 weeks agoEnable L1SS handling on RPI4 pcib
HP van Braam [Tue, 16 Apr 2024 23:01:20 +0000 (01:01 +0200)]
Enable L1SS handling on RPI4 pcib

Thanks to @kevans91 for pointing me in the right direction. FreeBSD had
the same bug as Linux (see
https://bugzilla.kernel.org/show_bug.cgi?id=217276) where the ultimate
solution was to honor the brcm,enable-l1ss FDT property.

In current versions of the dtb files this property has been added by
default.

Without this on many, many pcie addin cards the pcib will Serror when
trying to assert the clreq# pin on the pcie bus. Many cards do not have
these hooked up.

PR: 260131, 277638, 277605
Reviewed-by: emaste
Signed-off-by: HP van Braam <hp@tmm.cx>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1179

6 weeks agoAdd a few missed libclang_rt files to ObsoleteFiles.inc
Dimitry Andric [Sun, 21 Apr 2024 21:32:22 +0000 (23:32 +0200)]
Add a few missed libclang_rt files to ObsoleteFiles.inc

PR: 276104
Reported by: Mark Millard <marklmi@yahoo.com>
MFC after: 3 days

6 weeks agoRevert "OpenSSL: use the upstream provided version.map files for the fips/legacy...
Enji Cooper [Sun, 21 Apr 2024 16:55:01 +0000 (09:55 -0700)]
Revert "OpenSSL: use the upstream provided version.map files for the fips/legacy providers"

This change is still under review and should not have been merged
directly to main (yet).

This is a case and point for using `push.default` to nothing instead of
matching or simple.

This reverts commit 42ce242e353065dfbaa248955f6657005a395a95.

6 weeks agoOpenSSL: use the upstream provided version.map files for the fips/legacy providers
Enji Cooper [Sat, 20 Apr 2024 19:12:50 +0000 (12:12 -0700)]
OpenSSL: use the upstream provided version.map files for the fips/legacy providers

This change introduces a static copy of the fips and legacy linker version maps
generated by the OpenSSL 3.0.13 build process.

This unbreaks the fips and legacy providers by not exposing unnecessary
symbols from the fips/legacy provider shared objects shared with other
providers (base, default) and libcrypto.

More discussion:

Prior to this change, loading the fips provider indirectly from a
FreeBSD 14.0-CURRENT and 15.0-CURRENT host would result in a
process-wide deadlock when invoking select OpenSSL APIs
(CONF_modules_load* in this particular example).

Speaking with the upstream maintainers [1], it became obvious that
the FreeBSD base system was incorrectly building/linking the fips
provider, resulting in a symbol collision at runtime, and thus a
process-wide deadlock in specific circumstances. The fips provider
would deadlock when trying to acquire a write lock on internal
structures which should have only been available to the base and
default providers, as certain preprocessor ifdefs only allow specific
internal calls to be made with the base and default providers.

1. https://github.com/openssl/openssl/issues/24202

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

6 weeks agobsd.subdir.mk: improve `SUBDIR.${MK_FOO}` advice
Enji Cooper [Sun, 21 Apr 2024 16:27:48 +0000 (09:27 -0700)]
bsd.subdir.mk: improve `SUBDIR.${MK_FOO}` advice

- Remove superfluous whitespace by removing trailing whitespace
  before `\` (line continuation character)
- Quote `SUBDIR.` to clarify the fact that this is a variable
  reference--not the end of a sentence.

6 weeks agomfc-candidates: move pretty printing into lua
Ed Maste [Tue, 16 Apr 2024 16:49:05 +0000 (12:49 -0400)]
mfc-candidates: move pretty printing into lua

d51c59002367 moved the MFC hash matching logic into a lua utility
script but left the output formatting in the shell script. Simplify this
slightly by just printing the formatted output from lua.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44836

6 weeks agoRevert "dtrace: make 'ring' and 'fill' policies imply 'noswitch' flag"
Andriy Gapon [Sun, 21 Apr 2024 10:07:36 +0000 (13:07 +0300)]
Revert "dtrace: make 'ring' and 'fill' policies imply 'noswitch' flag"

This reverts commit e92491d95ff3500e140eafa614e88ca84ffb0d26.

The general idea looked good to me.  In particular, it allowed to save
some memory and avoid memory allocation failures when a large buffer
size was requested along with ring and fill policies.

But I didn't take into account that the second, supposedly unused
buffer, was actually used as the scratch buffer.  The scratch buffer is
used as a temporary space for DTrace subroutines like copyin, copyinstr,
and alloca.

I think that the change can be fixed by allocating a separate smaller
buffer for the scratch buffer, but that fix would require more work than
I am able to do now.  Hence the revert.

Reported by: Domagoj Stolfa
Diagnosed by: Domagoj Stolfa, markj
MFC after: immediately

6 weeks agofreescale: Fix a typo in a source code comment
Gordon Bergling [Sun, 21 Apr 2024 07:52:14 +0000 (09:52 +0200)]
freescale: Fix a typo in a source code comment

- s/cant/can't/

MFC after: 3 days

6 weeks agouipc_domain: Fix a typo in a source code comment
Gordon Bergling [Sun, 21 Apr 2024 07:51:14 +0000 (09:51 +0200)]
uipc_domain: Fix a typo in a source code comment

- s/cant/can't/

MFC after: 3 days

6 weeks agogeom(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 21 Apr 2024 07:49:44 +0000 (09:49 +0200)]
geom(4): Fix a typo in a source code comment

- s/cant/can't/

MFC after: 3 days

6 weeks agowtap: Fix typos in kernel messages
Gordon Bergling [Sun, 21 Apr 2024 07:47:24 +0000 (09:47 +0200)]
wtap: Fix typos in kernel messages

- s/cant/can't/

MFC after: 1 week

6 weeks agovmm(4): Fix a typo in a kernel message
Gordon Bergling [Sun, 21 Apr 2024 07:44:18 +0000 (09:44 +0200)]
vmm(4): Fix a typo in a kernel message

- s/cant/can't/

MFC after: 1 week

6 weeks agoahc(4)/ahd(4): fix target mode on ARM
Kyle Evans [Sun, 21 Apr 2024 03:04:04 +0000 (22:04 -0500)]
ahc(4)/ahd(4): fix target mode on ARM

One of the comments in ahc_execute_scb() notes that the CAM direction is
actually w.r.t. the initiator.  As a consequence, all of our sync ops
end up being wrong because the direction is flipped from that of the
transfer.  Fix it to do proper invalidation and avoid spewing random
garbage out on the SCSI bus.

Reported and tested by: HP van Braam <hp@tmm.cx>
Reviewed by: imp, mav
Differential Revision: https://reviews.freebsd.org/D44860

6 weeks agoahc(4): resolve some minor nits
Kyle Evans [Sun, 21 Apr 2024 03:04:04 +0000 (22:04 -0500)]
ahc(4): resolve some minor nits

In ahc_init(), qoutfifo is already assigned to effectively the same
value a couple lines up, except in the first assignment it uses the
proper definition; keep the more descriptive assignment.

ahc_targetcmd_offset() gets the offset wrong entirely; as per the
area of ahc_init() this diff also touches, targetcmds is laid out first
in the shared map and it's followed by the qoutfifo.  As a result, we'd
generally be getting negative offsets here.  We can't actually do a
partial sync anyways, so there was no consequence to getting this wrong.

Reviewed by: imp, mav
Differential Revision: https://reviews.freebsd.org/D44859

6 weeks agoadduser: A few more improvements.
Dag-Erling Smørgrav [Sat, 20 Apr 2024 19:35:25 +0000 (21:35 +0200)]
adduser: A few more improvements.

MFC after: 1 week
Reviewed by: jrm
Differential Revision: https://reviews.freebsd.org/D44871

6 weeks agoldconfig: fix man-page - duplicate dot at end of sentence
Stefan Eßer [Sat, 20 Apr 2024 17:49:10 +0000 (19:49 +0200)]
ldconfig: fix man-page - duplicate dot at end of sentence

Reported by: gbe

7 weeks agograid3: Fix teardown in g_raid3_try_destroy()
Mark Johnston [Sat, 20 Apr 2024 16:02:06 +0000 (12:02 -0400)]
graid3: Fix teardown in g_raid3_try_destroy()

Commit 33cb9b3c3a22 replaced a g_raid3_destroy_device() call with a
g_raid3_free_device() call, which was incorrect and could lead to a
panic if a RAID3 GEOM failed to start (e.g., due to missing disks).

Reported by: graid3 tests
Fixes: 33cb9b3c3a22 ("graid3: Fix teardown races")
MFC after: 3 days
Sponsored by: Klara, Inc.

7 weeks agowg tests: Add a simple regression test case for netmap support
Mark Johnston [Sat, 20 Apr 2024 16:01:53 +0000 (12:01 -0400)]
wg tests: Add a simple regression test case for netmap support

MFC after: 1 month
Sponsored by: Klara, Inc.
Sponsored by: Zenarmor

7 weeks agowg: Add netmap support
Mark Johnston [Sat, 20 Apr 2024 16:01:28 +0000 (12:01 -0400)]
wg: Add netmap support

When in netmap (emulated) mode, wireguard interfaces prepend or strip a
dummy ethernet header when interfacing with netmap.  The netmap
application thus sees unencrypted, de-encapsulated frames with a fixed
header.

In this mode, netmap hooks the if_input and if_transmit routines of the
ifnet.  Packets from the host TX ring are handled by wg_if_input(),
which simply hands them to the netisr layer; packets which would
otherwise be tunneled are intercepted in wg_output() and placed in the
host RX ring.

The "physical" TX ring is processed by wg_transmit(), which behaves
identically to wg_output() when netmap is not enabled, and packets
appear in the "physical" RX ring by hooking wg_deliver_in().

Reviewed by: vmaffione
MFC after: 1 month
Sponsored by: Klara, Inc.
Sponsored by: Zenarmor
Differential Revision: https://reviews.freebsd.org/D43460

7 weeks agolibpmc: Import AMD Zen 4 PMU events
Alexander Motin [Sat, 20 Apr 2024 15:54:04 +0000 (11:54 -0400)]
libpmc: Import AMD Zen 4 PMU events

MFC after: 1 week

7 weeks agoMerge llvm-project release/18.x llvmorg-18.1.4-0-ge6c3289804a6
Dimitry Andric [Sat, 20 Apr 2024 12:01:32 +0000 (14:01 +0200)]
Merge llvm-project release/18.x llvmorg-18.1.4-0-ge6c3289804a6

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.4-0-ge6c3289804a6.

PR: 276104
MFC after: 3 days

7 weeks agortld(1): minor clarification for LD_STATIC_TLS_EXTRA
Konstantin Belousov [Sat, 20 Apr 2024 13:47:44 +0000 (16:47 +0300)]
rtld(1): minor clarification for LD_STATIC_TLS_EXTRA

Also properly style the paragraph.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 weeks agods1307(4): Fix a typo in a source code comment
Gordon Bergling [Sat, 20 Apr 2024 12:14:21 +0000 (14:14 +0200)]
ds1307(4): Fix a typo in a source code comment

- s/slighly/slightly/

MFC after: 1 week

7 weeks agoi386: Fix a typo in a source code comment
Gordon Bergling [Sat, 20 Apr 2024 12:13:33 +0000 (14:13 +0200)]
i386: Fix a typo in a source code comment

- s/slighly/slightly/

MFC after: 1 week

7 weeks agosafe(4): Remove a double word in a source code comment
Gordon Bergling [Sat, 20 Apr 2024 12:12:23 +0000 (14:12 +0200)]
safe(4): Remove a double word in a source code comment

- s/of of/of/

MFC after: 3 days

7 weeks agousb(4): Remove a double word in a source code comment
Gordon Bergling [Sat, 20 Apr 2024 12:10:59 +0000 (14:10 +0200)]
usb(4): Remove a double word in a source code comment

- s/of of/of/

MFC after: 3 days

7 weeks agobhnd(4): Remove a double word in a source code comment
Gordon Bergling [Sat, 20 Apr 2024 12:09:18 +0000 (14:09 +0200)]
bhnd(4): Remove a double word in a source code comment

- s/of of/of/

MFC after: 3 days

7 weeks agoNOTES: Remove a double word in comment
Gordon Bergling [Sat, 20 Apr 2024 12:08:04 +0000 (14:08 +0200)]
NOTES: Remove a double word in comment

- s/of of/of/

MFC after: 3 days

7 weeks agoarm64: Remove a double word in a source code comment
Gordon Bergling [Sat, 20 Apr 2024 12:06:53 +0000 (14:06 +0200)]
arm64: Remove a double word in a source code comment

- s/of of/of/

MFC after: 3 days

7 weeks agosys: Remove two double words in source code comments
Gordon Bergling [Sat, 20 Apr 2024 12:04:31 +0000 (14:04 +0200)]
sys: Remove two double words in source code comments

- s/of of/of/

MFC after: 5 days

7 weeks agomwlstats: Fix a typo in an error message
Gordon Bergling [Sat, 20 Apr 2024 12:02:54 +0000 (14:02 +0200)]
mwlstats: Fix a typo in an error message

- s/the the/the/

MFC after: 5 days

7 weeks agoifconfig(8): Fix two typos in source code comments
Gordon Bergling [Sat, 20 Apr 2024 12:01:23 +0000 (14:01 +0200)]
ifconfig(8): Fix two typos in source code comments

- s/the the/the/

MFC after: 3 days

7 weeks agotimerfd.2: Remove a double word
Gordon Bergling [Sat, 20 Apr 2024 09:31:25 +0000 (11:31 +0200)]
timerfd.2: Remove a double word

- s/is is/is/

MFC after: 3 days

7 weeks agotarfs(5): Grammar fix for a source code comment
Gordon Bergling [Sat, 20 Apr 2024 09:21:54 +0000 (11:21 +0200)]
tarfs(5): Grammar fix for a source code comment

- s/the the/of the/

MFC after:i 3 days

7 weeks agonvmecontrol(8): Remove a double word in a source code comment
Gordon Bergling [Sat, 20 Apr 2024 09:18:59 +0000 (11:18 +0200)]
nvmecontrol(8): Remove a double word in a source code comment

- s/the the/the/

MFC after: 3 days

7 weeks agobinmiscctl.8: Remove a double word
Gordon Bergling [Sat, 20 Apr 2024 09:15:20 +0000 (11:15 +0200)]
binmiscctl.8: Remove a double word

- s/the the/the/

MFC after: 3 days

7 weeks agoman: do not ignore the exit status of roff tools
Wolfram Schneider [Sat, 20 Apr 2024 08:24:58 +0000 (08:24 +0000)]
man: do not ignore the exit status of roff tools

PR: 223516
Approved by: emaste, bapt
Differential Revision: https://reviews.freebsd.org/D44798

7 weeks agoldconfig: document changed default byte-order
Stefan Eßer [Sat, 20 Apr 2024 06:30:35 +0000 (08:30 +0200)]
ldconfig: document changed default byte-order

Document that the hints file is created in little-endian byte-order
by default now. The -B option can be used to create a big-endian hints
file. Currently, both formats are accepted by the run-time linker on
all architectures.

MFC after: 3 days
Relnotes: yes

7 weeks agoadd dtb support for RPI CM4, CM4s, CM4_ioBoard
Klaus Küchemann [Fri, 19 Apr 2024 22:53:46 +0000 (16:53 -0600)]
add dtb support for RPI CM4, CM4s, CM4_ioBoard

Signed-off-by: Klaus Küchemann <maciphone2@googlemail.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1182

7 weeks agopackage: move lpr into its own package
Lexi Winter [Fri, 19 Apr 2024 22:53:30 +0000 (16:53 -0600)]
package: move lpr into its own package

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1171

7 weeks agorescue: add ipfw, pfctl
Lexi Winter [Fri, 19 Apr 2024 22:53:23 +0000 (16:53 -0600)]
rescue: add ipfw, pfctl

Rationale for this change:

- ipf is already there

- if the kernel is configured with a packet filter which drops packets
  by default, pfctl or ipfw will be required in the rescue environment
  to make the network functional.

- rescue's stated purpose is to be useful for small/embedded systems
  (and is also quite useful for small jails); a rescue-based router
  would want these binaries.

On amd64, this increases the size of rescue from 17346200 to 17907248,
or 561048 bytes (3.2%).

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1169

7 weeks agousr.bin/units: use else..if to avoid calling the next branch
rilysh [Fri, 19 Apr 2024 22:53:05 +0000 (16:53 -0600)]
usr.bin/units: use else..if to avoid calling the next branch

Even if the first branch succeeds, next time it will still check for
the second branch (which will be false) as the first one was true.
Add an else..if statement to address this.

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1165