address an issue where consumers, like IPsec, can reuse the same
authorJohn-Mark Gurney <jmg@FreeBSD.org>
Wed, 8 Jul 2015 19:15:29 +0000 (19:15 +0000)
committerJohn-Mark Gurney <jmg@FreeBSD.org>
Wed, 8 Jul 2015 19:15:29 +0000 (19:15 +0000)
commit9d38fd076e371b15c56c7778f672e1a2aec8e047
tree12e78210806cfb01216e3c6c0f60749c28888b36
parent4cbf30133e8ebe5e442d24f5c431653736ef1cac
address an issue where consumers, like IPsec, can reuse the same
session in multiple threads w/o locking..  There was a single fpu
context shared per session, if multiple threads were using the session,
and both migrated away, they could corrupt each other's fpu context...

This patch adds a per cpu context and a lock to protect it...

It also tries to better address unloading of the aesni module...
The pause will be removed once the OpenCrypto Framework provides a
better method for draining callers into _newsession...

I first discovered the fpu context sharing issue w/ a flood ping over
an IPsec tunnel between two bhyve machines...  The patch in D3015
was used to verify that this fix does fix the issue...

Reviewed by: gnn, kib (both earlier versions)
Differential Revision:        https://reviews.freebsd.org/D3016
sys/crypto/aesni/aesni.c
sys/crypto/aesni/aesni.h