tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: brk(3)/break(2) does not fail for very high adresses



On Wed, Nov 25, 2009 at 01:39:56PM +0100, Joerg Sonnenberger wrote:
> On Wed, Nov 25, 2009 at 11:59:29AM +0100, Nicolas Joly wrote:
> > Index: sys/uvm/uvm_unix.c
> > ===================================================================
> > RCS file: /cvsroot/src/sys/uvm/uvm_unix.c,v
> > retrieving revision 1.41
> > diff -u -p -r1.41 uvm_unix.c
> > --- sys/uvm/uvm_unix.c      4 Mar 2009 21:52:38 -0000       1.41
> > +++ sys/uvm/uvm_unix.c      25 Nov 2009 10:58:40 -0000
> > @@ -86,7 +86,8 @@ sys_obreak(struct lwp *l, const struct s
> >     mutex_enter(&p->p_auxlock);
> >     old = (vaddr_t)vm->vm_daddr;
> >     new = round_page((vaddr_t)SCARG(uap, nsize));
> > -   if ((new - old) > p->p_rlimit[RLIMIT_DATA].rlim_cur && new > old) {
> > +   if ((SCARG(uap, nsize) && new == 0) ||
> 
> SCARG(uap, nsize) == 0 ==> new == 0, doesn't it?

Right. Originally, i only wanted to test/reject overflow; but a 0
value make no sense and will be rejected too (should not happen,
brk(3) already disallow it).

Will only add the `new == 0' part to the existing test.

Thanks.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index