[lkml]   [2009]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [RFC PATCH 3/X] ptrace: introduce the empty "struct ptrace_task"
    >  /**
    > + * tracehook_init_task - initialize the new child
    > + * @child: new child task


    > + * @clone_flags: %CLONE_* flags from clone/fork/vfork system call
    > + * @trace: return value from tracehook_prepare_clone()
    > + *
    > + * This is called immediately after dup_task_struct().

    * It must clear/reset any tracing state so that tracehook_free_task()
    * will work safely if the task creation fails. If the task creation
    * succeeds, a tracehook_finish_clone() call will follow with locks
    * held, before @task starts or is accessible to anyone else.

    > +int alloc_ptrace_task(struct task_struct *tsk)

    This deserves a short comment about the context it's called from,
    and when it is or isn't called at all.

    > + if (cmpxchg(&tsk->ptrace_task, NULL, ptrace_task) != NULL)
    > + kfree(ptrace_task);

    I don't see cmpxchg() used very often at all in generic kernel code. I
    wonder how good a choice it is across every arch. Is there a reason not to
    use e.g. task_lock() to mediate installing a new ->ptrace_task pointer?
    That seems like a more conservative route.


     \ /
      Last update: 2009-05-26 22:51    [W:0.022 / U:49.300 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site