Commit graph

291749 commits

Author SHA1 Message Date
Simon J. Gerraty dc501a9ec0 Allow DEBUG_SH=rc:all to debug all rc.d
Usually a bad idea but there are exceptions to every rule.
Allso debugging all rc.d scripts or all with a given arg.
2024-05-21 19:44:20 -07:00
Warner Losh 208f11e806 linprocfs: use %z for size_t arguments
64-bit doesn't care or give a warning, but i386 compile complains
(rightly) that these are size_t and need a %z modifier.

Fixes: 25a04527b7
Sponsored by:		Netflix
2024-05-21 20:03:08 -06:00
Ricardo Branco 25a04527b7 linprocfs: Add support for proc/sysvipc/{msg,sem,shm}
Reviewed by: imp,kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1232
2024-05-21 17:58:28 -06:00
Elliott Mitchell cbcb9778dd kern/rman: mark rman get functions as taking constants
The arguments are left completely unchanged by these functions.  This
allows passing constant pointers for verifying ownership, but not
modifying the contents.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
2024-05-21 17:52:29 -06:00
Elliott Mitchell 996fa9fb4e kern/rman: update rman_make_alignment_flags()
The flsl() function makes use of hardware functionality to compute the
value faster than this loop.  The only deviation from flsl() is at 0.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
2024-05-21 17:52:27 -06:00
Elliott Mitchell 037946dc9b kern/rman: remove rman_reserve_resource_bound(), partially revert 13fb665772
Not once has rman_reserve_resource_bound() ever been used.  There are
though several uses of RF_ALIGNMENT.  In light of this remove this
extra and leave the actually used portion in place.

This partially reverts commit 13fb665772.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
2024-05-21 17:52:24 -06:00
Elliott Mitchell beb1165a01 kern/rman: update debugging lines in subr_rman.c
Rather than hard-code the function name, use __func__ instead.  Apply
some style and adjust indentation as appropriate.  Remove the no longer
required braces.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
2024-05-21 17:52:21 -06:00
Elliott Mitchell 973c32297f kern/rman: update DPRINTF() macro, avoid semicolon swallowing match function
Using a variadic macro allows passing everything properly to printf().
Using the do { } while(0) construct ensures the macro acts like any
other single statement.  This shows just how long some of this has
existed.

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1224
2024-05-21 17:52:15 -06:00
Pierre Pronchery 408572a24e libnvmf: avoid resource leak
In nvmf_host_fetch_discovery_log_page(), the log variable may have been
allocated on the heap during the first loop cycle, and should be
free()'d before exiting upon errors.

Reported by:	Coverity
CID:		1545034
Sponsored by:	The FreeBSD Foundation

Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1239
2024-05-21 17:41:04 -06:00
Alexander Ziaee bd2d71b1c8 smb.4/smbfs.4: distinguishable descriptions, +SPDX
Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1241
2024-05-21 17:41:04 -06:00
Alexander Ziaee 5ad3b09f2f unionfs.4: describe better, tag SPDX
Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1242
2024-05-21 17:41:04 -06:00
Alexander Ziaee 7839534a5a autofs manuals: align lists, tag SPDX
MFC after: 3 days
Fixes: 286c4906d6 (add -noauto), 3914ddf8a7 (import autofs)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1243

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1243
2024-05-21 17:41:04 -06:00
Bjoern A. Zeeb bb025df257 LinuxKPI: add FIELD_PREP_CONST()
Add FIELD_PREP_CONST() like FIELD_PREP() without any extra checks likely
expected on this version in Linux.  This is called by an updated wireless
driver.

Sposnored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D45180
2024-05-21 23:27:10 +00:00
Eric Joyner ba222f6fb4 iavf(4): Improve man page
MFC after:	3 days
Reviewed by:	erj
Differential Revision:	https://reviews.freebsd.org/D43093
2024-05-22 01:24:31 +02:00
Allan Jude e209715001 ftpd: stop using -g flag for /bin/ls
In 3bfbb521 the behaviour of ls was changed such that -g was no longer
a noop for compatibility with BSD 4.3, but instead changed the output
of long mode to exclude the owner of the file and display only the
group.

Update how FTPd invokes ls to restore the previous behaviour

