lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <66305b15-fab0-8549-9219-1cba21ac9e5d@virtuozzo.com>
Date:   Mon, 26 Feb 2018 15:46:09 +0300
From:   Andrey Ryabinin <aryabinin@...tuozzo.com>
To:     Jan Beulich <JBeulich@...e.com>
Cc:     bp@...en8.de, brgerst@...il.com, dvyukov@...gle.com,
        glider@...gle.com, peterz@...radead.org, luto@...nel.org,
        mingo@...nel.org, tglx@...utronix.de,
        torvalds@...ux-foundation.org, boris.ostrovsky@...cle.com,
        dvlasenk@...hat.com, jpoimboe@...hat.com,
        Juergen Gross <jgross@...e.com>, linux-kernel@...r.kernel.org,
        linux-tip-commits@...r.kernel.org, hpa@...or.com
Subject: Re: [tip:x86/mm] x86/mm: Consider effective protection attributes in
 W+X check



On 02/26/2018 01:54 PM, Jan Beulich wrote:
>>>> On 26.02.18 at 11:47, <aryabinin@...tuozzo.com> wrote:
> 
>>
>> On 02/26/2018 01:08 PM, Jan Beulich wrote:
>>>>>> On 26.02.18 at 11:00, <aryabinin@...tuozzo.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.
> 

Fine, but this won't change anything. Since kasan_zero_pte[] always ro+nx, the effective
protections should be always the same.

> Before I do this for a possible v4, I'd like to seek clarification
> though whether this really is a case to care about.

It may be not that important case, but one of the points of this code is to check for the absence
of W+X mappings. Passing known to be wrong value to bypass that check is certainly not the
right thing to do.


> Jan
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