Skip to content

Commit 0f0c7c1

Browse files
Ard BiesheuvelAlex Shi
authored andcommitted
arm64: enable CONFIG_DEBUG_RODATA by default
In spite of its name, CONFIG_DEBUG_RODATA is an important hardening feature for production kernels, and distros all enable it by default in their kernel configs. However, since enabling it used to result in more granular, and thus less efficient kernel mappings, it is not enabled by default for performance reasons. However, since commit 2f39b5f91eb4 ("arm64: mm: Mark .rodata as RO"), the various kernel segments (.text, .rodata, .init and .data) are already mapped individually, and the only effect of setting CONFIG_DEBUG_RODATA is that the existing .text and .rodata mappings are updated late in the boot sequence to have their read-only attributes set, which means that any performance concerns related to enabling CONFIG_DEBUG_RODATA are no longer valid. So from now on, make CONFIG_DEBUG_RODATA default to 'y' Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit 57efac2f7108e3255d0dfe512290c9896f4ed55f) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent 2780600 commit 0f0c7c1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/arm64/Kconfig.debug

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ config DEBUG_SET_MODULE_RONX
6464

6565
config DEBUG_RODATA
6666
bool "Make kernel text and rodata read-only"
67+
default y
6768
help
6869
If this is set, kernel text and rodata will be made read-only. This
6970
is to help catch accidental or malicious attempts to change the
70-
kernel's executable code. Additionally splits rodata from kernel
71-
text so it can be made explicitly non-executable.
71+
kernel's executable code.
7272

73-
If in doubt, say Y
73+
If in doubt, say Y
7474

7575
config DEBUG_ALIGN_RODATA
7676
depends on DEBUG_RODATA

0 commit comments

Comments
 (0)