Re: [PATCH 0/1] uprobes: Kill __replace_page(), changeuprobe_write_opcode() to rely on gup(WRITE)

From: Linus Torvalds
Date: Tue Dec 10 2013 - 15:19:28 EST


On Tue, Dec 10, 2013 at 12:16 PM, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> On 12/10, Oleg Nesterov wrote:
>>
>> On 12/10, Linus Torvalds wrote:
>> >
>> > We'd be *much* better off using get_user_pages_fast() if possible -
>> > and I bet _is_ possible in 99% of all cases.
>>
>> We can't. get_user_pages_fast() takes mmap_sem.
>
> Hmm. I am stupid, there is __get_user_pages_fast(). OK, I'll try
> to think more.

There is indeed the non-locking version, however, since we want to get
the pte-pointer anyway, I really think you were right in complaining
about get_user_pages_fast() in the first place, and we'd be much
better off just doing the page table lookup ourselves. Which we have
to do later *anyway*.

The whole [__]get_user_pages[_fast]() family of functions are for
people who want the *page*. We want more than that. We really want the
page table entry, since we have to potentially change it.

Linus
--
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/