Re: [GIT pull] futex fixes for 2.6.31

From: Thomas Gleixner
Date: Thu Jun 25 2009 - 05:57:24 EST


On Thu, 25 Jun 2009, Zhang, Yanmin wrote:
> On Wed, 2009-06-24 at 21:48 +0200, Thomas Gleixner wrote:
> > +static int fault_in_user_writeable(u32 __user *uaddr)
> > +{
> > + int ret = get_user_pages(current, current->mm, (unsigned long)uaddr,
> > + sizeof(*uaddr), 1, 0, NULL, NULL);
> The 4th parameter of get_user_pages means page number. ïsizeof(*uaddr) is equal to
> 4, so you want 4 pages?

Grrr. I looked up the prototype of it in include/linux/mm.h:

int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, int len, int write, int force,
struct page **pages, struct vm_area_struct **vmas);

len == number of pages ! How intutitive. :(

I guess Linus tripped over it as well. See:
http://lkml.org/lkml/2009/6/21/95

> > > In fact, since you're not actually interested in the page, you _could_
> > > just do
> > >
> > > get_user_pages(tsk, mm, uaddr, 4, 1, 0, NULL, NULL);

Will fix, thanks for noticing!

tglx