From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B6B842D770 for ; Mon, 27 Jul 2026 18:35:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785177333; cv=none; b=CAMyH/52Xfwj1+oAE17KOiedPhNr7cRGs0F+Qrdp4sCL+Pr8GKOoo1x/Xk6AQbLIpVKBxmWnxHtWKWyyFjbhQXNBbYxjWIeTl3ixr/EMo6M1We9kIXGNIMJeJOgSNi6MH1ii9LtieYKz2Pf19QXF4tvPfqPOZdDmPes1B9ab9y4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785177333; c=relaxed/simple; bh=xlzB8HQBSRYMuy0xKVt3lbe1UF57n2ysO4A4GDNiVvI=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=SLLIJJbHgVHaIdNTpWotrws4mH0/RHnTyPN5my1Vj+90btvjmax7hKk5tKmKwlnOqCu4vcDijPjEXp/tOVuIwQHG9OZ0zfXPeib97ll+PMTVD7IALSnuL59cIK4H32f30Kp6xr+ZKzkN4/Ev+orcYw9JtwXQ35Ian0ZgOvLVum8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=p6tOrDOn; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="p6tOrDOn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ABF41F000E9; Mon, 27 Jul 2026 18:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1785177331; bh=ViR6DC/ZvgzwYbu96XsomABAIBwdE5dXzIiaRXSJtpI=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=p6tOrDOnq9TjYLbCW+1lE+T/5SWNyB5fpetZ4Nf2WdIKeCWCVA/e05WnfeNKX1Gmt UrXdMhCwKUcph6svYM+yL3QGbrzOuQwWZxcmJKs9umRexTqsKt92PoLTVM5iUIgDpD 8v0zrIz64eQ5WTULfU5ERZwUEsOePmTNevotOKQI= Date: Mon, 27 Jul 2026 11:35:30 -0700 From: Andrew Morton To: Xueyuan Chen Cc: linux-mm@kvack.org, david@kernel.org, ljs@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, peterz@infradead.org, lance.yang@linux.dev, usama.arif@linux.dev, jannh@google.com, yang@os.amperecomputing.com, rppt@kernel.org, ziy@nvidia.com, baolin.wang@linux.alibaba.com, liam@infradead.org, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org Subject: Re: [PATCH v5 0/3] mm: make persistent huge zero folio read-only Message-Id: <20260727113530.5cd347581a66b3279490a604@linux-foundation.org> In-Reply-To: <20260727143426.1077133-1-xueyuan.chen21@gmail.com> References: <20260727143426.1077133-1-xueyuan.chen21@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 27 Jul 2026 22:34:23 +0800 Xueyuan Chen wrote: > The persistent huge zero folio is shared globally and should stay zero > after initialization. As Jann Horn pointed out[1], kernel bugs have ended > up writing to pages that were meant to be read-only, including in > security-sensitive cases. Making the folio read-only in the direct map > turns such writes into faults instead of silent zero-page corruption. > > This series adds set_direct_map_ro_noflush() so mm code can make a > direct-map range read-only, then uses it for the persistent huge zero > folio. The helper is direct-map specific, takes an address-based range as > discussed for set_direct_map* helpers[2], and leaves TLB invalidation to > the caller. Thanks. AI review asked about a few things, some pre-existing. Includes a possible pre-existing ARM barrier issue in arch/arm64/mm/pageattr.c https://sashiko.dev/#/patchset/20260727143426.1077133-1-xueyuan.chen21@gmail.com