Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1495117pxb; Thu, 7 Oct 2021 08:52:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoo6wQ5dtKOVRxtxA6lvm705xEt2YvV+CMGg8evX6JOJcbMGV5bx3tS14zDs+pC5kfpx9S X-Received: by 2002:a17:906:eda6:: with SMTP id sa6mr6426880ejb.443.1633621946411; Thu, 07 Oct 2021 08:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633621946; cv=none; d=google.com; s=arc-20160816; b=SoFcnOFUcsmHPXX3Uu0hxUYHhfedbQ9B4M2g0pV0o8mZx+gvLCmQUIey1VEwnSTLip yFPIbQNprrj16EUkc4Q9yfEFw92rqfGGJyFoox37N1IrzCi10y3mkHHpM6OH+9IkgDyA HHmDjkWl+9mHotFuzNbidyTlICCuhij/3TYxcE0aLMvs94+IyLPF+vNhlCJntChx16H+ P7ZUd2QqTXnBQQshxlWUfTwuJmSF+ElferISayodsciDxeCQ1fWAzpwaN9Zf3fVdvSnN 4YGidL7ltoMyGGppXiPmzhzIaj3QeUGGzQx/JECu6Ibj5d+JHl9e6t53ZdEhi9/q4/dN ktMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=aY9YNaCzgoUZ9uT+Ybn9qFqS/TgJNUNrYOj5uKjtZis=; b=IaZelyadr5jEGhtg6yvLdwMTert1V5jcVE3olWHxR5/q9ADLOux9sTXFVqW3RkLcSV NqDmgoGYPFNdF6JH9WxJpXlXKO+xtatcRJQbHQMAAY1gRLTwX+ZChLucIZsNUmjLcMlE Tr5KBqACBoWW7lj1B9aw1zKQb8NfnU6oUBOtzMdT3vKWQXUCRrp8/ZGoy8OihyiebYUZ Gc1FTwx4xRHi8dpCctu22rmA+pNJPiKRvtLOb1xlnZQORqBNOI2V0+6fAt7iQDDmzOCL Iw+kRCpBK/SaxaE+QsbVRSt0Ijpd08Z93NwA30M9lRp5eImSfVWq7eew0fb0HQVZahpp lPbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eq7nqeO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd16si22184609edb.501.2021.10.07.08.52.01; Thu, 07 Oct 2021 08:52:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eq7nqeO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242188AbhJGO6y (ORCPT + 99 others); Thu, 7 Oct 2021 10:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233341AbhJGO6y (ORCPT ); Thu, 7 Oct 2021 10:58:54 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 424C6C061570 for ; Thu, 7 Oct 2021 07:56:59 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id r201so53347pgr.4 for ; Thu, 07 Oct 2021 07:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=aY9YNaCzgoUZ9uT+Ybn9qFqS/TgJNUNrYOj5uKjtZis=; b=eq7nqeO7gD4JfZB5BNsV68QEzyUQAkTeYyRndfSvY/hscVVEna52P4W6ZL6Y95wdyK 3OWRU9H71Yn5UWwpMr5sv+OvNQMlWu4Z6iSEvM6A9EismHzhme7kHz15SW26tYf+WSMu KOPNs+PxbtN03MF6n4st8zFcs0v+iteS7dkd0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aY9YNaCzgoUZ9uT+Ybn9qFqS/TgJNUNrYOj5uKjtZis=; b=79ksEIht3EjZJ+or7UKXie9c4kAVPalOoNsYX7492tZXEmQSb+KyEdXyyxCKiDER88 uwDOx55jncx9ssSMBh8DR4LJVF3ti+VJz19ZnYsr/L5ML3jDzyTzcyzBoPlGDlEOm1Lq hiNkiVHkzS7bczoy6d7oPqzOSbK6oajGTgPHX7ERSURCN1uNWc0q+1g7LIdkYeY6z9zy cA+yi59reYHKWdY1BBp4r7HuAcsw9h2KDW9iGSmMhNYzCbgapvzjuKTj3MlWp0TmZqoq iM+LwxZqTLJoJoB98bnsrzHKx87tfLaSWkAejwsuwV0rVqeJEB25j9bj5DNXw0B0YR7u latw== X-Gm-Message-State: AOAM531wA3oLXPBIE7p/1NT0ev6AOm0Sq7xcwbjQjR94GCfZaGmtKdTz UrbKosdzpQnF+cDMWCAK7bbTNQ== X-Received: by 2002:a63:374c:: with SMTP id g12mr85093pgn.35.1633618618740; Thu, 07 Oct 2021 07:56:58 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id z7sm14483740pff.23.2021.10.07.07.56.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 07:56:58 -0700 (PDT) Date: Thu, 7 Oct 2021 07:56:57 -0700 From: Kees Cook To: Yafang Shao Cc: pmladek@suse.com, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, peterz@infradead.org, valentin.schneider@arm.com, mathieu.desnoyers@efficios.com, qiang.zhang@windriver.com, robdclark@chromium.org, christian@brauner.io, dietmar.eggemann@arm.com, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/4] sched.h: extend task comm from 16 to 24 for CONFIG_BASE_FULL Message-ID: <202110070755.60DFB87711@keescook> References: <20211007120752.5195-1-laoar.shao@gmail.com> <20211007120752.5195-4-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211007120752.5195-4-laoar.shao@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 07, 2021 at 12:07:51PM +0000, 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. For example, the comm of the percpu thread on CPU10~19 are > all with the same name "cfs_migration/1", which will confuse the user. This > issue is not critical, because we can get the corresponding CPU from the > task's Cpus_allowed. But for kthreads correspoinding to other hardware > devices, it is not easy to get the detailed device info from task comm, > for example, > > jbd2/nvme0n1p2- > nvidia-modeset/ > > We can also shorten the name to work around this problem, but I find > there are so many truncated kthreads: > > rcu_tasks_kthre > rcu_tasks_rude_ > rcu_tasks_trace > poll_mpt3sas0_s > ext4-rsv-conver > xfs-reclaim/sd{a, b, c, ...} > xfs-blockgc/sd{a, b, c, ...} > xfs-inodegc/sd{a, b, c, ...} > audit_send_repl > ecryptfs-kthrea > vfio-irqfd-clea > jbd2/nvme0n1p2- > ... > > Besides the in-tree kthreads listed above, the out-of-tree kthreads may > also be truncated: > > rtase_work_queu > nvidia-modeset/ > UVM global queu > UVM deferred re > ... > > We should improve this problem fundamentally. > > This patch extends the size of task comm to 24 bytes, which is the > same length with workqueue's, for the CONFIG_BASE_FULL case. And for the > CONFIG_BASE_SMALL case, the size of task comm is still kept as 16 bytes. > > Suggested-by: Petr Mladek > Signed-off-by: Yafang Shao This, as expected, adds 8 bytes to task_struct, which is reasonable. I don't see any easy places to consolidate other members to make this a "free" change, but I did just remove 64 bytes from task_struct[1], so this is okay. :) Reviewed-by: Kees Cook [1] https://lore.kernel.org/lkml/20210924025450.4138503-1-keescook@chromium.org/ -- Kees Cook