Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1479861
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: Kernel panic - encryption/decryption failed when open file on Arm64 |
| Date | 2016-09-09 12:40 +0200 |
| Message-ID | <sfrnY-1F2-3@gated-at.bofh.it> (permalink) |
| References | <sf6Wf-5Sk-39@gated-at.bofh.it> <sf6Wf-5Sk-37@gated-at.bofh.it> <sfrei-1AG-41@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 9 September 2016 at 11:19, xiakaixu <xiakaixu@huawei.com> wrote:
> Hi,
>
> After a deeply research about this crash, seems it is a specific
> bug that only exists in armv8 board. And it occurs in this function
> in arch/arm64/crypto/aes-glue.c.
>
> static int ctr_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
> struct scatterlist *src, unsigned int nbytes)
> {
> ...
>
> desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
> blkcipher_walk_init(&walk, dst, src, nbytes);
> err = blkcipher_walk_virt_block(desc, &walk, AES_BLOCK_SIZE); --->
> page allocation failed
>
> ...
>
> while ((blocks = (walk.nbytes / AES_BLOCK_SIZE))) { ---->
> walk.nbytes = 0, and skip this loop
> aes_ctr_encrypt(walk.dst.virt.addr, walk.src.virt.addr,
> (u8 *)ctx->key_enc, rounds, blocks, walk.iv,
> first);
> ...
> err = blkcipher_walk_done(desc, &walk,
> walk.nbytes % AES_BLOCK_SIZE);
> }
> if (nbytes) { ---->
> enter this if() statement
> u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE;
> u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE;
> ...
>
> aes_ctr_encrypt(tail, tsrc, (u8 *)ctx->key_enc, rounds,
> ----> the the sencond input parameter is NULL, so crash...
> blocks, walk.iv, first);
> ...
> }
> ...
> }
>
>
> If the page allocation failed in the function blkcipher_walk_virt_block(),
> the variable walk.nbytes = 0, so it will skip the while() loop and enter
> the if(nbytes) statment. But here the varibale tsrc is NULL and it is also
> the sencond input parameter of the function aes_ctr_encrypt()... Kernel
> Panic...
>
> I have also researched the similar function in other architectures, and
> there if(walk.nbytes) is used, not this if(nbytes) statement in the armv8.
> so I think this armv8 function ctr_encrypt() should deal with the page
> allocation failed situation.
>
OK, thanks for the report, and for the analysis. I will investigate,
and propose a fix
Thanks,
Ard.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Kernel panic - encryption/decryption failed when open file on Arm64 Herbert Xu <herbert@gondor.apana.org.au> - 2016-09-08 14:50 +0200
Re: Kernel panic - encryption/decryption failed when open file on Arm64 xiakaixu <xiakaixu@huawei.com> - 2016-09-09 06:10 +0200
Re: Kernel panic - encryption/decryption failed when open file on Arm64 xiakaixu <xiakaixu@huawei.com> - 2016-09-09 12:30 +0200
Re: Kernel panic - encryption/decryption failed when open file on Arm64 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-09-09 12:40 +0200
Re: Kernel panic - encryption/decryption failed when open file on Arm64 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-09-09 13:00 +0200
RE: Kernel panic - encryption/decryption failed when open file on Arm64 liushuoran <liushuoran@huawei.com> - 2016-09-12 04:20 +0200
Re: Kernel panic - encryption/decryption failed when open file on Arm64 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-09-12 19:50 +0200
Re: Kernel panic - encryption/decryption failed when open file on Arm64 xiakaixu <xiakaixu@huawei.com> - 2016-09-13 04:10 +0200
Re: Kernel panic - encryption/decryption failed when open file on Arm64 Herbert Xu <herbert@gondor.apana.org.au> - 2016-09-13 08:50 +0200
Re: Kernel panic - encryption/decryption failed when open file on Arm64 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-09-13 10:00 +0200
csiph-web