Message ID | 20240729023719.1933-8-laoar.shao@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 F28F6C3DA49 for <linux-mm@archiver.kernel.org>; Mon, 29 Jul 2024 02:45:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83A876B00A0; Sun, 28 Jul 2024 22:45:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C21F6B00A1; Sun, 28 Jul 2024 22:45:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63C566B00A2; Sun, 28 Jul 2024 22:45:49 -0400 (EDT) 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 446DF6B00A0 for <linux-mm@kvack.org>; Sun, 28 Jul 2024 22:45:49 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EE90C1602F7 for <linux-mm@kvack.org>; Mon, 29 Jul 2024 02:45:48 +0000 (UTC) X-FDA: 82391249976.24.4872A4D Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf18.hostedemail.com (Postfix) with ESMTP id 27A5E1C001F for <linux-mm@kvack.org>; Mon, 29 Jul 2024 02:45:46 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=RlBa2opC; spf=pass (imf18.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.216.41 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=1722221121; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=K/nz1JHR4z8p+ajw1D912vGA5V6XqUcGmzMFKN4JA2M=; b=r17YD+InJgfp35VD5GvmuO+VNyRuvdafGRRFXWbWEUyHqfngDR9QSLSynmwxvevZkNeOBY 1XBq85KXxEwG0k7XrgCSpQeEUQOyZyNsF6fOrAlSMHvQ8gkX58YvEoW2jolN8/wcxt7QFH 7ZwRT5jYptZ26TxSr3leXWj5QdcAWbA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=RlBa2opC; spf=pass (imf18.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.216.41 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=1722221121; a=rsa-sha256; cv=none; b=b6+t52m+xf2YHIDD+e7AfzHuZjC36Rj4gF9K0JtZudEJ7xToCJTO3ewaPxmFmm6us5MuLO Y6CP+iPvMYtHcIO9o1rnLckhJc1iEZ5xqczWCt8c5L37RnlhBm+xG70tjjaJWeajEbcUQi 0t3aClKClWTUtsRCgF8Ncob2mj3AosA= Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2cb510cd097so2074537a91.1 for <linux-mm@kvack.org>; Sun, 28 Jul 2024 19:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722221146; x=1722825946; 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=K/nz1JHR4z8p+ajw1D912vGA5V6XqUcGmzMFKN4JA2M=; b=RlBa2opC6jdHimdXVLuVYFU9K0JNzMQmMbZbx7dtZpAh9K60GATllvgCAuiC0NHfYs stGIfJCOp+Jz72Wxoqw0yoIxKIQ8AdofE/rZCFUFOxG0ksxfX1n5tNeOMfr0nOZOHDgY IgMDqEGjXUXBdsOuhFVeBOoG++H/AI6Ys0BtqmxSQAY03+f4bfVahjhNiKvrtC4EJTUw zH6NkoFXRxFvzSCbHws4gIpjByelWN7dRx55y1J1vKwgoQ4jsdGswynSObm1QBRTpoQO Za0r9gbFN7NHfmteuNowYuZ+9uhu8+samD64QeRTSH1qsaZoN6Rwq+LlnlpocXOsXK7c dR8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722221146; x=1722825946; 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=K/nz1JHR4z8p+ajw1D912vGA5V6XqUcGmzMFKN4JA2M=; b=IGfUZ+SYwyW1QrGHLv7yvJifzpsLiqBtNlmpctBoCkwqtxwJsMplMMErutpCAndElP c0d1d6o/jGOz1nZZ2zp6p7TntmLMpFe3kYWDTtH+QMpCYsFaYB0hLEYnAfmWsv9RWyki WuE2B2CV1M/3FOm9AIJTs1qW0e9XIbD5h7z1IonTmo6errKKem7r9sfqSWao0F2YazHn iKDY5RCJGcvmMw7A7ps2KCHuCCHZjm1jl7r4sopoJNBW5kmkZmGP/A6haA1ZEJ23xmWl 8YeJQuP4xztNKwVlRwnrkWMAbK1Z6Qslxv+YIVb9iOXTXY3zzGMzKJavlJCiLLX8aDZK rmjQ== X-Forwarded-Encrypted: i=1; AJvYcCWrDWdOgmCvBezS4ubZ42Iu3ETEtnWf0niW6sftA2Iyby/VPmGg/mRfFOzXrVLfQDThTARWGi2Qehry+NPhe3uCoC4= X-Gm-Message-State: AOJu0YwFKiLjn5OGhKzUaGn/2E88VpAD0WVyXp7ZQOiK2cupRy0KPT/D SSpULfYpqO/xCyipLnQ+RMuJZy6OWbcYY89/sNCtTNWwCDV5w4Wf X-Google-Smtp-Source: AGHT+IENkAKdnpSBtIYs5HSWqyoiT1QcCfPMYBJH+JoZ3TUHyUdae/0TZfvoMrDMQbplggd9XcCiAw== X-Received: by 2002:a17:90b:4a03:b0:2ca:4fca:2892 with SMTP id 98e67ed59e1d1-2cf7e095c49mr6901128a91.7.1722221145808; Sun, 28 Jul 2024 19:45:45 -0700 (PDT) Received: from localhost.localdomain ([223.104.210.31]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cf28c55a38sm7332247a91.10.2024.07.28.19.44.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Jul 2024 19:45:45 -0700 (PDT) From: Yafang Shao <laoar.shao@gmail.com> To: akpm@linux-foundation.org Cc: torvalds@linux-foundation.org, ebiederm@xmission.com, alexei.starovoitov@gmail.com, rostedt@goodmis.org, catalin.marinas@arm.com, penguin-kernel@i-love.sakura.ne.jp, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, audit@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Yafang Shao <laoar.shao@gmail.com> Subject: [PATCH v4 07/11] mm/kmemleak: Replace strncpy() with __get_task_comm() Date: Mon, 29 Jul 2024 10:37:15 +0800 Message-Id: <20240729023719.1933-8-laoar.shao@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20240729023719.1933-1-laoar.shao@gmail.com> References: <20240729023719.1933-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 27A5E1C001F X-Stat-Signature: z4x5eiu6y9xf9i1q9poa64ztuoxbj3fx X-HE-Tag: 1722221146-686612 X-HE-Meta: U2FsdGVkX19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9sbvR9G+klclePTrWAJZ7RCNlfa+dhLei61HrLvRyCdjVu5N5nqolecZxDIYkzg+scmnrA7KnOzBMp+IYWPsCgCb8hys7GG91x+pUgOvRbcdFvnacKnM35C/ir0906uw2Jz49DyB5QB1GmP5tOp17zTZOg1Y/ovlPcZYrLBR+4dYjTWktcN6A5lp8ZghLRpXRrJDWeGtymJGuyLCxIBBj6FxhJOhEiQPsSvVjRigQrc+ZhNHKpdXDeU54qepD9/Jy9qu/RbcsWll1l4T9FtklKXMYgONE+lQiAlFt3B6+oVwjYp/UnIPS90cArgNukdlI6VJj5JOb1MKsjttNJjLywWXPChkydmnflBOZc3Ha0VX3l6bKc+9XAXlN6vwTk4hNRLN+YvZw5ptmJKJ0aqdzuj399Xw7+SbNEZ0FpdbndaUG5QUUMKlhJ4/ruT3LRLIygW1DxpvCvHcFA9Cjpv/zPUxyidRIzpgoB4Ke8nHLvJyo75f9zfapcxe9OpAH3MH1/NI4ooaFt/YqR/NR6SNobwSHHt67O9cEWFAI6pVg== 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Improve the copy of task comm
|
expand
|
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index d5b6fba44fc9..ef29aaab88a0 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -663,13 +663,7 @@ static struct kmemleak_object *__alloc_object(gfp_t gfp) strncpy(object->comm, "softirq", sizeof(object->comm)); } else { object->pid = current->pid; - /* - * There is a small chance of a race with set_task_comm(), - * however using get_task_comm() here may cause locking - * dependency issues with current->alloc_lock. In the worst - * case, the command line is not correct. - */ - strncpy(object->comm, current->comm, sizeof(object->comm)); + __get_task_comm(object->comm, sizeof(object->comm), current); } /* kernel backtrace */