From: Will Deacon <will@kernel.org>
To: Vladimir Murzin <vladimir.murzin@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
linux-arm-kernel@lists.infradead.org, keescook@chromium.org,
dave.martin@arm.com
Subject: Re: [PATCH v3 1/2] arm64: Support execute-only permissions with Enhanced PAN
Date: Fri, 12 Mar 2021 11:20:28 +0000 [thread overview]
Message-ID: <20210312112028.GC32208@willie-the-truck> (raw)
In-Reply-To: <2424c35d-3e88-de1e-89b6-11439f1d15c6@arm.com>
On Fri, Mar 12, 2021 at 11:19:02AM +0000, Vladimir Murzin wrote:
> On 1/26/21 12:23 PM, Will Deacon wrote:
> > On Tue, Jan 26, 2021 at 12:05:42PM +0000, Catalin Marinas wrote:
> >> On Tue, Jan 26, 2021 at 11:03:06AM +0000, Will Deacon wrote:
> >>> On Tue, Jan 19, 2021 at 04:07:22PM +0000, Vladimir Murzin wrote:
> >>>> #define pte_valid_not_user(pte) \
> >>>> - ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID)
> >>>> + ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == (PTE_VALID | PTE_UXN))
> >>>> #define pte_valid_user(pte) \
> >>>> ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER))
> >>>
> >>> Won't pte_valid_user() go wrong for exec-only mappings now?
> >>
> >> I wondered about the same in November (and reproducing my comment
> >> below):
> >>
> >> https://lore.kernel.org/linux-arm-kernel/20201119182236.GN4376@gaia/
> >>
> >> pte_valid_user() checks for both PTE_VALID and PTE_USER. In theory, a
> >> !PTE_UXN is also user-accessible but it's only used in gup_pte_range()
> >> via pte_access_permitted(). If "access" in the latter means only
> >> read/write, we should be ok. If we keep it as is, a comment would
> >> be useful.
> >
> > I think we should ensure that:
> >
> > pte_valid(pte) && (pte_valid_not_user(pte) || pte_valid_user(pte))
> >
> > is always true, but I don't think it is after this patch. It reminds me
> > of some of the tests that Anshuman wrote.
>
> Something like
>
> /*
> * Most of user mappings would have PTE_USER bit set except Execute-only
> * where both PTE_USER and PTE_UXN bits not set
> */
> #define pte_valid_user(pte) \
> (((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER)) || \
> ((pte_val(pte) & (PTE_VALID | PTE_UXN)) == PTE_VALID))
Yeah, assuming the compiler doesn't make a dog's dinner of it.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-03-12 11:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-19 16:07 [PATCH v3 0/2] arm64: Support Enhanced PAN Vladimir Murzin
2021-01-19 16:07 ` [PATCH v3 1/2] arm64: Support execute-only permissions with " Vladimir Murzin
2021-01-26 11:03 ` Will Deacon
2021-01-26 12:05 ` Catalin Marinas
2021-01-26 12:23 ` Will Deacon
2021-03-12 11:19 ` Vladimir Murzin
2021-03-12 11:20 ` Will Deacon [this message]
2021-03-12 12:23 ` Catalin Marinas
2021-03-12 11:17 ` Vladimir Murzin
2021-01-19 16:07 ` [PATCH v3 2/2] arm64: Introduce HWCAPS2_EXECONLY Vladimir Murzin
2021-01-26 11:07 ` Will Deacon
2021-01-26 11:09 ` [PATCH v3 0/2] arm64: Support Enhanced PAN Will Deacon
2021-03-12 11:18 ` Vladimir Murzin
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=20210312112028.GC32208@willie-the-truck \
--to=will@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=dave.martin@arm.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=vladimir.murzin@arm.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