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: <CAG48ez1pWdSaLs_37dhaD21Oq-c3sNGLhDE=ntg=d6SZm8-4Ug@mail.gmail.com>
Date: Mon, 13 Jan 2025 18:11:16 +0100
From: Jann Horn <jannh@...gle.com>
To: Rik van Riel <riel@...riel.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, bp@...en8.de, 
	peterz@...radead.org, dave.hansen@...ux.intel.com, zhengqi.arch@...edance.com, 
	nadav.amit@...il.com, thomas.lendacky@....com, kernel-team@...a.com, 
	linux-mm@...ck.org, akpm@...ux-foundation.org
Subject: Re: [PATCH v4 12/12] x86/mm: only invalidate final translations with INVLPGB

On Sun, Jan 12, 2025 at 4:55 PM Rik van Riel <riel@...riel.com> wrote:
> Use the INVLPGB_FINAL_ONLY flag when invalidating mappings with INVPLGB.
> This way only leaf mappings get removed from the TLB, leaving intermediate
> translations cached.
>
> On the (rare) occasions where we free page tables we do a full flush,
> ensuring intermediate translations get flushed from the TLB.
>
> Signed-off-by: Rik van Riel <riel@...riel.com>
> ---
>  arch/x86/include/asm/invlpgb.h | 10 ++++++++--
>  arch/x86/mm/tlb.c              |  8 ++++----
>  2 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/include/asm/invlpgb.h b/arch/x86/include/asm/invlpgb.h
> index d62e3733a1ab..4fa48d063b76 100644
> --- a/arch/x86/include/asm/invlpgb.h
> +++ b/arch/x86/include/asm/invlpgb.h
> @@ -61,9 +61,15 @@ static inline void invlpgb_flush_user(unsigned long pcid,
>
>  static inline void invlpgb_flush_user_nr_nosync(unsigned long pcid,
>                                                 unsigned long addr,
> -                                               int nr, bool pmd_stride)
> +                                               int nr, bool pmd_stride,
> +                                               bool freed_tables)
>  {
> -       __invlpgb(0, pcid, addr, nr - 1, pmd_stride, INVLPGB_PCID | INVLPGB_VA);
> +       unsigned long flags = INVLPGB_PCID | INVLPGB_VA;
> +
> +       if (!freed_tables)
> +               flags |= INVLPGB_FINAL_ONLY;
> +
> +       __invlpgb(0, pcid, addr, nr - 1, pmd_stride, flags);
>  }

Thanks, this looks much nicer to me.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