Bug 215621

Summary: Warning: Unable to mark rodata read only on this CPU. (PPC970MP)
Product: Platform Specific/Hardware Reporter: Erhard F. (erhard_f)
Component: PPC-64Assignee: platform_ppc-64
Status: RESOLVED INVALID    
Severity: normal CC: christophe.leroy
Priority: P1    
Hardware: PPC-64   
OS: Linux   
Kernel Version: 5.17-rc4 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg (5.17-rc4, PowerMac G5 11,2)
kernel .config (5.17-rc4, PowerMac G5 11,2)

Description Erhard F. 2022-02-19 01:04:16 UTC
Created attachment 300482 [details]
dmesg (5.17-rc4, PowerMac G5 11,2)

STRICT_MODULE_RWX is enabled in kernel but it does not seem to work on my PowerMac G5 11,2.

Kernel dmesg says:
[...]
Freeing unused kernel image (initmem) memory: 3968K
Warning: Unable to mark rodata read only on this CPU.
rodata_test: test data was not read only
[...]


 # lscpu 
Architecture:          ppc64
  CPU op-mode(s):      32-bit, 64-bit
  Byte Order:          Big Endian
CPU(s):                2
  On-line CPU(s) list: 0,1
Model name:            PPC970MP, altivec supported
  Model:               1.1 (pvr 0044 0101)
  Thread(s) per core:  1
  Core(s) per socket:  2
  Socket(s):           1
  CPU max MHz:         2300.0000
  CPU min MHz:         1150.0000
Caches (sum of all):   
  L1d:                 64 KiB (2 instances)
  L1i:                 128 KiB (2 instances)
  L2:                  2 MiB (2 instances)
NUMA:                  
  NUMA node(s):        1
  NUMA node0 CPU(s):   0,1
Vulnerabilities:       
  Itlb multihit:       Not affected
  L1tf:                Vulnerable
  Mds:                 Not affected
  Meltdown:            Vulnerable
  Spec store bypass:   Vulnerable
  Spectre v1:          Mitigation; __user pointer sanitization
  Spectre v2:          Vulnerable
  Srbds:               Not affected
  Tsx async abort:     Not affected
Comment 1 Erhard F. 2022-02-19 01:04:49 UTC
Created attachment 300483 [details]
kernel .config (5.17-rc4, PowerMac G5 11,2)
Comment 2 Christophe Leroy 2022-02-20 16:38:59 UTC
Look at https://elixir.bootlin.com/linux/v5.17-rc4/source/arch/powerpc/kernel/cputable.c#L196 at you'll see that your processor has .mmu_features = MMU_FTRS_PPC970

Then you see at https://elixir.bootlin.com/linux/v5.17-rc4/source/arch/powerpc/include/asm/mmu.h#L135 that MMU_FTRS_PPC970 doesn't include MMU_FTR_KERNEL_RO.

MMU_FTR_KERNEL_RO is in POWER6.

In commit 984d7a1ec67c ("powerpc/mm: Fixup kernel read only mapping") you see that this feature appears in ISA 2.04.

Previous version of ISA only has PP bits which only provides RW for kernel pages.

So this bug is not a bug, it's a limitation of PPC970MP, and the warning in dmesg is there to warn you that allthough you have select CONFIG_STRICT_KERNEL_RWX, this CPU doesn't support it.

And for the same reason, CONFIG_STRICT_MODULE_RWX doesn't work either.
Comment 3 Erhard F. 2022-02-20 18:10:22 UTC
Erm ok, so it seems I did not check this thoroughly...

If MMU_FTRS_PPC970 doesn't provide MMU_FTR_KERNEL_RO then perhaps CONFIG_STRICT_KERNEL_RWX can be skipped in the .config so it can't be wrongly selected?

Anyhow you are correct that this is not a bug. Thanks for the background!
Comment 4 Christophe Leroy 2022-02-21 06:55:00 UTC
It is up to you to unselect CONFIG_STRICT_KERNEL_RWX.

The kernel is usually built to boot on any PPC64 processors, so we can't forbid the selection of CONFIG_STRICT_KERNEL_RWX.