All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Balbir Singh <bsingharora@gmail.com>, linuxppc-dev@ozlabs.org
Cc: aneesh.kumar@linux.vnet.ibm.com, Balbir Singh <bsingharora@gmail.com>
Subject: Re: [powerpc v5 2/3] Detect instruction fetch denied and report
Date: Tue, 15 Nov 2016 13:39:16 +1100	[thread overview]
Message-ID: <87eg2dzctn.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <1479125778-18496-3-git-send-email-bsingharora@gmail.com>

Balbir Singh <bsingharora@gmail.com> writes:

> 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(+)
>
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index d0b137d..1e7ff7b 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -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))))
>  			goto bad_area;
> +
> +		if (regs->msr & SRR1_ISI_N_OR_G)
> +			goto bad_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

  reply	other threads:[~2016-11-15  2:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 12:16 [powerpc v5 0/3] Enable IAMR storage keys for radix Balbir Singh
2016-11-14 12:16 ` [powerpc v5 1/3] Setup AMOR in HV mode Balbir Singh
2016-11-14 12:16 ` [powerpc v5 2/3] Detect instruction fetch denied and report Balbir Singh
2016-11-15  2:39   ` Michael Ellerman [this message]
2016-11-14 12:16 ` [powerpc v5 3/3] Enable storage keys for radix - user mode execution Balbir Singh
2016-11-15  2:40 ` [powerpc v5 0/3] Enable IAMR storage keys for radix Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eg2dzctn.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=bsingharora@gmail.com \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.