freebsd-nq/sys
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
..
amd64 Include sys/_task.h into uma_int.h, so that taskqueue.h isn't a 2016-02-09 20:22:35 +00:00
arm Enable ARM_INTRNG on all kernel configs where we use the Generic Interrupt 2016-02-11 18:01:10 +00:00
arm64 Only update curthread and curpcb after we have finished using the old 2016-02-12 12:38:04 +00:00
boot o Move non-generic kernel configuration out from GENERIC. 2016-02-11 13:28:52 +00:00
bsm
cam Remove stray semicolons from the iSCSI code. 2016-02-10 17:55:39 +00:00
cddl ARM: Rename remaining ARMv4 specific function in DTrace code. 2016-02-06 11:16:15 +00:00
compat Rename P_KTHREAD struct proc p_flag to P_KPROC. 2016-02-09 16:30:16 +00:00
conf Remove bus space fdt for MIPS. 2016-02-11 06:19:32 +00:00
contrib ARM: Use new ARMv6 naming conventions for cache and TLB functions 2016-02-05 14:57:41 +00:00
crypto
ddb
dev If full width writes to the performance monitoring counters are 2016-02-12 07:27:24 +00:00
fs Ext4: Use boolean type instead of '0' and '1' 2016-02-11 15:27:14 +00:00
gdb
geom Teach the flashmap code about the SPI flash. 2016-01-23 05:26:29 +00:00
gnu Update our copy of the Linux dts files to be in sync with Linux 4.5-rc1. We 2016-02-09 16:42:32 +00:00
i386 Convert ss_sp in stack_t and sigstack to void *. 2016-01-27 17:55:01 +00:00
isa Convert rman to use rman_res_t instead of u_long 2016-01-27 02:23:54 +00:00
kern o Gather all mbuf(9) allocation functions into kern_mbuf.c, and all 2016-02-11 21:32:23 +00:00
kgssapi kcrypto_aes: Use separate sessions for AES and SHA1 2016-02-02 00:14:51 +00:00
libkern
mips POSIX states that #include <signal.h> shall make both mcontext_t and 2016-02-12 07:38:19 +00:00
modules Update of the Allwinner drivers to: 2016-02-10 09:19:29 +00:00
net Merge SVN r295220 (bz) from projects/vnet/ 2016-02-11 17:07:19 +00:00
net80211 These files were getting sys/malloc.h and vm/uma.h with header pollution 2016-02-01 17:41:21 +00:00
netgraph These files were getting sys/malloc.h and vm/uma.h with header pollution 2016-02-01 17:41:21 +00:00
netinet Loopback addresses are 127.0.0.0/8, not 127.0.0.1/32. 2016-02-11 22:29:39 +00:00
netinet6 Merge SVN r295220 (bz) from projects/vnet/ 2016-02-11 17:07:19 +00:00
netipsec MfH @r295202 2016-02-03 11:49:51 +00:00
netnatm
netpfil MfH @r295202 2016-02-03 11:49:51 +00:00
netsmb
nfs MFP r287070,r287073: split radix implementation and route table structure. 2016-01-25 06:33:15 +00:00
nfsclient
nfsserver
nlm
ofed LinuxKPI list updates: 2016-01-26 15:12:31 +00:00
opencrypto
pc98 Convert rman to use rman_res_t instead of u_long 2016-01-27 02:23:54 +00:00
powerpc POSIX states that #include <signal.h> shall make both mcontext_t and 2016-02-12 07:38:19 +00:00
riscv o Move non-generic kernel configuration out from GENERIC. 2016-02-11 13:28:52 +00:00
rpc These files were getting sys/malloc.h and vm/uma.h with header pollution 2016-02-01 17:41:21 +00:00
security Busy the mount point which is the owner of the audit vnode, around 2016-01-16 10:06:33 +00:00
sparc64 POSIX states that #include <signal.h> shall make both mcontext_t and 2016-02-12 07:38:19 +00:00
sys POSIX states that #include <signal.h> shall make both mcontext_t and 2016-02-12 07:38:19 +00:00
teken
tests
tools Fix MFS builds when both MD_ROOT_SIZE and MFS_IMAGE are specified 2016-02-02 07:02:51 +00:00
ufs Remove ffs_mountroot() prototype; seems to be long gone. 2016-01-28 12:21:23 +00:00
vm Include sys/_task.h into uma_int.h, so that taskqueue.h isn't a 2016-02-09 20:22:35 +00:00
x86 POSIX states that #include <signal.h> shall make both mcontext_t and 2016-02-12 07:38:19 +00:00
xdr
xen
Makefile