From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C268C433F5 for ; Thu, 25 Nov 2021 09:18:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E6E86B007B; Thu, 25 Nov 2021 04:18:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 996386B007D; Thu, 25 Nov 2021 04:18:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 885BE6B007E; Thu, 25 Nov 2021 04:18:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0241.hostedemail.com [216.40.44.241]) by kanga.kvack.org (Postfix) with ESMTP id 760D06B007B for ; Thu, 25 Nov 2021 04:18:20 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4557280CE2B6 for ; Thu, 25 Nov 2021 09:18:10 +0000 (UTC) X-FDA: 78846901140.18.32E3672 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf09.hostedemail.com (Postfix) with ESMTP id F1083300010A for ; Thu, 25 Nov 2021 09:18:05 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 648EE1FD37; Thu, 25 Nov 2021 09:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1637831888; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wwiQDOJPEAtzx84W81WwUuy+jKhgNVXmO5+Woa5hQic=; b=M/Ek+AulDH/wV30n8i89uCsJvOx1LasGO0CEKw1mF3nTtKNvw6GHp/8BcGum68QkcGGe0Y QNtXCVqyOlG6pGGmb6vvn2p2Cod/bdekR9z1FNTtZ93mC7vd9QvrjY4mBgWRpuTF1MGmg5 EevC5cXRISLOJ6H5f4vGzbUcE63Et+U= Received: from suse.cz (unknown [10.100.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id F35B4A3B81; Thu, 25 Nov 2021 09:18:07 +0000 (UTC) Date: Thu, 25 Nov 2021 10:18:07 +0100 From: Petr Mladek To: Yafang Shao Cc: akpm@linux-foundation.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, oliver.sang@intel.com, lkp@intel.com, Steven Rostedt , Mathieu Desnoyers , Arnaldo Carvalho de Melo , Alexei Starovoitov , Andrii Nakryiko , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , David Hildenbrand , Al Viro , Kees Cook Subject: Re: [PATCH v2] kthread: dynamically allocate memory to store kthread's full name Message-ID: References: <20211120112850.46047-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211120112850.46047-1-laoar.shao@gmail.com> X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: F1083300010A X-Stat-Signature: gyp1a8d3s8bc9ahot3y7yjc16ys38ui7 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="M/Ek+Aul"; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf09.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=pmladek@suse.com X-HE-Tag: 1637831885-841064 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat 2021-11-20 11:28:50, Yafang Shao wrote: > When I was implementing a new per-cpu kthread cfs_migration, I found the > comm of it "cfs_migration/%u" is truncated due to the limitation of > TASK_COMM_LEN. > > One possible way to fix this issue is extending the task comm size, but > as task->comm is used in lots of places, that may cause some potential > buffer overflows. Another more conservative approach is introducing a new > pointer to store kthread's full name if it is truncated, which won't > introduce too much overhead as it is in the non-critical path. Finally we > make a dicision to use the second approach. See also the discussions in > this thread: > https://lore.kernel.org/lkml/20211101060419.4682-1-laoar.shao@gmail.com/ > > After this change, the full name of these truncated kthreads will be > displayed via /proc/[pid]/comm: > Signed-off-by: Yafang Shao Looks good to me: Reviewed-by: Petr Mladek Best Regards, Petr