Re: Dosemu leaks on fork

Kai Henningsen (kaih@khms.westfalen.de)
11 Jan 1998 22:42:00 +0200


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 sequence I currently find in my logs is:

Jan 11 22:22:35 khms kernel: copy_thread: vmalloc(00010000) -> 04849000
Jan 11 22:22:35 khms kernel: copy_thread: vmalloc(00010000) -> 04a69000
Jan 11 22:22:35 khms kernel: flush_thread: free_page(04a69000)
Jan 11 22:22:36 khms kernel: exit_thread: vfree(04849000)

MfG Kai