Subject: Re: Fixing Linux emulated brk()
To: None <tech-kern@netbsd.org, christos@zoulas.com>
From: Wolfgang Solfrank <ws@tools.de>
List: tech-kern
Date: 03/15/2001 15:23:36
Hi,

> A horrible kludge would be to store the
> actual value somewhere else in struct proc [p_emuldata], and return
> it so that we behave like linux. I don't see another solution that
> does not involve changes to the non-compat code. It is ~trivial to
> do. So add a vm_dsize to linux_emuldata and go from there.
> If anyone else can see another way to do it, feel free to yell.

Wouldn't simply always returning a page-aligned value (even if the user
didn't ask for it) help here?  Actually, the real break value cannot be
non-page-aligned anyways...

BTW, the linux_sys_brk looks a bit broken to me.

1. It doesn't take into account that vm_daddr might be unaligned.
It probably should do something similar to what sys_obreak does when
extracting the old value, i.e.
	oldbrk = round_page(vm->vm_daddr + ctob(vm->vm_dsize));

2. From the comment in this file, it seems that it wants to only increase
the break value.  The actual code however doesn't compare with the old
break value, but with vm_daddr, i.e. the start of the data area.

Ciao,
Wolfgang
-- 
ws@TooLs.DE     Wolfgang Solfrank, TooLs GmbH 	+49-228-985800