Re: [PATCH 7/8] FDPIC: Add coredump capability for the ELF-FDPIC binfmt [try #4]

From: Oleg Nesterov
Date: Sun Jul 09 2006 - 18:45:08 EST


David Howells wrote:
>
> +static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
> + struct file *file)
> +{
>
> [... snip ...]
>
> + read_lock(&tasklist_lock);
> + do_each_thread(g,p)
> + if (current->mm == p->mm && current != p) {
> + tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC);
> + if (!tmp) {
> + read_unlock(&tasklist_lock);
> + goto cleanup;
> + }
> + INIT_LIST_HEAD(&tmp->list);
> + tmp->thread = p;
> + list_add(&tmp->list, &thread_list);
> + }
> + while_each_thread(g,p);
> + read_unlock(&tasklist_lock);

Do you see any reason for tasklist_lock here (and in elf_core_dump) ?

do_each_thread() is rcu-safe, and all tasks which use this ->mm must
sleep in wait_for_completion(&mm->core_done) at this point.

Oleg.

-
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/