From patchwork Mon Dec 9 22:10:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13900454 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 B9A0AE7717D for ; Mon, 9 Dec 2024 22:10:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F9516B00BF; Mon, 9 Dec 2024 17:10:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4AA6B6B00C0; Mon, 9 Dec 2024 17:10:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 371756B00C1; Mon, 9 Dec 2024 17:10:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 161D56B00BF for ; Mon, 9 Dec 2024 17:10:35 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8A350120BE9 for ; Mon, 9 Dec 2024 22:10:34 +0000 (UTC) X-FDA: 82876814916.23.D085BC4 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf02.hostedemail.com (Postfix) with ESMTP id 77D0380007 for ; Mon, 9 Dec 2024 22:09:52 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=LJ6WGF9x; spf=pass (imf02.hostedemail.com: domain of 312pXZwYKCEw685s1pu22uzs.q20zw18B-00y9oqy.25u@flex--surenb.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=312pXZwYKCEw685s1pu22uzs.q20zw18B-00y9oqy.25u@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733782218; 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:in-reply-to: references:dkim-signature; bh=s5kJ8tuGRSUiMYssDTJ1ovChFT1489Ldfej8iSXdE6s=; b=xyyRamZi6iGUGp+RricrWvu/LUL3MBn2Y2jRy0LpwalXbzKFBx/+ETTunyplCNeG0619Jl u1kAgNYpLD+wWsp3vClKdyoQTWWFqV12PVv74E9wdzKN6thLhTlKoxtPkwWNcnL9eqIEPV H/Za+b1nCb3Hl1xZeRnXwh0BAdDzJds= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733782218; a=rsa-sha256; cv=none; b=u5DReF098MF5BQ2i6HWTFpQP+R0u4oxJzf3+gp40DnNU5e3+lRI7wESg23MfD8c9U4yWNK 3gJHBLLCBzwGaHbjn8ElWzMJsSgyEvH1fPtCfr7R7t9rLenwhrfFTTRe91OYCZXy3Y2npQ Hb9ltzhjGfGCMfBZas5UXkNRCV+jhyI= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=LJ6WGF9x; spf=pass (imf02.hostedemail.com: domain of 312pXZwYKCEw685s1pu22uzs.q20zw18B-00y9oqy.25u@flex--surenb.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=312pXZwYKCEw685s1pu22uzs.q20zw18B-00y9oqy.25u@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-725e59e41d2so1538221b3a.0 for ; Mon, 09 Dec 2024 14:10:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1733782231; x=1734387031; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=s5kJ8tuGRSUiMYssDTJ1ovChFT1489Ldfej8iSXdE6s=; b=LJ6WGF9xbYpJ185IkxfEgvaiW5uIQFVJGYIIFbh9pFHgt5YWvT2v1xil+EAvw0K0BN 2mKLpZWDIAiGmslljNU765+LN131g32hIsNSPwncvZ8uZwzluOiCt2jXUhfis7AVKd43 9dr6cmN39nCuFzGylEZJ1dGcd/8XEpfvv5C+l2DglE4gRhLmuBJvNp8X+hmoGxsA2sbr I9DIiva6w9joezDkX8nHSJiWSFhiHiRUBtsI20urRmR0zb2CGxsp3ekoIROboo4Eeqo6 mfw8BrkdwTio5P5x0tAVvpsnePbEvQ3TZtoPTFZYuJNUL1pqQLskqalrQSP+ju8xAbss tC4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733782231; x=1734387031; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=s5kJ8tuGRSUiMYssDTJ1ovChFT1489Ldfej8iSXdE6s=; b=N3MKLuq9ayv9mgtoAV0eSAm3dvO7NpueZHNWBOLcSmuSQV05IkzHrdL1F+4vNf1ybL 2MTTtL0nqIuQn+cp13XJeRaCVIVFbf2bJuU+dwNFHZfk5GWNH8oKjwI46PjtiZb084Ox oAWeyCLlRCMdnX7bXh7MHvOckQpGxzNs427poCtGd05l9sNttj5eRLVRRvPb7PhooWWl JRCrOQW2F+zwv064v5Zj5sL3ct9Hb/l2TBo93V8DUJK8KGji7poOVk+1Ot+KVKECzTPK tMRMp5AHDAjYYtTLJhRSXxcLR8AEwEvLrBWGs6GFf6vdOWu5WKsIQVLh+PVvHI/K7k6d Z5Hg== X-Forwarded-Encrypted: i=1; AJvYcCU1YUnuoImbQNchPUZER6FZqIJK5W0DG/4plTQkOYUsfRx+8NeCXOIyRYbknvprqAwaFjyYOVqEzA==@kvack.org X-Gm-Message-State: AOJu0YwzVbsgoxIvW05NfVIf9iaYkCMag5KB9GELu0m1esyZy6jP52bm fHB715Wo69A0HyVhJpKB6OeblALhE2sdzCYClsLtnDF8av4zuqHqL4WxovrpzDb9zqnA/W8cnsB SYQ== X-Google-Smtp-Source: AGHT+IGwA+SRdoKoKP199xBaNffbhc4gaYBx7LHg0PekrQ7mrUUner/oH79OTzpbo5FJCxTnEDqYj4PiT/s= X-Received: from pgbda5.prod.google.com ([2002:a05:6a02:2385:b0:7fd:57ef:61e]) (user=surenb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:918b:b0:1e0:d837:c929 with SMTP id adf61e73a8af0-1e1870a8012mr22865787637.9.1733782231311; Mon, 09 Dec 2024 14:10:31 -0800 (PST) Date: Mon, 9 Dec 2024 14:10:28 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241209221028.1644210-1-surenb@google.com> Subject: [PATCH 1/1] mm: fix vma_copy for !CONFIG_PER_VMA_LOCK From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: oliver.sang@intel.com, klarasmodin@gmail.com, willy@infradead.org, liam.howlett@oracle.com, lorenzo.stoakes@oracle.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mjguzik@gmail.com, mgorman@techsingularity.net, david@redhat.com, peterx@redhat.com, oleg@redhat.com, dave@stgolabs.net, paulmck@kernel.org, brauner@kernel.org, dhowells@redhat.com, hdanton@sina.com, hughd@google.com, minchan@google.com, jannh@google.com, shakeel.butt@linux.dev, souravpanda@google.com, pasha.tatashin@soleen.com, corbet@lwn.net, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com, surenb@google.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 77D0380007 X-Stat-Signature: d77en5agz1jyabmqbihrk4yzpwrhtmpi X-Rspam-User: X-HE-Tag: 1733782192-691823 X-HE-Meta: U2FsdGVkX18LblHgPh+ebVC2gyA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Jte3NCilHsRgJTMS/FOKr+5sNb4xlofwPakXdr/9mITebzePREqUd5OzlnMA70B+S37U7mYku+1gsMuAmsIQsWL6n9w+L1hI+o/ZiIyDSEc9sJEeBH7rbnEXWIqxUD0iQn2Wo05FE3OnxYe/NS/3kdORYhyHOhgH+VrETX7mQgi3sum62SZP0LIOpkEZgf2/jrb2rI01fJIqM4fSstS7kANpc3/reUyMFinL9yMPB7swJwANqURsN9f1Hm7RWw3N799JtkczcMcdKEf1Q5OE5vU78iufijEulG6PZHPYivowDt3T3JKbQFWiey7IUrwRwpkQDYOuHU9Ma8gG6tDV3Hoiy7e/PeFszNUAzkEfbvR+FBiyWCMZszkKHvq6OcZ+CF9+2fXqgm4ljK2qI4ptJqvsFIWmzB+2osJbDZGHzDdduUmpSR06jTO3gOYpZnPmCd6+YDso1JBlcXKXnVLXj17ekCI7flvhsOGVI/wwdl7Ztzq19CDT5RwUSo6E8T2NVZ4avF424C1iFk+KhyMe0kj/SSXQH9sjCppgRQWmD2mZlCbFOmmimvAnnU6o X-Bogosity: Ham, tests=bogofilter, spamicity=0.013349, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: vma_copy() function for !CONFIG_PER_VMA_LOCK configuration copies all fields using memcpy() as opposed to CONFIG_PER_VMA_LOCK version which copies only required fields. anon_vma_chain field should not be copied and new vma should instead initialize it to an empty list. Fix this by initializing anon_vma_chain inside vma_copy() function. The version of vma_copy() for CONFIG_PER_VMA_LOCK is fine since it does not change that field and anon_vma_chain of any new vma is already initialized and empty. Fixes: 85ad413389ae ("mm: make vma cache SLAB_TYPESAFE_BY_RCU") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202412082208.db1fb2c9-lkp@intel.com Reported-by: Klara Modin Closes: https://lore.kernel.org/all/d0ae7609-aca4-4497-9188-bb09e96e7768@gmail.com/ Signed-off-by: Suren Baghdasaryan Tested-by: Klara Modin Reviewed-by: Lorenzo Stoakes --- Applies over mm-unstable kernel/fork.c | 1 + 1 file changed, 1 insertion(+) base-commit: 6e165f54437931f329d09dca6c19d99af08a36e1 diff --git a/kernel/fork.c b/kernel/fork.c index fec32aa06135..d532f893e977 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -524,6 +524,7 @@ static void vma_copy(const struct vm_area_struct *src, struct vm_area_struct *de * will be reinitialized. */ data_race(memcpy(dest, src, sizeof(*dest))); + INIT_LIST_HEAD(&dest->anon_vma_chain); } #endif /* CONFIG_PER_VMA_LOCK */