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]
Message-ID: <20220720123831.ebftged5jjpw3mfy@black.fi.intel.com>
Date:   Wed, 20 Jul 2022 15:38:31 +0300
From:   "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To:     Alexander Potapenko <glider@...gle.com>
Cc:     Andi Kleen <ak@...ux.intel.com>,
        Andrey Konovalov <andreyknvl@...il.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Dmitriy Vyukov <dvyukov@...gle.com>,
        "H.J. Lu" <hjl.tools@...il.com>,
        Kostya Serebryany <kcc@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        Andy Lutomirski <luto@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Rick Edgecombe <rick.p.edgecombe@...el.com>,
        Andrey Ryabinin <ryabinin.a.a@...il.com>,
        Taras Madan <tarasmadan@...gle.com>,
        the arch/x86 maintainers <x86@...nel.org>
Subject: Re: [PATCHv5.1 04/13] x86/mm: Handle LAM on context switch

On Wed, Jul 20, 2022 at 10:57:01AM +0200, Alexander Potapenko wrote:
> >         /*
> > @@ -491,6 +493,8 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
> >  {
> >         struct mm_struct *real_prev = this_cpu_read(cpu_tlbstate.loaded_mm);
> >         u16 prev_asid = this_cpu_read(cpu_tlbstate.loaded_mm_asid);
> > +       unsigned long prev_lam = tlbstate_lam_cr3_mask();
> Note: this variable is never used if CONFIG_DEBUG_VM is off.

Good point. I will add this:

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 4c93f87a8928..5e9ed9f55c36 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -558,6 +558,7 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
 	if (real_prev == next) {
 		VM_WARN_ON(this_cpu_read(cpu_tlbstate.ctxs[prev_asid].ctx_id) !=
 			   next->context.ctx_id);
+		VM_WARN_ON(prev_lam != new_lam);

 		/*
 		 * Even in lazy TLB mode, the CPU should stay set in the
-- 
 Kirill A. Shutemov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