lkml.org 
[lkml]   [2013]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] Add a text_poke syscall v2
    On 11/29, H. Peter Anvin wrote:
    >
    > On 11/29/2013 12:05 PM, Oleg Nesterov wrote:
    > >
    > > Can't we invalidate pte (so that any user will stuck in page fault),
    > > update the page(s), restore the pte and drop the locks?
    > >
    > > This way sys_text_poke() won't be x86-specific, and it will be per-mm.
    > >
    >
    > Hmmm... if we hold mmap_sem() this pretty much will be the net result,
    > no?

    Yes, down_write(mmap_sem) is enough to block the page faults.

    But we need pte-lock anyway, to avoid the races with, say, try_to_unmap().
    (and of course, we need to retry if page_check_address() fails).

    This actually means that if we want to update a single page we could
    use down_read(). But in general we need to update 2 pages. Or even more
    if we generalize sys_text_poke(), perhaps it should be renamed in this
    case, but this is off-topic.

    > That would mean no additional tests needed on the page fault path.

    Not sure I understand... but of course we should not change the fault
    paths in any case.

    > What I'm not sure of is whether or not it is actually safe to hold
    > mmap_sem across all the code we need

    Let me repeat, I do not understand vm enough to answer authoritatively.

    But I think this should be safe. I do not see why it should not, but
    see above.

    Oleg.



    \
     
     \ /
      Last update: 2013-11-30 16:21    [W:3.540 / U:0.312 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site