Commit graph

291096 commits

Author SHA1 Message Date
Martin Vahlensieck d44c78074d ng_pipe: Do not panic when memory allocations fail
Signed-off-by: Martin Vahlensieck <git@academicsolutions.ch>

Reviewed by:	markj
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1181
2024-04-24 08:44:50 -04:00
Martin Vahlensieck a3ecf8c786 ng_pipe: Replace deprecated random() with prng32_bounded()
Signed-off-by: Martin Vahlensieck <git@academicsolutions.ch>

MFC after:	2 weeks
Reviewed by:	markj
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1181
2024-04-24 08:44:50 -04:00
Martin Vahlensieck bb2ab7a374 ng_pipe: Remove node when all hooks are disconnected
This is the behavior described in the man page.

Signed-off-by: Martin Vahlensieck <git@academicsolutions.ch>

Discussed with:	glebius
Reviewed by:	markj
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1181
2024-04-24 08:44:50 -04:00
Martin Vahlensieck 8512311fb5 ng_pipe: Fix whitespace
Signed-off-by: Martin Vahlensieck <git@academicsolutions.ch>

Reviewed by:	markj
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1181
2024-04-24 08:40:51 -04:00
Cy Schubert a0d7d68a2d heimdal: Fix compiling hdb ldap as a module
Fix build when WITH_OPENLDAP defined.

PR:		278430
Obtained from:	Upstream c1c7da7f79
2024-04-23 22:54:20 -07:00
Cy Schubert 9e248b7f64 kdc: Add restart option
Add a new kdc_restart rc variable that manages kdc (or krb5kdc) under
daemon(8). This automatically restarts the kdc should it fail, i.e.
when it's configured to use LDAP as a backend and cannot connect to its
LDAP directory.

Set kdc_restart="YES" to auto restart kdc on abnormal termination.

Set kdc_restart_delay="N" to the number of seconds to delay before
restarting the kdc. The daemon(8) default seconds applies when not set.

Reported by:		Lexi Winter <lexi.freebsd@le-fay.org>
PR:			278395
Differential Revision:	https://reviews.freebsd.org/D44898
2024-04-23 22:50:38 -07:00
Ricardo Branco cae336280b MFV: less: Do not trust st_size if it equals zero
This is a smaller version of upstream
1fafd968b48e5cea6c85f126d77071a8de707a55 to address the
issue that less not being able to operate on files
residing in pseudo-filesystems that advertize a zero
size value.

PR:		bin/276133
MFC after:	3 days
2024-04-23 22:33:26 -07:00
Ricardo Branco e8ec4b5d12 less: Do not trust st_size if it equals zero 2024-04-23 22:27:06 -07:00
Warner Losh feabaf8d53 Revert "swapon: Do not overwrite Linux swap header"
This reverts commit cf04a7775a4e8ff6fd28c768be9daa3d83dd382e.This is
broken on armv7, and closer scrutiny of the reviews shows I was in error
when I thought it was ready.
2024-04-23 21:18:56 -06:00
Warner Losh 560931508c Revert "bsdinstall/distfetch.c: check environment variables before downloading and handle memory allocation errors"
This reverts commit 91bdebc958. It wasn't
as ready as I thought
2024-04-23 21:18:56 -06:00
Jake Freeland f239db4800 ktrace: Remove CAPFAIL from default trace points
The CAPFAIL tracepoint was recently extended to report ECAPMODE
capability  violations for processes that do not enter capability mode.
This allows developers that are interested in Capsicumizing their
programs to determine where violations are being raised.

Previously, CAPFAIL only produced output for processes using Capsicum(4)
capabilties. Thus, most ktrace users never received log output from the
trace point. With the recent changes, this is no longer the case.

Having this trace point enabled by default will produce output for all
processes that use syscalls that are not permitted in capability mode.
This may lead to confusion for users that are not familiar with the
feature. Remove KTRFAC_CAPFAIL from ktrace's default points to avoid
this.

