Commit Graph

293456 Commits

Author SHA1 Message Date
Christos Margiolis 3decd659a7 sound examples: Simplify audio example
- Merge ossinit.h and basic.c.
- Rename basic.c to audio.c.
- Use err(3) instead of fprintf(3) + exit(3).
- Some style(9) improvements.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46307
2024-08-24 15:07:45 +03:00
Christos Margiolis 0ca4d5d820 sound examples: Simplify MIDI example
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D46306
2024-08-24 15:07:40 +03:00
Christos Margiolis 9aac27599a mixer(8): Implement hot-swapping
Introduce a -V option, which can be used alongside -d (default unit
change), in order to hot-swap devices (i.e switch to them on the fly
without needing to restart the track), in case virtual_oss(8) exists and
is running.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46253
2024-08-24 15:07:35 +03:00
Christos Margiolis 2668e76d6e sound tests: Add SNDSTIOC_ADD_USER_DEVS test
Test whether the SNDSTIOC_ADD_USER_DEVS IOCTL (registers a userland
device to /dev/sndstat) works properly.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46228
2024-08-24 15:07:29 +03:00
Gordon Tetlow e972e408d1 release: Redirect etcupdate logfile to /dev/null.
Stop shipping a log file for etcupdate. This is a source of
non-reproducability as it uses mktemp thereby guaranteeing the output is
different each run.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46317
2024-08-23 22:35:07 -07:00
Brooks Davis 5cbb98c825 proccontrol.1: bump doc date
Fixes:		70174ef7d2 proccontrol: make -s require a target
2024-08-23 18:59:46 +01:00
Brooks Davis 70174ef7d2 proccontrol: make -s require a target
Require a command to exec or a pid to target and update usage and the
manpage to make this more clear.

It makes no sense to invoke a procctl(2) command on the current process
only to exit.  Users are sometimes confused about how proccontrol works
and think it effects their shell environment when invoked without a
target.  Disallowing this nonsensical behavior and clarifiying usage
will hopefully reduce confusion.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46422
2024-08-23 18:57:59 +01:00
Simon J. Gerraty bd8486b9fe kern.pre.mk include local.kern.pre.mk
Allow for local customization.

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D46423
2024-08-23 10:31:16 -07:00
Li-Wen Hsu abdc7bb796 bhyve(8): Remove mention of -A flag, again
Follow 107584716c to remove the mention
of -A flag added in b30a7e5418 .

Sponsored by:	The FreeBSD Foundation
2024-08-23 19:57:09 +08:00
Oliver Fromme ef3f8aa0a0 amdsmn(4), amdtemp(4): add support for AMD Ryzen 7 "Phoenix" processors
Adds support for AMD Ryzen 7 "Phoenix" processors (family 0x19,
model 0x70-0x7f) to the amdsmn(4) and amdtemp(4) drivers. This
enables temperature readings of these CPUs via sysctl.

The sensors function identically to those for the "Raphael" processors
(model 0x60-0x6f); only the PCI device ID differs.

PR:		kern/280942
Relnotes:	yes
MFC after:	3 days
2024-08-22 21:51:19 -07:00
Warner Losh 101afbc6ee loader/menu: tweak for added line
I added a line to the menu, but didn't adjust so things were a
line off. Make the necessary adjustments.

Fixes: 7cb65be96d
Sponsored by: Netflix
MFC After: 3 days
2024-08-22 17:28:51 -06:00
Maxim Konovalov 6aee1dc480 pam_xdg.8: the module option name corrected
PR:	280994
2024-08-22 21:07:10 +00:00
Michael Tuexen e41364711c tcp: improve consistency of SYN-cache handling
Originally, a SYN-cache entry was always allocated and later freed,
when not needed anymore. Then the allocation was avoided, when no
SYN-cache entry was needed, and a copy on the stack was used.
But the logic regarding freeing was not updated.
This patch doesn't re-check conditions (which may have changed) when
deciding to insert or free the entry, but uses the result of
the earlier check.
This simplifies the code and improves also consistency.

Reviewed by:		glebius
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46410
2024-08-22 22:17:05 +02:00
Jessica Clarke 8afae0caf4 riscv: Add machine/ifunc.h corresponding to rtld-elf's resolver interface
Reviewed by:	kib, mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46279
2024-08-22 20:36:45 +01:00
Jessica Clarke 729d2b16b7 rtld-elf: Support IFUNCs on riscv
GNU/Linux has historically had the following two resolver prototypes:

  1. Elf_Addr(uint64_t, void *)
  2. Elf_Addr(uint64_t, void *, void *)

