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 1B22533F5A9 for ; Fri, 22 May 2026 23:34:43 +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=1779492885; cv=none; b=hGpR+uhkADjBotRaA6u8+fxayFXtLr2M49oaq39jVzS5v2nTtt9dWGkw8iY2IHrTzvHADJfLcNRFcuvZo5qavAkQg9h6RxrBIFiGXzF8DaCvwq9PhpZ2mdDMSeCNekhvpvkyjIqx04rq64Y2aH1nC+y9JtjNn7cjOWdiXg6eBPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779492885; c=relaxed/simple; bh=1LrG30YOYROPtKzqCisERHK0kD0nx/SbM7Nc2KdbGdo=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=Bz8jRstVQOWlVRjMwX21/mV5OlnxhGJWp4DKvWJ/KXg3DJMUxLva4PMC5SrKQCmwdqykjh2A0NLeYtHne/oYx64Yw/0PNQDmPYfLtnzqnHXsFM51g7JnJWWOzbSTcbDTLA6igCf9lEaywxR1uQbo9iF7a9Qe5UVYVRJT8gr3DAE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ASjnISBR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ASjnISBR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 490F71F000E9; Fri, 22 May 2026 23:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779492883; bh=VMvgSHoc+/iyV82IwnOE+0098QoliehZNh09YdCaJU4=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=ASjnISBRVdytlkUv22NWGncl9MkZpBeA7xDH28klSOewl+lsx+RT++CwsZncnoymM IA4Vj/EXZLQvJtsdDj14vFpeDFtaF2YF2Nd4KZ8zogn/SaHj9D/e7f5NP63lXk0sph nEWKOqWujq4yTYsE+Xp8ODIp6FzCH/uw2V74Rno+CAQ5RsjcgVZLv8cDIaqBLKP8Lu mixAsR4h+0HQoFImZdYqQMYp8MKQkELXVTx5M+zQLlMv4Q9b0BUsgeM/URJtBNBXad Me+BUj2mTfhQP1au1Ui4czGLmPmKo60pzEBJEgujO2U7WKuwF47+v09NOIIaab8ZyW HXV84bfGblnsQ== Date: Fri, 22 May 2026 17:34:41 -0600 (MDT) From: Paul Walmsley To: Austin Kim cc: Paul Walmsley , Palmer Dabbelt , Alexandre Ghiti , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: check leaf entry alignment in pageattr_pxd_entry() In-Reply-To: Message-ID: <1d3c3d6a-dbd2-b56e-5a44-e9aded173d33@kernel.org> References: 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 Hi Austin, On Mon, 20 Apr 2026, Austin Kim wrote: > During page table walking, ensure the range being processed matches > the expected size of a leaf entry (P4D, PUD, or PMD). While pxd_addr_end() > functions handle boundary checks, they do not inherently validate whether > the entry is a leaf node of the expected size. > > Add WARN_ON_ONCE() to detect misalignments or partial updates of huge > pages. If a mismatch is detected, return -EINVAL to prevent potential > corruption of page table entries. > > Signed-off-by: Austin Kim Is this in response to a failure mode that you've seen? Or is it simply prophylactic? Seems like a better place for this might be in common code, so other architectures could benefit as well? - Paul