All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevich@gmail.com>
To: linux-sctp@vger.kernel.org
Subject: Re: Kernel crypto framework, sleeping-in-atomic issues
Date: Tue, 15 Dec 2015 02:31:46 +0000	[thread overview]
Message-ID: <566F7B92.3080103@gmail.com> (raw)
In-Reply-To: <CACzeOEegCN+pXaa6vM8QQrbRDD=iDaXOQyg=5JCUU9T6zQ5j1g@mail.gmail.com>

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
> 


      reply	other threads:[~2015-12-15  2:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 15:49 Kernel crypto framework, sleeping-in-atomic issues Fabrizio Demaria
2015-12-15  2:31 ` Vlad Yasevich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=566F7B92.3080103@gmail.com \
    --to=vyasevich@gmail.com \
    --cc=linux-sctp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.