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] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c2735ac-0335-6e2a-8341-8266d5d13c30@intel.com>
Date:   Tue, 10 May 2022 07:39:30 -0700
From:   Dave Hansen <dave.hansen@...el.com>
To:     Tom Lendacky <thomas.lendacky@....com>,
        Hyeonggon Yoo <42.hyeyoo@...il.com>
Cc:     Rick Edgecombe <rick.p.edgecombe@...el.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Andy Lutomirski <luto@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Tianyu Lan <Tianyu.Lan@...rosoft.com>,
        "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/mm/cpa: set PAGE_KERNEL in __set_pages_p()

On 5/10/22 06:35, Tom Lendacky wrote:
> I'm wondering if adding a specific helper that takes a boolean to
> indicate whether to set the global flag would be best. I'll let some of
> the MM maintainers comment about that.

First of all, I'm not positive that _PAGE_BIT_PROTNONE is ever used for
kernel mappings.  This would all get a lot easier if we decided that
_PAGE_BIT_PROTNONE is only for userspace mappings and we don't have to
worry about it when _PAGE_USER is clear.

Second, the number of places that do these
__set_pages_p()/__set_pages_np() pairs is pretty limited.  Some of them
are *quite* unambiguous over whether they are dealing with the direct map:

> int set_direct_map_invalid_noflush(struct page *page)
> {
>         return __set_pages_np(page, 1);
> }
> 
> int set_direct_map_default_noflush(struct page *page)
> {
>         return __set_pages_p(page, 1);
> }

which would make it patently obvious whether __set_pages_p() should
restore the global bit.  That would have been a problem in the "old" PTI
days where _some_ of the direct map was exposed to Meltdown.  I don't
think we have any of those mappings left, though.  They're all aliases
like text and cpu_entry_area.

It would be nice if someone could look into unraveling
_PAGE_BIT_PROTNONE.  We could even probably move it to another bit for
kernel mappings if we actually need it (I'm not convinced we do).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