Re: [PATCH] Don't apply for write lock on tasklist_lock if parentdoesn't ptrace other processes

From: Roland McGrath
Date: Thu Jul 22 2010 - 15:25:30 EST


> So, this list_empty() check needs taskslit at least for reading. But, we
> are going to take it for writing right after exit_ptrace() returns, afaics
> we can add this fastpatch check for free.

That looks good to me, but it could use some more scare comments.

> /*
> - * Detach all tasks we were using ptrace on.
> + * Detach all tasks we were using ptrace on. Called with tasklist held.

* Called with tasklist held for writing, and returns with it held too.
* But note it can release and reacquire the lock.

> + write_lock_irq(&tasklist_lock);
> +
/*
* Note that exit_ptrace() might drop tasklist_lock and reacquire it.
*/
> exit_ptrace(father);
>
> - write_lock_irq(&tasklist_lock);
> reaper = find_new_reaper(father);


Thanks,
Roland
--
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/