]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
arm64: mm: Rework the 'rodata=' options
authorHuang Shijie <shijie@os.amperecomputing.com>
Tue, 9 Sep 2025 03:32:35 +0000 (11:32 +0800)
committerWill Deacon <will@kernel.org>
Tue, 16 Sep 2025 19:53:13 +0000 (20:53 +0100)
As per admin guide documentation, "rodata=on" should be the default on
platforms. Documentation/admin-guide/kernel-parameters.txt describes
these options as

   rodata=         [KNL,EARLY]
           on      Mark read-only kernel memory as read-only (default).
           off     Leave read-only kernel memory writable for debugging.
           full    Mark read-only kernel memory and aliases as read-only
                   [arm64]

But on arm64 platform, RODATA_FULL_DEFAULT_ENABLED is enabled by default,
so "rodata=full" is the default instead.

For parity with other architectures, namely x86, rework 'rodata=on' to
match the current "full" behaviour and replace 'rodata=full' with a new
'rodata=noalias' option which retains writable aliases in the direct map
for memory regions outside of the kernel image.

Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
Documentation/admin-guide/kernel-parameters.txt
arch/arm64/include/asm/setup.h

index 747a55abf4946bb9efe320f0f62fdcd1560b0a71..fe99652c584ec85cf8115e08ad9e06c5ee0a5b1e 100644 (file)
        rodata=         [KNL,EARLY]
                on      Mark read-only kernel memory as read-only (default).
                off     Leave read-only kernel memory writable for debugging.
-               full    Mark read-only kernel memory and aliases as read-only
-                       [arm64]
+               noalias Mark read-only kernel memory as read-only but retain
+                       writable aliases in the direct map for regions outside
+                       of the kernel image. [arm64]
 
        rockchip.usb_uart
                        [EARLY]
index ba269a7a32013454215acbb444fa70b931bb971b..3d96dde4d214cbf27ec47a67ff09b8e3920e1ce3 100644 (file)
@@ -21,7 +21,7 @@ static inline bool arch_parse_debug_rodata(char *arg)
        if (!arg)
                return false;
 
-       if (!strcmp(arg, "full")) {
+       if (!strcmp(arg, "on")) {
                rodata_enabled = rodata_full = true;
                return true;
        }
@@ -31,7 +31,7 @@ static inline bool arch_parse_debug_rodata(char *arg)
                return true;
        }
 
-       if (!strcmp(arg, "on")) {
+       if (!strcmp(arg, "noalias")) {
                rodata_enabled = true;
                rodata_full = false;
                return true;