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
Changelog
Remove __init annotation for iamr and amor init
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(+)
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-11-15 02:39:16
Balbir Singh [off-list ref] writes:
quoted hunk
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(+)
@@ -404,6 +404,10 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,(cpu_has_feature(CPU_FTR_NOEXECUTE)||!(vma->vm_flags&(VM_READ|VM_WRITE))))gotobad_area;++if(regs->msr&SRR1_ISI_N_OR_G)+gotobad_area;
Can you move that check above the more complicated check. It shouldn't
change anything in practice, but makes it easier to follow the code
because the easy cases can be discarded.
cheers
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-11-15 02:40:12
Balbir Singh [off-list ref] writes:
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
Changelog
Remove __init annotation for iamr and amor init
Balbir Singh (3):
Setup AMOR in HV mode
Enable storage keys for radix - user mode execution