Approved by:	markj (mentor)
Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D44887
2024-04-23 19:26:14 -05:00
Jake Freeland 4f2ada0d88 ktrace: Describe CAPFAIL trace point in man page
Update the ktrace(1) man page to describe the recently improved
capability failure tracing.

Approved by:	markj (mentor)
Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D44886
2024-04-23 19:25:16 -05:00
Gleb Smirnoff a8acc2bf56 sockets: inherit SO_ACCEPTFILTER from listener to child
This is crucial for operation of accept_filter(9).  See added comment.

Fixes:	d29b95ecc0
2024-04-23 17:17:14 -07:00
rilysh 91bdebc958 bsdinstall/distfetch.c: check environment variables before downloading and handle memory allocation errors
1. Currently, distfetch checks environment variables existence
when it will use them or in a case (in chdir()) it doesn't check
at all. As they are necessary to set before doing anything with
it, check them, if they set or not, before proceeding any further.
This also avoids extra cleaning when that environment variable
isn't set.

2. Handle memory allocation error in malloc(PATH_MAX) and replace
(sizeof const char *) with (sizeof char *). Both are similar and
const doesn't have a size.

3. Indent the error message a bit in chdir().

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1071
2024-04-23 16:42:38 -06:00
Martin Matuska 0d4ad64077 zfs: merge openzfs/zfs@1f940de07
Notable upstream pull request merges:
 #16038 1f940de07 L2ARC: Cleanup buffer re-compression
 #16093 c183d164a Parallel pool import
 #16094 cd3e6b4f4 Add zfetch stats in arcstats
 #16103 35bf25848 Fix: FreeBSD Arm64 does not build currently
 #16104 4036b8d02 Refactor dbuf_read() for safer decryption
 #16110 9f83eec03 Handle FLUSH errors as "expected"
 #16117 c346068e5 zfs get: add '-t fs' and '-t vol' options

Obtained from:  OpenZFS
OpenZFS commit: 1f940de072
2024-04-23 23:59:18 +02:00
Ricardo Branco cf04a7775a swapon: Do not overwrite Linux swap header
Reviewed by: imp, jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1084
2024-04-23 15:48:01 -06:00
Jose Luis Duran 4f223e0da7 release: Change vmimage EFI GPT label
This matches the default bsdinstall nomenclature.

PR: 278480
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1188
2024-04-23 15:13:40 -06:00
Jose Luis Duran 14e3f2d8d3 nanobsd: Set a GPT label for EFI and cfg partitions
Use efiboot0 for the EFI partition, the nomenclature efiboot + #index
was taken from bsdinstall (zfsboot).

Use cfg for the cfg partition.  Poudriere firmware images are already
using this label.

