From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3118837FF63 for ; Fri, 10 Jul 2026 19:05:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783710336; cv=none; b=Qhl/RqwUY9y0/nzaru4nKn1DvFwbxezF0EM2/c9TPwIuBTgWg+UKuhvdhdz+XUw/xirt1nvqoSh7F3QGm/qY4nwNtn80uI/B1ug+cvrNE2FlUhxr1JKiJhbERfKrwiCVCRK5m96QLLtaaqZPiqOV96JjfnHqB9Iqb20nug/WiFk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783710336; c=relaxed/simple; bh=0O95+yAo6D3yNWuX9lzWEAviyk6KjGyNsi91HXznKL4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oLo5WKeR2zsiAER0sSLgfS8kvFSXJV84NRpMW5Iz7R4kUP7FzePq81LuRukNRr2X7WyQ2SrIddfVKLi301GuLgc/93t19exQr0LByQGT0tR2EDSf+6DSIzg9QbWAUf3MdGII+/CXdlVodRsHJNDP7Lt++ZPQIWPEH9hKHDM0BqI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=tyGs4YzK; arc=none smtp.client-ip=209.85.222.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="tyGs4YzK" Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-92e50979c71so125283885a.3 for ; Fri, 10 Jul 2026 12:05:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1783710333; x=1784315133; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=5Cb4T8zzpAMOVzwqCT+1eDu/jZ6x8Q2fk7Pyrqw1u7c=; b=tyGs4YzKykavFOU7RpmSsqQAhspsUgdW4ruG/mBjVMFoJjf6CNDMip1BPFXVYFwgBV S8mzQQ31fxxPWg1IYsGznuUYTJEueHjursWZ4QHWCV8xifPKDBSq3dxqRhn2gPsTjQb5 ASAqJfwDZV8FsYtCKMxuKXvhMgWH/uY483GNeeIiNloZT/uuc9aPJPi8J24RQb7myLHE 5lHGqnVQh+bigcLMCkxKtvThM3lBt+pQm6X0conpdFV8gErXzkYi/eCt6H+ikbVByjiE E6SFU35OwPnGWINhkRXxffFldULXzgkmy9/IKyFsiHdUGRhLJhtwroVBVCQ8cMYA0SI0 zWLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783710333; x=1784315133; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=5Cb4T8zzpAMOVzwqCT+1eDu/jZ6x8Q2fk7Pyrqw1u7c=; b=TsAafOy3wSMgmW0w3/Tr+ptwJajX3dxIGp8ru7hXs+gmUFwYvczi16nP8nju10aYTJ hmiTeoDs0px6/5JM7HGbVcOHmaHYh5sm2aKB1TC4xivV6jE036BIb5DAP4jNRC6hEH5t ssfZsXwYPugpMzk5I9eiytZ33eo59ADEYkUPq8g0AKOQ/QAQGNhvJgztWcAiYmoRlRTh OAaIi+rUOdLh1ahmKYXFE0ykVNlxkZBWPabQz/YmzLIEHGPilDZvpQgaPdSiDJT2DcsR ETEXkd1lN0zdIi3AZkw71O/beNWx7ECWV2pUBA8TjvjpDiTzjBFVwz1EIE2UgQDQCnIt k4PA== X-Forwarded-Encrypted: i=1; AHgh+RpsbXrQVPPIKcJJoUxkMLa6fUFuUUJXYO3QRg/KY4qvteYcy1xm7iwfUqRaJtvZ5swnpoXmPVjKsRNNpf4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4+tY1baXgS3UNUvx4PeuRQfbxn86BNU5RZyAW/h5L9wqYjPho 51uGa3XzT/JG8IzY1A+8fkCseBK6xabpZULmlrsgIBYuLuojKApoTPiUUUU9FGuPk2U= X-Gm-Gg: AfdE7ckfjc3G+5+6qxMYBHbHE4pk8U3uyDyHujBFpN1GtwsZNc1KtOK1e3q+TqDuKG+ 5CW35U443IH291K5CONtj5SlzPR+07lVGcVDzN+lIHTozbkqGp5Kj9zmjmaLt7hEGpPD4tq14wi 4V6PaUWZPsPDg0B4V+yIRz5Od1r+Ed2uGO+UcYwVNqGSibsVh0sbcaUuG3Ga6G78PqNfKqcXvtx p1NprqtpZFUlipJnEW8dvtKNkgTV/KWV6ZxmG+eJFpHTLU+LVgXu3/J4vCqQrCAzh+ewZseaD1s Gi7k21tgUew8CtRmaQwnwTuUH3fYjAMiEsJyJzcb8bdCmPaByMOc3r57GUq/a+cLvS395PToKlp o2YrDK99O7dA0r0Se0xNo4q0zZUyOsvYvOSKWJL1dfqypU3ZFm74anU+rnB6eNEJXHhbOBOcm4X nM92+PNcC2hrrF1pDqlcIEUBTM8ydWuNO3Z//+7dhYzFubwdg00IJEM3+YK54HOG7+hcfg X-Received: by 2002:a05:6214:33c5:b0:8f0:65c7:315d with SMTP id 6a1803df08f44-903ff971194mr4994756d6.24.1783710333250; Fri, 10 Jul 2026 12:05:33 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ffd80fe009sm47940576d6.38.2026.07.10.12.05.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 12:05:32 -0700 (PDT) Date: Fri, 10 Jul 2026 15:05:27 -0400 From: Gregory Price To: Lorenzo Stoakes Cc: Andrew Morton , Russell King , Dinh Nguyen , Simon Schuster , "James E . J . Bottomley" , Helge Deller , Jarkko Sakkinen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Ian Abbott , H Hartley Sweeten , Lucas Stach , David Airlie , Simona Vetter , Patrik Jakobsson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Dmitry Baryshkov , Tomi Valkeinen , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Christian Koenig , Huang Rui , Ankit Agrawal , Alex Williamson , Alexander Viro , Christian Brauner , Dan Williams , Muchun Song , Oscar Salvador , David Hildenbrand , Suren Baghdasaryan , "Liam R . Howlett" , Matthew Wilcox , Marek Szyprowski , Peter Zijlstra , Arnaldo Carvalho de Melo , Namhyung Kim , Masami Hiramatsu , Oleg Nesterov , Steven Rostedt , SeongJae Park , Miaohe Lin , Hugh Dickins , Mike Rapoport , Kees Cook , Paolo Bonzini , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-sgx@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-tegra@vger.kernel.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-mm@kvack.org, iommu@lists.linux.dev, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, kasan-dev@googlegroups.com, damon@lists.linux.dev, Pedro Falcato , Rik van Riel , Harry Yoo , Jann Horn Subject: Re: [PATCH 20/30] mm/vma: introduce vma_assert_can_modify() Message-ID: References: <23c7602c58cacc23ef22618a27af9a2d54addf58.1782735110.git.ljs@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <23c7602c58cacc23ef22618a27af9a2d54addf58.1782735110.git.ljs@kernel.org> On Mon, Jun 29, 2026 at 01:23:31PM +0100, Lorenzo Stoakes wrote: > vma_assert_write_locked() and vma_assert_attached() are useful for their > own purposes, however VMA code absolutely does allow the modification of > non-write locked VMAs if they are at that point detached (i.e. unreachable > from anywhere). > curiosity: I presume this happens mostly during init and/or teardown of a vma? > It's therefore useful to be able to assert that a VMA is either > detached (modification doesn't matter) or write locked (you're explicitly > locked for modification). > > Therefore introduce vma_assert_can_modify() for this purpose. > > While we're here, make vma_is_attached() available generally - if > !CONFIG_PER_VMA_LOCKS, then there's no sense in which a VMA is > detached (vma_mark_detached() is a noop), so have this default to true in > this case. > > Signed-off-by: Lorenzo Stoakes Reviewed-by: Gregory Price