svn commit: r273997 - head/sys/dev/random
Mateusz Guzik
mjguzik at gmail.com
Mon Nov 3 03:08:47 UTC 2014
On Sun, Nov 02, 2014 at 11:30:51PM +0000, Xin LI wrote:
> Author: delphij
> Date: Sun Nov 2 23:30:50 2014
> New Revision: 273997
> URL: https://svnweb.freebsd.org/changeset/base/273997
>
> Log:
> - Make sure random_adaptor accesses happen only when
> random_adaptors_lock is held.
> - Use sx_sleep instead of tsleep in read and write path to allow
> another thread that registers a new random adapter when waiting.
> Assert that random_adaptor is not NULL after reacquiring the lock.
> - Capture EINTR/ERESTART from sx_sleep to allow the blocking cycle be
> stopped when user requests so, while there also make short
> read/write's return 0.
> - Move M_WAITOK allocations out of lock scope.
>
> In collobration with: kib, markm, ian, jilles
> Reviewed by: kib, markm
> Approved by: so
>
> Modified:
> head/sys/dev/random/random_adaptors.c
>
> @@ -269,6 +275,8 @@ random_adaptor_read_rate(void)
> {
> int ret;
>
> + sx_assert(&random_adaptors_lock, SA_LOCKED);
> +
> KASSERT(random_adaptor != NULL, ("No active random adaptor in %s", __func__));
>
> mtx_lock(&random_read_rate_mtx);
This panics with:
panic: Lock (sx) random_adaptors not locked @
/usr/src/sys/dev/random/random_adaptors.c:278.
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame
0xfffffe02e7fe4940
kdb_backtrace() at kdb_backtrace+0x39/frame 0xfffffe02e7fe49f0
vpanic() at vpanic+0x189/frame 0xfffffe02e7fe4a70
kassert_panic() at kassert_panic+0x139/frame 0xfffffe02e7fe4ae0
witness_assert() at witness_assert+0x32a/frame 0xfffffe02e7fe4b40
random_adaptor_read_rate() at random_adaptor_read_rate+0x23/frame
0xfffffe02e7fe4b60
live_entropy_sources_feed() at live_entropy_sources_feed+0x2a/frame
0xfffffe02e7fe4b90
Quick look suggests these asserts can be removed since random_read_rate_mtx
protects stuff.
--
Mateusz Guzik <mjguzik gmail.com>
More information about the svn-src-all
mailing list