Re: Dosemu leaks on fork

Kai Henningsen (kaih@khms.westfalen.de)
12 Jan 1998 19:40:00 +0200


kaih@khms.westfalen.de (Kai Henningsen) wrote on 11.01.98 in <6ldhcZ9Xw-B@khms.westfalen.de>:

> mingo@chiara.csoma.elte.hu (MOLNAR Ingo) wrote on 11.01.98 in
> <Pine.LNX.3.96.980111202533.15060A-100000@chiara.csoma.elte.hu>:
>
> > On 11 Jan 1998, Kai Henningsen wrote:
> >
> > > > > I looked at the output, and it appears that someone is vmallocing
> > > > > like *mad*. You could try wrapping vmalloc to see who's doing that.
> >
> > > I made a very crude patch which, with some obscene command line for
> > > searching /var/log/messages, made me find it, I think.
> > >
> > > It's in process.c, line 484. It's when dosemu forks Linux programs.
> > > (This is in copy_thread, but only if the thread has an ldt.)
> >
> > ugh. Does this patch (against 2.0.33) remove the leak?
> >
> > --- linux/arch/i386/kernel/.process.c.orig Sat Jan 10 20:23:11 1998
> > +++ linux/arch/i386/kernel/process.c Sat Jan 10 20:23:44 1998
> > @@ -421,8 +421,9 @@
> > int i;
> >
> > if (current->ldt) {
> > - free_page((unsigned long) current->ldt);
> > + void * ldt = current->ldt;
> > current->ldt = NULL;
> > + vfree(ldt);
> > for (i=1 ; i<NR_TASKS ; i++) {
> > if (task[i] == current) {
> > set_ldt_desc(gdt+(i<<1)+
>
> I'll try this out. That one looked suspicious to me, too.

The leak seems to have disappeared.

My torture test is this simple DOS batch file:

@echo off
:start
unix echo
goto :start

With the leak, I could see the memory going away. Now, nothing.

However, I've just booted the new kernel (just enough for the torture
test); I'll see how it looks in a day or two.

But it sure looks as if we got it nailed.

MfG Kai