Re: [PATCH v1 4/10] User Space Breakpoint Assistance Layer

From: Srikar Dronamraju
Date: Tue Mar 23 2010 - 07:26:27 EST


>
> > User Space Breakpoint Assistance Layer (USER_BKPT)
> >
>
> A quick scan, just to show I was paying attention ;)

Thanks for taking a look and commenting on the code.

>
> > +int user_bkpt_read_vm(struct task_struct *tsk, unsigned long vaddr,
> > + void *kbuf, int nbytes)
> > +{
> > + if (tsk == current) {
> > + int nleft = copy_from_user(kbuf, (void __user *) vaddr,
> > + nbytes);
> > + return nbytes - nleft;
> > + } else
> > + return access_process_vm(tsk, vaddr, kbuf, nbytes, 0);
> > +}
>
> copy_from_user() takes and returns an unsigned long arg but this
> function is converting these to and from ints. That's OK if we're 100%
> sure that we'll never get or return an arg >2G. Otherwise things could
> get ghastly. Please have a think. (Dittoes for some other functionss
> around here).
>

nbytes would not be greater than the maximum size of a instruction for
that architecture. Hence I dont see it going above 2G. However I will
take a relook.


I will rework the rest of the comments as suggested by you.
It would be part of the next version.

--
Thanks and Regards
Srikar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/