From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753985AbbIAPHm (ORCPT ); Tue, 1 Sep 2015 11:07:42 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:30665 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbbIAPHk (ORCPT ); Tue, 1 Sep 2015 11:07:40 -0400 Message-ID: <55E5BF34.8080005@oracle.com> Date: Tue, 01 Sep 2015 11:07:32 -0400 From: Sasha Levin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Steven Rostedt CC: mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracepoint: don't make assumptions about length of string on task rename References: <1440760018-1557-1-git-send-email-sasha.levin@oracle.com> <20150828110251.41b6b805@gandalf.local.home> In-Reply-To: <20150828110251.41b6b805@gandalf.local.home> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/28/2015 11:02 AM, Steven Rostedt wrote: > On Fri, 28 Aug 2015 07:06:58 -0400 > Sasha Levin wrote: > >> While the dest comm string size is assured to be at least TASK_COMM_LEN long, >> doing a memcpy() also adds the assumption that the source is at least that >> long as well, which isn't assured, and isn't true in cases such as: >> >> set_task_comm(worker->task, "kworker/dying"); >> >> This leads to accessing invalid memory. >> >> Signed-off-by: Sasha Levin > > Acked-by: Steven Rostedt > > Should this go to stable as well? Yup. > Also, as the memcpy was just faster than a strcpy, the static length > was used. Perhaps we should convert that to a dynamic length string. > But that should be a separate patch as this one fixes a possible bug, > and the conversion to a dynamic string is just an enhancement. That'll slow things down for the common case, no? Thanks, Sasha