1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00
Commit Graph

295113 Commits

Author SHA1 Message Date
Ed Maste
13da1af1cd libcxxrt: Update to upstream 698997bfde1f
Interesting fixes:

045c52c Mark __cxa_allocate_exception, __cxa_free_exception and
        __cxa_init_primary_exception noexcept.
8a2f123 Define _LIBCXXRT_NOEXCEPT in cxxabi.h and use it instead of
        throw()
9529236 Fix memory corruption in cpp_demangle_read_sname()
8f5c74e Add test cases, fix more bugs, and improve perf
391a3dc Add a simple implementation of __cxa_call_terminate
40e4fa2 mark std::terminate as noreturn and noexcept
5eede09 Print diagnostics in default std::terminate handler

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47238
2024-10-22 19:43:54 -04:00
Doug Moore
e2414d91d3 vfs_subr: maintain sorted tailq
Pctries are based on unsigned index values. Type daddr_t is
signed. Using daddr_t as an index type for a pctrie works, except that
the pctrie considers negative values greater than nonnegative
ones. Building a sorted tailq of bufs, based on pctrie results, sorts
negative daddr_ts larger than nonnegative ones, and makes code that
depends on the tailq being actually sorted broken.

Write wrappers for the functions that do pctrie operations that depend
on index ordering that fix the order problem, and use them in place of
direct pctrie operations.

PR:		282134
Reported by:	pho
Reviewed by:	kib, markj
Tested by:	pho
Fixes: 2c8caa4b39 vfs_subr: optimize inval_buf_range
Differential Revision:	https://reviews.freebsd.org/D47200
2024-10-22 16:54:34 -05:00
Konstantin Belousov
5a6e19cac0 acpidump: use acpica definitions for devscope types in DMAR decoding
and add missed acpi namespace device type entry decoding.

Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-10-22 22:34:34 +03:00
Konstantin Belousov
8f553746b4 acpidump: correct memcmp() result check
Fixes:	e9ab827df9
Sponsored by:	The FreeBSD Foundation
2024-10-22 22:34:33 +03:00
Brooks Davis
8ae9921f2e sys_capability.c: update the source of CAPENABLED
System calls allowed in capability mode have been specified by the
CAPENABLED flag in syscalls.master since 2021.
2024-10-22 19:44:41 +01:00
Brooks Davis
3dd490e800 DS3231: converstion -> conversion 2024-10-22 19:23:45 +01:00
Brooks Davis
76ab72e828 sysent: regen for typo fix 2024-10-22 19:21:26 +01:00
Brooks Davis
8bc14f6ba9 makesyscalls.lua: converstion -> conversion
Reported by:	agge3 <sterspark@gmail.com>
2024-10-22 19:21:26 +01:00
Simon J. Gerraty
02653835cd debug.sh add DebugAdd
Sometimes it is desirable while debugging one script for it to enable
debugging of a child.
We can do that with

$DEBUG_DO DebugAdd tag

to add tag to DEBUG_SH but only when we are already debugging.
2024-10-22 11:07:37 -07:00
Colin Percival
f6197f2bc0 sys: Add GPIO_INTR_EDGE_MASK define
This is the GPIO_INTR_EDGE_* flags, just as a convenience to let code
test flags for interrupt edginess.

Sponsored by:	Amazon
2024-10-22 09:15:30 -07:00
Warner Losh
c1cc3d96da scsi: Make asc/ascq 44/0 fatal with ENXIO
44/0: INTERNAL TARGET FAILURE

Several different HGST/WD hard disks report this during geom
tasting. Several vendor manuals indicate this is not recoverable as
well, though are a bit coy as to whether it's permanant for all I/O or
just for this particular one. An internet search resolves the ambiguity
in favor of permanant error more generally, rather than for a specific
LBA or LBA range.

This has the side effect of speeding up boot for systems that have
drives that have failed with this symptom.

Sponsored by:		Netflix
2024-10-22 09:33:44 -06:00
Warner Losh
ad0df04a5d da: Add comments about asc/ascq values
Having had to look some of these up several times, add comments from the
latest standard for all the asc/ascq values we test against. In a couple
of cases, this is a little redundant with the printf on the following
line(s), but makes it clear what the ASC/ASCQ codes are.

Sponsored by:		Netflix
2024-10-22 09:33:44 -06:00
Colin Percival
f41ef9d80b ACPI: Implement power button on !x86
ACPI sleep states are only implemented on x86 systems, so having the
ACPI power button attempt to enter "S5" (or other state as configured
via the hw.acpi.power_button_state sysctl) is not useful.

On non-x86 systems, implement the power button with a call to
    shutdown_nice(RB_POWEROFF)
to shut down the system.

