On Tue, 2013-12-10 at 14:33 -0800, Linus Torvalds wrote: > On Tue, Dec 10, 2013 at 2:19 PM, Linus Torvalds > <torva...@linux-foundation.org> wrote: > > > > Shouldn't we do something like the attached? > > So I think that kernel/futex.c part of the patch might be a good idea, > but on x86-64 (which is what Dave is running), the > > if (end >> __VIRTUAL_MASK_SHIFT) > > test in get_user_pages_fast() should have been equivalent. And even on > 32-bit, we do check the _PAGE_USER bits in the page tables, so I guess > it's all good on a get_user_pages_fast() side. > > So never mind. It's not the address checking. > > And I think I see what's up. > > I think what happens is: > - get_user_pages_fast(address, 1, 1, &page) fails (because it's read-only) > - get_user_pages_fast(address, 1, 0, &page) succeeds and gets a large-page > - __get_user_pages_fast(address, 1, 1, &page) fails (because it's read-only). > > so what triggers this is likely that Dave now does large-pages, and > one of them is a read-only mapping. > > So I would suggest replacing the second "1" in the > __get_user_pages_fast() call with a "!ro" instead. So how about this > second patch instead (the access_ok() move remains). > > Comments? >
You're too fast for me, but I'm trying to keep up. It was my understanding that access_ok() was an optimization for private futexes, but something more heavy weight was required for shared. I believe that was find_vma() in the past, but Peter Z changed that with fast gup. Trying to page that all in now and get the exact details.... -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/