From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796133100; b=1hFpgut1OcIxhczAPVXIZvjqVic4qgYqtJ/ZN83YE7rvLjTmTKDXEtlFDuR3mEsVXp46 FJqLOPtzgloJCHK3EraduVWuFHpCteCaHWXnnjr9vlmjUqFvNxcU01ch9rhQP8JZE3TFY AjHalkOQM0aMSrM4I+0Nr0INBfpwL3/0U158F9fr284C8aGRhUwhxck7wKayKdbQHUzT4 yIrJd53Q47TZpd9PfzsPL3JhWKZqzzUwJPJt2qODW44AbDeC68wDwCu9qhRBeyRc3yfpB NQI/1I/FQoGRCyrYlwN/80Ejw1WkwTPPdafWUCchnYHfGEv3zbJ2tMZatfwaS+SgiNw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796133100; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: MIME-Version:Content-Type:Content-Transfer-Encoding:Subject:From:To: Cc:In-Reply-To:References:Date:Message-Id:X-Mailer; bh=7ZSyjDXDYJlS+fU1bTLDgIBEXsmNmL+Ptqq8M1+ebN4=; b=iLbDbTrbjnCQ4g3k2vZJ2i7gxrmLlrZwiBeE3M+j458Zv/q6N4RyAj4uskGT8YUd5n96 tKhFylTg3lxUsKAGhaFXRl8six2HavHBqFRe06zxUAM6ZDLVxHe3oO1lDFDjsG6HZ5lX1 kJkRTjSxvY8azzPJ0ml3e6Z/AcxaLaR4HW3Pqc8uoLfvVMPgLMFsankJo9K9RcZSNSO+8 7NGFy7cMHb1Z4nhm0LUPflDd2H/ClSr9iNgmdSmYaDOpv3/toHGTYUhFW8pKY9W8H4eII 0crjy7xAtagrTDXIV23YS5xhLCzVMkUb+jCOmMNN8EsaHZKRWFa8wVfM+JnVarcZeMA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass header.d=gourry.net header.i=@gourry.net header.a=rsa-sha256 header.s=google header.b=eMNjtpZP; arc=none smtp.remote-ip=209.85.219.41 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 146B5606A327 for ; Tue, 1 Dec 2026 13:51:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 146B5606A327 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.a=rsa-sha256 header.s=google header.b=eMNjtpZP Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-921367ef6b3so85418636d6.0 for ; Tue, 01 Dec 2026 05:51:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1796133098; x=1796737898; darn=vger.kernel.org; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:content-type:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=7ZSyjDXDYJlS+fU1bTLDgIBEXsmNmL+Ptqq8M1+ebN4=; b=eMNjtpZP1/Fehgb7ucHv0jHXJkqI0tx/cKzluKe0cc5pmuV8jaHeaGfAgcMx62nkkE bP1cP9J3KEp0Vp8NZe0yV6NamQkOyB7De4UT65LobUjmsIiAEj7SQyBtn3QlgBCLadct eUXy1Qlugedpc2KcSwzvlcaSgzh+cxFnZRSqibnoZ61VhZueaQfuX3X8qrGPmxlL0qDr WTqEHwMSbbWD2+pMVNqKrOB8vURTWORQk0OGFV4sATz9R91lRIlKZp8Eu8IxHCft9YBF JYsTwvze876HfLt8RqJnP9p2IzWllzHAePVt1a5eKj2ANDU3r07XtiGUQrIlXpKvDW1K T/3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796133098; x=1796737898; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:content-type:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=7ZSyjDXDYJlS+fU1bTLDgIBEXsmNmL+Ptqq8M1+ebN4=; b=ZZU7CTuW9gq7zcKOj6zq6FQq1JV0v13e2kI0hOU2SWBW1HDqY+LenUGxGvuBqk4ePd nW//lJJNMMpHe2izZV0KFgKJTKBTgcM0LueoVDAdhu/oFY5rWhXkhJ+COv2vrywGogTP u/0EphSjbHrGmLsmgCtvsLIoiJrmjzCG/mzHMDnNMLxmtvGFfPxIe4Vk7WlKdI7tMth3 aAEqLLprwgzIGi96+nCgz03nAkcd+K0FoBljuouOPKj7XbqJZT7YsylbaTwk8Mv/3k10 o3vFzEiQ+6BP8kJ3t8QzQ0OR0G4Upb5XwUNixPTcrhnildoTVE23+aFbdrwKX4sCJWBi Qz0w== X-Forwarded-Encrypted: i=1; AL+hErF9tHXRzC4myYshpi5aoG1dBAk02GUYmC0HGFrD5GC9IbJ1PdWK9Bzau/ncJaVDZC9gLD87l6dXaeRlzhI=@vger.kernel.org X-Gm-Message-State: APuU4Z9px8342jt0uiZpoVxBZ87YYt0pkcZ9nNuAmRQ7qUtp0FRl/1Sy BcdcjLDOVEMNBuwzH8HK91izFC7kpy3W46TRgJSeX3XeO/ZOl43AqesQTucAfg6iuck= X-Gm-Gg: AZFdTZcTFiIPKcSj6RDeMuBj+1bcMBL47uy5sOVTQo2NiNhYZv9F7LLIktnwvu33Hl4 v4rNt4Q/K9ElaVcvNk3GdEaJLn6VUWvnCgOu6ZMYqoAg8brhVamfOrrbQiO3TdY80ygELiiGema K7g0auPYZK6PPzYNHDotoyZ6gs1weJX6FhMrbvvFIa0pTFoDnv+ZLgYCvdm5cIanRmSnFg3EEIq MbX8AV9DQVfG/dP8DQxRLWiLVjESQqb1Y1qyalX5n7H8vzyTmQ+QykR49am4ASsoA7pY57R9a/5 1UNP7tlX7nX1dRWIqDnOE+keOO5WQWtxgQu2wM7M7uyC9xWxFIb4AupevtIhnzNHbKefzublOiL /MWQpCkBdxeegiX8YcKtz2qotz9b9o0yKHrpOnMzBJfJZA/64KoAO8kq7izimEssMvFmEeAYE7Y AGEuEimz7a7jfOrc5GEShWGtwhsFjHk/yDq1onUjtJrTi/tgD6xszCWbISDQkog53V2qjMD/T4R fSfvwyzZGWxngNbcGII4NBxJpL2toHoOir9f+pEh8lNa7cJO7Ihj4300DiVc/DLp75alZUr4mvL EJNQhYRCKT4QPv6lZjIYOMVsYhQLoglD50Q4SsgDAKaKwL5lLlbJHx4rYA/iVlwM6RZBK0NnAUa JWBjvkiY= X-Received: by 2002:a05:6214:33c5:b0:921:65e5:5da8 with SMTP id 6a1803df08f44-92165e568e4mr492490846d6.56.1796133098015; Tue, 01 Dec 2026 05:51:38 -0800 (PST) Received: from [192.168.50.231] (pool-71-191-145-202.washdc.fios.verizon.net. [71.191.145.202]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921349f2186sm329255206d6.29.2026.12.01.05.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 05:51:37 -0800 (PST) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: Re: [PATCH 14/32] mm/huge_memory: split huge zero PMDs on unshare faults From: "Gregory Price (Meta)" To: "David Hildenbrand (Arm)" Cc: Hugh Dickins , Baolin Wang , Andrew Morton , Mike Rapoport , Peter Xu , Michal Hocko , Kiryl Shutsemau , Manfred Spraul , Davidlohr Bueso , Cyrill Gorcunov , Zi Yan , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Lorenzo Stoakes , Rik van Riel , Vlastimil Babka , Harry Yoo , Jann Horn , Yang Shi , Zach O'Keefe , Song Liu , David Stevens , Kefeng Wang , Alex Williamson , Suren Baghdasaryan , Dave Jiang , Matthew Wilcox , Miaohe Lin , David Rientjes , Shakeel Butt , Jan Kara , Mel Gorman , Jason Gunthorpe , John Hubbard , Gerd Hoffmann , Vivek Kasireddy , Dave Airlie , Matthew Brost , Joshua Hahn , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Hagen Paul Pfeifer , James Bottomley , Felix Kuehling , Alex Sierra , Balbir Singh , Kairui Song , Qi Zheng , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Oscar Salvador , Muchun Song , Dan Williams , Rakie Kim , Hao Li , Christoph Lameter , Roman Gushchin , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Alexei Starovoitov , Xu Xin , Chengming Zhou , Shivank Garg , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cxl@vger.kernel.org, linux-rt-devel@lists.linux.dev, SJ Park , Chris Mason In-Reply-To: <20261129-fixes_core_3-v1-14-f66094116801@kernel.org> References: <20261129-fixes_core_3-v1-0-f66094116801@kernel.org> <20261129-fixes_core_3-v1-14-f66094116801@kernel.org> Date: Tue, 01 Dec 2026 08:51:35 -0500 Message-Id: <179613309561.412063.10046964756705914254.b4-reply@b4> X-Mailer: b4 0.17-dev On 2026-11-29 11:06 +0100, David Hildenbrand (Arm) wrote: > FAULT_FLAG_UNSHARE breaks COW without making the mapping writable. > Unlike FAULT_FLAG_WRITE, it must leave write protection in place so > that a later write still faults. > > A read-only long-term pin can trigger an unshare fault on a huge zero > PMD. do_huge_zero_wp_pmd() treats it as a write fault: it marks the > replacement THP dirty, makes it writable if the VMA allows writes, and > drops any UFFD write protection. > > Consequently, a later write no longer faults, which, for example, > bypasses UFFD write protection. > > Let's fix it by returning VM_FAULT_FALLBACK for unshare faults, so the > caller splits the PMD. The PTE fault path already handles unsharing > while keeping the mapping read-only and preserving UFFD write protection > and soft-dirty state. > > This has low urgency, as it requires a read-only long-term pin of a huge > zero PMD. No need to CC stable. > > Fixes: 1ced09e0331f ("mm: allocate THP on hugezeropage wp-fault") > Reported-by: Chris Mason > Signed-off-by: David Hildenbrand (Arm) I continue to think UFFD is the un-gift that keeps on un-giving :[ Tested-by: Gregory Price (Meta) Reviewed-by: Gregory Price (Meta) -- ~Gregory