freebsd-dev/sys/arm64
Andrew Turner 770fd1c976 Only update curthread and curpcb after we have finished using the old
values.

If switching from a thread that used floating-point registers to a thread
that is still running, but holding the blocked_lock lock we would switch
the curthread to the new (running) thread, then call critical_enter. This
will non-atomically increment td_critnest, and later call critical_exit to
non-atomically decrement this value.

This can happen at the same time as the new thread is still running on the
old core, also calling these functions. In this case there will be a race
between these non-atomic operations. This can be an issue as we could loose
one of these operations leading to the value to not return to zero.

If, later on, we then hit a data abort we check if the td_critnest is zero.
If this check fails we will panic the kernel.

This has been observed when running pcmstat on a Cavium ThunderX. The pcm
thread will use the blocked_lock lock and there is a high chance userspace
will use the floating-point registers. When, later on, pmcstat triggers a
data abort we will hit this panic.

The fix is to update these values after storing the floating-point state.
This means we use the correct curthread while storing the state so it will
not be an issue that the changes to td_critnest are non-atomic.

Sponsored by:	ABT Systems Ltd
2016-02-12 12:38:04 +00:00
..
acpica Add ARM64TODO comments to ACPI PCI stubs 2015-07-12 18:32:16 +00:00
arm64 Only update curthread and curpcb after we have finished using the old 2016-02-12 12:38:04 +00:00
cavium Fix VNIC enumeration after r294993 and r294990 2016-01-28 16:58:49 +00:00
cloudabi64 Add support for CloudABI on ARM64. 2015-10-22 11:09:25 +00:00
conf Revert r294267 to avoid using experimental VFS_AIO in ARM64's GENERIC 2016-01-20 11:34:22 +00:00
include Introduce bus_bind_intr method for ARM64 2016-02-11 11:58:27 +00:00