Skip to content

Commit 5a82223

Browse files
dwmw2Ingo Molnar
authored andcommitted
x86/kexec: Mark relocate_kernel page as ROX instead of RWX
All writes to the page now happen before it gets marked as executable (or after it's already switched to the identmap page tables where it's OK to be RWX). Signed-off-by: David Woodhouse <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Baoquan He <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Dave Young <[email protected]> Cc: Eric Biederman <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 93e489a commit 5a82223

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kernel/machine_kexec_64.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ int machine_kexec_prepare(struct kimage *image)
323323

324324
__memcpy(control_page, __relocate_kernel_start, reloc_end - reloc_start);
325325

326-
set_memory_x((unsigned long)control_page, 1);
326+
set_memory_rox((unsigned long)control_page, 1);
327327

328328
return 0;
329329
}
@@ -333,6 +333,7 @@ void machine_kexec_cleanup(struct kimage *image)
333333
void *control_page = page_address(image->control_code_page);
334334

335335
set_memory_nx((unsigned long)control_page, 1);
336+
set_memory_rw((unsigned long)control_page, 1);
336337

337338
free_transition_pgtable(image);
338339
}

0 commit comments

Comments
 (0)