linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	Stephan Mueller <smueller@chronox.de>,
	"David S. Miller" <davem@davemloft.net>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: cryptomgr_test / drbg_ctr: BUG: sleeping function called from invalid context
Date: Fri, 18 May 2018 10:36:04 +0200	[thread overview]
Message-ID: <CAMuHMdW_4gvQYhCxcXR+sa6dhwAshyJnhXhc36=VC=hWKB-7Jw@mail.gmail.com> (raw)

Hi,

After enabling CONFIG_CRYPTO_DRBG_CTR, I start seeing during kernel boot:

BUG: sleeping function called from invalid context at
include/crypto/algapi.h:416
in_atomic(): 1, irqs_disabled(): 0, pid: 203, name: cryptomgr_test
1 lock held by cryptomgr_test/203:
 #0:         (ptrval) (&drbg->drbg_mutex){+.+.}, at: drbg_kcapi_seed+0x128/0x4bc
CPU: 3 PID: 203 Comm: cryptomgr_test Not tainted
4.17.0-rc5-salvator-x-00509-g0ad2b9f404d6a668-dirty #1742
Hardware name: Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+ (DT)
Call trace:
 dump_backtrace+0x0/0x140
 show_stack+0x14/0x1c
 dump_stack+0xb4/0xf0
 ___might_sleep+0x1fc/0x218
 skcipher_walk_done+0x2c8/0x38c
 ctr_encrypt+0x84/0x110
 simd_skcipher_encrypt+0xa4/0xb0
 drbg_kcapi_sym_ctr+0xb4/0x178
 drbg_ctr_update+0x17c/0x2c4
 drbg_seed+0x20c/0x26c
 drbg_kcapi_seed+0x458/0x4bc
 crypto_rng_reset+0x84/0xa8
 alg_test_drbg+0x12c/0x324
 alg_test.part.7+0x264/0x2bc
 alg_test+0x44/0x58
 cryptomgr_test+0x28/0x48
 kthread+0x11c/0x124
 ret_from_fork+0x10/0x18

I tried following the code path, but couldn't find where it went wrong.

mutex_lock(&drbg->drbg_mutex) is called from drbg_instantiate(), which is
inlined by the compiler into drbg_kcapi_seed().

Do you have a clue?
Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

             reply	other threads:[~2018-05-18  8:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18  8:36 Geert Uytterhoeven [this message]
2018-05-20 19:54 ` cryptomgr_test / drbg_ctr: BUG: sleeping function called from invalid context Stephan Müller
2018-06-26 10:33   ` Geert Uytterhoeven
2018-06-26 11:33     ` Stephan Mueller

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='CAMuHMdW_4gvQYhCxcXR+sa6dhwAshyJnhXhc36=VC=hWKB-7Jw@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smueller@chronox.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).