Diego Nieto Cid, le Fri 17 Jan 2014 22:49:25 -0200, a écrit :
> El ene 17, 2014 11:36 a.m., "Marin Ramesa" <[email protected]> escribió:
> > +
> > +kern_return_t
> > +futex_wait(task_t task, vm_offset_t futex_address, int value,
> > +          mach_msg_timeout_t msec, boolean_t private_futex)
> > +{
> > +       if (private_futex) {
> > +               struct private_futex *futex;
> > +
> > +               futex = futex_private_lookup_address(futex_address);
> > +               if (futex == NULL) {
> > +                       futex = futex_private_init(futex_address);
> > +                       if (futex == NULL)
> > +                               return KERN_RESOURCE_SHORTAGE;
> > +               }
> > +
> > +               if (__atomic_load_n(
> > +                       (int *) futex_address, __ATOMIC_RELAXED) == value) {
> 
> Are you sure you can dereference futex_address?
> 
> It's a user supplied virtual address which is probably not valid in the
> kernel's virtual address space (unless things like copyin are used)
> 
> I have the vague idea that the kernel has it's own address space. Can somebody
> confirm that? :-)

Yes. Care has to be taken when dereferencing user pointers.

Samuel

Reply via email to