The first patch sets up AMOR in hypervisor mode. AMOR
needs to be setup before IAMR (details of AMOR/IAMR in
each patch). The second patch enables detection of exceptions
generated due to instruction fetch violations caused
and OOPSs' the task. The third patch enables IAMR for
both hypervisor and guest kernels.
I've tested with patch series with a sample hack and
payload.
Chris Smart helped with the series, reviewing and
providing valuable feedback
Cc: Chris Smart <redacted>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Neuling <redacted>
Cc: Aneesh Kumar K.V <redacted>
Cc: Paul Mackerras <redacted>
Changelog
Enable both primary and secondary MMU's (BUG FIX)
Make the check for instruction violations common (SRR1_ISI_N_OR_G)
Balbir Singh (3):
Setup AMOR in HV mode
Detect instruction fetch denied and report
Enable storage keys for radix - user mode execution
arch/powerpc/mm/fault.c | 4 ++++
arch/powerpc/mm/pgtable-radix.c | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
--
2.5.5
AMOR should be setup in HV mode, we set it up once
and let the generic kernel handle IAMR. This patch is
used to enable storage keys in a following patch as
defined in ISA 3
Reported-by: Aneesh Kumar K.V <redacted>
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/mm/pgtable-radix.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
ISA 3 allows for prevention of instruction fetch and execution
of user mode pages. If such an error occurs, SRR1 bit 35
reports the error. We catch and report the error in do_page_fault()
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/mm/fault.c | 4 ++++
1 file changed, 4 insertions(+)
ISA 3 defines new encoded access authority that allows instruction
access prevention in privileged mode and allows normal access
to problem state. This patch just enables IAMR (Instruction Authority
Mask Register), enabling AMR would require more work.
I've tested this with a buggy driver and a simple payload. The payload
is specific to the build I've tested.
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/mm/pgtable-radix.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
WARNING: arch/powerpc/mm/built-in.o(.text+0xadac): Section mismatch in reference from the function .radix__early_init_mmu_secondary() to the function .init.text:.radix_init_amor()
The function .radix__early_init_mmu_secondary() references
the function __init .radix_init_amor().
This is often because .radix__early_init_mmu_secondary lacks a __init
annotation or the annotation of .radix_init_amor is wrong.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
WARNING: vmlinux.o(.text+0x645f0): Section mismatch in reference from the function .radix__early_init_mmu_secondary() to the function .init.text:.radix_init_iamr()
The function .radix__early_init_mmu_secondary() references
the function __init .radix_init_iamr().
This is often because .radix__early_init_mmu_secondary lacks a __init
annotation or the annotation of .radix_init_iamr is wrong.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation