From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794527947; b=b5+ixsRUSQKbu+Oo4u6UTbhmQBKV8AV3LWnqDOKFTylAlUdDRRSVNJhw+TW4cb4zMAPk lf7J+KUqPvBQTxRyxLeYaxdT1U3w5ubG63qcbPV3O7Y5IUv9ukXCZdJinX0JdlF6KYnbu 3OMF7qYeQNSkuDqv184U2UJhyjeVJ634fsx/uhQQ8GJYuLhsCIpu9hw3H7iiYvPxOqMUP lQKL9fvGzzohFpUUZm+K5La6+BrrdgTmddEmovH+kaorANK7u2wGe1ieEk8oW4VG2Qaa6 8jK3VLHHyGUoXRrKTz3aEL+rfYhA9LbTuJx4CzM1/zKw0pxOrgPCuHs73GG7L/Ssofw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794527947; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:Content-Language:Autocrypt:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=WxgEX4388zF6U8KM4KgbrPSeQjWqRryJtZ/6cfDPpWs=; b=yGlzcA8VfB0AcPVo0ZfOur+cJ+J/hbQ/DT5ZYbU+i8hEeibbtZgwzx6w6gtZlHav2fdj eyeaCXLkz2NBRr7FsWzejTmc+s+uP5T8Cko0Jq4sxmqT3dvlJ9IJSCQSnBVrpn+nbCIFY 6kyXiURezVzosr89vkqDgqvP3+Rw0XNGelGgpLq1vD7B3oRrMTviGJDMj8IOAeXFF44xM ZWBAJOgmJ0vR9BpVWHMNxDjNJupeJbyMfxYGqmGEV7KbPnH63P0GJp84cPhnDy80yvBw7 wZbk7G11rZSQ0oFvzsBeYpnO4e1+wGMrXcuqsBqTMrOjwLO1L9mu1mi9W7W9X+vqOBA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fChm8D0E; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B9A6606A327; Thu, 12 Nov 2026 23:59:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fChm8D0E Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B85D1F000C4; Thu, 12 Nov 2026 23:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794527946; bh=WxgEX4388zF6U8KM4KgbrPSeQjWqRryJtZ/6cfDPpWs=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=fChm8D0EaIVF/iA0odcAXXSgtLTuReq648ASLwVx75+fiP4hIn2IxqLOz393lT+YY dI8xkbOHhpkbeTDq49ki1fgPcIHoVyx1+iZ7zaGmN6hCbjsvGXdDGgiwJvYx3klF5e O5UVzIf7JepO57KRDdTFadPkEVTj5ipcuzLl84Jc8p4boWXZ7hEMKmtBfiA3xf1Stf a3XKSwLSu+8hq2nPVjCaLlJOWZVVtC6rH+jtL9Y5tn9d4ybEcMlJwSUsDYuHHrC4MU s1wQta+FgpLtpRPpuq1QPBR0dfJKP8XE5E9LXzW3BEYZwID1RrNmguRyzXA0OJAFs0 MmIfRR0TmzGFg== Message-ID: <0e3e876e-c3df-4660-ad89-a5f0fd7dedc8@kernel.org> Date: Fri, 13 Nov 2026 00:59:00 +0100 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm/madvise: disallow guard region installation in uffd-armed VMAs To: "Lorenzo Stoakes (ARM)" , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Jann Horn , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Shuah Khan Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Tal Zussman , stable@vger.kernel.org References: <20261112-disallow-uffd-guard-install-v1-1-bcf8b1aaa72e@kernel.org> From: "David Hildenbrand (Arm)" Content-Language: en-US Autocrypt: addr=david@kernel.org; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzS5EYXZpZCBIaWxk ZW5icmFuZCAoQ3VycmV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Ieoyhy9vnIa3w1uZ 3iyY2Nsd7JxfKu1PRhCGwXzRw5TlfEsoRI7V9A8isUCoqE2Dzh3FvYHVeX4Us+bRL/oqareJ CIFqgYMyvHj7Q06kTKmauOe4Nf0l0qEkIuIzfoLJ3qr5UyXc2hLtWyT9Ir+lYlX9efqh7mOY qIws/H2t In-Reply-To: <20261112-disallow-uffd-guard-install-v1-1-bcf8b1aaa72e@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/12/26 18:38, Lorenzo Stoakes (ARM) wrote: > In order to establish guard regions, guard markers are installed in the > page tables of a mapped VMA. > > However, problems arise when one tries to combine this with registering a > VMA for userfaultfd, as such operations may themselves need to install page > table markers such as uffd-wp. How does this interact with UFFDIO_POISON markers that can outlive even userfaultfd registration? I'd assume it's just the same thing, just like having proper hwpoison marker in anon mappings, so it just works (uffd-wp will skip, guard installation will zap). > > When this installation is attempted the guard marker prevents these markers > being applied, which can lead to unexpected results (especially if the > guard regions are later removed.) > > This is especially problematic because guard region installation causes the > regions to be zapped first, meaning that the removal of userfaultfd-tracked > ranges will not be logged in this case. Again, similar to trying to uffd-wp-protect'ing a hwpoison marker (which will be ignored), and then zapping that. Isn't guard marker installation/removal just another form of zapping? So to me this all sounds like "if user space does something stupid, it's user space's fault". > > Therefore, disallow this. > > This makes sense as conceptually, guard regions mark a part of a VMA as > effectively unmapped at the page table level, and removing the markers is > like mapping the VMA again, over which operation uffd markers would in any > case be lost. Right, but that to me just says "on the parts of the VMA where you mess with guard markers, your uffd-wp protection is similarly ignored". So disallowing it entirely for a VMA, I am not sure. I could see use cases for that, although you might argue that user space should then register uffd-wp on the separate pieces. But then you get multiple VMAs again. -- Cheers, David