lkml.org 
[lkml]   [2012]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [RFC][PATCH] fix move/migrate_pages() race on task struct
    Christoph Lameter <cl@linux.com> writes:

    > On Fri, 24 Feb 2012, Dave Hansen wrote:
    >
    >> > Is that all safe? If not then we need to take a refcount on the task
    >> > struct after all.
    >>
    >> Urg, no we can't sleep under an rcu_read_lock().
    >
    > Ok so take a count and drop it before entering the main migration
    > function?

    For correct operation of kernel code a count sounds fine.

    If you are going to allow sleeping how do you ensure that an exec that
    happens between the taking of the reference count and checking the
    permissions does not mess things up.

    At the very least the patch description needs an explanation of what
    the thinking will be in that case.

    At the moment I suspect the permissions checks are not safe unless
    performed under both rcu_read_lock and task_lock to ensure that
    the task<->mm association does not change on us while we are
    working. Even with that the cred can change under us but at least
    we know the cred will be valid until rcu_read_unlock happens.

    This entire thinhg of modifying another process is a pain.

    Perhaps you can play with task->self_exec_id to detect an exec and fail
    the system call if there was an exec in between when we find the task
    and when we drop the task reference.

    Eric



    \
     
     \ /
      Last update: 2012-02-25 13:17    [W:2.276 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site