Reviewed by:	Andrew
Tested on:	Graviton 2
MFC after:	2 weeks
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D47094
2024-10-22 07:56:20 -07:00
Ed Maste
5a07cb0492 Import libcxxrt master 698997bfde1fc81b0bc0bfd1a1e5e3ad6f33b634
Interesting fixes:
045c52c Mark __cxa_allocate_exception, __cxa_free_exception and
        __cxa_init_primary_exception noexcept.
8a2f123 Define _LIBCXXRT_NOEXCEPT in cxxabi.h and use it instead of
        throw()
9529236 Fix memory corruption in cpp_demangle_read_sname()
8f5c74e Add test cases, fix more bugs, and improve perf
391a3dc Add a simple implementation of __cxa_call_terminate
40e4fa2 mark std::terminate as noreturn and noexcept
5eede09 Print diagnostics in default std::terminate handler
2024-10-22 10:43:39 -04:00
Mark Johnston
6a07e67fb7 vm_meter: Fix laundry accounting
Pages in PQ_UNSWAPPABLE should be considered part of the laundry.
Otherwise, on systems with no swap, the total amount of memory visible
to tools like top(1) decreases.

It doesn't seem very useful to have a dedicated counter for unswappable
pages, and updating applications accordingly would be painful, so just
lump them in with laundry for now.

PR:		280846
Reviewed by:	bnovkov, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47216
2024-10-22 12:48:43 +00:00
Mark Johnston
1249ee57e9 vmstat: Add a column to vmstat -o output for laundry pages
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47215
2024-10-22 12:48:04 +00:00
Mark Johnston
a86373bc93 vm_object: Report laundry pages in kinfo_vmobject
Reviewed by:	bnovkov, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47214
2024-10-22 12:47:52 +00:00
Corvin Köhne
08139140c5
bhyve: merge adjacent E820 entries
EDKII can allocate adjacent E820 entries only if they are at a page
boundary.  For some unknown and probably strange reasons, Intel puts
it's OpRegion at an offset of 0x18 bytes. If the VBT lays directly
behind the OpRegion, we're going to try allocating two adjacent E820
sharing the same page. This causes EDKII to do not properly allocate
those entries. A Linux guest then isn't able to map the VBT and those
fails to find it.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D45336
2024-10-22 14:17:02 +02:00
Hans Rosenfeld
d93fbcf022
bhyve: TPM 2.0 emulation with swtpm
Implement a TPM 2.0 emulation backend to connect to a running swtpm
instance using a UNIX domain socket.

Reviewed by:		corvink
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D46373
2024-10-22 14:04:24 +02:00
Hans Rosenfeld
bc3d09e90b
bhyve: TPM CRB: pass actual TPM request length to backend execute_cmd()
The TPM spec (TPM Library, Part3: Commands, Section 5.2: Command Header
Validation) requires that no more bytes are written than the size of the
commands, as given in the request header. Thus the TPM CRB interface
needs to get the command size from the request header and pass that to
the emulation backend.

As the guest OS driver can set the address and size of the command and
response buffers freely within the limits of the provided CRB data
buffer, bhyve should verify that the values set in the corresponding
registers make sense before processing a command.

Reviewed by:		corvink
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D46564
2024-10-22 14:04:23 +02:00
Hans Rosenfeld
2feea221b2
bhyve: don't crash when guest writes TPM int_enable register
FreeBSD's own TPM driver writes 0 to the INT_ENABLE register during
attach, making sure interrupts are off. bhyve really shouldn't kill the
VM when that happens just because it doesn't support TPM interrupts.
Even if a guest was trying to enable interrupts, we should just ignore
it like real TPM hardware would.

Reviewed by:		corvink
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D46562
2024-10-22 14:04:21 +02:00
Zhenlei Huang
d1d839d0b5 ifnet: Assert that we are assigning network stack correctly
It makes no sense to assign NULL vnet to an interface when the kernel
option VIMAGE is enabled. Add an assertion to catch that.

This will also help diagnosing problem report [1] and [2].

1. https://bugs.freebsd.org/275381
2. https://bugs.freebsd.org/282168

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46982
2024-10-22 12:32:24 +08:00
Rick Macklem
caa309c881 nfsd: Fix handling of credentials with cr_ngroups == 0
There has been a documented case in the exports(5) man
page forever, which specifies that the -maproot or -mapall
may have a single user entry, followed by a ':'.
This case is defined as specifying no groups (aka cr_ngroups == 0).

This patch fixes the NFS server so that it handles this case correctly.

After MFC'ng this patch to stable/13 and stable/14, I propose that
this unusual case be deprecated and no longer allowed in FreeBSD15.
At that point, this patch can be reverted.

