--- 25-akpm/include/linux/sched.h | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletion(-) diff -puN include/linux/sched.h~race-condition-with-current-group_info-tweaks include/linux/sched.h --- 25/include/linux/sched.h~race-condition-with-current-group_info-tweaks 2004-05-21 20:26:35.937367176 -0700 +++ 25-akpm/include/linux/sched.h 2004-05-21 20:27:43.997020536 -0700 @@ -371,6 +371,12 @@ struct group_info { gid_t *blocks[0]; }; +/* + * get_group_info() must be called with the owning task locked (via task_lock()) + * when task != current. The reason being that the vast majority of callers are + * looking at current->group_info, which can not be changed except by the + * current task. Changing current->group_info requires the task lock, too. + */ #define get_group_info(group_info) do { \ atomic_inc(&(group_info)->usage); \ } while (0) @@ -966,7 +972,9 @@ static inline int thread_group_empty(tas extern void unhash_process(struct task_struct *p); /* - * Protects ->fs, ->files, ->mm, ->ptrace and synchronises with wait4(). + * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info and synchronises with + * wait4(). + * * Nests both inside and outside of read_lock(&tasklist_lock). * It must not be nested with write_lock_irq(&tasklist_lock), * neither inside nor outside. _