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 | 22 ++++++++++++++++++++++
1 file changed, 22 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.
Don't we need to do them in hypervisor mode. Ie, the hypervisor setup
things such that guest privileged mode cannot execute guest userspace.
quoted hunk
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 | 22 ++++++++++++++++++++++
1 file changed, 22 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()
But what does the error mean ? A buggy application ? IIUC, it indicate a
buggy kernel isn't it ?. So should we kill the application or panic() ?
On Mon, Aug 22, 2016 at 11:35:36AM +0530, Aneesh Kumar K.V wrote:
Balbir Singh [off-list ref] writes:
quoted
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()
But what does the error mean ? A buggy application ? IIUC, it indicate a
buggy kernel isn't it ?. So should we kill the application or panic() ?
We oops.. basically we get a kernel fault. We handle it the same way
we handle other kernel faults.
On Mon, Aug 22, 2016 at 11:32:44AM +0530, Aneesh Kumar K.V wrote:
Balbir Singh [off-list ref] writes:
quoted
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.
Don't we need to do them in hypervisor mode. Ie, the hypervisor setup
things such that guest privileged mode cannot execute guest userspace.
Yes, true!
quoted
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 | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
You are right, I should split the AMOR initialization
to be HV only. IAMR is saved/restored during guest exit/entry.
So, the AMOR initialization needs to move.
I'll post a v2
Balbir Singh.
We shouldn't need the #ifdef, radix_enabled() will be false.
+ if (radix_enabled() && regs->msr & PPC_BIT(35))
+ goto bad_area;
Is it really architected as radix only?
Personally I dislike PPC_BIT(), I'd rather you just used 0x10000000. That way
when I'm staring at a register dump I have some chance of spotting that mask.
Also brackets around the bitwise & would make me feel more comfortable.
cheers
We shouldn't need the #ifdef, radix_enabled() will be false.
quoted
+ if (radix_enabled() && regs->msr & PPC_BIT(35))
+ goto bad_area;
Is it really architected as radix only?
Personally I dislike PPC_BIT(), I'd rather you just used 0x10000000. That way
when I'm staring at a register dump I have some chance of spotting that mask.
Also brackets around the bitwise & would make me feel more comfortable.
cheers