Re: [PATCH v2] Yama: access task_struct->comm directly

From: Oleg Nesterov
Date: Thu Aug 16 2012 - 14:23:11 EST


On 08/15, Kees Cook wrote:
>
> v2: update with newly added traceme report.

...

> @@ -319,12 +316,9 @@ static int yama_ptrace_traceme(struct task_struct *parent)
> }
>
> if (rc) {
> - char name[sizeof(current->comm)];
> printk_ratelimited(KERN_NOTICE
> "ptraceme of pid %d was attempted by: %s (pid %d)\n",
> - current->pid,
> - get_task_comm(name, parent),
> - parent->pid);
> + current->pid, parent->comm, parent->pid);

Hmm, yes. This change is even more important. This is called under
write_lock_irq(tasklist_lock), task_lock() can deadlock if we race
with another CPU doing task_lock()->interrupt->read_lock(tasklist).

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/