Message ID | 20240628090517.17994-7-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 C938AC30659 for <linux-mm@archiver.kernel.org>; Fri, 28 Jun 2024 09:06:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D0F26B00A6; Fri, 28 Jun 2024 05:06:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58BFB6B00A7; Fri, 28 Jun 2024 05:06:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FA266B00A9; Fri, 28 Jun 2024 05:06:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1CF836B00A6 for <linux-mm@kvack.org>; Fri, 28 Jun 2024 05:06:11 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BB2FEC0B21 for <linux-mm@kvack.org>; Fri, 28 Jun 2024 09:06:10 +0000 (UTC) X-FDA: 82279715700.22.A5A32F7 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf08.hostedemail.com (Postfix) with ESMTP id D5601160018 for <linux-mm@kvack.org>; Fri, 28 Jun 2024 09:06:08 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Ox/+b2Ef"; spf=pass (imf08.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.175 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=1719565545; 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=LAlsKUTpDm20M0ee1JmhaQBMRAxeoSEVBJ53jxF8wBjtn3BNgKdJ3krLlpQXJoNJtTepgk CJfCDYZjgnKU3OmOJ/Lzl2i5BOirfMfT3TPq521wKWdYN2qgXj9rbvfCdzmRpfydaAvbXX k1s+n/VYxMwCoSmF+KvW2u77DpW4/rk= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="Ox/+b2Ef"; spf=pass (imf08.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.175 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=1719565545; a=rsa-sha256; cv=none; b=Tfe8/H1uqfC+9FqXFTyYX9GE8NN9hyjdJq8vyYxgtmDlxzBHXIJ4sjjhO6mx5YRGDAN1RQ JUsmEbbgTaaCuqXyRZ1FY39C5P+MdLM3Kf9WPzbyBlXdHYPmi7Mfqf0n/8+t14KAHduv0V Rjsy6K9sPx4Wh11PcaPFFNCMDp2pG1w= Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1fa07e4f44eso1913465ad.2 for <linux-mm@kvack.org>; Fri, 28 Jun 2024 02:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719565568; x=1720170368; 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=Ox/+b2Effab4AFM+DKJYH0QjZWx6BOYoUUNKFMfFL3VUOgrSnMSBylcECdLSXpZu6e 3JufNu8BiybQPCoR/5QvdhGBLRkAjf4EZ5U7UyWkJ1s4cYmFRwLAHheolN+R5B5YnQfG /27u2FofDS2yAedWG3dzV8X7zTKERSpKRiW7jMXknik6IDwqzBPzrm1APvf/cYApER7+ rOsu2QRbUEw0MXLFIWK7Cg58ZFE+0aavnHB4fw7JQQ6n63OlY50oMqAK/hp/vfFFM+bw BIfIt5MPkUZVxVQM/1Y8MdOAJDvwjooGfNCA6tX+looWDYu2+ZcmG87Zq4O5UlEDhgpZ b/cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719565568; x=1720170368; 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=MevvBomu6my1EkdgJEHP3AQURpsRLqzqi+O/sYjSvR7cbOb3fAU1forqCPYUfbSpzA 2BxO+x3BwPNUZ0vX4Mj9/YgMIn+pJS0Pw7HXQGP/zFaMYafSZiy5DOLnS2EqWjZecJgE 26Xv5awcrsEqi4nduPznOd8rxJYzGQTbbPHeLgzC348J2dC1+pALLO9MQOD3XUpUoG/0 grTpolXDT6bKLLsOjErCMhFsqtYwm7Ypx+z6baZMYY8PBVCdd4A/Kt29ADY+EE7vY+iG xbaybXV+l3cDgdXPSxyUBZ39IjLj4LqfZ6LmGvUkNfQgzagaJ0Vol6O9QoJA6wVl8fBY 7RwA== X-Forwarded-Encrypted: i=1; AJvYcCUWfnLgljG2AXEq/I+XtaTcGsc1hxrSIeGbohbSkT6F1AsjDbdd5StMqBBX1yRXzw9eU1aceIbtBm9O3j7JoKP21iA= X-Gm-Message-State: AOJu0YwxPmGCWYbawVRBrttVJ9t2r+qBtXQUlnRZWfSFHgjEqL4p93aY ZAWkKbNq3tIbcxypWUu1GpFvMPhMjSZi+8e7vLCDnzOFVjllHRj1 X-Google-Smtp-Source: AGHT+IHdHlMsiSxDneCpl0Z+k+h/q/UIRrZYdoSU24sjr9+9ved5pPcYJylJrzwg3G+ZaraRZ/+k4g== X-Received: by 2002:a17:902:eccb:b0:1fa:ab7c:a483 with SMTP id d9443c01a7336-1faab7ca748mr37580565ad.5.1719565567694; Fri, 28 Jun 2024 02:06:07 -0700 (PDT) Received: from localhost.localdomain ([39.144.106.153]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac10e3a1dsm10473085ad.68.2024.06.28.02.06.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2024 02:06:07 -0700 (PDT) From: Yafang Shao <laoar.shao@gmail.com> To: torvalds@linux-foundation.org, laoar.shao@gmail.com Cc: akpm@linux-foundation.org, alexei.starovoitov@gmail.com, audit@vger.kernel.org, bpf@vger.kernel.org, catalin.marinas@arm.com, dri-devel@lists.freedesktop.org, ebiederm@xmission.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org, penguin-kernel@i-love.sakura.ne.jp, rostedt@goodmis.org, selinux@vger.kernel.org Subject: [PATCH v4 07/11] mm/kmemleak: Replace strncpy() with __get_task_comm() Date: Fri, 28 Jun 2024 17:05:13 +0800 Message-Id: <20240628090517.17994-7-laoar.shao@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20240628090517.17994-1-laoar.shao@gmail.com> References: <20240628085750.17367-1-laoar.shao@gmail.com> <20240628090517.17994-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D5601160018 X-Stat-Signature: azfotyxffuzbbhfuamoshsq6q4n537g3 X-Rspam-User: X-HE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w3ysyJbWFVDo9I2HCc61QrZWWioGBQxDMzEbo6zugX2z2kP0tG5lua58Ve0Zkr+bfyNTwfQ/5M5BPmCCuLICGY08NzRibJx5pJnGYpp7TlfmhXxV0NQ9jd+mrWzXo5jpKkSj/bDi2lOM14qGiTR39BZT8b5YduxjL8aIw0vbKjjLXayX355uWg9gRsjkLf8UzAKUq8wW8NpuT58gN5amLfercr34439LdvzzikyFwQEVYw0AdCrTy0yyQs8XGgPK4rsUsw5DvTGREzoAWCCyPfo5fQbue4/jEINV1YVPbyHrRbRajBRoVJgNGUFPTgT6bm3Fw/sZYzdBzsIsRPpCygRUifV6mn6gRZsoNM9pLWl36BeqR2xZPxcyAl+cYMUzJwqjk/PPzjS5Ea+wBqfFd7KTpIbJR1YINcDDXfyXza2xX7c+GdS/2XSZxDiPuEX8fYZUV25gn6Y+vj38MqKveauDmBoQVQHFemeEnpao928FvlkAN/zmaaQ/eL5PJu5vBCJ5t6pO3xvZ1PLdgYwLHrb3JxdQVlRWQGRJoD4959wzbqxTMPcadso2YKQg== 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 */