From patchwork Fri Dec 27 09:23:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guo Weikang X-Patchwork-Id: 13921634 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 A08E3E7718B for ; Fri, 27 Dec 2024 09:23:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D307F6B007B; Fri, 27 Dec 2024 04:23:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CB9896B0082; Fri, 27 Dec 2024 04:23:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B32676B0083; Fri, 27 Dec 2024 04:23:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 93D3E6B007B for ; Fri, 27 Dec 2024 04:23:25 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 11A0B46F3D for ; Fri, 27 Dec 2024 09:23:25 +0000 (UTC) X-FDA: 82940200266.28.1E6F6C5 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf17.hostedemail.com (Postfix) with ESMTP id BB03E4000B for ; Fri, 27 Dec 2024 09:22:50 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KCKBiyXL; spf=pass (imf17.hostedemail.com: domain of guoweikang.kernel@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=guoweikang.kernel@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735291363; a=rsa-sha256; cv=none; b=hWVUMyPqIW6P7FbiywJQOUzr4csML/YgZBOsNd+CvIfjAqwa2eqgG5mEeORUJ8sVAvChvQ E2HcHul5VatwVAAE3m41Q1eCRRqVyoeydEIlt1aRA9qfGk2abQuleHm0ft/40DGvE1ELnh LpJSdXRYUatwTz71an5bSE+OtVgqvok= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KCKBiyXL; spf=pass (imf17.hostedemail.com: domain of guoweikang.kernel@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=guoweikang.kernel@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=1735291363; 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:references:dkim-signature; bh=HrHKAY5yPoOvCnk/71J0NDrOtLLBwEAzsW8nNtgWjBI=; b=5kSRxASypsjqgOq2crrg/OGJqj0UAes6yO1SfgNF5QxJ9yH4O8PgbPm9BW6LQZICRm8Fmd uZGwDlTvD2b3mHecF3dpCPpnnAKM7Di3KXS8KODF3z9oydcp6AGRWmGL0T0O2/50/3qiSK 0akCSXKDbDQ2Ca3DJKq+iIgzfTjBu70= Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-21680814d42so75521785ad.2 for ; Fri, 27 Dec 2024 01:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735291402; x=1735896202; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HrHKAY5yPoOvCnk/71J0NDrOtLLBwEAzsW8nNtgWjBI=; b=KCKBiyXLmNrqvduwhGtAgAwBndYPeYY9IEuyM981ek8zrfIsHAyUHGQjwCQ87dg+xD eFd9Tq6domizgUB42QeOsV0zsNIg83qm+6Un9vSGrVEGX8Kbi1uV39wCHhlSzrrd46ce Of/vApW2jQKJfpso14XleewwS7PuxyVS3kF/MW0UoX1xwSImEkELFXOT7idRyrPh47rn JMPmrQ33jrjsY1d4hXVF9wd44FhZqq7bnp+G9d/f36sXitSRr7sMmCQyiQAtP3v5WV9Y /3IRbEi9Guw5h2dUuP/km7Hu9c/dxLrXIzYmGCljrItZ7OuikbibS7vgkLEQGNAeu1cm 4jcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735291402; x=1735896202; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HrHKAY5yPoOvCnk/71J0NDrOtLLBwEAzsW8nNtgWjBI=; b=KOHsrmVEv6vPxbaGz6hBK5EKU1qnGNne1aSx8yCtdSHhD0UfCfK4Hya7dvjVdSHly4 lZ/QgKCQK7kBft7/YlRk3OnfhRl9PcoteLX1YndiuAd8lqFNDnE672xxvEap3WZNRapr lkZv4e/kP31/bCa7eAFlv+23UHRjAgG23DlT2k3PiOIq0W3Xz5K4uE55KZjq50Cj63s/ YGX2HbXFr8e9zK9oewgn2SDNyYTLdJjXO1r9w4P3cafpJbhWEv/4/a11GQFhwRG6d4rU 5DpAj4rfMLhy6sBK3KfmPRCvlu1ocQAHDv707IVJqP6E6lpm69Hj2lD5YbHFLMe29gGS e4+Q== X-Forwarded-Encrypted: i=1; AJvYcCWdIb4cAsOs2Q0mCBO+t5BxR6j3O05VWCcHV12hb9EEsMkmulQucTrxbHhg1rkR2fYyHT0QI2zRHA==@kvack.org X-Gm-Message-State: AOJu0YyMJAvzffWeKW+/vIzv7l9OeOrjYmvaFhs+QE/B6sb1LDmOH/A4 Ylh511xtORb9d7bL/Fn8ywo7wHsSRO+YQVV/a+NtuUpMsFruRnZOufiQD+sf X-Gm-Gg: ASbGncsGsFnG9ewP4OAXq03qRhGRIagyK4DarzRkSd5d59MlnSlUBnNfJ0DahAzZTI0 AmYFuXJTTlDCd2zQV/uxOKzVvBLy2zK8hjkQPt7apEVXyvV8tOi3gQGbU4tWZprtSuFo1Xk3f2i VmAD/X+r1LlV8ARRqySoTSVJLXFNQZxaEg1uuI8rIbzmdFBX67f+jNcWkg6QcYmdgFsYBMSQ5ZX BMAyRepaGh3QDSVOIxzlSlJm+bUW25kMWtPXX2SPt0IyJzqsO1i6O7rj+YpY7KY6mnmoXqpKKc9 BPgJ X-Google-Smtp-Source: AGHT+IFTKH9hF3F/4UMq/rIwQxcLCHygv6n2Pe6hDSMJn5DgdniyZ7FcMlqcyy13iVUmuY1F0lZ2YA== X-Received: by 2002:a17:903:32c5:b0:215:bb50:6a05 with SMTP id d9443c01a7336-219e6e894f4mr381258775ad.9.1735291401881; Fri, 27 Dec 2024 01:23:21 -0800 (PST) Received: from localhost.localdomain ([36.110.106.149]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-842b8e867d7sm13066173a12.46.2024.12.27.01.23.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 01:23:21 -0800 (PST) From: Guo Weikang To: Catalin Marinas , Andrew Morton , Uros Bizjak Cc: Guo Weikang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/kmemleak: Fix percpu memory leak detection failure Date: Fri, 27 Dec 2024 17:23:10 +0800 Message-Id: <20241227092311.3572500-1-guoweikang.kernel@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: BB03E4000B X-Stat-Signature: pwkusa5f5iqegkeyrioq8fdji9o7jnba X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1735291370-878565 X-HE-Meta: U2FsdGVkX19w7+93WznXGTV7ki/dYUq97paHgvwEXFQykxW20y5LdCWdnIjIGbvc2dSNcJvwP8PBJ8PMugJr3dyrsW/UiblS2bo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jJLK3Dkul6n+VZpGoNJAs9Hhm1HWgSWHVB+JMc4zG0j2o36BeqixezVGCnQS0b00dntlphziezbm+wN90Z/P7MZMblZ7SA+wTlkrnJZA721JMZ0vqpfNSZnOUFRYVyYnDU580TAJ/lUWY7axEnvc26bjdJPo+QcMjhctyTCCN2v4OVoJfaFyuQZUffhb5WZAWQipxDAq0G3HFZuwOtzGsv+vlnRxmEg5zoJbaXU1EN0rPaqnpi2ScQgV934NewJ/N54bQ1MEXheTKZWcH3SsWH2EWdCIYuCDpp 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: List-Subscribe: List-Unsubscribe: kmemleak_alloc_percpu gives an incorrect min_count parameter, causing percpu memory to be considered a gray object. Fixes: 8c8685928910 ("mm/kmemleak: use IS_ERR_PCPU() for pointer in the percpu address space") Signed-off-by: Guo Weikang Acked-by: Uros Bizjak --- mm/kmemleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 238ab733fbea..982bb5ef3233 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -1093,7 +1093,7 @@ void __ref kmemleak_alloc_percpu(const void __percpu *ptr, size_t size, pr_debug("%s(0x%px, %zu)\n", __func__, ptr, size); if (kmemleak_enabled && ptr && !IS_ERR_PCPU(ptr)) - create_object_percpu((__force unsigned long)ptr, size, 0, gfp); + create_object_percpu((__force unsigned long)ptr, size, 1, gfp); } EXPORT_SYMBOL_GPL(kmemleak_alloc_percpu);