All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Fabrizio Demaria <fabrizio.f.demaria@gmail.com>
Cc: linux-crypto@vger.kernel.org, joakim.nordell@intel.com,
	shujuan.chen@intel.com, doru.gucea@intel.com
Subject: Re: "crypto_hash_setkey" call from atomic context
Date: Fri, 11 Dec 2015 15:42:23 +0800	[thread overview]
Message-ID: <20151211074223.GA11688@gondor.apana.org.au> (raw)
In-Reply-To: <CACzeOEfg9x+aEwuP9xH3BLd5+RzpDBZBGsnsLw7skW9FP5LVGw@mail.gmail.com>

Fabrizio Demaria <fabrizio.f.demaria@gmail.com> 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.
> Is there a way to make sure that “crypto_hash_setkey” can be safely
> called in an atomic context, considering all the possible code-paths
> followed by the function?

Indeed, in general setkey should not be invoked in atomic contexts.
The only exception would be extremely simple hashes such as CRC.

Keys should be setup before hand.  So SCTP needs to be fixed.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2015-12-11  7:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 15:59 "crypto_hash_setkey" call from atomic context Fabrizio Demaria
2015-12-11  7:42 ` Herbert Xu [this message]
2015-12-14  8:53   ` Fabrizio Demaria
2015-12-14  9:57     ` Herbert Xu

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=20151211074223.GA11688@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=doru.gucea@intel.com \
    --cc=fabrizio.f.demaria@gmail.com \
    --cc=joakim.nordell@intel.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=shujuan.chen@intel.com \
    /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.