Commit graph

291118 commits

Author SHA1 Message Date
Mateusz Piotrowski 42255af64a checkstyle9: Allow a space between "*" and _*restrict
Before the change, we would get errors like this:

    ERROR: "foo * bar" should be "foo *bar"
    #369: FILE: foobar.c:369:
    +barbaz(char * __restrict s,

Reviewed by:		des, imp
Sponsored by:		Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D44911
2024-04-25 11:51:25 +02:00
Mateusz Piotrowski 177ba18307 sync.8: Document that the "sync dance" is not a thing
People still believe that it is essential to run sync(8) a couple of
times before a reboot/halt. Document that this has not been necessary
for a long time now.

Reviewed by:	imp, bcr, Pau Amma <pauamma@gundo.com>
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D33233
2024-04-25 11:49:50 +02:00
Mateusz Piotrowski 4395d3ced5 Document that gettimeofday() is obsolescent
Reported by:	kaktus
Reviewed by:	kaktus, pstef
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D23942
2024-04-25 11:42:59 +02:00
Gleb Smirnoff 19307b86d3 accept_filter: return different errors for non-listener and a busy socket
The fact that an accept filter needs to be cleared first before setting to
a different one isn't properly documented.  The requirement that the
socket needs already be listening, although trivial, isn't documented
either.  At least return a more meaningful error than EINVAL for an
existing filter.  Cover this with a test case.
2024-04-24 21:55:58 -07:00
Gleb Smirnoff c68eed82a3 accf_tls: accept filter that waits for TLS handshake header 2024-04-24 17:53:10 -07:00
Brooks Davis 78101d437a syscalls.master: correct return type of {read,write}v
This was missed when read/write, etc were updated to return ssize_t.

Fixes:		2e83b28161 Fix a few syscall arguments to use size_t instead of u_int.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D44930
2024-04-24 20:48:46 +01:00
Konstantin Belousov 6b0cf2a237 vfs_lookup.c: only call ktrcapfail() if KTRACE is enabled
Reviewed by:	emaste, imp, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44931
2024-04-24 22:43:32 +03:00
Konstantin Belousov 66df81021e sys/namei.h: move NI_CAP_VIOLATION() macro from namei.h to vfs_lookup.c
Reviewed by:	emaste, imp, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44931
2024-04-24 22:43:31 +03:00
Simon J. Gerraty 0135101e23 meta.autodep.mk do not override start_utc
Update meta.autodep.mk
If included at level 0 it is important not to override start_utc
2024-04-24 12:25:42 -07:00
Andrew Turner d7ac42676d elf_common.h: Add STO_AARCH64_VARIANT_PCS
This is used to mark symbols that use a variant procedure call with
a different calling convention to the main ABI.

Reviewed by:	kib, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44868
2024-04-24 18:17:20 +00:00
Andrew Turner 2c35c867ba showconfig: Set MACHINE for src.opts.mk
Also set MACHINE and MACHINE_ARCH when reading config options from
src.opts.mk. This ensures any machine-dependent options are reported
correctly.

Reviewed by:	emaste, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44838
2024-04-24 18:17:20 +00:00
Andrew Turner 9d40492efa arm64: Check DMAP address is valid in PHYS_IN_DMAP
When checking if a physical address is in the DMAP region we assume
all physical addresses between DMAP_MIN_PHYSADDR and DMAP_MAX_PHYSADDR
are able to be accesses through the DMAP. It may be the case that
there is device memory in this range that shouldn't be accessed through
the DMAP mappings.

Add a check to PHYS_IN_DMAP that the translated virtual address is a
valid kernel address. To support code that already checks the address
is valid add PHYS_IN_DMAP_RANGE.

PR:		278233
Reviewed by:	alc, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44677
2024-04-24 18:17:19 +00:00
Andrew Turner ef80df0a71 arm64/vmm: Ensure the tlbi has completed
Ensure the TLB is invalidated before enabling the EL2 MMU. Without
this the TLB may be in an inconsistant state leading to a possible
exception when enabling the MMU.

PR:		277559
Reviewed by:	markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44799
2024-04-24 18:17:19 +00:00
Mark Johnston 71b2ba9099 bhyve.8: Document arm64 support
- Mention the options that are amd64-only.
- Provide a minimal example for booting an arm64 guest.

Reviewed by:	corvink
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D44738
2024-04-24 09:58:04 -04:00
Mark Johnston 63d5f8c0f2 vmrun.sh: Stop passing -A to bhyve
It's a no-op now.

Sponsored by:	Innovate UK
2024-04-24 09:58:04 -04:00
Mark Johnston 107584716c bhyve.8: Remove mention of the -A flag
It is a no-op on amd64 now and is not implemented on arm64, so let's
remove mention of it altogether so as to reduce confusion for arm64
users.

Reviewed by:	corvink, jhb
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D44737
2024-04-24 09:57:12 -04:00
Alan Somers 4b7949144c geli.8: add some notes regarding performance tuning
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D44908
2024-04-24 07:53:37 -06:00
Mark Johnston 8ef2c02182 busdma: uma_zcreate() does not fail
No functional change intended.

MFC after:	1 week
2024-04-24 08:46:41 -04:00
Mark Johnston 1e607a0753 khelp: uma_zcreate() does not fail
No functional change intended.

MFC after:	1 week
2024-04-24 08:46:35 -04:00
Mark Johnston 78c51db3c4 udf: uma_zcreate() does not fail
While here remove an old comment regarding preallocation; it appears to
refer to an optimization that is almost certainly irrelevant at this
point.

No functional change intended.

MFC after:	1 week
2024-04-24 08:45:59 -04:00
Mark Johnston b6a0ed7c78 wg: uma_zcreate() does not fail
No functional change intended.

MFC after:	1 week
2024-04-24 08:45:40 -04:00
Mark Johnston 964064937e dpaa: uma_zcreate() does not fail
No functional change intended.

MFC after:	1 week
2024-04-24 08:45:24 -04:00
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