Skip to content

Commit 2081b3b

Browse files
ardbiesheuvelctmarinas
authored andcommitted
arm64: fix rodata=full again
Commit 2e8cff0 ("arm64: fix rodata=full") addressed a couple of issues with the rodata= kernel command line option, which is not a simple boolean on arm64, and inadvertently got broken due to changes in the generic bool handling. Unfortunately, the resulting code never clears the rodata_full boolean variable if it defaults to true and rodata=on or rodata=off is passed, as the generic code is not aware of the existence of this variable. Given the way this code is plumbed together, clearing rodata_full when returning false from arch_parse_debug_rodata() may result in inconsistencies if the generic code decides that it cannot parse the right hand side, so the best way to deal with this is to only take rodata_full in account if rodata_enabled is also true. Fixes: 2e8cff0 ("arm64: fix rodata=full") Cc: <stable@vger.kernel.org> # 6.0.x Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20221103170015.4124426-1-ardb@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 85f1506 commit 2081b3b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/arm64/mm/pageattr.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bool can_set_direct_map(void)
2626
* mapped at page granularity, so that it is possible to
2727
* protect/unprotect single pages.
2828
*/
29-
return rodata_full || debug_pagealloc_enabled() ||
29+
return (rodata_enabled && rodata_full) || debug_pagealloc_enabled() ||
3030
IS_ENABLED(CONFIG_KFENCE);
3131
}
3232

@@ -102,7 +102,8 @@ static int change_memory_common(unsigned long addr, int numpages,
102102
* If we are manipulating read-only permissions, apply the same
103103
* change to the linear mapping of the pages that back this VM area.
104104
*/
105-
if (rodata_full && (pgprot_val(set_mask) == PTE_RDONLY ||
105+
if (rodata_enabled &&
106+
rodata_full && (pgprot_val(set_mask) == PTE_RDONLY ||
106107
pgprot_val(clear_mask) == PTE_RDONLY)) {
107108
for (i = 0; i < area->nr_pages; i++) {
108109
__change_memory_common((u64)page_address(area->pages[i]),

0 commit comments

Comments
 (0)