bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH v16] kern: simple futex for gnumach


From: Samuel Thibault
Subject: Re: [PATCH v16] kern: simple futex for gnumach
Date: Sat, 18 Jan 2014 02:06:05 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Diego Nieto Cid, le Fri 17 Jan 2014 22:49:25 -0200, a écrit :
> El ene 17, 2014 11:36 a.m., "Marin Ramesa" <mpr@hi.t-com.hr> 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

[Prev in Thread] Current Thread [Next in Thread]