From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753036Ab2HOSUk (ORCPT ); Wed, 15 Aug 2012 14:20:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43175 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750984Ab2HOSUj (ORCPT ); Wed, 15 Aug 2012 14:20:39 -0400 Date: Wed, 15 Aug 2012 20:17:11 +0200 From: Oleg Nesterov To: Kees Cook Cc: Peter Zijlstra , Fengguang Wu , LKML Subject: Re: yama_ptrace_access_check(): possible recursive locking detected Message-ID: <20120815181711.GA19018@redhat.com> References: <20120726134748.GA20605@localhost> <20120810015222.GA19286@localhost> <20120815030110.GA24836@localhost> <20120815130159.GA3221@redhat.com> <1345041021.31459.88.camel@twins> <20120815175651.GA17814@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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. Or I am totally confused ;) Oleg.