lkml.org 
[lkml]   [2012]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: yama_ptrace_access_check(): possible recursive locking detected
From
On Wed, Aug 15, 2012 at 11:44 AM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>> It sounds like get_task_comm shouldn't have locking at all then? It
>> should just do a length-limited copy and make sure there is a trailing
>> 0-byte?
>
> It has locking so that it has a consistent state and more importantly it
> has an accessor function
>
> Directly accessing it is asking for bugs in future. If you hold the
> needed lock then just add an
>
> __get_task_comm()
>
> method that asserts the lock is held. That way the rest of the behaviour
> remains properly encapsulated for when someone changes it.

But what's been discussed is that no lock is needed if the caller
doesn't care about the accuracy of the contents, which is the
situation I'm in. Looking at other readers of ->comm, they just either
use it directly or copy it directly. Only when accuracy matters does
the kernel use get_task_comm.

-Kees

--
Kees Cook
Chrome OS Security


\
 
 \ /
  Last update: 2012-08-15 21:23    [W:0.052 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site