From patchwork Thu Dec 19 02:34:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 13914391 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 A6F06E77188 for ; Thu, 19 Dec 2024 02:35:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 367A16B0085; Wed, 18 Dec 2024 21:35:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F0C16B0088; Wed, 18 Dec 2024 21:35:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 142D06B0089; Wed, 18 Dec 2024 21:35:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E7E666B0085 for ; Wed, 18 Dec 2024 21:35:09 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 93F14141389 for ; Thu, 19 Dec 2024 02:35:09 +0000 (UTC) X-FDA: 82910140908.04.0E18C34 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf12.hostedemail.com (Postfix) with ESMTP id 755734000A for ; Thu, 19 Dec 2024 02:34:53 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CljPE5T5; spf=pass (imf12.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734575683; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6yZ75uwrgzXS/KAS9XiI4pfcH/Aa7U+Upt9QqSiD0i8=; b=xYb6GcNEapwY2tXmjYdtjgMOPcMs6QhLDwKa+pPjN8Gfz+S97rtqmxdCX3EoqimFPD+OM5 JYCbeSmP6v+ytWwDN/RVjNXpOBtObIAxGWvA4+cRS/8JgfSN7oOGqtL7Z2QK0HYqh23BQz 1RsMXjFRRLpgNIOXn2fpQkaCJbd0hVU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=CljPE5T5; spf=pass (imf12.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734575683; a=rsa-sha256; cv=none; b=6Ta3WWLym0TWfZttCD3oOPcNGRSqOhA00tO5qJtbReimpP2DHsLj5glP2gkZWvCM95Bul3 9E8mE7oZKwdwo0WJp7YWZAQBtzyilvxZo3E/dy4wmNM6t6cvEmDj474KjQgOySgxXyTWGv 6YAOdNe3iZhsEPU93TwN3NvqfE53fP0= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-216395e151bso2164105ad.0 for ; Wed, 18 Dec 2024 18:35:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734575706; x=1735180506; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6yZ75uwrgzXS/KAS9XiI4pfcH/Aa7U+Upt9QqSiD0i8=; b=CljPE5T5X99G5gVlWXB3CtihXgkyCAmNj0NwxrJQmVHeOBsWxChhKCgyQn56dSgqJH TF+dJ1bg3VJnZXnfuG1R8a0P31Y5RxoGM8fFxMBijnnCQeJDU607Fd+4ceyhJeIbu1EM fGifd/O9HSFkU27POQ9aqF3lFP+WsbPYFS4Nq1PdX2nooiLQvujoET4DbvbWIjjV+wED 9Tej2mPBtPWXv3EDcytONQxV2FzLw8HWYrskNaLDllxuzEBqPTs8ZlY594pPBrNz5NjG igazEQKm8j/jg4103v8S1wwQiCT0SiqZUjbLjUs8N6WKWdsD5H43G0ShgK35gKkOo3NV tJiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734575706; x=1735180506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6yZ75uwrgzXS/KAS9XiI4pfcH/Aa7U+Upt9QqSiD0i8=; b=V+uqPj8cYROte9pzEe+DWU2Z0s8p6oFv8KTx0lxrnpUZdIYlgBTOYbs1uu3iGbozYp KaqGyWwnjFuh1KdTX80gMcgk2RuU9+7I6f/OiwJHlzA7q0+HXJ6/pI0AlBFsbh+o89+M fefoKn+1Oo1ej4tqX4yya6P6Aj/hKeSnDnHE8hyG4FcE1TyeOY7I7I1g/wP9em5r9cfo ZTtOP6pUGRNXwBL8JsfsBKoClgemKpWU7p4L8vfTX9FpC/df4i2eNGwX/xg+cnfFKWOy H8rOZJWz5z9NRGxEMRkcn0TeQwDvSosAmtsy9THuki9zal8E6Qk7tpc5axCrt9G+netp gxZw== X-Forwarded-Encrypted: i=1; AJvYcCXtW/mieFMxDzHvO543s+lNweiv6NY6TTY5JFf4kDcIsRVkc/DM5WG2RjfZ04J1p85DmN8Th3nC5w==@kvack.org X-Gm-Message-State: AOJu0YwtjJt9Vxan46hFiqsiQKlFa6wDmg/XiY5rtFZWLrApFvcwkI/P SPOlpVaEQosZn8p+4fCH6owVbmvQmGLe/M1YA6+RCAWVQeAvyEuZ X-Gm-Gg: ASbGnct/Ehl9hgTLdSUE/yeQP2Y9R1mDc5mR/kXXvH/Lxaqat0Q0bHrvXwDTY7YG120 l5H8so6WHKpAnrVywO0KbL/+Ag6vg1b649MKKnFUA3zNsBHsDMuIHHWsBW1o5DHtwiDMLlwhP42 GRxVIvWAy67++GhMjwsw963u/BkP6gsHDJcIpD5zWLQeK1xPO4HFOwhbgQNe4ZUa/t850rzLkfi n70upZ/Xtx4xWuj2qVR+VI9s5j83icEd9otqzhZwY2e2JPaYaen218vrCc7/ZSEGuVqORDpAkc1 jtIAtto= X-Google-Smtp-Source: AGHT+IHDUXmWYVlYvXYhHIsD36N49JfOorXAToNFZUciCwG5nEYfG9fZ9g2sYrKUGUIeEzsd5pUGJQ== X-Received: by 2002:a17:902:f689:b0:215:2d2c:dd0c with SMTP id d9443c01a7336-219da5e3b97mr23433885ad.14.1734575706180; Wed, 18 Dec 2024 18:35:06 -0800 (PST) Received: from localhost.localdomain ([180.159.118.224]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-842b821da83sm142163a12.40.2024.12.18.18.35.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Dec 2024 18:35:05 -0800 (PST) From: Yafang Shao To: akpm@linux-foundation.org Cc: torvalds@linux-foundation.org, pmladek@suse.com, kvalo@kernel.org, bp@alien8.de, andriy.shevchenko@linux.intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, x86@kernel.org, linux-snps-arc@lists.infradead.org, linux-wireless@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, ocfs2-devel@lists.linux.dev, Yafang Shao , Serge Hallyn , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , Davidlohr Bueso , =?utf-8?q?Andr=C3=A9_Almeida?= Subject: [PATCH v2 1/5] kernel: Remove get_task_comm() and print task comm directly Date: Thu, 19 Dec 2024 10:34:48 +0800 Message-Id: <20241219023452.69907-2-laoar.shao@gmail.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20241219023452.69907-1-laoar.shao@gmail.com> References: <20241219023452.69907-1-laoar.shao@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 755734000A X-Rspamd-Server: rspam12 X-Stat-Signature: 9gss6objz9dzx5d9yh99yj6fe9fmk1ep X-Rspam-User: X-HE-Tag: 1734575693-360104 X-HE-Meta: U2FsdGVkX1/ChRBKcuBis7GgBSm9FKfV3SlPYTEtYlFkeQ0rctzRTIewpkemnmBApAsWebHNPVZOeCq52UEeac1+4y+MNy6yTjjd4Ft9KTokWU6tZhs8pw/m9H72LEIQ1SYn4ZKTrCBoE3G7hHHVxO3e7uamWxpajIHd0vgNrFxAGDXHtNMZ9JZ24Ixl5ajqXh3vrja0y0fPFN+13gXUUeR6qF9vxLHrX5as255zFp9qe3M0M2qVYEOFXcGo6MYap4Vq9EnPNzt39pDyOvjVW2AIgpsXd5iJUg3xxEf/ortotIGHhwdJp9DMLrr+iG6pUJWHrC227eMG2GI2VCIEbSfhk6PhorQue96S4LQ2a3PBkSqerZSEfKcfh/lbQ+2szKrln5XIAEIFCpJkQKaDkfXfFWsFdTxxAG5XYXa3HdxsAbLOKQdztQe42lGiPNacEFKeDDd0nUI+Xbx778ALNTxk8+xEzSAYKMrJOD3Ryc8PyONbnVjE6v9vjDJ5RKVVM5eTMaVZfLs1jxOhOvqcN7+eQZjozjY4Ot2Wt3xafwydqUO4figceZWTmb90LkqawarfICtybhdSTmTYlVlEkuMOzbaaZnYHqt554+KgbBfvVTKtoCLqYVyG4XYtF/kQmQzcOMLhA91tjWk6o+bwtFRBYQRK5WCc3dGTOeYnfGq4y/MY6d1SNAfFMotxtl6jw8OnGvLY4n6WBEocntRaGfwHzDzSXOISUCYOlAIDDg+1ZQXHAzjzhjbpKDH7aFFAMLOvbe+/wqhGxrwrO3bjVXmg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, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Since task->comm is guaranteed to be NUL-terminated, we can print it directly without the need to copy it into a separate buffer. This simplifies the code and avoids unnecessary operations. Signed-off-by: Yafang Shao Cc: Serge Hallyn Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Darren Hart Cc: Davidlohr Bueso Cc: "André Almeida" --- kernel/capability.c | 8 ++------ kernel/futex/waitwake.c | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/kernel/capability.c b/kernel/capability.c index dac4df77e376..e089d2628c29 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -38,10 +38,8 @@ __setup("no_file_caps", file_caps_disable); static void warn_legacy_capability_use(void) { - char name[sizeof(current->comm)]; - pr_info_once("warning: `%s' uses 32-bit capabilities (legacy support in use)\n", - get_task_comm(name, current)); + current->comm); } /* @@ -62,10 +60,8 @@ static void warn_legacy_capability_use(void) static void warn_deprecated_v2(void) { - char name[sizeof(current->comm)]; - pr_info_once("warning: `%s' uses deprecated v2 capabilities in a way that may be insecure\n", - get_task_comm(name, current)); + current->comm); } /* diff --git a/kernel/futex/waitwake.c b/kernel/futex/waitwake.c index 3a10375d9521..eb86a7ade06a 100644 --- a/kernel/futex/waitwake.c +++ b/kernel/futex/waitwake.c @@ -210,13 +210,12 @@ static int futex_atomic_op_inuser(unsigned int encoded_op, u32 __user *uaddr) if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) { if (oparg < 0 || oparg > 31) { - char comm[sizeof(current->comm)]; /* * kill this print and return -EINVAL when userspace * is sane again */ pr_info_ratelimited("futex_wake_op: %s tries to shift op by %d; fix this program\n", - get_task_comm(comm, current), oparg); + current->comm, oparg); oparg &= 31; } oparg = 1 << oparg;