Reported-by:	Andrew Fengler <andrew.fengler@scaleengine.com>
Reviewed-by:	jrtc27, des, imp
MFC after:	3 days
Sponsored-by:	ScaleEngine Inc.
Fixes:		3bfbb521fe ("ls: Improve POSIX compatibility for -g and -n.")
2024-05-21 22:50:14 +00:00
Dag-Erling Smørgrav a4be1eb211 access(2): Discourage use of these system calls.
Fixes:		421025a274
PR:		262895
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45240
2024-05-22 00:35:22 +02:00
Bjoern A. Zeeb 8e4b8e9d80 LinuxKPI: add kvmemdup()
Add kvmemdup() as a variant of kmemdup().  While currently it could
just call kmemdup() we duplicate the code and use kvmalloc() in case
someone will change the implementation of kvmalloc/kvfree in slab.h.
This is used by an updated wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D45181
2024-05-21 22:14:50 +00:00
Bjoern A. Zeeb 69b6c4a6ec LinuxKPI: 802.11: fix for_each_sta_active_link()
Likely a c&p error from for_each_vif_active_link() to
for_each_sta_active_link().
We are checking the nitems on the vif instead of the sta in this macro.
Function wise there is no difference as the arrays are the same size
but for correctness fix this.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-05-21 22:12:00 +00:00
Mariusz Zaborski 408957613b Regen 2024-05-21 22:03:20 +02:00
Edward Tomasz Napierala 6b7e4254a2 capsicum: allow rfork(2) in capability mode
Reviewed by:	brooks, rwatson
MFC after:	4 days
Differential Revision:	https://reviews.freebsd.org/D45040
2024-05-21 22:02:36 +02:00
Chris Moerz c80c104cbd
glabel.8: Describe cases related to permissions / existing mounts
Specially, note some requirements for label changes:

- glabel requires write permission on device
- filesystems first need to be unmounted for new labels to persist
  across reboots
- if the affected device node holds the filesystem root, single-user
  mode with r/o mount will be required.

Also, while here, apply some formatting tweaks.

PR:		276724
Reported by:	Alex Matei <matei35@yahoo.com>
Reviewed by:	gbe, jrm, Alexander Ziaee <concussious@runbox.com>
Differential Revision:	https://reviews.freebsd.org/D44394
2024-05-21 15:49:17 -03:00
Ryan Libby a332ba32d4 getblk: fail faster with GB_LOCK_NOWAIT
If we asked not to wait on a lock, and then we failed to get a buf lock
because we would have had to wait, then just return the error.  This
avoids taking the bufobj lock and a second trip to lockmgr.

Reviewed by:	mckusick, kib, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45245
2024-05-21 10:21:50 -07:00
Ryan Libby bd56aad33c buf: define and use BUF_DISOWNED
Implement an API where previously code was directly reaching into the
buf's internal lock.

Reviewed by:	mckusick, imp, kib, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45249
2024-05-21 10:21:50 -07:00
Ryan Libby b92cd6b294 lockmgr: make lockmgr_disowned public and use it
Reviewed by:	mckusick, kib, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45248
2024-05-21 10:21:50 -07:00
John Baldwin 4ebf794a08 cryptocheck: Don't test Chacha20-Poly1305 with an IV size of 8
OpenSSL 3.0+ doesn't support an IV size of 8 either for the Chacha20
stream cipher or the AEAD combination with Poly1305.  This did work
previously with OpenSSL 1.1.

Reviewed by:	markj
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D45280
2024-05-21 09:48:50 -07:00
Zhenlei Huang 76df3c57a0 ifconfig: Redo fix vlan/vlanproto reconfiguration
When the if_vlan(4) interface has not been fully configured, i.e., a
bare interface without a physical interface associated with it,
retrieving the current settings of it and unconditionally overwriting
`params` will result in losing vlandev settings in `params`. That will
lead to failing to associate the if_vlan(4) interface with the requested
physical interface and the false report 'both vlan and vlandev must be
specified'.

Fix that by checking if the vlan interface has been fully configured.

The basic VLAN test is slightly modified to cover this case.

PR:		279181
Reviewed by:	kp
Tested by:	Mike Tancsa <mike@sentex.net>
Fixes:		b82b8055ad ifconfig: fix vlan/vlanproto reconfiguration
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45283
2024-05-22 00:35:01 +08:00
Jeremy Collin 48edad2edf fix (nuageinit): SSH keys are not handled in metadata but in userdata
MFC After: 1 day
2024-05-21 16:52:42 +02:00
Ricardo Branco 7975f57b7e uipc_shm: Fix double check for shmfd->shm_path
Reviewed by:	emaste, zlei
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1250
2024-05-21 09:39:53 -04:00
Mathieu Simon 8e5e42d54a Add man page for the ice network driver.
PR:		262892
MFC after:	3 days
Reviewed by:	concussious.bugzilla@runbox.com, erj
Differential Revision:	https://reviews.freebsd.org/D45270
2024-05-21 07:53:02 +02:00
Christos Margiolis d59058f3b3 sound: Make SNDST_UNVLBUF_MAX a power of two
Fixes:		074d337ad6 ("sound: Check user-supplied size passed to SNDSTIOC_ADD_USER_DEVS*")
Reported by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45277
2024-05-20 19:41:18 +02:00
Ryan Libby da590a3e18 lock.9: LK_TIMELOCK is a lockmgr flag, not lockinit
Reviewed by:	imp, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45246
2024-05-20 09:48:32 -07:00
Renato Botelho 55d2990548 bsdinstall: Fix wifi network selection size
Use correct variable while creating dialog used to select among
available wireless networks

Approved by:	asiciliano
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D45271
2024-05-20 13:39:29 -03:00
Wolfram Schneider 37be4197f7 man: the exists function needs to validate the first parameter
This fixes an issue with the ".so " macro for FreeBSD
ports manual pages.

PR: 275978
Reported by:	Jamie Landeg-Jones <jamie@catflap.org>
MFC after:	1 week

Differential Revision:	https://reviews.freebsd.org/D45231 (discussion)
2024-05-20 16:02:21 +00:00
Brooks Davis 6edb14c006 Make WITHOUT_UNDEFINED_VERSION the default
Link with --no-undefined-version by default.  Will detect and prevent
the accidental removal of symbols from versioned libraries.

(cherry picked from commit 4510f2ca91)
This reverts commit b25ceb97ed.

Reviewed by:	arichardson, kib, dim, emaste
Differential Revision:	https://reviews.freebsd.org/D44216
2024-05-20 15:40:19 +01:00
Dag-Erling Smørgrav 9c7f83bbb4 diff: Nits in tests.
Sponsored by:	Klara, Inc.
2024-05-20 16:27:50 +02:00
Christos Margiolis 64f4e2db6d sound: Correctly check nvlist_unpack() error
The current check is never false and if nvlist_unpack() fails, we might
panic later down the road.

PR:		266144
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45237
2024-05-20 16:18:33 +02:00
Christos Margiolis 074d337ad6 sound: Check user-supplied size passed to SNDSTIOC_ADD_USER_DEVS*
SNDSTIOC_ADD_USER_DEVS* expects a user-supplied sndstioc_nv_arg->nbytes,
however we currently do not check whether this size is actually valid,
which results in a panic when SNDSTIOC_ADD_USER_DEVS* is called with an
invalid size. sndstat_add_user_devs() calls
sndstat_unpack_user_nvlbuf(), which then calls malloc() with that size.

PR:		266142
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D45236
2024-05-20 16:18:28 +02:00
Christos Margiolis 5d1a5d6f1f sound: Prevent uninitialized variable destruction in chn_init()
If dsp_unit2name() fails, we'll get to out2 with b, bs and devinfo
uninitialized, which will result in a panic.

Reported by:	Pierre Pronchery <pierre@freebsdfoundation.org>
Reported by:	Coverity Scan
CID:		1545029, 1545025
Pull-request:	https://github.com/freebsd/freebsd-src/pull/1240
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45272
2024-05-20 16:14:25 +02:00
Christos Margiolis 2db2292dac sound: Get rid of redundant assignments in chn_init()
c is allocated with M_ZERO.

Reported by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45273
2024-05-20 16:14:17 +02:00
Mike Karels 0b39b2e2dd adduser: create dataset only if home is directly within dataset
Currently, if the prefix of the new home directory is a subdirectory
of a ZFS dataset, adduser will create a new dataset up one or more
levels from the intended destination.  "pw useradd" will then create
a normal directory in the desired location, leaving an unused dataset.
Check for this situation when determining whether to create a dataset,
and let pw create the directory.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D45229
MFC after:	3 days
2024-05-20 08:43:34 -05:00
Dag-Erling Smørgrav b780b6508b diff: Warn if the atomizer detected truncation.
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D45219
2024-05-20 15:26:46 +02:00
Dag-Erling Smørgrav 02d98d1850 libdiff: Add a test for the truncation issue.
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D45218
2024-05-20 15:26:42 +02:00
Dag-Erling Smørgrav 974ea6b297 libdiff: Detect and recover from file truncation.
If a memory-mapped file is truncated before we get to the end, the
atomizer may catch SIGBUS.  Detect that, reduce the input length to
what we were actually able to read, and set a flag so the caller can
take further action (e.g. warn the user and / or start over).

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45217
2024-05-20 15:26:33 +02:00
Zhenlei Huang 93fbfef0b5 if_vxlan(4): Add checking for loops and nesting of tunnels
User misconfiguration, either tunnel loops, or a large number of
different nested tunnels, can overflow the kernel stack. Prevent that
by using if_tunnel_check_nesting().

PR:		278394
Diagnosed by:	markj
Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45197
2024-05-20 20:14:07 +08:00
Warner Losh c7581d76a1 loader: fix stupid typos
Sponsored by:		Netflix
2024-05-19 23:04:18 -06:00
Warner Losh 861f802b3e textvidc: Reindent
Since this is now 'new code' go ahead and reindent for modern project
preferences.

Sponsored by:		Netflix
2024-05-19 22:05:43 -06:00
Warner Losh 4cddd20e1e loader/ofw: Style(9) pass over return statements
Make these consistent. Some files weren't even consistent with
themselves. Make them all either return <space> ( <value> ); or
return;

Sponsored by:		Netflix
2024-05-19 22:05:43 -06:00
Warner Losh 3f012b9508 loader: stlye(9) nit: Space between return and the value
Sponsored by:		Netflix
2024-05-19 22:05:43 -06:00
Warner Losh 2d425b634f loader: c_init returns 0 or 1
c_init returns 0 (success) or 1 (failure). Don't return other values.

Sponsored by:		Netflix
2024-05-19 22:05:42 -06:00
Warner Losh 125b181674 userboot: Use C99 Initializers for each of the consoles here
Sponsored by:		Netflix
2024-05-19 22:05:42 -06:00