From: Herbert Xu <herbert@gondor.apana.org.au>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: christophe.leroy@c-s.fr, "David S. Miller" <davem@davemloft.net>,
"open list:HARDWARE RANDOM NUMBER GENERATOR CORE"
<linux-crypto@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] crypto/testmgr: fix skcipher test with CONFIG_VMAP_STACK
Date: Tue, 11 Dec 2018 13:07:38 +0800 [thread overview]
Message-ID: <20181211050737.ubxpofoxj7gjmcs3@gondor.apana.org.au> (raw)
In-Reply-To: <CAKv+Gu9gz0h2CFNPe9bgrSBzRe7iTVOMxiEEb6OXb75Acv7HUQ@mail.gmail.com>
On Fri, Dec 07, 2018 at 09:26:15PM +0100, Ard Biesheuvel wrote:
> On Fri, 7 Dec 2018 at 18:33, Christophe Leroy <christophe.leroy@c-s.fr> wrote:
> >
> > [ 2.364486] WARNING: CPU: 0 PID: 60 at ./arch/powerpc/include/asm/io.h:837 dma_nommu_map_page+0x44/0xd4
> > [ 2.373579] CPU: 0 PID: 60 Comm: cryptomgr_test Tainted: G W 4.20.0-rc5-00560-g6bfb52e23a00-dirty #531
> > [ 2.384740] NIP: c000c540 LR: c000c584 CTR: 00000000
> > [ 2.389743] REGS: c95abab0 TRAP: 0700 Tainted: G W (4.20.0-rc5-00560-g6bfb52e23a00-dirty)
> > [ 2.400042] MSR: 00029032 <EE,ME,IR,DR,RI> CR: 24042204 XER: 00000000
> > [ 2.406669]
> > [ 2.406669] GPR00: c02f2244 c95abb60 c6262990 c95abd80 0000256a 00000001 00000001 00000001
> > [ 2.406669] GPR08: 00000000 00002000 00000010 00000010 24042202 00000000 00000100 c95abd88
> > [ 2.406669] GPR16: 00000000 c05569d4 00000001 00000010 c95abc88 c0615664 00000004 00000000
> > [ 2.406669] GPR24: 00000010 c95abc88 c95abc88 00000000 c61ae210 c7ff6d40 c61ae210 00003d68
> > [ 2.441559] NIP [c000c540] dma_nommu_map_page+0x44/0xd4
> > [ 2.446720] LR [c000c584] dma_nommu_map_page+0x88/0xd4
> > [ 2.451762] Call Trace:
> > [ 2.454195] [c95abb60] [82000808] 0x82000808 (unreliable)
> > [ 2.459572] [c95abb80] [c02f2244] talitos_edesc_alloc+0xbc/0x3c8
> > [ 2.465493] [c95abbb0] [c02f2600] ablkcipher_edesc_alloc+0x4c/0x5c
> > [ 2.471606] [c95abbd0] [c02f4ed0] ablkcipher_encrypt+0x20/0x64
> > [ 2.477389] [c95abbe0] [c02023b0] __test_skcipher+0x4bc/0xa08
> > [ 2.483049] [c95abe00] [c0204b60] test_skcipher+0x2c/0xcc
> > [ 2.488385] [c95abe20] [c0204c48] alg_test_skcipher+0x48/0xbc
> > [ 2.494064] [c95abe40] [c0205cec] alg_test+0x164/0x2e8
> > [ 2.499142] [c95abf00] [c0200dec] cryptomgr_test+0x48/0x50
> > [ 2.504558] [c95abf10] [c0039ff4] kthread+0xe4/0x110
> > [ 2.509471] [c95abf40] [c000e1d0] ret_from_kernel_thread+0x14/0x1c
> > [ 2.515532] Instruction dump:
> > [ 2.518468] 7c7e1b78 7c9d2378 7cbf2b78 41820054 3d20c076 8089c200 3d20c076 7c84e850
> > [ 2.526127] 8129c204 7c842e70 7f844840 419c0008 <0fe00000> 2f9e0000 54847022 7c84fa14
> > [ 2.533960] ---[ end trace bf78d94af73fe3b8 ]---
> > [ 2.539123] talitos ff020000.crypto: master data transfer error
> > [ 2.544775] talitos ff020000.crypto: TEA error: ISR 0x20000000_00000040
> > [ 2.551625] alg: skcipher: encryption failed on test 1 for ecb-aes-talitos: ret=22
> >
> > IV cannot be on stack when CONFIG_VMAP_STACK is selected because the stack
> > cannot be DMA mapped anymore.
> >
> > This patch allocates it with kmalloc()
> >
>
> This looks like a driver bug to me. Other accelerators in
> drivers/crypto all take a copy of the IV before mapping it for DMA, so
> it would be better if talitos did the same.
Yes please fix the driver. In general, if a paramter is coming in
as a pointer, you must assume that it may lie on the stack.
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
next prev parent reply other threads:[~2018-12-11 5:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-07 17:33 [PATCH] crypto/testmgr: fix skcipher test with CONFIG_VMAP_STACK Christophe Leroy
2018-12-07 20:26 ` Ard Biesheuvel
2018-12-07 20:26 ` Ard Biesheuvel
2018-12-11 5:07 ` Herbert Xu [this message]
2018-12-11 5:07 ` Herbert Xu
2018-12-11 7:31 ` Christophe Leroy
2018-12-11 7:31 ` Christophe Leroy
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=20181211050737.ubxpofoxj7gjmcs3@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=ard.biesheuvel@linaro.org \
--cc=christophe.leroy@c-s.fr \
--cc=davem@davemloft.net \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox