Commit graph

291908 commits

Author SHA1 Message Date
Andrew Turner 53120fbb68 csu: Find the main pointer through the GOT
Use the Global Offset Table to find the location of main in crt1. With
lld the old code would point to main@plt, however ld.bfd fails to link
when main is in a shared library.

Fix this by using the GOT address to find main as it works with both
lld and bfd.

Reviewed by:	jrtc27
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45259
2024-05-22 08:18:10 +00:00
Andrew Turner 8e82c5e28d stand/kboot: Fix the linker script OUTPUT_FORMAT
ld.bfd doesn't understand elf64-aarch64 but does have
elf64-littleaarch64. Switch to this so we can link kboot with it.

While here switch to the single format version. We are unlikely to
support booting from a big-endian Linux.

Reviewed by:	imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45258
2024-05-22 08:17:52 +00:00
Andrew Turner 9f44638ef2 stand/efi: Fix for binutils when targeting arm64
When linking with ld.bfd it complain with the following:

/usr/local/bin/aarch64-unknown-freebsd14.0-ld: start.o: relocation
 R_AARCH64_ABS32 against `__data_size' can not be used when making a
 shared object

Fix this by marking the __data_size with ABSOLUTE. This returns a
non-relocatable value which appears to be the same behaviour of lld.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45257
2024-05-22 08:17:26 +00:00
Juraj Lutter 7618c9e163 daemon: Add -C (--restart-count) option
Add a new option (-C, --restart-count) to specify the maximum
number of times that the controlled process is restarted if
restart (-r) is restarted.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44944
2024-05-22 09:45:23 +02:00
Kristof Provost bdd12889ea if_vlan: handle VID conflicts
If we fail to change the vlan id we have to undo the removal (and vlan id
change) in the error path. Otherwise we'll have removed the vlan object from the
hash table, and have the wrong vlan id as well. Subsequent modification attempts
will then try to remove an entry which doesn't exist, and panic.

Undo the vlan id modification if the insertion in the hash table fails, and
re-insert it under the original vlan id.

PR:		279195
Reviewed by:	zlei
MFC atfer:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D45285
2024-05-22 09:08:02 +02:00
Kyle Evans 6e824f3713 time: siginfo_recvd needs to be marked volatile
sig_atomic_t does not imply volatility, we must do it ourselves to avoid
caching of siginfo_recvd loads.

Sponsored by:	Klara, Inc.
2024-05-22 00:37:41 -05:00
Pawel Jakub Dawidek 61e3e1776d capsicum: SIGTRAP is delivered also on ECAPMODE error.
Approved by: oshogbo (mentor)
2024-05-21 21:51:50 -07:00
Pawel Jakub Dawidek ff4fc43afd Fix build. 2024-05-22 03:56:59 +00:00
Pawel Jakub Dawidek 31223e68e2 Simplify the code.
Obtained from: Fudo Security
Reviewed by: asomers, imp
Approved by: oshogbo (mentor)
Differential Revision: https://reviews.freebsd.org/D45247
2024-05-22 03:01:24 +00:00
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