From: Matt Domsch <Matt_Domsch@dell.com>
To: jmorris@redhat.com, davem@davemloft.net
Cc: linux-kernel@vger.kernel.org, Oleg Makarenko <mole@quadra.ru>
Subject: using crypto_digest() on non-kmalloc'd memory failures
Date: Mon, 18 Oct 2004 14:29:52 -0500 [thread overview]
Message-ID: <20041018192952.GB8607@lists.us.dell.com> (raw)
James, David,
Oleg noted that when we call crypto_digest() on memory allocated as a
static array in a module, rather than kmalloc(GFP_KERNEL), it returns
incorrect data, and with other functions, a kernel panic.
Thoughts as to why this may be? Oleg's test patch appended.
--
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
----- Forwarded message from Oleg Makarenko <mole@quadra.ru> -----
From: Oleg Makarenko <mole@quadra.ru>
To: Matt Domsch <Matt_Domsch@dell.com>
CC: linux-ppp@vger.kernel.org, pptpclient-devel@lists.sourceforge.net
Subject: Re: [pptp-devel] Re: [2/2]: ppp_mppe inclusion
Date: Sun, 05 Sep 2004 22:23:15 +0400
>>>2. For some reason you can not use non GFP_KERNEL memory and scatter
>>>lists or at least mix them in crypto_digest(). That is why sha_pad is
>>>now in struct state {}.
>
>Can you describe what happens when you do?
please try the attached patch for tcrypt.c to see what is going on
yourself. modprobe the resulting module with mode=2 parameter to test
sha1 and see how it fails the tests (incorrect results, no kernel panic).
For mode=0 (or without any parameter) you should get kernel panic.
=oleg
--- tcrypt.c.orig 2004-08-14 09:37:38.000000000 +0400
+++ tcrypt.c 2004-09-05 21:11:19.000000000 +0400
@@ -58,6 +58,8 @@
static char *xbuf;
static char *tvmem;
+static char tvmem_buf[TVMEMSIZE];
+
static char *check[] = {
"des", "md5", "des3_ede", "rot13", "sha1", "sha256", "blowfish",
"twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6",
@@ -820,7 +822,8 @@
static int __init
init(void)
{
- tvmem = kmalloc(TVMEMSIZE, GFP_KERNEL);
+ tvmem = &tvmem_buf[0];
+
if (tvmem == NULL)
return -ENOMEM;
@@ -833,7 +836,6 @@
do_test();
kfree(xbuf);
- kfree(tvmem);
return 0;
}
next reply other threads:[~2004-10-18 19:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-18 19:29 Matt Domsch [this message]
2004-10-18 19:35 ` using crypto_digest() on non-kmalloc'd memory failures James Morris
2004-10-18 20:05 ` Oleg Makarenko
2004-10-18 20:16 ` David S. Miller
2004-10-18 23:04 ` James Morris
2004-10-19 5:41 ` Oleg Makarenko
2004-10-18 20:30 ` Brian Gerst
2004-10-18 22:10 ` Gene Heskett
2004-10-18 22:29 ` dupes (was Re: using crypto_digest() on non-kmalloc'd memory failures) Matt Domsch
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=20041018192952.GB8607@lists.us.dell.com \
--to=matt_domsch@dell.com \
--cc=davem@davemloft.net \
--cc=jmorris@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mole@quadra.ru \
/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