Message ID | 20241226170710.1159679-7-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 4DD70E7718F for <linux-mm@archiver.kernel.org>; Thu, 26 Dec 2024 17:07:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A7CF06B0096; Thu, 26 Dec 2024 12:07:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A2D436B0098; Thu, 26 Dec 2024 12:07:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 881C96B0099; Thu, 26 Dec 2024 12:07:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5AD346B0096 for <linux-mm@kvack.org>; Thu, 26 Dec 2024 12:07:29 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0C296ADBFC for <linux-mm@kvack.org>; Thu, 26 Dec 2024 17:07:29 +0000 (UTC) X-FDA: 82937740158.22.BD4A764 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf16.hostedemail.com (Postfix) with ESMTP id 8A3A0180011 for <linux-mm@kvack.org>; Thu, 26 Dec 2024 17:06:44 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=WWafnpsa; spf=pass (imf16.hostedemail.com: domain of 3TY1tZwYKCGAQSPCL9EMMEJC.AMKJGLSV-KKIT8AI.MPE@flex--surenb.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3TY1tZwYKCGAQSPCL9EMMEJC.AMKJGLSV-KKIT8AI.MPE@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=1735232828; 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=g5ywt//znwFKMBkiU95FpNYi4gj0LeYvCae6lfTb4Ek=; b=MhgZSpgDfMTFuJZw/6aAz8IpzmPTh/6Rt7aOytpwaNY9vHdQgw8YVXfoOJzaMbPmJ/WYTS 8t2O33FdTReealzn3crjH0iOXnvhEbUzeK7PyQeW5f5I7wiNuZveW8Ha8Zxy0Lz9FovUdJ y+wx4C64nraVKJyxk7/awRvLPYRWbvs= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=WWafnpsa; spf=pass (imf16.hostedemail.com: domain of 3TY1tZwYKCGAQSPCL9EMMEJC.AMKJGLSV-KKIT8AI.MPE@flex--surenb.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3TY1tZwYKCGAQSPCL9EMMEJC.AMKJGLSV-KKIT8AI.MPE@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735232828; a=rsa-sha256; cv=none; b=P0x+3SMnpd4hCWykjUtvNpWOw62ixSx+/wQGVUd4jpHo65wBCS1t0IeV89pQdETYQuZKu+ f1Oj0wASHs99vFYqfNYUz2mJTEJBB6H0xBp6kPhyt4JHLAzIRmbVKzUSNG3FtA0jpA7r99 CgcnTapmkbswzw63gSRDLbLdMMYgLNA= Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-21640607349so115048225ad.0 for <linux-mm@kvack.org>; Thu, 26 Dec 2024 09:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1735232846; x=1735837646; 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=g5ywt//znwFKMBkiU95FpNYi4gj0LeYvCae6lfTb4Ek=; b=WWafnpsaSd+0UqhmtOtrPvyAafO2U5Lhpx0kqqu0kvNeTxYrpyG6B2+nXf6wPMr6WC /wU+MrE9S7b8OfozlgxwXrbCZMx4wY4u3Y/o3tlnHELzrF8ZCVOPLQPUqtMDqj8xq1Z2 gZo8Sptb/27cliexLL6Xei3oUQblo91G6I54C0YkIYb8Y0+jpnLZN/xAQMxd/ux27R/J Y/2g0aYcfD8hTJjBbPZeXtIdVEMRS8fL82Wx/xIqwmcn3WVP9iOXhu3IK9mqDzZo9C6R fkJ+zoCpyC7Xvk7Ehti8R3B+EXECPaDUEOkPmEuhIWH/svIIs2/A6VHZznwlYKxZMUyf WpHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735232846; x=1735837646; 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=g5ywt//znwFKMBkiU95FpNYi4gj0LeYvCae6lfTb4Ek=; b=sdqEqyjBV0DCcJNMrMA8Z5nlbzSsQAxvQiva7ZdJAe8D0us/bXCFSxWiQ+xRlqvBM0 ZhJN1xxKPTXhhoAdGTsvGTAeZPUXAxz8Hd8XXsTWI50/7ZE1ftuqj1OA8ruDvs2Sk+Yy P06r6bFZboFj2o+cbOHmoFRndcAcDtjMogdFZupvSj6AGbz6mSmx91MWJbknwpZ9B2GV NLyVFhpatvH2GqemFD5xxpPrT5xlo2vmVFDVQ7jJ/RpjmHoyoCojyByrp1o0HdGfNyRS fU8G26axDSsz/wZUGZoBsXCJlKWQ3EHBdEsNHaRDTJvptXOrqhFv5L3eFgsCMqTZgF5l E0jw== X-Forwarded-Encrypted: i=1; AJvYcCWli3xu5jsvQOkJbMIyxCsMpwwcHdeqbrJvszKMIU9/SN98ADdi0TK5lOSdA0o5eIqkcd0WeWHTNw==@kvack.org X-Gm-Message-State: AOJu0Ywlmoe0Bw9Yt47k2vbDUSubWOwnlqMDbo19T02j83SmWtM0SGds jkao1/hucBaSm7j3OxFntQRjQO1IxjddClhNNsOXayUklIN0qgrsFI/FMsLSt0Ta6MVC5PagK/4 oDQ== X-Google-Smtp-Source: AGHT+IE/h3it9ewL3ohy9Py+t9rkxMgblJxIK9ZNryUZhJOqjESQSzvwpTa/5zazFY30vveAdTUiPRQAGfg= X-Received: from pgjs19.prod.google.com ([2002:a63:f053:0:b0:800:502a:791c]) (user=surenb job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:d589:b0:216:45b9:439b with SMTP id d9443c01a7336-219e6f28486mr336700685ad.50.1735232845994; Thu, 26 Dec 2024 09:07:25 -0800 (PST) Date: Thu, 26 Dec 2024 09:06:58 -0800 In-Reply-To: <20241226170710.1159679-1-surenb@google.com> Mime-Version: 1.0 References: <20241226170710.1159679-1-surenb@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Message-ID: <20241226170710.1159679-7-surenb@google.com> Subject: [PATCH v7 06/17] 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-Queue-Id: 8A3A0180011 X-Stat-Signature: fsmz1wq7npkcpg9rcn4pog86orj76n9b X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1735232804-202278 X-HE-Meta: U2FsdGVkX19qgljM6rurDO6In5ErCK7prOI1a7vu7uJIB3OajSZkSCxE3bLP3R3qLkBMG2A6OWuwWn6+ttCx2sGog5MbNBblCng5pEe4qbYG/yiKYeySR0wY3t9omnJ6KReVJygCnDoRFikqYfVStT9b+rl8mr3fLDk/5JxRngrq+muFNQNMszSG49eDRR3Q0VSyl36nxu6CXi6htYVQxATazx6Ux4/mDxBeYkdq3W6HL8rUY79M1IhvEvgdqbLQww9uzsrwfWQokHBJHsHmfLWDPYe+osY7hcnPGwiNUfv4MaizaDvgr/uKAqrF5NlWGkJ3b1sGvqerI+cqYpOjOIlVp3NZQLFagjy1S4oQZtYN/EfLVzeXaZi5zkiQXr0VBKDKZsCEtNlBI09jbwAuhho3EPp7IrVinyho7/2Uq2L+w497Hql2h1pOqzdFf3yCzUBlU78hIT6x/YpwqHgmlrWFsbqwQgLPa9lHQdEZ6WJwvbHjGUi6m1XKl3UIfztOANINsxbvxoGoaSHBZsh/IPvKH+uGoa1x/4sCcn+Y1MiLqa5fcA8X6hywIgUrNr9ijZlps/sAxKtXOByxC3t5vemWUoqCSu6RDON6VLebrSJaHTiOp6HeHCTYpZhDKB6zgCdNWlWic4a++teD7JtEmtV1jnOCJFUNWja0k99wfWaGYcfLrkLiPukLha3Jy9yI6Cu7Y293KojY995karOszJhN+2uht+d/Wi/IblNkqtUFO4J2UMrjo4CcTV8c8x7crqjQWOGqnPzHn+QjV3gUAhVk+d9tQF6cECqB6ay1PNmbTCuHH7VqRdupGQRkjSpXPcrg6WdynhCNzevfPCfT0y87A4aLWmyVl0W/rAIXByEsoaF0TbgNVB0TI2bO/mJ3m6GuckFQQKznQM7dEJZvBceZ2ySkJoIYGKqL9WiYJ8AL1pPtngr2szmQmBIjPBxnM+JStTRokYK9A1+9c+s THTaqdRL BP6yYL0Qv2dYD70waRoa/ZMeusPfFJ9x8EYAsssRQNM7Awj0l6iGuACZKoTt9Jj6UezEAHHOCF2mTOSGrGB03vwkdHDI7uG1LXlJvaHmYlH+FX+z93cY4QLOSH75CY6VB7CvVXpg6Hh/IhZbxXiWpptXwsEmz6Q2rrGAYRQXM9nCnrrwTGkvvq+OmyIpcmVy32jec+slpYtiG0VLn0h2yVVv0+sGZtpSBRncwPrEwrg6kG+5oDDJNYixTNVRs+Sqn4lVJHZT+nMGivUbimqX+J0A8UEkAsPlKBiUxymCm2F1zT+ikpzd4TYpG/au6dT9V+HV1hvBQXUvH5kZTptO+f+W8z63ynRQWr5sqtprt5MnBWY8uEcNOF1aP2ozKerXco2IAITDhVHm95CZkTQ9cOelPLhGUN9mEpgVB3HWFpStyifVbsTbaPdupZwFOKndeCwuLyPnMSikqxW9blL/zWbKIRd6FbGfCuWAglBvczGljSTdnj1HSx9McC510kwDHVpatEVwiq3GVB4QNOrvdsogB7lBbGgr7aDyDiVt8nrNom0ER02QcWzZsFzxPqSBY4/qK269aRhrlYNVz/YQhYHVXKsGU7pSnZUb+ X-Bogosity: Ham, tests=bogofilter, spamicity=0.007109, 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 72c8c505836c..1754e84e5758 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, true); @@ -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, true); 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(+)