Subject: Re: GCC3.3.1 switch coming soon.
To: Andrew Brown <atatat@atatdot.net>
From: enami tsugutomo <enami@sm.sony.co.jp>
List: tech-kern
Date: 09/03/2003 11:06:27
Moved to tech-kern.

Andrew Brown <atatat@atatdot.net> writes:

> does the patch you sent rely on other recent changes?  i tried
> applying it to my 8/10 source tree and while the kernel compiled
> happily, it panicked very early on...early enough that it would not
> generate a kernel dump.

If your kernel configuration has DIAGNOSTIC option, you need following
change:

enami@memory-leak% CVS_RSH=ssh cvs -qu log -N -r1.83 kern_malloc.c

RCS file: /cvsroot/src/sys/kern/kern_malloc.c,v
Working file: kern_malloc.c
head: 1.85
branch:
locks: strict
access list:
keyword substitution: kv
total revisions: 122;   selected revisions: 1
description:
----------------------------
revision 1.83
date: 2003/08/28 14:54:32;  author: enami;  state: Exp;  lines: +4 -4
Use vm_map_{min,max}() rather than accessing struct vm_map.header.{start,end}
directly.
=============================================================================

Otherwise, please let me know the panic message.

> >It is actually a bug in topdown vm code.  It incorrectly re-uses
> >space already in-use under some condition which began to met
> >recently.
> 
> where?  tell me tell me.  :)

In the uvm_map_findspace(), if topdown and the uvm_map_lookup_enty()
returns true and tmp->next is &map-header, it returns wrong address.

And on -current, stack and anon just above the stack is merged if
stack is unlimited.

root@kk-3f-102-222# sh -c 'ulimit -s unlimited; sh -c pmap'
08048000    104K read/exec         /bin/sh
08062000     32K read/write          [ anon ]
9DB20000      4K read/write          [ anon ]
9DB21000    608K read/exec         /lib/libc.so.12.100
9DBB9000     24K read/write        /lib/libc.so.12.100
9DBBF000     76K read/write          [ anon ]
9DBD2000      8K read/exec         /lib/libtermcap.so.0.5
9DBD4000      4K read/write        /lib/libtermcap.so.0.5
9DBD5000     88K read/exec         /lib/libedit.so.2.6
9DBEB000      8K read/write        /lib/libedit.so.2.6
9DBED000     32K read/write          [ anon ]
9DBF5000      4K read/exec           [ uvm_aobj ]
9DBF6000     36K read/exec         /libexec/ld.elf_so
9DBFF000  32772K read/write          [ anon ]
 total    33800K
root@kk-3f-102-222# 

> it also looks like the patch drops some of the required changes to
> deal with topdown...

where, where? :)

enami.