The only patch which probably makes sense anyway.

Currently utrace assumes that task->utrace_flags can have only one
special bit, ENGINE_STOP. But it make sense to add more special bits.

For example, ptrace-utrace. It still uses task->ptrace for PT_PTRACE_CAP
and PT_UTRACED (the latter one is only needed to indicate that this task
is re-parented by ptrace). We can move them both into ->utrace_flags.

Introduce ENGINE_EXTRA_FLAGS == ENGINE_STOP and change utrace_set_events()
to use it. It is the only helper which changes target->utrace_flags and
engine->flags and needs the fix. utrace_reset() is OK, it just OR's all
engine->flags into task->utrace_flags.

See also the next "patches".

---

 kernel/utrace.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- RHEL6/kernel/utrace.c~1_NONEVENT_BITS       2010-01-31 17:01:59.000000000 
+0100
+++ RHEL6/kernel/utrace.c       2010-07-06 22:47:28.000000000 +0200
@@ -460,6 +460,8 @@ static void put_detached_list(struct lis
  */
 #define ENGINE_STOP            (1UL << _UTRACE_NEVENTS)
 
+#define ENGINE_EXTRA_FLAGS     (ENGINE_STOP)
+
 static void mark_engine_wants_stop(struct task_struct *task,
                                   struct utrace_engine *engine)
 {
@@ -530,14 +532,14 @@ int utrace_set_events(struct task_struct
         * We just ignore the internal bit, so callers can use
         * engine->flags to seed bitwise ops for our argument.
         */
-       events &= ~ENGINE_STOP;
+       events &= ~ENGINE_EXTRA_FLAGS;
 
        utrace = get_utrace_lock(target, engine, true);
        if (unlikely(IS_ERR(utrace)))
                return PTR_ERR(utrace);
 
        old_utrace_flags = target->utrace_flags;
-       old_flags = engine->flags & ~ENGINE_STOP;
+       old_flags = engine->flags & ~ENGINE_EXTRA_FLAGS;
 
        if (target->exit_state &&
            (((events & ~old_flags) & _UTRACE_DEATH_EVENTS) ||
@@ -569,7 +571,7 @@ int utrace_set_events(struct task_struct
                read_unlock(&tasklist_lock);
        }
 
-       engine->flags = events | (engine->flags & ENGINE_STOP);
+       engine->flags = events | (engine->flags & ENGINE_EXTRA_FLAGS);
        target->utrace_flags |= events;
 
        if ((events & UTRACE_EVENT_SYSCALL) &&

Reply via email to