Reviewed by:	brooks
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D47204
2024-10-21 15:48:39 -07:00
Mateusz Piotrowski
d2e7bb630b rc.d/sendmail: Return non-zero if the daemon fails to start or is not running
If you have a mail server that is running sendmail daemon
(sendmail_enable=YES) and sendmail queue runner (sendmail_msp_queue=YES)
and the sendmail daemon dies, /etc/rc.d/sendmail status does see the
daemon is not running but returns 0 as the exit code.  This prevents
other programs (like puppet) from restarting sendmail to fix the issue.

Make sure that the exit code is propagated towards the end of the script
if any of the sendmail services fail.

This patch does not call exit directly but instead just sets the exit
status code by calling exit in a subshell. This way we do not exit the
current shell in case the service script is sourced (e.g., when
rc_fast_and_loose is active).

PR:		223132
MFC after:	2 weeks
Reported by:	pirzyk
Discussed with:	jilles, eugen
Reviewed by:	christos, gshapiro (previous version), markj
Approved by:	christos (mentor), markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D46862
Co-authored-by: Jim Pirzyk <pirzyk@FreeBSD.org>
2024-10-21 21:20:36 +02:00
John Baldwin
0e3a211961 ctl_report_supported_opcodes: Handle invalid requested service action
Service actions are only valid up to 31 as they are encoded in the low
5 bits of byte 1 in CDBs.  Fail requests with a requested service
action of 32 or higher with an INVALID FIELD IN COMMAND specifying
byte 4 as the illegal byte.

Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D46611
2024-10-21 10:53:48 -04:00
John Baldwin
5201decc8b Use bus_delayed_attach_children instead of its inline implementation
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D47186
2024-10-21 10:24:39 -04:00
John Baldwin
ab4f969f8d legacy cpu: Add proper device_probe and device_attach routines
Set a device description in probe and handle both adding and attaching
children in attach.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D47185
2024-10-21 10:24:28 -04:00
John Baldwin
ce968b095e cpufreq: Use a real device_probe routine
cpufreq doesn't have any child drivers, so calling bus_generic_probe
was a nop.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D47184
2024-10-21 10:24:15 -04:00
Mark Johnston
5fc3437915 vm_object: Assert that managed pages are on pagequeues when freeing
Reviewed by:	dougm, kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D46945
2024-10-21 13:25:53 +00:00
Martin Matuska
6c40282284 libarchive: backport PR #2386 (fixes output of one test)
MFC after:	6 days
2024-10-21 14:37:09 +02:00
Andrew Turner
edc692b905 .github: Update the clang release used for macos
Reviewed by:	emaste, jhb
Sponsored by:	Arm Ltd
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1399
2024-10-21 13:23:16 +01:00
Andrew Turner
386e2dc442 .github: Use the two most recent LTS releases
Ubuntu 24.04 is the most recent LTS release. Use it and the previous
22.04 LTS for cross build testing.

Reported by:	emaste, jhb
Sponsored by:	Arm Ltd
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1399
2024-10-21 13:23:16 +01:00
Zachary Leaf
3bd4724794 arm64: write PID in CONTEXTIDR_EL1 on ctx switch
Debug and trace features such as Statistical Profiling Extension (SPE)
use the CONTEXTIDR_EL1 register to get the PID of the current process.

Add a sysctl switch to toggle writing the current PID into this register
in the thread switcher.

To make use of the feature, the following sysctl switch must be set:

    sysctl machdep.pid_in_contextidr=1

Kernel code can also toggle the sysctl by writing directly to the global
var behind the sysctl arm64_pid_in_contextidr:

    extern bool arm64_pid_in_contextidr;

Sponsored by:   Arm Ltd
2024-10-21 13:23:16 +01:00
Andrew Turner
9707243a04 arm64: Remove a duplicated include
Sponsored by:	Arm Ltd
2024-10-21 13:23:16 +01:00
Andrew Turner
ea6865bb78 arm64: Update how we handle SpecSEI
The ID_AA64MMFR1_EL0.SpecSEI field needs to use MRS_HIGHER to get the
largest value from all CPUs. This is because it indicates when an
exception might happen when it's non-zero and can't happen when zero.
As indicating something that might happen even when it can't is safer
use MRS_HIGHER to handle this field.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47126
2024-10-21 13:23:16 +01:00
Andrew Turner
5727c249ad arm64: Use register types to build kernel ID regs
Use the ID register tables to find how to adjust the ID register fields
in the kernel and vmm views. This allows us to use the same method to
get a common view of CTR_EL0.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47125
2024-10-21 13:23:15 +01:00
Andrew Turner
a090372f38 arm64: Decode CTR_EL0 via a table
Use the same method to decode CTR_EL0 as for the ID registers. This
will allow us to create a common view over all CPUs.