For the former, AT_HWCAP is passed in the first argument, and NULL in
the second. For the latter, AT_HWCAP is still passed, and the second
argument is a pointer to their home-grown __riscv_hwprobe function.
Should they want to use the third argument in future, they'll have to
introduce yet another prototype to allow for later expansion, and then
all users will have to check whether the second argument is NULL to know
if the third argument really exists. This is all rather silly and will
surely prove fun in the face of type-checking CFI.

Instead, be like arm64 and just define all 8 possible general purpose
register arguments up front. To naive source code that forgets non-Linux
OSes exist this will be compatible with prototype 1 above, since the
second argument will be 0 and it won't look further (though should we
start using the second argument for something that wouldn't be true any
more and it might think it's __riscv_hwprobe, but that incompatibility
is one we can defer committing to, and can choose to never adopt).

Until the standard interface for querying extension information[1] is
settled and implemented in FreeBSD there's not much you can do in a
resolver other than use HWCAP_ISA_B, but this gets the infrastructure in
place for when that day comes.

[1] https://github.com/riscv-non-isa/riscv-c-api-doc/pull/74

Reviewed by:	kib, mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46278
2024-08-22 20:36:44 +01:00
Jessica Clarke 228a3e73e1 riscv: Recognise B extension for AT_HWCAP
This was ratified earlier this year as an alias for Zba_Zbb_Zbs. Whilst
we don't currently export multi-letter extensions, we can still export
this alias in AT_HWCAP.

Reviewed by:	mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46277
2024-08-22 20:36:44 +01:00
Jessica Clarke 33658afd4e rtld-elf: Pass parsed aux_info to ifunc_init
Currently we pass the raw pointer to the on-stack auxargs. This can
legitimately have fewer than AT_COUNT entries, so the use of
__min_size(AT_COUNT), i.e. static AT_COUNT, is inaccurate, and also
needlessly forces the callee to iterate over the elements to find the
entry for a given type. Instead we can just pass aux_info like we use
for everything else.

