Re: [PATCH v2] arm64: pageattr: Explicitly bail out when changing permissions for vmalloc_huge mappings

From: Gavin Shan
Date: Fri Apr 04 2025 - 05:44:25 EST


On 4/3/25 3:28 PM, Dev Jain wrote:
arm64 uses apply_to_page_range to change permissions for kernel vmalloc mappings,
which does not support changing permissions for block mappings. This function
will change permissions until it encounters a block mapping, and will bail
out with a warning. Since there are no reports of this triggering, it
implies that there are currently no cases of code doing a vmalloc_huge()
followed by partial permission change. But this is a footgun waiting to
go off, so let's detect it early and avoid the possibility of permissions
in an intermediate state. So, explicitly disallow changing permissions
for VM_ALLOW_HUGE_VMAP mappings.

Reviewed-by: Ryan Roberts <ryan.roberts@xxxxxxx>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
---
v1->v2:
- Improve changelog, keep mention of page mappings in comment

arch/arm64/mm/pageattr.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)


Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>