public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Zwane Mwaikambo <zwane@arm.linux.org.uk>
Cc: Andrew Morton <akpm@osdl.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.11-rc2-mm1 Random related problems
Date: Tue, 25 Jan 2005 12:40:56 -0800	[thread overview]
Message-ID: <20050125204056.GL12076@waste.org> (raw)
In-Reply-To: <Pine.LNX.4.61.0501242134390.3010@montezuma.fsmlabs.com>

On Mon, Jan 24, 2005 at 09:36:37PM -0700, Zwane Mwaikambo wrote:
> I'm having trouble booting here, were those random-* patches tested?
> 
> EIP is at __add_entropy_words+0xc5/0x1c0
> eax: 0000002d   ebx: 0000000f   ecx: 0000007b   edx: f5e50000
> esi: c0810980   edi: 0000000f   ebp: f5e4fea4   esp: f5e4fe5c
> ds: 007b   es: 007b   ss: 0068
> Process dd (pid: 2255, threadinfo=f5e4e000 task=ebdd7ac0)
> Stack: 00000010 78000000 c07043e0 00000286 0000007b 0000001f 00000001 00000007
>        0000000e 00000014 0000001a 00000000 0000002d f5e50000 c07043c0 00000080
>        c0704340 c07043c0 f5e4ff40 c037a4e0 00000000 00000010 2cda69d0 f7b9f75e
> Call Trace:
>  [<c010403a>] show_stack+0x7a/0x90
>  [<c01041c6>] show_registers+0x156/0x1c0
>  [<c01043e0>] die+0x100/0x190
>  [<c0116d59>] do_page_fault+0x349/0x63f
>  [<c0103cc7>] error_code+0x2b/0x30
>  [<c037a4e0>] xfer_secondary_pool+0xb0/0xe0

This oops is add_entropy_words running off the top of the stack
reading its input. The overrun is harmless until it causes a page
fault. After much staring:

This should fix Zwane's oops. Looks like I introduced this bug in Aug
2003, but it was hard to trigger until the recent changes. But it
ought to make it to mainline soonish.

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: rc2mm1/drivers/char/random.c
===================================================================
--- rc2mm1.orig/drivers/char/random.c	2005-01-25 12:27:00.000000000 -0800
+++ rc2mm1/drivers/char/random.c	2005-01-25 12:27:36.000000000 -0800
@@ -701,7 +701,7 @@
 
 		bytes=extract_entropy(r->pull, tmp, bytes,
 				      random_read_wakeup_thresh / 8, rsvd);
-		add_entropy_words(r, tmp, bytes);
+		add_entropy_words(r, tmp, (bytes + 3) / 4);
 		credit_entropy_store(r, bytes*8);
 	}
 }


-- 
Mathematics is the supreme nostalgia of our time.

  parent reply	other threads:[~2005-01-25 20:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-25  4:36 2.6.11-rc2-mm1 Random related problems Zwane Mwaikambo
2005-01-25  4:45 ` Matt Mackall
2005-01-25  4:49   ` Zwane Mwaikambo
2005-01-25 20:40 ` Matt Mackall [this message]
2005-01-25 21:42   ` Zwane Mwaikambo

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=20050125204056.GL12076@waste.org \
    --to=mpm@selenic.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zwane@arm.linux.org.uk \
    /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