Message ID | 20241216192419.2970941-5-surenb@google.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 BA317E77183 for <linux-mm@archiver.kernel.org>; Mon, 16 Dec 2024 19:24:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4220F6B00B1; Mon, 16 Dec 2024 14:24:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D3886B00B2; Mon, 16 Dec 2024 14:24:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2251E6B00B3; Mon, 16 Dec 2024 14:24:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id EAD356B00B1 for <linux-mm@kvack.org>; Mon, 16 Dec 2024 14:24:34 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A8D16B0366 for <linux-mm@kvack.org>; Mon, 16 Dec 2024 19:24:34 +0000 (UTC) X-FDA: 82901798322.04.C43A09B Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf25.hostedemail.com (Postfix) with ESMTP id 980B0A0009 for <linux-mm@kvack.org>; Mon, 16 Dec 2024 19:24:11 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=h3Jgwu8Y; spf=pass (imf25.hostedemail.com: domain of 3b35gZwYKCDAegdQZNSaaSXQ.OaYXUZgj-YYWhMOW.adS@flex--surenb.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3b35gZwYKCDAegdQZNSaaSXQ.OaYXUZgj-YYWhMOW.adS@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=1734377058; 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:in-reply-to:references:references:dkim-signature; bh=/Ia4skJ0dxk8cYc3IKUIPhlZF9heDgJL08xGmdJ5E3s=; b=VcxG63RMdDXoyez90s1RKdq8T8Cd1GdRKv8Eh1bQsdcGBhs6pDoa7JoOgYU5l2QSY/yKoS GRNLJuq8k3i9AvK5ojDy03bqEwfrI4H9R4cj0Ru1v4Xigdks+Ytp8OLjrBAeEhU+2YCGS/ P41inF6ats0yiCtKimzmmaqeksp/wxQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734377058; a=rsa-sha256; cv=none; b=OcJT1+TeutToBkILl+Tf3jcl4LLKPPk1bdxjjQPFzFGmBDn2aAtFcn1DenDd5uPTpDrMpQ q23Jnv76Dda3nS2HcNKZN4ENHH5b0PMeOWgWdhyRYs5W6ivkBd4ZPT/g9mR8RIT4j7q889 rEq5aENpmE4R5cWlkRo4s9T2+6B3hRo= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=h3Jgwu8Y; spf=pass (imf25.hostedemail.com: domain of 3b35gZwYKCDAegdQZNSaaSXQ.OaYXUZgj-YYWhMOW.adS@flex--surenb.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3b35gZwYKCDAegdQZNSaaSXQ.OaYXUZgj-YYWhMOW.adS@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-727c59ecb9fso3958002b3a.1 for <linux-mm@kvack.org>; Mon, 16 Dec 2024 11:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1734377071; x=1734981871; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/Ia4skJ0dxk8cYc3IKUIPhlZF9heDgJL08xGmdJ5E3s=; b=h3Jgwu8YZzhhOmVWKTredBhibKzZ5Ga9efJKRimqagRkvSV6S2rh8Th7SHHNGoFEuC 8/2k2a6XAzfPmMyAvJXKzcbKj0J2/vOtTg73b8fnLLpE+rki0lPduisg5GDo7SH6oDB4 44/3yY3jK3sjO2g3kpdTRnCVFwKNKSGj2uK+BbaHTPpvmY5gHPEI57pOq5q8F+WKnpUV vZu5gl8JiakegMdSFdE03Hhtw5eRnMgrRjexRTfQKxL/8yVchnoYyHk/uT2U1CiaZu1+ 1dJksyTWLN+FDUbtv3mKOuPZjnUdowyv0NdjHQYRG3rIO/xAdqxy1v2y+lOSuSP9oW/H bVTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734377071; x=1734981871; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/Ia4skJ0dxk8cYc3IKUIPhlZF9heDgJL08xGmdJ5E3s=; b=OmXQAxWzEJjuyDbDHLKz52sx8pohMapheQ5+1+bNgQ7ehWMPIZG7eq+GaJ9U0jJu1p pg1WH/1ZhUgGvaJIMdkLonG0RKufJeNPhZ4Ia/rZRSPWZLzUdstHz0jaVlhCsiFYBaU0 xfZiniKK0SAskSP2/w1boJqPYERBIqNGklgi4AXEJ/Cgy2PJJfAZV6gPQv7UgPKa3NIm aCSU4NWIuYeKuQcwSFjCKiWEEaQda3oNjtft3KBkqbEv8iDvQa+8bgoQSL0DfqINwqqD oRo/CCuxpENoWP+OCt5iaRMMklk49YMvqVKpl/Q8smhZKMvJcZ2WH6JermS2Up/vZjuK MkeQ== X-Forwarded-Encrypted: i=1; AJvYcCUvjBCSQl3Q8Owsll4pBdaqy+SikuAhIRi4ulAn8vdEx4sdQkhWH5lJJzgELgLb546yIfLHoWWbmg==@kvack.org X-Gm-Message-State: AOJu0YxrG++dA2aQvs85SIxrUpQTOaYBmObaK02Mdul3O5hleXnv8EY+ tFjpujlYoW1Z3b/HLgUi6gY4uiuxCgF6kGoOIzcwZ/e/g0W1zh3MkVN0o5BYVvf5sPbgVv/cd1F NvA== X-Google-Smtp-Source: AGHT+IGblgxI1ekRLHe39odjzDuWa2GhKIvnP9JXJ082wXSRcQoL744G5O8IU0+gMQyAryC3i1beb9Fb4As= X-Received: from pfbci13.prod.google.com ([2002:a05:6a00:28cd:b0:725:ec78:5008]) (user=surenb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:6c8c:b0:728:b601:86ee with SMTP id d2e1a72fcca58-7290c24330fmr18435707b3a.16.1734377071613; Mon, 16 Dec 2024 11:24:31 -0800 (PST) Date: Mon, 16 Dec 2024 11:24:07 -0800 In-Reply-To: <20241216192419.2970941-1-surenb@google.com> Mime-Version: 1.0 References: <20241216192419.2970941-1-surenb@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Message-ID: <20241216192419.2970941-5-surenb@google.com> Subject: [PATCH v6 04/16] mm/nommu: fix the last places where vma is not locked before being attached From: Suren Baghdasaryan <surenb@google.com> To: akpm@linux-foundation.org Cc: peterz@infradead.org, willy@infradead.org, liam.howlett@oracle.com, lorenzo.stoakes@oracle.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mjguzik@gmail.com, oliver.sang@intel.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, lokeshgidra@google.com, minchan@google.com, jannh@google.com, shakeel.butt@linux.dev, souravpanda@google.com, pasha.tatashin@soleen.com, klarasmodin@gmail.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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 980B0A0009 X-Stat-Signature: afpcj1p3c85xkgnuzxjrienudt8ewxro X-Rspam-User: X-HE-Tag: 1734377051-505235 X-HE-Meta: U2FsdGVkX18gNIX2VdUp7+O9QCIRZ22uwVzKiGFLaBJlDozZ+W/HZjoeDgD9RRKH8sceI2cf+JaGLLxLi2sAVqr+EEHMHC//UelTeIsZDVW/GEPctK9uHk+R7uJpwmUbP9oITzni7nSml3OQ/OqsjPRU5JUybQ4aYVa2OSpz+CNTgx3lNpgYmbntwcZ26zphrz7gmsmKDHIzCg/5sVU+zsgwTsmu31gYSk0RVVJ/ankDjuIamXnevXx7i3uvuxlvS+er1u8C5mcRbyqyc9J0WTpGZbPWeBvRt8xD0h4PTfRiJpWo/pQglMuZQnUm8xa6JYrVHotTmNul/UqxDwQf8XcGJrKsbQOpQy8HxoBJjEaZpKQrAkrAyYv+UoB5UqH8C3VKr7CY3dbtb/RyqVcW+mfMqRBBFsGFKmzyF42hR0COzQmlut+b83KnGokQXYBal6ZHvhJXRxV2nnWc7//+U8e8cvGg7XndQ7+3GAu2cYSY5NloEuhG73ZYTOUixLlIZOc68CCpx3g5Sqk2plZRs6/sN4eUD63ICAJL8RYaOdUFavRxgjhkm38JNHhFmvzu4+NqApklB92vQALO0HX6uHonhBx3HNEQRF4mvpSeyMYpwjcJE9m/kSJFf8+4NhoBTd3dUGngmWYQ+6GSNLWjLZqkSA07mKl10XF9bd2A6MYl9UDHJkNA+2OdD2eJWLqToRHioPHPuY/zD8mnseVwY8Ou+Jd4ySFFvL+v0leIlqpmXJ08t1n4j+XgqQSbRbdMF5GvdXFre4JyDRGNQbqNoBXKOzwtoaemu07ZUoEjR2jfSFN1/Fp71otYOeqq08lfbpwGrCRjQguIHMOIlC1w4nkOBI04Eiw9jYKKuo78vn+K04YieuWevg5hErAzIZQJKJA0T6Rgph01HpYPrr4T2qHTcyVx8o0euTLfpmt6zZHTo9od//D3w0PyyEVcWbpRopAAQFHrjBxWPTVsjnS nuqNMQhO B0rHu/7521wSxR/4kdjgrP+AcEtdj5JHok1CjRC02jLDGmwskr+A4aJ/4HvaAWt1a7030MyDCtd+UqtOLHCkwvAV/w7iHr6/tVcSfiYjQXyqrDrm5LZ33zjlPN0PyskwGSjQAVrm+C8rkL+wnWxs9y8tqyFylqWQKnw49fYYYh1F+cGqWUNbEuzb9IYNIrpocfzW/2AfINAGU2PSftUkgBt8i4a+rMIgHEjXKZ4PG9Ex3uFQyGVzkFyWgbuNsYj0Y7i1mXiNqiyxfl5qCEzdAUsfSfgQtBdycX0WopBfZpNIlBRtWtOARK+ZHFEWRwb1htbe5sNKNma9fKW/ij8YMmJJ8cT+AI6K9qGqAj7IPfs/RnNJpnOnWSWA10XR1S3Eqywsl+Re/u7D4fZfF+fsWQx5u8EMR/uMMsiThGehojQ0J8fqR2rfrTQb+Nc4+8kIUMdEM1fSZTYDnK4bScscDzxSDiwHYmyYAxISlTxOF00G/9s+UfcKsY6Ilc30NqJQzZgoYyM2RF1pNnDU1E1TDIS04JZwF5+vjmoAJhoqTWVbLlCPFxB9RGS6pwr185fanqC0cm6aWEMejtX3UCey5PkcTTBHwUOvFwfyH X-Bogosity: Ham, tests=bogofilter, spamicity=0.301470, 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 |
move per-vma lock into vm_area_struct
|
expand
|
diff --git a/mm/nommu.c b/mm/nommu.c index 9cb6e99215e2..248392ef4048 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1189,6 +1189,7 @@ unsigned long do_mmap(struct file *file, goto error_just_free; setup_vma_to_mm(vma, current->mm); + vma_start_write(vma); current->mm->map_count++; /* add the VMA to the tree */ vma_iter_store(&vmi, vma); @@ -1356,6 +1357,7 @@ static int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, setup_vma_to_mm(vma, mm); setup_vma_to_mm(new, mm); + vma_start_write(new); vma_iter_store(vmi, new); mm->map_count++; return 0;
nommu configuration has two places where vma gets attached to the vma tree without write-locking it. Add the missing locks to ensure vma is always locked before it's attached. Signed-off-by: Suren Baghdasaryan <surenb@google.com> --- mm/nommu.c | 2 ++ 1 file changed, 2 insertions(+)