Commit graph

291816 commits

Author SHA1 Message Date
Ricardo Branco ddbfb544c6 mqueuefs: Relax restriction that path must begin with a slash
This is needed to support Linux implementation which discards the leading slash when calling mq_open(2)

Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1248
2024-05-23 13:40:46 -06:00
Ricardo Branco 04d3f8e539 linprocfs: Add support for proc/sys/fs/mqueue/*
Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1248
2024-05-23 13:40:45 -06:00
Ricardo Branco acb7a4deb2 mqueue: Add sysctl for default_maxmsg & default_msgsize and fix descriptions
Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1248
2024-05-23 13:40:45 -06:00
Gleb Smirnoff 0d37895849 ctl: use socket buffer mutexes in struct socket directly
A mechanical change performed with sed(1) script:

s/SOCKBUF_LOCK\(&so->so_rcv\)/SOCK_RECVBUF_LOCK(so)/
s/SOCKBUF_UNLOCK\(&so->so_rcv\)/SOCK_RECVBUF_UNLOCK(so)/
s/SOCKBUF_MTX\(&so->so_rcv\)/SOCK_RECVBUF_MTX(so)/
s/SOCKBUF_LOCK\(&so->so_snd\)/SOCK_SENDBUF_LOCK(so)/
s/SOCKBUF_UNLOCK\(&so->so_snd\)/SOCK_SENDBUF_UNLOCK(so)/
s/SOCKBUF_MTX\(&so->so_snd\)/SOCK_SENDBUF_MTX(so)/

Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D45190
2024-05-23 12:11:54 -07:00
Pierre Pronchery 3d7c8f0887 cp: avoid a resource leak
In copy_file(), make sure the from_fd file descriptor is closed even
when the operation failed early.

Reported by:	Coverity Scan
CID:		1545036
Sponsored by:	The FreeBSD Foundation

Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1238
2024-05-23 12:04:43 -06:00
Warner Losh a5f03413aa ci: Redirect output for builds.
This target is far too noisy to be at all useful. Save the output ala
make universe in _. files. Also report where to find errors.

Sponsored by:		Netflix
2024-05-23 11:59:40 -06:00
Michael Dexter be3631bc8d option_survey.sh: Bump size to 5GB
Increase image size from 4G to 5G to accommodate growth in OS.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1251
2024-05-23 10:47:38 -06:00
Tom Hukins 083d149224 etherswitch.4: List manual pages alphabetically
Signed-off-by: Tom Hukins <tom@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1253
2024-05-23 10:35:29 -06:00
Tom Hukins 2c9f8518de etherswitch.4: Remove non-existent manual pages
Signed-off-by: Tom Hukins <tom@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1253
2024-05-23 10:35:28 -06:00
Tom Hukins 2ce32ab21a Fix "version introduced" in two manual pages
Signed-off-by: Tom Hukins <tom@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1252
2024-05-23 10:30:32 -06:00
Brooks Davis fcc5fa091e libcompiler_rt: gcc13 doesn't support _Float16 on arm
Don't set CRT_COMMON_F16_ARCH for arm as it's not supported by gcc13.

Differential Revision:	https://reviews.freebsd.org/D45234
2024-05-23 17:27:37 +01:00
Brooks Davis 6729e8a40b libpmc: remove tautological assert
gcc13 whines about this assert than an unsigned integer is >= 0.

Reviewed by:	luporl
Fixes:		b48a2770d4 powerpc64: add Power8 and Power9 PMCs
Differential Revision:	https://reviews.freebsd.org/D45232
2024-05-23 17:27:37 +01:00
Alexander Motin 49086aa35d Fix scn_queue races on very old pools
Code for pools before version 11 uses dmu_objset_find_dp() to scan
for children datasets/clones.  It calls enqueue_clones_cb() and
enqueue_cb() callbacks in parallel from multiple taskq threads.
It ends up bad for scan_ds_queue_insert(), corrupting scn_queue
AVL-tree.  Fix it by introducing a mutex to protect those two
scan_ds_queue_insert() calls.  All other calls are done from the
sync thread and so serialized.

Reviewed-by:	Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by:	Brian Atkinson <batkinson@lanl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes	#16162
PR:	278414
2024-05-23 12:20:37 -04:00
Brooks Davis fb9013f215 pcm: centralize 32-bit ioctl compat
Move all handlng of struct sndstioc_nv_arg(32) to sndstat_ioctl() and
make the functions that actually do the work take a buffer and size or
size pointer.  The 32-bit compat work is minimal so just inline it.

Remove checks that we've got a 32-bit process for 32-bit ioctls.  We
don't check that default ioctls are from 64-bit processes on 64-bit
systems.

Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D45307
2024-05-23 17:15:09 +01:00
Baptiste Daroussin 61b07f8aa5 MAC/do: allow to call setuid if real user id is 0
This fixed sshd not able to call restore_uid when MAC/do policy is
loaded
2024-05-23 12:09:11 +02:00
Pawel Jakub Dawidek 56a8aca83a Stop treating size 0 as unknown size in vnode_create_vobject().
Whenever file is created, the vnode_create_vobject() function will
try to determine its size by calling vn_getsize_locked() as size 0
is ambigious: it means either the file size is 0 or the file size
is unknown.

Introduce special value for the size argument: VNODE_NO_SIZE.
Only when it is given, the vnode_create_vobject() will try to obtain
file's size on its own.

Introduce dedicated vnode_disk_create_vobject() for use by
g_vfs_open(), so we don't have to call vn_isdisk() in the common case
(for regular files).

Handle the case of mediasize==0 in g_vfs_open().

Reviewed by: alc, kib, markj, olce
Approved by: oshogbo (mentor), allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D45244
2024-05-23 06:08:14 +00:00
Zhenlei Huang d76ef58d56 freebsd-update: Correctly check if pkg(8) is present
On systems without pkg(8) installed, `command -v pkg` will return
success and falsely report that pkg(8) is present. Fix that by checking
via the `pkg -N` form.

This is missing from the final revision of D39695.

Reported by:	delphij
Reviewed by:	fernape, delphij
Fixes:		bc0c6c9cf3 freebsd-update: Add check for kernel modules
Differential Revision:	https://reviews.freebsd.org/D45292
2024-05-23 12:10:17 +08:00
Alan Cox 9fc5e3fb39 arm64: set ATTR_CONTIGUOUS on the DMAP's L2 blocks
On systems configured with 16KB pages, this change creates 1GB page
mappings in the direct map where possible.  Previously, the largest page
size that was used to implement the direct map was 32MB.  Similarly, on
systems configured with 4KB pages, this change creates 32MB page
mappings, instead of 2MB, in the direct map where 1GB is too large.

Implement demotion on L2C (32MB/1GB) page mappings within the DMAP.

Update sysctl vm.pmap.kernel_maps to report on L2C page mappings.

Reviewed by:	markj
Tested by:	gallatin, Eliot Solomon <ehs3@rice.edu>
Differential Revision:	https://reviews.freebsd.org/D45224
2024-05-22 22:09:43 -05:00
Christos Margiolis 425a7bc465 sound: Fix minchn, maxchn and fmts in sndstat_get_caps()
The current implementation (incorrectly) passes the channel encoding
value to AFMT_CHANNEL(), which will always return 0, since the channel
number bits are masked out by AFMT_ENCODING().

Also add missing fmts initialization and aggregate encoding formats into
it directly.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45312
2024-05-23 02:57:55 +02:00
Christos Margiolis 1ab62c8d06 mixer.3: Fix mandoc -Tlint warnings
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45290
2024-05-23 02:57:49 +02:00
Christos Margiolis e3b94b375e mixer(8): Use mixer_get_path()
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45276
2024-05-23 02:57:43 +02:00
Christos Margiolis 67c89b21b9 mixer(3): Implement mixer_get_path() function
This is better than hardcoding device paths in mixer applications.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45275
2024-05-23 02:57:36 +02:00
Christos Margiolis 0e80798518 mixer(8): Ignore mixer_open() failures for the -a option
The most likely reason mixer_open() will fail is because either the
device doesn't exist, or because it is disabled, so there is not reason
to kill the application. Instead, continue and print the rest of the
enabled mixers.

PR:		277615
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45151
2024-05-23 02:57:25 +02:00
Christos Margiolis 5d980fadf7 sound: Handle unavailable devices in various OSS IOCTLs
mixer(8)'s -a option is used to print information about all mixer
devices in the system. To do this, it loops from 0 to
mixer_get_nmixers(), and tries to open "/dev/mixer%d". However, this
approach doesn't work when there are disabled/unregistered mixers in the
system, or when an audio device simply doesn't have a mixer.

mixer_get_nmixers() calls SNDCTL_SYSINFO and returns
oss_sysinfo->nummixers, whose value is the number of currently _enabled_
mixers only. Taking the bug report mentioned below (277615) as an
example, suppose a system with 8 mixer devices total, but 3 of them are
either disabled or non-existent, which means they will not show up under
/dev, meaning we have 5 enabled mixer devices, which is also what the
value of oss_sysinfo->nummixers will be. What mixer(8) will do is loop
from 0 to 5 (instead of 8), and start calling mixer_open() on
/dev/mixer0, up to /dev/mixer4, and as is expected, the first call will
fail right away, hence the error shown in the bug report.

To fix this, modify oss_sysinfo->nummixers to hold the value of the
maximum unit in the system, which, although not necessarily "correct",
is more intuitive for applications that will want to use this value to
loop through all mixer devices.

Additionally, notify applications that a device is
unavailable/unregistered instead of skipping it. The current
implementations of SNDCTL_AUDIOINFO, SNDCTL_MIXERINFO and
SNDCTL_CARDINFO break applications that expect to get information about
a device that is skipped. Related discussion can be found here:
https://reviews.freebsd.org/D45135#1029526

It has to be noted, that other applications, apart from mixer(8), suffer
from this.

PR:		277615
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45256
2024-05-23 02:57:17 +02:00
Christos Margiolis e07f917850 sound: Separate implementations for SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO
FreeBSD's implementation of SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO
does not exactly work as intended. The problem is essentially that both
IOCTLs return the same information, while in fact the information
returned currently by dsp_oss_audioinfo() is what _only_
SNDCTL_ENGINEINFO is meant to return.

This behavior is also noted in the OSS manual [1] (see bold paragraph in
"Audio engines and device files" section), but since e8c0d15a64
("sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)") we can
actually fix this, because we now expose only a single device for each
soundcard, and create the engines (channels) internally.
SNDCTL_ENGINEINFO will now report info about all channels in a given
device, and SNDCTL_AUDIOINFO[_EX] will only report information about
/dev/dspX.

To make this work, we also have to modify the SNDCTL_SYSINFO IOCTL to
report the number of audio devices and audio engines correctly.

While here, modernize the minimum and maximum channel counting in both
SNDCTL_AUDIOINFO[_EX] and SNDCTL_ENGINEINFO. Currently these IOCTLs will
report only up to 2 channels, which is no longer the case.

[1] http://manuals.opensound.com/developer/SNDCTL_AUDIOINFO.html

PR:		246231, 252761
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45164
2024-05-23 02:57:04 +02:00
Warner Losh 1e84b85aad geom: Remove sysctl.h
These files don't need sysctl.h, so remove it.

Sponsored by:		Netflix
2024-05-22 16:24:11 -06:00
Lutz Bichler 93ad59a251 snd_hda: Add patch for Asus UX331UAL
PR:		242802
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D45238
2024-05-23 00:19:50 +02:00
Konstantin Belousov f0a4dd6d46 mqueuefs: mark newly allocated vnode as constructed, under the lock
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-05-23 01:13:29 +03:00
Konstantin Belousov b6f4a3fa75 mqueuefs: uma_zfree() can be postponed until mqfs sx mi_lock is dropped
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-05-23 01:13:29 +03:00
Konstantin Belousov 63f18b37e0 mqueuefs: minor style pass
Also remove not needed inclusion of sys/cdefs.h.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-05-23 01:13:29 +03:00
Warner Losh 58e44aa011 Fix typo
ioclt -> ioctl. <blush>

Fixes:		08b4520338
Noticed by:	Thomas Mueller and John W. De Boskey
Pointy hat to:	imp
Sponsored by:	Netflix
2024-05-22 15:10:09 -06:00
Warner Losh 0115ad61d8 autofs: Fix cross-threading on file to delete
We want to delete the new file, which is installed in man4 not man5.

Noticed by:	Gary Jennejohn
Fixes:		a03e8a40d4
Sponsored by:	Netflix
2024-05-22 15:10:08 -06:00
Bjoern A. Zeeb d1af434d99 LinuxKPI: 802.11: rename chanctx_conf for consistency
We used to call the struct ieee80211_chanctx_conf variable "conf"
in some places but that becomes confusing with bss_conf and other
"conf" bits.  On the vif it is already called chanctx_conf thus also
rename it on the internal struct lkpi_chanctx and for our variables
in the implementation.

This should not have any external visibility.
No functional changes intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D45185
2024-05-22 21:08:55 +00:00
Bjoern A. Zeeb 5a4d24610f LinuxKPI: 802.11: change teardown order to avoid iwlwifi firmware crashes
While the previous order worked well for iwlwifi 22000 and later chipsets
(AXxxx, BE200), earlier chipsets had trouble and ran into firmware crashes.
Change the teardown order to avoid these problems.  The inline comments
in lkpi_sta_run_to_init() (and lkpi_disassoc()) try to document the new
order and also the old problems we were seeing (too early sta removal or
silent non-removal) leading to follow-up problems.

There is a possible further problem still lingering but a lot harder to
trigger (see comment in review) and likely related to some other doings
so we'll track it separately.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
PR:		275255
Tested with:	AX210, 8265 (bz); 9260 (Bakul Shah)
Differential Revision: https://reviews.freebsd.org/D45293
2024-05-22 21:04:19 +00:00
Oleksandr Kryvulia 6841c2677c zzz: Fix output formatting when suspend state not supported
Reviewed by: imp (who also simplified things a little)
Differenetial Revision: https://reviews.freebsd.org/D45299
2024-05-22 14:21:18 -06:00
Stephen J. Kiernan 56b2742130 Add function to OSD to get values without taking the lock.
There are some cases of OSD use where the value is only initialized once
at a point where successive access of the value can be done so safely
without the need to take the lock.

Reviewed by:	markj
Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D44631
2024-05-22 15:55:48 -04:00
Michael Tuexen a45a9e61b4 blackhole.4: improve man page
Not the connection is dropped, but the incoming SYN segment.
Reviewed by:		concussious.bugzilla_runbox.com
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D45296
2024-05-22 20:36:24 +02:00
Andrew Turner a3310b7943 src.conf.5: Regen 2024-05-22 17:02:26 +00:00
Andrew Turner 82854693ae arm64: Allow userspace to be built with PAC and BTI
Add the WITH/WITHOUT_BRANCH_PROTECTION build flags. This can be used
to enable the use of pointer authentication (FEAT_PAuth) and branch
target identification (FEAT_BTI) in userspace.

The kernel already handles both of these is userspace, we just need
to enable it.

Leave disabled for a short period for this to settle before enabling.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42596
2024-05-22 17:02:26 +00:00
Ruslan Bukin 2183004e14 riscv: Implement atomic operations
Implement atomic_load_acq_16, atomic_store_rel_16.

These are needed by bhyve(8) PCIe bus emulation code.

Group 16-bit atomic functions similarly to 32 and 64-bit.

Reviewed by:	mhorne
Differential Revision:	https://reviews.freebsd.org/D45228
2024-05-22 16:45:11 +01:00
Ruslan Bukin ddd0d4f4cd riscv: Fix SSTC extension support
From the SSTC spec:
"If the stimecmp (supervisor-mode timer compare) register is implemented,
then STIP is read-only in mip and reflects the supervisor-level timer
interrupt signal resulting from stimecmp. This timer interrupt signal
is cleared by writing stimecmp with a value greater than the current time
value."

This fixes operation in Spike with sstc extension enabled.
Example:
  spike --isa RV64IMAFDCH_zicntr_zihpm_sstc

Reviewed by:	mhorne
Differential Revision:	https://reviews.freebsd.org/D45226
2024-05-22 16:44:03 +01:00
Ryan Libby bea2bf458d tpm_if.m: declare bus addresses as bus_size_t not bus_addr_t
Do like bus_space(9) does.  This fixes the build on platforms where
bus_addr_t and bus_size_t are different (like i386 PAE).

Reviewed by:	jhibbits
Fixes:		c2e9c5bbf0 tpm: Refactor TIS and add a SPI attachment
Differential Revision:	https://reviews.freebsd.org/D45287
2024-05-22 07:55:04 -07:00
Piotr Kubaj b7f62c6042 usr.bin/top: fix displaying load average for loads of at least 100
After top registers load average of at least 100 which then gets reduced to
below 100, there are left stray digits.
Supporting load over 100 requires increasing the width only to 6, but since
we support over 1000 CPU's now, let's increase it to 7.

Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D45284
2024-05-22 16:47:46 +02:00
Baptiste Daroussin eaab8e4166 mac_do(4): fix typo
Reported by:	Gary Jennejohn <garyj@gmx.de>
2024-05-22 15:56:36 +02:00
Alexander Leidinger f99f0ee14e rc.d: add a service jails config to all base system services
This gives more permissions to services (e.g. network access to
services which require this) when they are started as an automatic
service jail.

The sshd patch is important for the sshd-related functionality as
described in the man-page in the service jails part.

The location of the added env vars is supposed to allow overriding them
in rc.conf, and to hard-disable the use of svcj for some parts where it
doesn't make sense or will not work.

Only a subset of all of the services are fully tested (I'm running this
since more than a year with various services started as service jails).
The untested parts should be most of the time ok, in some edge-cases
more permissions are needed inside the service jail.
Differential Revision:	https://reviews.freebsd.org/D40371
2024-05-22 15:41:49 +02:00
Alexander Leidinger 2efbd480f1 rc: add service jails framework
This takes a rc.d-service and starts it in a jail which shares the same
root-path as the host (or parent jail) and may inherit the network from
the host (or parent jail). Per service there is the possibility to
specify some arguments which give more permissions (e.g. netv4, netv6,
sysvipc...).
Reviewed by:	bcr (man page)
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D40370
2024-05-22 15:41:48 +02:00
Dmitry Salychev 971b77da46
arm64: Return newline at the end of NOTES back
It fixes LINT kernel build after ac4ddc467b.

MFC after:	3 days
2024-05-22 15:20:40 +02:00
Baptiste Daroussin c180fd3d75 RELNOTES: document MAC/do 2024-05-22 14:05:57 +02:00
Baptiste Daroussin 8aac90f18a mac_do: add a new MAC/do policy and mdo(1) utility
This policy enables a user to become another user without having to be
root (hence no setuid binary). it is configured via rules using sysctl
security.mac.do.rules

For example:
security.mac.do.rules=uid=1001:80,gid=0:any

The above rule means the user identifier by the uid 1001 is able to
become user 80
Any user of the group 0 are allowed to become any user on the system.

The mdo(1) utility expects the MAC/do policy to be installed and its
rules defined.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D45145
2024-05-22 14:01:41 +02:00
Dmitry Salychev ac4ddc467b
arm64: Fixed IOMMU compilation errors
These are missing changes after 1228b93b41 when ref_count was
removed from bus_dma_tag_common and 1e3f42b6ba, when the address
arguments were switched to pointers.

Reviewed by:		jhb
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D45289
2024-05-22 11:08:00 +02:00