PR: 278480
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1187
2024-04-23 15:13:35 -06:00
Lexi Winter 8a8daeafaf sys/*/conf: do not use "../../conf/" when including std.*
Since config(8) searches sys/conf by default, there's no need to specify
the full relative path here; replace it by the filename alone.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1124
2024-04-23 15:13:31 -06:00
Lexi Winter 4f8f9d708e sys: add conf/std.debug, generic debugging options
The new sys/conf/std.debug contains the list of debugging options
enabled by default in -CURRENT, so they don't need to be listed
individually in every kernel config.

The enabled options are the set of all debug options which were enabled
for the GENERIC kernel on any platform.  This means some architectures
now have debugging options enabled in GENERIC which weren't previously
enabled:

- amd64: [1]
- arm64: [2]
- arm: [2]. [3]
- i386: [1], [2]
- powerpc: [1], [2], [3]
- riscv: [2]

[1] ALT_BREAK_TO_DEBUGGER is now enabled.
[2] BUF_TRACKING, FULL_BUF_TRACKING, and QUEUE_MACRO_DEBUG_TRASH are now
    enabled.
[3] DEADLKRES is now enabled.

While here, move the documentation for the (commented out) K*SAN options
for amd64 from GENERIC to NOTES.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1124
2024-04-23 15:13:31 -06:00
Lexi Winter 93c5ba5a83 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
2024-04-23 15:13:21 -06:00
Lexi Winter 65767e6126 sys/net/if_bridge: support non-INET kernels
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1159
2024-04-23 15:13:00 -06:00
HP van Braam d31b677356 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
2024-04-23 14:57:19 -06:00
HP van Braam 65971073d9 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
2024-04-23 14:56:11 -06:00
Warner Losh ea6f2d7797 checkstyle9.pl: Warn if there's no SOB line
If there's no Signed-off-by: line, complain.

Sponsored by:		Netflix
2024-04-23 14:04:08 -06:00
Karl Tomlinson e75a1bbc23 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
2024-04-23 14:04:07 -06:00
Konstantin Belousov aa66995b4c 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
2024-04-23 22:44:07 +03:00
Konstantin Belousov bac9d7e8f2 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
2024-04-23 22:44:07 +03:00
Konstantin Belousov f887667694 __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
2024-04-23 22:43:01 +03:00
Konstantin Belousov 92771bc00a 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
2024-04-23 22:40:29 +03:00
John Baldwin cbbc5770a3 src.conf.5: Regen after removing MK_NVME 2024-04-23 11:48:50 -07:00
John Baldwin ee3187f6fa 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
2024-04-23 11:47:44 -07:00
John Baldwin 2d51a9898e 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
2024-04-23 11:47:26 -07:00
John Baldwin 2b676a66c0 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
2024-04-23 11:47:12 -07:00
Dimitry Andric f48643d376 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:		911a6479e1
2024-04-23 19:40:29 +02:00
Mark Johnston ca0620b707 RELNOTES: Add an entry for the nfs_reserved_port_only default change
Sponsored by:	The FreeBSD Foundation
2024-04-23 12:55:10 -04:00
Mark Johnston 6d5ce2bb63 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
2024-04-23 12:54:46 -04:00
Konstantin Belousov fb2ab7ce52 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
2024-04-23 19:51:31 +03:00
Konstantin Belousov 91da6becae pthread_sigqueue(3): document
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44867
2024-04-23 19:51:25 +03:00
Konstantin Belousov 220aa0f450 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
2024-04-23 19:51:22 +03:00
Konstantin Belousov 97acb35bd7 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
2024-04-23 19:51:20 +03:00
Konstantin Belousov dcc180c51b sigqueue(2): Document __SIGQUEUE_TID
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44867
2024-04-23 19:51:10 +03:00
Konstantin Belousov 53186bc143 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
2024-04-23 19:51:09 +03:00
Konstantin Belousov 0c11c1792b 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
2024-04-23 19:51:07 +03:00
Konstantin Belousov 2effad53b4 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
2024-04-23 19:51:05 +03:00
Konstantin Belousov 53e0938b0b 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
2024-04-23 19:51:03 +03:00
Denny Page fcdf9a1989 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
0437c8e3b1, presumably because comments implied it was used only by
FDDI or Token Ring.

Fixes: 0437c8e3b1 ("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
2024-04-23 12:30:53 -04:00
Alexander Motin 1f940de072
L2ARC: Cleanup buffer re-compression
When compressed ARC is disabled, we may have to re-compress when
writing into L2ARC.  If doing so we can't fit it into the original
physical size, we should just fail immediately, since even if it
may still fit into allocation size, its checksum will never match.

While there, refactor the code similar to other compression places
without using abd_return_buf_copy().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #16038
2024-04-23 09:06:00 -07:00
Mitchell Horne c5989febcc ieee80211_vap(9): fix the title
MFC after:	3 days
2024-04-23 13:00:28 -03:00
Christopher Davidson 96a2e036b7 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
2024-04-23 12:50:54 -03:00