netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [CRYPTO] Fix stack overrun in crypt()
@ 2004-07-15 11:48 Herbert Xu
  2004-07-16 15:27 ` James Morris
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Herbert Xu @ 2004-07-15 11:48 UTC (permalink / raw)
  To: David S. Miller; +Cc: James Morris, netdev

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

Hi:

The stack allocation in crypt() is bogus as whether tmp_src/tmp_dst
is used is determined by factors unrelated to nbytes and
src->length/dst->length.

Since the condition for whether tmp_src/tmp_dst are used is very
complex, let's allocate them always instead of guessing.

This fixes a number of weird crashes including those AES crashes
that people have been seeing with the 2.4 backport + ipt_conntrack.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

PS I think someone should double-check the logic in the scatterwalk
stuff, especially the whichbuf bits.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 439 bytes --]

===== crypto/cipher.c 1.18 vs edited =====
--- 1.18/crypto/cipher.c	2004-05-27 06:25:36 +10:00
+++ edited/crypto/cipher.c	2004-07-15 21:40:53 +10:00
@@ -52,8 +52,8 @@
 {
 	struct scatter_walk walk_in, walk_out;
 	const unsigned int bsize = crypto_tfm_alg_blocksize(tfm);
-	u8 tmp_src[nbytes > src->length ? bsize : 0];
-	u8 tmp_dst[nbytes > dst->length ? bsize : 0];
+	u8 tmp_src[bsize];
+	u8 tmp_dst[bsize];
 
 	if (!nbytes)
 		return 0;

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-07-21 22:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-15 11:48 [CRYPTO] Fix stack overrun in crypt() Herbert Xu
2004-07-16 15:27 ` James Morris
2004-07-17  7:43   ` Herbert Xu
2004-07-17  9:48     ` Herbert Xu
2004-07-21 21:58 ` David S. Miller
2004-07-21 22:02 ` David S. Miller

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).