This will also allow us to create a common view for userspace and the
kernel if we detect a difference on some CPUs, or to handle errata.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47124
2024-10-21 13:23:15 +01:00
Andrew Turner
e5f33d4297 arm64: Handle RES1 ID register fields
Some special registers we may want to emulate for userspace have fields
that are reserved to be 1. Add support for these fields.

As there is no value to print jump over printing them in print_id_fields.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47123
2024-10-21 13:23:15 +01:00
Andrew Turner
f1fb1d5c90 arm64: Support more ID register field types
Add MRS_EXACT_IF_DIFFERENT, MRS_HIGHER_OR_ZERO, and MRS_HIGHER.

These will be used to handle the cache CTR_EL0 register, and make some
ID register values safer.

They are:
 - MRS_EXACT_IF_DIFFERENT: If the field is the same on all CPUs then
                           use this value, otherwise use the safe value.
 - MRS_HIGHER_OR_ZERO: Use the highest value, or zero if seen,
 - MRS_HIGHER: Use the highest value.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47122
2024-10-21 13:23:15 +01:00
Andrew Turner
f031499405 arm64: Use a bit to hold userspace ID reg exports
When exporting ID registers to userspace we should either adjust them
the same way for FreeBSD and Linux binaries, or export the Linux
field values to a safe value, e.g. when a needed syscall is missing.

To allow for this, and to clean up ID register handling in the kernel
move to using a bit per userspace ABI.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47121
2024-10-21 13:23:15 +01:00
Andrew Turner
ffdf9db281 arm64: Add MRS_SAFE to hold a safe ID field value
To support reworking the arm64 CPU ID code to add CTR_EL0, the cache
type register, start to move the safe value to be encoded as a named
field rather than part of MRS_EXACT.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47120
2024-10-21 13:23:15 +01:00
Andrew Turner
aa760039c6 arm64: Support non-4 bit ID reg fields
In preparation for using the ID register decode with the cache type
register support a non-4 bit field width.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47119
2024-10-21 13:23:15 +01:00
Andrew Turner
590c32321d arm64: Add ID register field width values
In preperation for supporting non-4 bit field width to identcpu.c,
e.g. for ctr_el0, add the width of the existing ID register fields.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47118
2024-10-21 13:23:15 +01:00
Andrew Turner
2b3d9ac890 arm64: Remove old I-Cache types
The VPIPT and AIVIVT cache types are reserved from Armv8.0. Remove
them as nothing will report these values.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47117
2024-10-21 13:23:15 +01:00
Andrew Turner
9d3dc1e5e0 arm64: Remove VPIPT I-cache support from pmap
The VPIPT I-cache policy has been removed from the architecture.
Remove support for it from pmap. The vmm side was not imported so
calls to pmap_invalidate_vpipt_icache would cause the kernel to branch
to a NULL pointer.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D47116
2024-10-21 13:23:15 +01:00
Poul-Henning Kamp
f50d2fced2 Give usbdump a '-u' option for unbuffered output. 2024-10-21 11:21:05 +00:00
Edward Tomasz Napierala
31eec6fe1a linux: support IUTF8
Make Linuxulator support the recently added IUTF8 termios(4) flag.

Reviewed By:	dchagin, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D44525
2024-10-21 08:22:50 +00:00
Robert Wing
525a177c16 mkuzip: drop support for executable uzip images
A uzip image has a 128-byte header, historically, this header could be
executed as a shell script to mount the uzip image to a user provided
mountpoint.

The embedded shell commands only work for uzip images that were created
with zlib or zstd compression that contained an ISO-9660 file system.
Given the limited space available in the uzip header, it is not
practical to extend this feature to include other file systems or to
provide sensible error handling and error messages to the user.
For these reasons, abandon the embedded shell script in the uzip image
header.

To maintain backwards compatibility, the shebang and shell must reside
in the 128-byte header.

This change of behavior is documented in mkuzip(8) and an example
has been provided for creating/mounting uzip images.

PR: 276174
2024-10-20 22:45:09 -08:00
Doug Moore
d2d0d6cb47 subr_pctrie: fix a comment
A comment used least > instead of greatest <.  Fix it.
2024-10-20 21:46:30 -05:00
Kyle Evans
096c39fae4 tests: kern: add some porch(1)-based tty tests
If sysutils/porch is installed, we'll do some basic testing of tty
behavior.  The existing tests primarily cover ICANON-related processing
and corner cases that have been fixed somewhat recently, but I
anticipate growing this out a bit in due time.

Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D46806
2024-10-20 20:32:31 -05:00