Skip to content

Commit e5efd56

Browse files
Dev Jainctmarinas
authored andcommitted
arm64/pageattr: Propagate return value from __change_memory_common
The rodata=on security measure requires that any code path which does vmalloc -> set_memory_ro/set_memory_rox must protect the linear map alias too. Therefore, if such a call fails, we must abort set_memory_* and caller must take appropriate action; currently we are suppressing the error, and there is a real chance of such an error arising post commit a166563 ("arm64: mm: support large block mapping when rodata=full"). Therefore, propagate any error to the caller. Fixes: a166563 ("arm64: mm: support large block mapping when rodata=full") Signed-off-by: Dev Jain <dev.jain@arm.com> Reviewed-by: Ryan Roberts <ryan.roberts@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 3a86608 commit e5efd56

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

arch/arm64/mm/pageattr.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ static int change_memory_common(unsigned long addr, int numpages,
148148
unsigned long size = PAGE_SIZE * numpages;
149149
unsigned long end = start + size;
150150
struct vm_struct *area;
151+
int ret;
151152
int i;
152153

153154
if (!PAGE_ALIGNED(addr)) {
@@ -185,8 +186,10 @@ static int change_memory_common(unsigned long addr, int numpages,
185186
if (rodata_full && (pgprot_val(set_mask) == PTE_RDONLY ||
186187
pgprot_val(clear_mask) == PTE_RDONLY)) {
187188
for (i = 0; i < area->nr_pages; i++) {
188-
__change_memory_common((u64)page_address(area->pages[i]),
189+
ret = __change_memory_common((u64)page_address(area->pages[i]),
189190
PAGE_SIZE, set_mask, clear_mask);
191+
if (ret)
192+
return ret;
190193
}
191194
}
192195

0 commit comments

Comments
 (0)