Note that the argument has been left unused by every callee since its
introduction in 4352999e0e ("Pass CPUID[1] %edx (cpu_feature), %ecx
(cpu_feature2) and CPUID[7].%ebx (cpu_stdext_feature), %ecx
(cpu_stdext_feature2) to the ifunc resolvers on x86.")

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46276
2024-08-22 20:36:44 +01:00
John Baldwin 776cd02b89 vmm ppt: Enable busmastering and BAR decoding while a device is assigned
Reviewed by:	corvink, markj
Fixes:		f44ff2aba2 bhyve: Treat the COMMAND register for PCI passthru devices as emulated
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D46245
2024-08-22 14:40:48 -04:00
Brooks Davis 5680cf6dc6 jemalloc: don't expose 3.0 compat symbols
Don't provide default linkage for jemalloc 3.0 compatability symbols.
We stopped declaring these interfaces with the introduction of jemalloc
4.0 prior to FreeBSD 11.0.  Any code using them would have had to
declare them manually so stop declaring them and export the symbols
directly for compatability.  Arguably they should be x86 only as they
were never declared on other Tier-1 architectures.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D46407
2024-08-22 17:08:24 +01:00
Michael Tuexen 498286d4e8 tcp: fix format of sysctl variable
The format for CTLTYPE_UINT is "IU" instead of "UI" as specified
in sysctl.9.

Reviewed by:		cc, zlei
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46408
2024-08-22 14:44:47 +02:00
Zhenlei Huang 0f64fc6a34 kern: Align the declaration of kernconfstring with its definition
It is defined as const char[] in config.c which is auto generated by
usr.sbin/config/kernconf.tmpl .

While here prefer macro SYSCTL_CONST_STRING to avoid casting.

MFC after:	1 week
2024-08-22 18:00:34 +08:00
Michael Tuexen a1d9ce19b1 sctp: fix format of sysctl variables
MFC after:		1 week
2024-08-22 09:07:27 +02:00
Maxim Konovalov d399c791b2 bsd-family-tree: NetBSD 8.3 added
PR:	280983
2024-08-22 00:29:36 +00:00
John Baldwin c0c1b1cd89 freebsd32: Fix a few typos in syscalls.conf comments
Sponsored by:	AFRL, DARPA
2024-08-21 17:14:56 -04:00
Doug Moore d48524e21f dev_pager: define free_page for mgt devices
Callers of cdev_pager_free_page in the kernel always have object->type
== OBJT_MGTDEVICE. Define a function for them to call that skips the
runtime type check in cdev_pager_free.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46389
2024-08-21 15:48:59 -05:00
Navdeep Parhar d668a0b0ab cxgbe(4): reset routine for general use.
Add a reset_adapter wrapper that picks the most suitable reset routine
internally.  Use it in the fatal error handler as well as the sysctl
based reset.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-08-21 11:47:15 -07:00
John Baldwin 297a9e552b libcxxrt: Add a stub implementation of __cxa_call_terminate
This function is called by GCC 14 if a destructor invoked during
exception unwinding throws an exception.

Reviewed by:	emaste
Obtained from:	libcxxrt commit 391a3dcc1054e18c2f0dff4e14d6d79ac95399d7
Differential Revision:	https://reviews.freebsd.org/D46004
2024-08-21 13:37:48 -04:00
Konstantin Belousov 47656cc1ef amd64: use INVLPGB for kernel pmap invalidations
avoiding broadcast IPIs.

Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45191
2024-08-21 19:35:15 +03:00
Konstantin Belousov bc4ffcadf2 amd64: add variables indicating INVLPGB works
Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45191
2024-08-21 19:35:07 +03:00
Konstantin Belousov 111c7fc2fe amd64: add convenience wrappers for INVLPGB and TBLSYNC
Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45191
2024-08-21 19:34:59 +03:00
Konstantin Belousov 45543d3424 DMAR: clear dmar_devs[unit] if attach failed
This should stop attempts to use a unit which was not completely
initialized, but referenced by ACPI DMAR table during scoped devices
operions.

PR:	280817
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46382
2024-08-21 18:23:07 +03:00
Konstantin Belousov 40bffb7d21 rangelocks: fix typo in rl_w_validate
The freed elements should be threaded using rl_q_free pointer.

Reported by:	dougm, markj
Tested by:	markj
Sponsored by:	The FreeBSD Foundation
2024-08-21 18:20:28 +03:00
Konstantin Belousov c4d8b2462e rangelocks: recheck that entry is not marked after sleepq is locked in rl_w_validate()
otherwise we might loose the wakeup.

Reported and tested by:	markj
Sponsored by:	The FreeBSD Foundation
2024-08-21 18:19:57 +03:00
Konstantin Belousov a725d61825 rangelock: if CAS for removal failed, restart list iteration
Our next pointer is invalid and cannot be followed.

Tested by:	markj, pho
Sponsored by:	The FreeBSD Foundation
2024-08-21 18:19:36 +03:00
Konstantin Belousov 9467c1a69b rangelock: assert that we never insert or remove our entry after a logically deleted one
Tested by:	markj, pho
Sponsored by:	The FreeBSD Foundation
2024-08-21 18:19:15 +03:00
Konstantin Belousov e228961d6e rangelock_destoy(): poison lock->head to trip fault on lock attempt
Tested by:	markj, pho
Sponsored by:	The FreeBSD Foundation
2024-08-21 18:18:56 +03:00
Konstantin Belousov 8a5b2db3d8 ranglelock_destroy(): do not remove lock entries from under live lock acquirer
Tested by:	markj, pho
Sponsored by:	The FreeBSD Foundation
2024-08-21 18:18:39 +03:00
Konstantin Belousov a3f10d0882 rangelocks: add rangelock_free_free() helper to free free list
Tested by:	markj, pho
Sponsored by:	The FreeBSD Foundation
2024-08-21 18:18:16 +03:00
Ed Maste db87c98168 ctl: avoid heap info leak in ctl_request_sense
Previously 3 bytes of data from the heap could be leaked to ctl
consumers.

Reported by:	Synacktiv
Reviewed by:	asomers, mav
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46091
2024-08-21 09:32:41 -04:00
Pietro Cerutti 1af7d5f389 libfetch: don't include fragments in HTTP requests
Summary:
Fragments are reserved for client-side processing, see
https://www.rfc-editor.org/rfc/rfc9110.html#section-7.1

Also, some servers don't like to receive HTTP requests with fragments.

```
$ fetch 'https://dropbox.com/a/b'
fetch: https://dropbox.com/a/b: Not Found

$ fetch 'https://dropbox.com/a/b#'
fetch: https://dropbox.com/a/b#: Bad Request
```

This is a real-world scenario, where some download link from dropbox
(eventually) redirects to an URL with a fragment:

```
$ fetch -v 'https://www.dropbox.com/sh/<some>/<thing>?dl=1' 2>&1 | grep requesting
requesting https://www.dropbox.com/sh/<some>/<thing>?dl=1
requesting https://www.dropbox.com/scl/fo/<foo>/<bar>?rlkey=<baz>&dl=1
requesting https://<boo>.dl.dropboxusercontent.com/zip_download_get/<some-long-strig>#
```

See how the last redirect ends with a `#`.

Currently, libfetch includes the ending fragment and makes it impossible
to download the file.

Differential Revision:	https://reviews.freebsd.org/D46318
MFC after:		2 weeks
2024-08-21 12:35:27 +00:00
Igor Ostapenko e7f9171b67 pf: Handle m_len < sizeof(struct ether_header) case
Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46391
2024-08-21 14:10:03 +02:00
Konstantin Belousov 828445cc5e if_vlan: set if_cap{abilities2,enable2} after IFCAP_IPSEC_OFFLOAD is recalculated
This makes the vlan IPSEC offload really functional.

Noted by:	Ariel Ehrenberg <aehrenberg@nvidia.com>
Sponsored by:	NVidia networking
2024-08-21 13:31:41 +03:00
Andrew Turner 024248c933 libc/aarch64: Remove an unneeded weak symbol
The index symbol doesn't belong in memcpy.S as it is already in
strchr.S where it belongs.

Sponsored by:	Arm Ltd
2024-08-21 10:16:10 +00:00
Andrew Turner f1bc3750cf arm64: Use store-pair to zero the kernel bss
While this won't be noticed by most users the time to zero the bss
while using instruction tracing in the Arm FVP models (simulators) is
noticeable.

Reduce this time by using a store-pair instruction to double the size
of memory we zero on each iteration of the loop.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42733
2024-08-21 10:16:10 +00:00
Andrew Turner 78d69d0a3c arm64: Fix the kernel with options VMM
* We can build the non-VHE code with branch protection, it is already
   build as such in the module.
 * Use the correct file name for the non-VHE exception .o file.
2024-08-21 10:16:10 +00:00
Zhenlei Huang 7412517f29 init_main: Sprinkle const qualifiers where appropriate
No functional change intended.

MFC after:	1 week
2024-08-21 18:01:30 +08:00
Andrew Turner 0054693392 arm64: Boot into VHE mode when able
When FEAT_VHE is present the HCR_EL2 E2H field will be implemented. Try
setting this and checking if it's still set to decide if we can boot
into VHE mode or not.

When it is implemented the kernel will boot into EL2 rather than EL1
it currently boots to. The parts of the kernel that need to know if
they are in EL1 or EL2 have been updated other than the CoreSight
driver as there doesn't appear to be any way to currently use it and
it will be updated soon with the new HWT framework.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46087
2024-08-21 08:46:59 +00:00
Andrew Turner db6e3260a8 arm64: Remove the E2H check from has_hyp
This was added to not use the physical timer when E2H was set. As we
now use the correct timer in this case we can remove this extra check.

Tested by:	kevans
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46086
2024-08-21 08:46:59 +00:00
Steve Kargl 213eb102ae msun: Fix typo in comment
PR:		280965
MFC after:	3 days
2024-08-21 14:59:07 +08:00
Rick Macklem 2477e88b8d nfs: Add support for the NFSv4.2 mode_umask attribute
RFC8275 defines a new attribute as an extension to NFSv4.2
called MODE_UMASK.  This patch adds support for this attribute
to the NFSv4.2 client and server.

Since FreeBSD applies the umask above the VFS/VOP layer,
this attribute does not actually have any effect on the
handling of ACL inheritance, which is what it is designed for.
However, future changes to NFSv4.2 require support of it,
so this patch does that, resulting in behaviour identcal to
the mode attribute already supported.

MFC after:	2 months
2024-08-20 18:48:19 -07:00