All of lore.kernel.org
 help / color / mirror / Atom feed
* Kernel crypto framework, sleeping-in-atomic issues
@ 2015-12-10 15:49 Fabrizio Demaria
  2015-12-15  2:31 ` Vlad Yasevich
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrizio Demaria @ 2015-12-10 15:49 UTC (permalink / raw)
  To: linux-sctp

Hello,

I am investigating the current usage of kernel crypto-libraries in the
SCTP code, considering to adopt the same crypto framework for the
MPTCP implementation.

In sm_make_chunk.c, the crypto function "crypto_hash_setkey" is called
in an atomic context, despite the fact that this function CAN invoke a
GFP_KERNEL (sleeping) memory allocation. Calling a sleeping function
from an atomic context can end up in deadlock. Has this factor been
considered when adding the crypto functions into the SCTP code or has
it been safely handled/verified in any way?


Thanks,
Fabrizio

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Kernel crypto framework, sleeping-in-atomic issues
  2015-12-10 15:49 Kernel crypto framework, sleeping-in-atomic issues Fabrizio Demaria
@ 2015-12-15  2:31 ` Vlad Yasevich
  0 siblings, 0 replies; 2+ messages in thread
From: Vlad Yasevich @ 2015-12-15  2:31 UTC (permalink / raw)
  To: linux-sctp

On 12/10/2015 10:49 AM, Fabrizio Demaria wrote:
> Hello,
> 
> I am investigating the current usage of kernel crypto-libraries in the
> SCTP code, considering to adopt the same crypto framework for the
> MPTCP implementation.
> 
> In sm_make_chunk.c, the crypto function "crypto_hash_setkey" is called
> in an atomic context, despite the fact that this function CAN invoke a
> GFP_KERNEL (sleeping) memory allocation. Calling a sleeping function
> from an atomic context can end up in deadlock. Has this factor been
> considered when adding the crypto functions into the SCTP code or has
> it been safely handled/verified in any way?

That code has been in use since the very beginning and we've never seen
any atomicity issues.  I think the reason for this is that we are only
using the sha1 hash code which doesn't seem to provide its own setkey
function.  What I think it's using is the hmac version of setkey (I could
be wrong here...) and that doesn't actually allocate any memory.

-vlad

> 
> 
> Thanks,
> Fabrizio
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-15  2:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10 15:49 Kernel crypto framework, sleeping-in-atomic issues Fabrizio Demaria
2015-12-15  2:31 ` Vlad Yasevich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.