From: Jorgen Lundman <lundman@lundman.net>
To: linux-crypto@vger.kernel.org
Subject: Crypto causes panic in scatterwalk_done with large/multiple buffers
Date: Thu, 15 Nov 2012 18:03:42 +0900 [thread overview]
Message-ID: <50A4AFEE.9030206@lundman.net> (raw)
I have a situation where I setup scatterlists as:
input scatterlist of 1, address ffffc90003627000 len 0x20000.
output scatterlist of 2, address 0 ffffc90002d45000 len 0x20000
address 1 ffff88003b079d98 len 0x000c
When I call crypto_aead_encrypt(req); it will die with:
kernel: [ 925.151113] BUG: unable to handle kernel paging request at
ffffeb04000b5140
kernel: [ 925.151253] IP: [<ffffffff812f4880>] scatterwalk_done+0x50/0x60
kernel: [ 925.151325] PGD 0
kernel: [ 925.151381] Oops: 0000 [#1] SMP
kernel: [ 925.151442] CPU 1
kernel: [ 925.154255] [<ffffffff812f7640>] blkcipher_walk_done+0xb0/0x230
kernel: [ 925.154255] [<ffffffffa02e9169>] crypto_ctr_crypt+0x129/0x2b0 [ctr]
kernel: [ 925.154255] [<ffffffff812fe580>] ? crypto_aes_set_key+0x40/0x40
kernel: [ 925.154255] [<ffffffff812f6cbd>] async_encrypt+0x3d/0x40
kernel: [ 925.154255] [<ffffffffa0149326>] crypto_ccm_encrypt+0x246/0x290
[ccm]
kernel: [ 925.154255] [<ffffffffa01633bd>] crypto_encrypt+0x26d/0x2d0
What is interesting about that is, if I allocate a linear buffer instead:
dst = kmalloc(cryptlen, GFP_KERNEL); // 0x20000 + 0x000c
sg_init_table(sg, 1 );
sg_set_buf(&sg[0], dst, cryptlen);
crypto_aead_encrypt(req);
will no longer panic. However, when I try to copy the linear buffer back to
scatterlist;
scatterwalk_map_and_copy(dst, sg, 0, cryptlen, 1);
then it will panic there instead.
However, if I replace it with the call:
sg_copy_from_buffer(sg, sg_nents(sg),
dst, cryptlen);
everything works! <-
So, what am I doing wrong that makes scatterwalk_map_and_copy() fail, and
sg_copy_from_buffer() work fine? It would be nice if I could fix it, so I
did not need to copy to a temporary buffer.
Lund
--
Jorgen Lundman | <lundman@lundman.net>
Unix Administrator | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo | +81 (0)90-5578-8500 (cell)
Japan | +81 (0)3 -3375-1767 (home)
next reply other threads:[~2012-11-15 9:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-15 9:03 Jorgen Lundman [this message]
2012-11-17 0:42 ` Crypto causes panic in scatterwalk_done with large/multiple buffers Jussi Kivilinna
2012-11-17 8:39 ` Jussi Kivilinna
2012-11-18 0:29 ` Jorgen Lundman
2012-11-18 2:10 ` Jorgen Lundman
2012-11-18 17:40 ` Jussi Kivilinna
2012-11-19 0:29 ` Jorgen Lundman
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=50A4AFEE.9030206@lundman.net \
--to=lundman@lundman.net \
--cc=linux-crypto@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox