From: Mike Rapoport <rppt@linux.ibm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@kernel.org,
kirill@shutemov.name, kirill.shutemov@linux.intel.com,
vbabka@suse.cz, will.deacon@arm.com, catalin.marinas@arm.com,
dave.hansen@intel.com
Subject: Re: [RFC 1/4] mm: Introduce lazy exec permission setting on a page
Date: Thu, 14 Feb 2019 11:06:29 +0200 [thread overview]
Message-ID: <20190214090628.GB9063@rapoport-lnx> (raw)
In-Reply-To: <19b85484-e76b-3ef0-b013-49efa87917ae@arm.com>
On Wed, Feb 13, 2019 at 07:23:18PM +0530, Anshuman Khandual wrote:
>
>
> On 02/13/2019 06:47 PM, Matthew Wilcox wrote:
> > On Wed, Feb 13, 2019 at 01:36:28PM +0530, Anshuman Khandual wrote:
> >> +#ifdef CONFIG_ARCH_SUPPORTS_LAZY_EXEC
> >> +static inline pte_t maybe_mkexec(pte_t entry, struct vm_area_struct *vma)
> >> +{
> >> + if (unlikely(vma->vm_flags & VM_EXEC))
> >> + return pte_mkexec(entry);
> >> + return entry;
> >> +}
> >> +#else
> >> +static inline pte_t maybe_mkexec(pte_t entry, struct vm_area_struct *vma)
> >> +{
> >> + return entry;
> >> +}
> >> +#endif
> >
> >> +++ b/mm/memory.c
> >> @@ -2218,6 +2218,8 @@ static inline void wp_page_reuse(struct vm_fault *vmf)
> >> flush_cache_page(vma, vmf->address, pte_pfn(vmf->orig_pte));
> >> entry = pte_mkyoung(vmf->orig_pte);
> >> entry = maybe_mkwrite(pte_mkdirty(entry), vma);
> >> + if (vmf->flags & FAULT_FLAG_INSTRUCTION)
> >> + entry = maybe_mkexec(entry, vma);
> >
> > I don't understand this bit. We have a fault based on an instruction
> > fetch. But we're only going to _maybe_ set the exec bit? Why not call
> > pte_mkexec() unconditionally?
>
> Because the arch might not have subscribed to this in which case the fall
> back function does nothing and return the same entry. But in case this is
> enabled it also checks for VMA exec flag (VM_EXEC) before calling into
> pte_mkexec() something similar to existing maybe_mkwrite().
Than why not pass vmf->flags to maybe_mkexec() so that only arches
subscribed to this will have the check for 'flags & FAULT_FLAG_INSTRUCTION' ?
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2019-02-14 9:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-13 8:06 [RFC 0/4] " Anshuman Khandual
2019-02-13 8:06 ` [RFC 1/4] " Anshuman Khandual
2019-02-13 13:17 ` Matthew Wilcox
2019-02-13 13:53 ` Anshuman Khandual
2019-02-14 9:06 ` Mike Rapoport [this message]
2019-02-15 8:11 ` Anshuman Khandual
2019-02-15 9:49 ` Catalin Marinas
2019-02-13 8:06 ` [RFC 2/4] arm64/mm: Identify user level instruction faults Anshuman Khandual
2019-02-13 8:06 ` [RFC 3/4] arm64/mm: Allow non-exec to exec transition in ptep_set_access_flags() Anshuman Khandual
2019-02-13 8:06 ` [RFC 4/4] arm64/mm: Enable ARCH_SUPPORTS_LAZY_EXEC Anshuman Khandual
2019-02-13 11:21 ` [RFC 0/4] mm: Introduce lazy exec permission setting on a page Catalin Marinas
2019-02-13 15:38 ` Michal Hocko
2019-02-14 6:04 ` Anshuman Khandual
2019-02-14 8:38 ` Michal Hocko
2019-02-14 10:19 ` Catalin Marinas
2019-02-14 12:28 ` Michal Hocko
2019-02-15 8:45 ` Anshuman Khandual
2019-02-15 9:27 ` Michal Hocko
2019-02-18 3:07 ` Anshuman Khandual
2019-02-14 15:38 ` Dave Hansen
2019-02-18 3:19 ` Anshuman Khandual
2019-02-13 15:44 ` Dave Hansen
2019-02-14 4:12 ` Anshuman Khandual
2019-02-14 16:55 ` Dave Hansen
2019-02-18 8:31 ` Anshuman Khandual
2019-02-18 9:04 ` Catalin Marinas
2019-02-18 9:16 ` Anshuman Khandual
2019-02-18 18:20 ` Dave Hansen
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=20190214090628.GB9063@rapoport-lnx \
--to=rppt@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=vbabka@suse.cz \
--cc=will.deacon@arm.com \
--cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox