Skip to content

Commit 213056d

Browse files
anthraxxawcurless
authored andcommitted
Revert "mark kernel_set_to_readonly as __ro_after_init"
This reverts commit 296db04. CPA conflicts detected when marking kernel_set_to_readonly as __ro_after_init #4
1 parent c97fcea commit 213056d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

arch/x86/mm/init_32.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ int arch_remove_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap)
872872
#endif
873873
#endif
874874

875-
int kernel_set_to_readonly __ro_after_init;
875+
int kernel_set_to_readonly __read_mostly;
876876

877877
void set_kernel_text_rw(void)
878878
{
@@ -924,11 +924,12 @@ void mark_rodata_ro(void)
924924
unsigned long start = PFN_ALIGN(_text);
925925
unsigned long size = (unsigned long)__end_rodata - start;
926926

927-
kernel_set_to_readonly = 1;
928927
set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
929928
pr_info("Write protecting kernel text and read-only data: %luk\n",
930929
size >> 10);
931930

931+
kernel_set_to_readonly = 1;
932+
932933
#ifdef CONFIG_CPA_DEBUG
933934
pr_info("Testing CPA: Reverting %lx-%lx\n", start, start + size);
934935
set_pages_rw(virt_to_page(start), size >> PAGE_SHIFT);

arch/x86/mm/init_64.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ void __init mem_init(void)
12011201
mem_init_print_info(NULL);
12021202
}
12031203

1204-
int kernel_set_to_readonly __ro_after_init;
1204+
int kernel_set_to_readonly;
12051205

12061206
void set_kernel_text_rw(void)
12071207
{
@@ -1250,9 +1250,10 @@ void mark_rodata_ro(void)
12501250

12511251
printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
12521252
(end - start) >> 10);
1253-
kernel_set_to_readonly = 1;
12541253
set_memory_ro(start, (end - start) >> PAGE_SHIFT);
12551254

1255+
kernel_set_to_readonly = 1;
1256+
12561257
/*
12571258
* The rodata/data/bss/brk section (but not the kernel text!)
12581259
* should also be not-executable.

0 commit comments

Comments
 (0)