lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 15 Aug 2012 11:30:12 -0700
From:	Kees Cook <keescook@...omium.org>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Fengguang Wu <fengguang.wu@...el.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: yama_ptrace_access_check(): possible recursive locking detected

On Wed, Aug 15, 2012 at 11:17 AM, Oleg Nesterov <oleg@...hat.com> wrote:
> On 08/15, Kees Cook wrote:
>>
>> It sounds like get_task_comm shouldn't have locking at all then? It
>> should just do a length-limited copy
>
> Without task_lock() get_task_comm() can copy incomplete new name.
>
> Honestly, I do not know any user which "strictly" needs the correct
> name. may be proc.

Right, which is my point -- if the race to read against
set_task_comm() isn't useful to anything, why lock in get_task_comm at
all?

>
>> and make sure there is a trailing
>> 0-byte?
>
> get_task_comm()->strncpy() should always see (and copy) 0-byte.
> comm[TASK_COMM_LEN - 1] == '\0' and this byte is never changed.
>
> set_task_comm()->strlcpy() can write to this byte, but it can
> only write 0 again.

Right, and set_task_comm even does a memset() of 0 over the whole area
before the strlcpy too.

Regardless, it sounds like just using ->comm directly is fine; I'll
send a patch.

-Kees

-- 
Kees Cook
Chrome OS Security
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