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
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
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.
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
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
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
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
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
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
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
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
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
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
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>
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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