From: Thiago Jung Bauermann <bauerman@linux.ibm.com>
To: Ram Pai <linuxram@us.ibm.com>
Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org,
benh@kernel.crashing.org, paulus@samba.org,
aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com,
hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com,
msuchanek@suse.com, Ulrich.Weigand@de.ibm.com,
dave.hansen@intel.com, Shakeel Butt <shakeelb@google.com>
Subject: Re: [PATCH ] powerpc/pkeys: Detach execute_only key on !PROT_EXEC
Date: Mon, 21 May 2018 22:42:23 -0300 [thread overview]
Message-ID: <87wovwea9s.fsf@morokweng.localdomain> (raw)
In-Reply-To: <1525464111-1096-1-git-send-email-linuxram@us.ibm.com>
Ram Pai <linuxram@us.ibm.com> writes:
> Disassociate the exec_key from a VMA if the VMA permission is not
> PROT_EXEC anymore. Otherwise the exec_only key continues to be
> associated with the vma, causing unexpected behavior.
>
> The problem was reported on x86 by Shakeel Butt,
> which is also applicable on powerpc.
>
> cc: Shakeel Butt <shakeelb@google.com>
> Reported-by: Shakeel Butt <shakeelb@google.com>
> Fixes 5586cf6 ("powerpc: introduce execute-only pkey")
^
Missing a colon here.
> Signed-off-by: Ram Pai <linuxram@us.ibm.com>
> ---
> arch/powerpc/mm/pkeys.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c
> index e81d59e..fdeb9f5 100644
> --- a/arch/powerpc/mm/pkeys.c
> +++ b/arch/powerpc/mm/pkeys.c
> @@ -425,9 +425,9 @@ int __arch_override_mprotect_pkey(struct vm_area_struct *vma, int prot,
> {
> /*
> * If the currently associated pkey is execute-only, but the requested
> - * protection requires read or write, move it back to the default pkey.
> + * protection is not execute-only, move it back to the default pkey.
> */
> - if (vma_is_pkey_exec_only(vma) && (prot & (PROT_READ | PROT_WRITE)))
> + if (vma_is_pkey_exec_only(vma) && (prot != PROT_EXEC))
> return 0;
>
> /*
I think I'm slow today. It took me a while to figure out why this is
buggy. It will leave the VMA with the execute-only pkey if prot = 0.
Other bit combinations work fine IIUC.
Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
--
Thiago Jung Bauermann
IBM Linux Technology Center
next prev parent reply other threads:[~2018-05-22 1:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-04 20:01 [PATCH ] powerpc/pkeys: Detach execute_only key on !PROT_EXEC Ram Pai
2018-05-22 1:42 ` Thiago Jung Bauermann [this message]
2018-06-05 15:19 ` 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=87wovwea9s.fsf@morokweng.localdomain \
--to=bauerman@linux.ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=bauerman@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=bsingharora@gmail.com \
--cc=dave.hansen@intel.com \
--cc=hbabu@us.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=linuxram@us.ibm.com \
--cc=mhocko@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=msuchanek@suse.com \
--cc=paulus@samba.org \
--cc=shakeelb@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox