[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120815130159.GA3221@redhat.com>
Date: Wed, 15 Aug 2012 15:01:59 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Kees Cook <keescook@...omium.org>
Cc: Fengguang Wu <fengguang.wu@...el.com>,
LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: yama_ptrace_access_check(): possible recursive locking detected
On 08/14, Kees Cook wrote:
>
> Okay, I've now managed to reproduce this locally. I added a bunch of
> debugging, and I think I understand what's going on. This warning is,
> actually, a false positive.
Sure. I mean that yes, this warning doesn't mean we already hit deadlock.
> get used recursively (the task_struct->alloc_lock), but they are
> separate instantiations ("task" is never "current").
Yes. But suppose that we have 2 tasks T1 and T2,
- T1 does ptrace(PTRACE_ATTACH, T2);
- T2 does ptrace(PTRACE_ATTACH, T1);
at the same time. This can lead to the "real" deadlock, no?
> So Oleg's suggestion of removing the locking around the reading of
> ->comm is wrong since it really does need the lock.
Nothing bad can happen without the lock. Yes, printk() can print
some string "in between" if we race with set_task_comm() but this
is all.
BTW, set_task_comm()->wmb() and memset() should die. There are
not needed afaics, and the comment is misleading.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists