From: "Jan Beulich" <JBeulich@suse.com>
To: "Andrey Ryabinin" <aryabinin@virtuozzo.com>
Cc: <bp@alien8.de>, <brgerst@gmail.com>, <dvyukov@google.com>,
<glider@google.com>, <peterz@infradead.org>, <luto@kernel.org>,
<mingo@kernel.org>, <tglx@linutronix.de>,
<torvalds@linux-foundation.org>, <boris.ostrovsky@oracle.com>,
<dvlasenk@redhat.com>, <jpoimboe@redhat.com>,
"Juergen Gross" <jgross@suse.com>, <linux-kernel@vger.kernel.org>,
<linux-tip-commits@vger.kernel.org>, <hpa@zytor.com>
Subject: Re: [tip:x86/mm] x86/mm: Consider effective protection attributes in W+X check
Date: Mon, 26 Feb 2018 03:54:22 -0700 [thread overview]
Message-ID: <5A93F56E02000078001ABA78@prv-mh.provo.novell.com> (raw)
In-Reply-To: <702b0f08-57a6-0ee0-d2e1-1310c00351e6@virtuozzo.com>
>>> On 26.02.18 at 11:47, <aryabinin@virtuozzo.com> wrote:
>
> On 02/26/2018 01:08 PM, Jan Beulich wrote:
>>>>> On 26.02.18 at 11:00, <aryabinin@virtuozzo.com> wrote:
>>> On 02/26/2018 11:48 AM, tip-bot for Jan Beulich wrote:
>>>> @@ -351,7 +362,7 @@ static inline bool kasan_page_table(struct seq_file *m,
> struct pg_state *st,
>>>> (pgtable_l5_enabled && __pa(pt) == __pa(kasan_zero_p4d)) ||
>>>> __pa(pt) == __pa(kasan_zero_pud)) {
>>>> pgprotval_t prot = pte_flags(kasan_zero_pte[0]);
>>>> - note_page(m, st, __pgprot(prot), 5);
>>>> + note_page(m, st, __pgprot(prot), 0, 5);
>>>
>>> Isn't this disables W+X check for kasan page table?
>>> Methinks it should be 'prot' here.
>>
>> Might well be - I actually did ask the question before sending v3,
>> but didn't get any answer (yet). The kasan_zero_p?d names
>> suggested to me that this is a shortcut for mappings which
>> otherwise would be non-present anyway, but that was merely a
>> guess.
>
> kasan_zero_p?? are used to map kasan_zero_page. That's it.
Ah, thanks for explaining.
>> As to W+X checks - I can't see how the result could be
>> any better if the protections of kasan_zero_pte[0] would be
>> used: Those can't possibly be applicable independent of VA.
>
> I'm not sure I understand what do you mean.
> If we somehow screw up and accidentally make kasan_zero_pte writable and executable,
> note_page() should report this. With your patch, it won't work.
If this is a case to care about, simply passing "prot" won't be right
though - the callers accumulated effective protections would then
need passing in here, and merging with prot.
Before I do this for a possible v4, I'd like to seek clarification
though whether this really is a case to care about.
Jan
next prev parent reply other threads:[~2018-02-26 10:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 14:34 [PATCH v2] x86: consider effective protection attributes in W+X check Jan Beulich
2018-02-21 16:53 ` Ingo Molnar
2018-02-22 10:13 ` Jan Beulich
2018-02-23 7:49 ` Ingo Molnar
2018-02-23 7:57 ` Jan Beulich
2018-02-23 8:27 ` [PATCH v3] " Jan Beulich
2018-02-23 10:13 ` [tip:x86/mm] x86/mm: Consider " tip-bot for Jan Beulich
2018-02-26 8:48 ` tip-bot for Jan Beulich
2018-02-26 10:00 ` Andrey Ryabinin
2018-02-26 10:08 ` Jan Beulich
2018-02-26 10:47 ` Andrey Ryabinin
2018-02-26 10:54 ` Jan Beulich [this message]
2018-02-26 12:46 ` Andrey Ryabinin
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=5A93F56E02000078001ABA78@prv-mh.provo.novell.com \
--to=jbeulich@suse.com \
--cc=aryabinin@virtuozzo.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).