linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.6.11-rc2-mm1 Random related problems
@ 2005-01-25  4:36 Zwane Mwaikambo
  2005-01-25  4:45 ` Matt Mackall
  2005-01-25 20:40 ` Matt Mackall
  0 siblings, 2 replies; 5+ messages in thread
From: Zwane Mwaikambo @ 2005-01-25  4:36 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Andrew Morton, Linux Kernel

I'm having trouble booting here, were those random-* patches tested?

Initializing random number generator:  [  OK  ]
Unable to handle kernel paging request at virtual address f5e50000
 printing eip:
c037a0a5
*pde = 0086e067
Oops: 0000 [#1]
PREEMPT SMP DEBUG_PAGEALLOC
Modules linked in:
CPU:    0
EIP:    0060:[<c037a0a5>]    Not tainted VLI
EFLAGS: 00010006   (2.6.11-rc2-mm1)
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
 [<c037a7ce>] extract_entropy_user+0x1e/0xd0
 [<c0163578>] vfs_read+0xe8/0x1a0
 [<c01638e1>] sys_read+0x41/0x70
 [<c010315d>] sysenter_past_esp+0x52/0x75
Code: ff 0f 84 cf 00 00 00 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 
b6 4d c8 89 f8 d3 c0 8945 bc 8b 45 e8 85 c0 7e 0e 8b 55 ec <8b> 0a 83 c2 
04 89 55 ec 89 4d c8 8b 4d cc 4b 8d 47 0e 8b 55 e0
 <3>Debug: sleeping function called from invalid context at 
include/linux/rwsem.h:43
in_atomic():1, irqs_disabled():0
 [<c0104067>] dump_stack+0x17/0x20
 [<c011cf2c>] __might_sleep+0xac/0xc0
 [<c0120cd3>] profile_task_exit+0x23/0x60
 [<c0122fbc>] do_exit+0x1c/0x450
 [<c0104468>] die+0x188/0x190
 [<c0116d59>] do_page_fault+0x349/0x63f
 [<c0103cc7>] error_code+0x2b/0x30
 [<c037a4e0>] xfer_secondary_pool+0xb0/0xe0
 [<c037a7ce>] extract_entropy_user+0x1e/0xd0
 [<c0163578>] vfs_read+0xe8/0x1a0
 [<c01638e1>] sys_read+0x41/0x70
 [<c010315d>] sysenter_past_esp+0x52/0x75
note: dd[2255] exited with preempt_count 1
scheduling while atomic: dd/0x10000001/2255
 [<c0104067>] dump_stack+0x17/0x20
 [<c05e8fd2>] schedule+0xc82/0xc90
 [<c05e983a>] cond_resched+0x2a/0x50
 [<c0153709>] unmap_vmas+0x189/0x260
 [<c015810b>] exit_mmap+0x8b/0x160
 [<c011da91>] mmput+0x41/0xf0
 [<c0123047>] do_exit+0xa7/0x450
 [<c0104468>] die+0x188/0x190
 [<c0116d59>] do_page_fault+0x349/0x63f
 [<c0103cc7>] error_code+0x2b/0x30
 [<c037a4e0>] xfer_secondary_pool+0xb0/0xe0
 [<c037a7ce>] extract_entropy_user+0x1e/0xd0
 [<c0163578>] vfs_read+0xe8/0x1a0
 [<c01638e1>] sys_read+0x41/0x70
 [<c010315d>] sysenter_past_esp+0x52/0x75
/etc/rc3.d/S20random: line 57:  2255 Segmentation fault      dd 
if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null

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

* Re: 2.6.11-rc2-mm1 Random related problems
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Matt Mackall @ 2005-01-25  4:45 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Andrew Morton, Linux Kernel

On Mon, Jan 24, 2005 at 09:36:37PM -0700, Zwane Mwaikambo wrote:
> I'm having trouble booting here, were those random-* patches tested?

Works here, can you send me a copy of your init script?

-- 
Mathematics is the supreme nostalgia of our time.

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

* Re: 2.6.11-rc2-mm1 Random related problems
  2005-01-25  4:45 ` Matt Mackall
@ 2005-01-25  4:49   ` Zwane Mwaikambo
  0 siblings, 0 replies; 5+ messages in thread
From: Zwane Mwaikambo @ 2005-01-25  4:49 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Andrew Morton, Linux Kernel

On Mon, 24 Jan 2005, Matt Mackall wrote:

> On Mon, Jan 24, 2005 at 09:36:37PM -0700, Zwane Mwaikambo wrote:
> > I'm having trouble booting here, were those random-* patches tested?
> 
> Works here, can you send me a copy of your init script?

#!/bin/bash
#
# random	Script to snapshot random state and reload it at boot time.
#
# Author:       Theodore Ts'o <tytso@mit.edu>
#
# chkconfig: 2345 20 80
# description: Saves and restores system entropy pool for higher quality \
#              random number generation.

. /etc/init.d/functions

random_seed=/var/lib/random-seed

# See how we were called.
case "$1" in
  start)
	# Carry a random seed from start-up to start-up
	# Load and then save 512 bytes, which is the size of the entropy pool
	if [ -f $random_seed ]; then
		cat $random_seed >/dev/urandom
	else
		touch $random_seed
	fi
	action $"Initializing random number generator: " /bin/true
	chmod 600 $random_seed
	dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
	touch /var/lock/subsys/random

	;;
  stop)
	# Carry a random seed from shut-down to start-up
	# Save 512 bytes, which is the size of the entropy pool
	touch $random_seed
	chmod 600 $random_seed
	action $"Saving random seed: " dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
	
	rm -f /var/lock/subsys/random
	;;
  status)
	# this is way overkill, but at least we have some status output...
	if [ -c /dev/random ] ; then
		echo $"The random data source exists"
	else
		echo $"The random data source is missing"
	fi
	;;
  restart|reload)
	# do not do anything; this is unreasonable
	:
	;;
  *)
	# do not advertise unreasonable commands that there is no reason
	# to use with this device
	echo $"Usage: $0 {start|stop|status|restart|reload}"
	exit 1
esac

exit 0

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

* Re: 2.6.11-rc2-mm1 Random related problems
  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 20:40 ` Matt Mackall
  2005-01-25 21:42   ` Zwane Mwaikambo
  1 sibling, 1 reply; 5+ messages in thread
From: Matt Mackall @ 2005-01-25 20:40 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Andrew Morton, Linux Kernel

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.

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

* Re: 2.6.11-rc2-mm1 Random related problems
  2005-01-25 20:40 ` Matt Mackall
@ 2005-01-25 21:42   ` Zwane Mwaikambo
  0 siblings, 0 replies; 5+ messages in thread
From: Zwane Mwaikambo @ 2005-01-25 21:42 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Andrew Morton, Linux Kernel

On Tue, 25 Jan 2005, Matt Mackall wrote:

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

Thanks Matt, that fixes it.


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

end of thread, other threads:[~2005-01-25 21:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2005-01-25 21:42   ` Zwane Mwaikambo

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