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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 20 Mar 2020 14:02:13 -0700
From:   Dave Hansen <dave.hansen@...el.com>
To:     David Rientjes <rientjes@...gle.com>,
        Joerg Roedel <joro@...tes.org>
Cc:     x86@...nel.org, hpa@...or.com, Andy Lutomirski <luto@...nel.org>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Hellstrom <thellstrom@...are.com>,
        Jiri Slaby <jslaby@...e.cz>,
        Dan Williams <dan.j.williams@...el.com>,
        Tom Lendacky <thomas.lendacky@....com>,
        Juergen Gross <jgross@...e.com>,
        Kees Cook <keescook@...omium.org>,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        virtualization@...ts.linux-foundation.org,
        Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 21/70] x86/boot/compressed/64: Add function to map a page
 unencrypted

On 3/20/20 1:53 PM, David Rientjes wrote:
>> +
>> +	/* Clear encryption flag and write new pte */
>> +	pte = pte_clear_flags(*ptep, _PAGE_ENC);
>> +	set_pte(ptep, pte);
>> +
>> +	/* Flush TLB to map the page unencrypted */
>> +	write_cr3(top_level_pgt);
>> +
> Is there a guarantee that this flushes the tlb if cr3 == top_level_pgt 
> alrady without an invlpg?

Ahh, good catch.

It *never* flushes global pages.  For a generic function like this, that
seems pretty dangerous because the PTEs it goes after could quite easily
be Global.  It's also not _obviously_ correct if PCIDs are in play
(which I don't think they are on AMD).

A flush_tlb_global() is probably more appropriate.  Better yet, is there
a reason not to use flush_tlb_kernel_range()?  I don't think it's
necessary to whack the entire TLB for one PTE set.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