[Bug 230304] Malloc while lock is held in crypto code

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Aug 2 20:50:18 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230304

Conrad Meyer <cem at freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Open
           Assignee|bugs at FreeBSD.org            |cem at freebsd.org

--- Comment #1 from Conrad Meyer <cem at freebsd.org> ---
The issue is that crypto_newsession() holds the normal mutex ("Crypto
driver table" / CRYPTO_DRIVER_LOCK()) over the CRYPTODEV_NEWSESSION()
call, and the cryptosoft driver allocates extra memory with M_WAITOK.

The short term solution is to change crypto driver allocations back to
M_NOWAIT unconditionally and be sure to check all error paths for bugs
and memory leaks.

But I don't think that's a reasonable long term approach.  I think we
probably want to pass a flags argument from crypto_newsession all the
way down into individual driver newsessions to fix this right.  That
will take a decent amount of churn.  crypto_newsession() also needs to
be fixed to avoid deadlock when the caller allows M_WAITOK by dropping
the lock over the call.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list